]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/sndg72x.h
*** empty log message ***
[wxWidgets.git] / utils / wxMMedia2 / lib / sndg72x.h
1 // --------------------------------------------------------------------------
2 // Name: sndg72x.h
3 // Purpose:
4 // Date: 08/26/1999
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6 // CVSID: $Id$
7 // --------------------------------------------------------------------------
8 #ifndef _WX_SNDG72X_H
9 #define _WX_SNDG72X_H
10
11 #ifdef __GNUG__
12 #pragma interface "sndg72x.h"
13 #endif
14
15 #include <stddef.h>
16 #include "sndcodec.h"
17 #include "sndbase.h"
18
19 typedef enum {
20 wxSOUND_G721,
21 wxSOUND_G723_24,
22 wxSOUND_G723_40
23 } wxSoundG72XType;
24
25 //
26 // G72X format
27 //
28 class WXDLLEXPORT wxSoundFormatG72X: public wxSoundFormatBase {
29 public:
30 wxSoundFormatG72X();
31 ~wxSoundFormatG72X();
32
33 void SetG72XType(wxSoundG72XType type);
34 wxSoundG72XType GetG72XType() const { return m_g72x_type; }
35
36 void SetSampleRate(wxUint32 srate);
37 wxUint32 GetSampleRate() const;
38
39 wxSoundFormatType GetType() const { return wxSOUND_G72X; }
40 wxSoundFormatBase *Clone() const;
41
42 wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
43 wxUint32 GetBytesFromTime(wxUint32 time) const;
44
45 bool operator !=(const wxSoundFormatBase& frmt2) const;
46
47 protected:
48 wxUint32 m_srate;
49 wxSoundG72XType m_g72x_type;
50 };
51
52 //
53 // ULAW converter class
54 //
55
56 class WXDLLEXPORT wxSoundRouterStream;
57 class WXDLLEXPORT wxSoundStreamG72X: public wxSoundStreamCodec {
58 public:
59 wxSoundStreamG72X(wxSoundStream& sndio);
60 ~wxSoundStreamG72X();
61
62 wxSoundStream& Read(void *buffer, wxUint32 len);
63 wxSoundStream& Write(const void *buffer, wxUint32 len);
64
65 bool SetSoundFormat(const wxSoundFormatBase& format);
66
67 protected:
68 wxSoundRouterStream *m_router;
69 wxUint8 m_n_bits, m_current_mask, m_current_b_pos, m_current_byte;
70 wxUint8 *m_io_buffer;
71 struct g72x_state *m_state;
72
73 int (*m_coder)(int code, int in_code, struct g72x_state *state);
74 int (*m_decoder)(int code, int out_code, struct g72x_state *state);
75
76 protected:
77 void PutBits(wxUint8 bits);
78 wxUint8 GetBits();
79 };
80
81 #endif