summaryrefslogtreecommitdiff
path: root/audio.h
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2014-01-07 16:32:58 +0100
committerThomas Reufer <thomas@reufer.ch>2014-01-07 16:32:58 +0100
commitdd9fbf38610934623869728d1b00904d15783480 (patch)
tree789059da0b20f3c7d9711b3dd638a770d2a6cfb2 /audio.h
parent9512123c95324f1679d748993662bd9f08f6f763 (diff)
downloadvdr-plugin-rpihddevice-0.0.5.tar.gz
vdr-plugin-rpihddevice-0.0.5.tar.bz2
2013-11-17: Version 0.0.50.0.5
------------------------- - new: - improved audio format detection (taken from softhddevice) - separate thread for audio decoding - fixed: - jump forward/backward in recordings - several minor bugfixes - missing: - still picture - trick modes - deinterlacer - video format/output options
Diffstat (limited to 'audio.h')
-rw-r--r--audio.h82
1 files changed, 35 insertions, 47 deletions
diff --git a/audio.h b/audio.h
index a4ade81..327d312 100644
--- a/audio.h
+++ b/audio.h
@@ -12,56 +12,38 @@ extern "C"
#include <libavcodec/avcodec.h>
}
-class cMutex;
+#include <vdr/thread.h>
-class cAudioDecoder
-{
+#include "types.h"
+#include "omx.h"
-public:
+class cAudioParser;
- enum eCodec {
- ePCM,
- eMPG,
- eAC3,
- eEAC3,
- eAAC,
- eDTS,
- eNumCodecs
- };
+class cAudioDecoder : public cThread
+{
- enum ePort {
- eLocal,
- eHDMI
- };
+public:
- static const char* CodecStr(eCodec codec)
- {
- return (codec == ePCM) ? "PCM" :
- (codec == eMPG) ? "MPG" :
- (codec == eAC3) ? "AC3" :
- (codec == eEAC3) ? "E-AC3" :
- (codec == eAAC) ? "AAC" :
- (codec == eDTS) ? "DTS" : "unknown";
- }
-
- cAudioDecoder();
+ cAudioDecoder(cOmx *omx);
virtual ~cAudioDecoder();
virtual int Init(void);
virtual int DeInit(void);
- virtual bool SetupAudioCodec(const unsigned char *data, int length);
+ virtual bool WriteData(const unsigned char *buf, unsigned int length, uint64_t pts = 0);
- virtual eCodec GetCodec(void) { return m_codec; }
- virtual eCodec GetOutputFormat(void) { return m_outputFormat; }
- virtual ePort GetOutputPort(void) { return m_outputPort; }
- virtual int GetChannels(void) { return m_channels; }
- virtual int GetSamplingrate(void) { return m_samplingRate; }
+ virtual bool Poll(void);
+ virtual void Reset(void);
- virtual unsigned int DecodeAudio(const unsigned char *data, int length,
- unsigned char *outbuf, int bufsize);
+protected:
-private:
+ virtual void Action(void);
+
+ virtual unsigned int DecodeFrame();
+ virtual unsigned int ReadFrame(unsigned char *buf, unsigned int bufsize);
+
+ virtual bool ProbeCodec(void);
+ void SetCodec(cAudioCodec::eCodec codec);
struct Codec
{
@@ -69,17 +51,23 @@ private:
AVCodecContext *context;
};
- Codec m_codecs[eNumCodecs];
- eCodec m_codec;
- eCodec m_outputFormat;
- ePort m_outputPort;
- int m_channels;
- int m_samplingRate;
-
- bool m_passthrough;
+private:
- AVFrame *m_frame;
- cMutex *m_mutex;
+ Codec m_codecs[cAudioCodec::eNumCodecs];
+ cAudioCodec::eCodec m_codec;
+ cAudioCodec::eCodec m_outputFormat;
+ cAudioPort::ePort m_outputPort;
+ int m_channels;
+ int m_samplingRate;
+ bool m_passthrough;
+ bool m_outputFormatChanged;
+ uint64_t m_pts;
+
+ AVFrame *m_frame;
+ cMutex *m_mutex;
+ cCondWait *m_newData;
+ cAudioParser *m_parser;
+ cOmx *m_omx;
};
#endif