Async  1.5.0
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:
120  static bool isAvailable(const std::string &name);
121 
126  static AudioDecoder *create(const std::string &name);
127 
131  AudioDecoder(void) {}
132 
136  virtual ~AudioDecoder(void) {}
137 
142  virtual const char *name(void) const = 0;
143 
149  virtual void setOption(const std::string &name, const std::string &value) {}
150 
154  virtual void printCodecParams(void) const {}
155 
161  virtual void writeEncodedSamples(void *buf, int size) = 0;
162 
166  virtual void flushEncodedSamples(void) { sinkFlushSamples(); }
167 
175  virtual void resumeOutput(void) {}
176 
180  sigc::signal<void> allEncodedSamplesFlushed;
181 
182 
183  protected:
191  virtual void allSamplesFlushed(void) { allEncodedSamplesFlushed(); }
192 
193 
194  private:
195  AudioDecoder(const AudioDecoder&);
196  AudioDecoder& operator=(const AudioDecoder&);
197 
198 }; /* class AudioDecoder */
199 
200 
201 } /* namespace */
202 
203 #endif /* ASYNC_AUDIO_DECODER_INCLUDED */
204 
205 
206 
207 /*
208  * This file has not been truncated
209  */
210 
Async::AudioDecoder::allEncodedSamplesFlushed
sigc::signal< void > allEncodedSamplesFlushed
This signal is emitted when all encoded samples have been flushed.
Definition: AsyncAudioDecoder.h:236
Async::AudioDecoder::setOption
virtual void setOption(const std::string &name, const std::string &value)
Set an option for the decoder.
Definition: AsyncAudioDecoder.h:205
Async::AudioDecoder::isAvailable
static bool isAvailable(const std::string &name)
Check if a specific decoder is available.
Async::AudioDecoder::name
virtual const char * name(void) const =0
Get the name of the codec.
Async::AudioDecoder::allSamplesFlushed
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
Definition: AsyncAudioDecoder.h:247
Async::AudioDecoder::flushEncodedSamples
virtual void flushEncodedSamples(void)
Call this function when all encoded samples have been received.
Definition: AsyncAudioDecoder.h:222
Async::AudioSource::sinkFlushSamples
void sinkFlushSamples(void)
Async::AudioDecoder::writeEncodedSamples
virtual void writeEncodedSamples(void *buf, int size)=0
Write encoded samples into the decoder.
Async::AudioDecoder::create
static AudioDecoder * create(const std::string &name)
Create a new decoder of the specified type.
Async::AudioDecoder
Base class for an audio decoder.
Definition: AsyncAudioDecoder.h:133
Async::AudioDecoder::AudioDecoder
AudioDecoder(void)
Default constuctor.
Definition: AsyncAudioDecoder.h:187
Async
Namespace for the asynchronous programming classes.
Definition: AsyncApplication.h:75
Async::AudioDecoder::printCodecParams
virtual void printCodecParams(void) const
Print codec parameter settings.
Definition: AsyncAudioDecoder.h:210
Async::AudioDecoder::~AudioDecoder
virtual ~AudioDecoder(void)
Destructor.
Definition: AsyncAudioDecoder.h:192
AsyncAudioSource.h
This file contains the base class for an audio source.
Async::AudioDecoder::resumeOutput
virtual void resumeOutput(void)
Resume audio output to the sink.
Definition: AsyncAudioDecoder.h:231