]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/sndg72x.h
Major changes in wxVidXANIM (support for output filtering)
[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 // This fixes a bug in Mingw95
26 typedef struct g72x_state g72state;
27
28 //
29 // G72X format
30 //
31 class WXDLLEXPORT wxSoundFormatG72X: public wxSoundFormatBase {
32 public:
33 wxSoundFormatG72X();
34 ~wxSoundFormatG72X();
35
36 void SetG72XType(wxSoundG72XType type);
37 wxSoundG72XType GetG72XType() const { return m_g72x_type; }
38
39 void SetSampleRate(wxUint32 srate);
40 wxUint32 GetSampleRate() const;
41
42 wxSoundFormatType GetType() const { return wxSOUND_G72X; }
43 wxSoundFormatBase *Clone() const;
44
45 wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
46 wxUint32 GetBytesFromTime(wxUint32 time) const;
47
48 bool operator !=(const wxSoundFormatBase& frmt2) const;
49
50 protected:
51 wxUint32 m_srate;
52 wxSoundG72XType m_g72x_type;
53 };
54
55 //
56 // ULAW converter class
57 //
58
59 class WXDLLEXPORT wxSoundRouterStream;
60 class WXDLLEXPORT wxSoundStreamG72X: public wxSoundStreamCodec {
61 public:
62 wxSoundStreamG72X(wxSoundStream& sndio);
63 ~wxSoundStreamG72X();
64
65 wxSoundStream& Read(void *buffer, wxUint32 len);
66 wxSoundStream& Write(const void *buffer, wxUint32 len);
67
68 bool SetSoundFormat(const wxSoundFormatBase& format);
69
70 protected:
71 wxSoundRouterStream *m_router;
72 wxUint8 m_n_bits, m_current_mask, m_current_b_pos, m_current_byte;
73 wxUint8 *m_io_buffer;
74 g72state *m_state;
75
76 int (*m_coder)(int code, int in_code, struct g72x_state *state);
77 int (*m_decoder)(int code, int out_code, struct g72x_state *state);
78
79 protected:
80 void PutBits(wxUint8 bits);
81 wxUint8 GetBits();
82 };
83
84 #endif