Async  1.3.1
AsyncAudioDecoder.h
Go to the documentation of this file.
1 
27 #ifndef ASYNC_AUDIO_DECODER_INCLUDED
28 #define ASYNC_AUDIO_DECODER_INCLUDED
29 
30 
31 /****************************************************************************
32  *
33  * System Includes
34  *
35  ****************************************************************************/
36 
37 #include <string>
38 #include <sigc++/sigc++.h>
39 
40 
41 /****************************************************************************
42  *
43  * Project Includes
44  *
45  ****************************************************************************/
46 
47 #include <AsyncAudioSource.h>
48 
49 
50 /****************************************************************************
51  *
52  * Local Includes
53  *
54  ****************************************************************************/
55 
56 
57 
58 /****************************************************************************
59  *
60  * Forward declarations
61  *
62  ****************************************************************************/
63 
64 
65 
66 /****************************************************************************
67  *
68  * Namespace
69  *
70  ****************************************************************************/
71 
72 namespace Async
73 {
74 
75 
76 /****************************************************************************
77  *
78  * Forward declarations of classes inside of the declared namespace
79  *
80  ****************************************************************************/
81 
82 
83 
84 /****************************************************************************
85  *
86  * Defines & typedefs
87  *
88  ****************************************************************************/
89 
90 
91 
92 /****************************************************************************
93  *
94  * Exported Global Variables
95  *
96  ****************************************************************************/
97 
98 
99 
100 /****************************************************************************
101  *
102  * Class definitions
103  *
104  ****************************************************************************/
105 
113 class AudioDecoder : public AudioSource, public sigc::trackable
114 {
115  public:
116  static AudioDecoder *create(const std::string &name);
117 
121  AudioDecoder(void) {}
122 
126  virtual ~AudioDecoder(void) {}
127 
132  virtual const char *name(void) const = 0;
133 
139  virtual void setOption(const std::string &name, const std::string &value) {}
140 
144  virtual void printCodecParams(void) const {}
145 
151  virtual void writeEncodedSamples(void *buf, int size) = 0;
152 
156  virtual void flushEncodedSamples(void) { sinkFlushSamples(); }
157 
165  virtual void resumeOutput(void) {}
166 
170  sigc::signal<void> allEncodedSamplesFlushed;
171 
172 
173  protected:
181  virtual void allSamplesFlushed(void) { allEncodedSamplesFlushed(); }
182 
183 
184  private:
185  AudioDecoder(const AudioDecoder&);
186  AudioDecoder& operator=(const AudioDecoder&);
187 
188 }; /* class AudioDecoder */
189 
190 
191 } /* namespace */
192 
193 #endif /* ASYNC_AUDIO_DECODER_INCLUDED */
194 
195 
196 
197 /*
198  * This file has not been truncated
199  */
200 
virtual ~AudioDecoder(void)
Destructor.
virtual const char * name(void) const =0
Get the name of the codec.
void sinkFlushSamples(void)
virtual void resumeOutput(void)
Resume audio output to the sink.
This file contains the base class for an audio source.
virtual void printCodecParams(void) const
Print codec parameter settings.
virtual void flushEncodedSamples(void)
Call this function when all encoded samples have been received.
Base class for an audio decoder.
static AudioDecoder * create(const std::string &name)
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
virtual void setOption(const std::string &name, const std::string &value)
Set an option for the decoder.
Namespace for the asynchronous programming classes.
virtual void writeEncodedSamples(void *buf, int size)=0
Write encoded samples into the decoder.
AudioDecoder(void)
Default constuctor.
sigc::signal< void > allEncodedSamplesFlushed
This signal is emitted when all encoded samples have been flushed.
The base class for an audio source.