diff options
author | Thomas Reufer <thomas@reufer.ch> | 2014-01-07 16:32:58 +0100 |
---|---|---|
committer | Thomas Reufer <thomas@reufer.ch> | 2014-01-07 16:32:58 +0100 |
commit | dd9fbf38610934623869728d1b00904d15783480 (patch) | |
tree | 789059da0b20f3c7d9711b3dd638a770d2a6cfb2 /omx.h | |
parent | 9512123c95324f1679d748993662bd9f08f6f763 (diff) | |
download | vdr-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 'omx.h')
-rw-r--r-- | omx.h | 122 |
1 files changed, 122 insertions, 0 deletions
@@ -0,0 +1,122 @@ +/* + * See the README file for copyright information and how to reach the author. + * + * $Id$ + */ + +#ifndef OMX_H +#define OMX_H + +#include "types.h" + +extern "C" +{ +#include "ilclient.h" +} + +class cMutex; + +class cOmx +{ + +public: + + cOmx(); + virtual ~cOmx(); + int Init(void); + int DeInit(void); + + static OMX_TICKS ToOmxTicks(int64_t val); + static int64_t FromOmxTicks(OMX_TICKS &ticks); + static void PtsToTicks(uint64_t pts, OMX_TICKS &ticks); + static uint64_t TicksToPts(OMX_TICKS &ticks); + + int64_t GetSTC(void); + bool IsClockRunning(void); + + enum eClockState { + eClockStateRun, + eClockStateStop, + eClockStateWaitForVideo, + eClockStateWaitForAudio, + eClockStateWaitForAudioVideo + }; + + void SetClockState(eClockState clockState); + void SetClockScale(float scale); + void SetMediaTime(uint64_t pts); + unsigned int GetMediaTime(void); + + enum eClockReference { + eClockRefAudio, + eClockRefVideo + }; + + void SetClockReference(eClockReference clockReference); + void SetVolume(int vol); + void SendEos(void); + void Stop(void); + + void FlushAudio(void); + void FlushVideo(bool flushRender = false); + + int SetVideoCodec(cVideoCodec::eCodec codec); + int SetupAudioRender(cAudioCodec::eCodec outputFormat, + int channels, int samplingRate, cAudioPort::ePort audioPort); + + OMX_BUFFERHEADERTYPE* GetAudioBuffer(uint64_t pts = 0); + OMX_BUFFERHEADERTYPE* GetVideoBuffer(uint64_t pts = 0); + bool PollVideoBuffers(int minBuffers = 0); + bool PollAudioBuffers(int minBuffers = 0); + + bool EmptyAudioBuffer(OMX_BUFFERHEADERTYPE *buf); + bool EmptyVideoBuffer(OMX_BUFFERHEADERTYPE *buf); + +private: + + static const char* errStr(int err); + + enum eOmxComponent { + eClock = 0, + eVideoDecoder, + eVideoScheduler, + eVideoRender, + eAudioRender, + eNumComponents + }; + + enum eOmxTunnel { + eVideoDecoderToVideoScheduler = 0, + eVideoSchedulerToVideoRender, + eClockToVideoScheduler, + eClockToAudioRender, + eNumTunnels + }; + + ILCLIENT_T *m_client; + COMPONENT_T *m_comp[cOmx::eNumComponents + 1]; + TUNNEL_T m_tun[cOmx::eNumTunnels + 1]; + + cMutex *m_mutex; + + bool m_setVideoStartTime; + bool m_setAudioStartTime; + bool m_setVideoDiscontinuity; + + int m_freeAudioBuffers; + int m_freeVideoBuffers; + + eClockReference m_clockReference; + + void HandleEndOfStream(unsigned int portId); + void HandlePortSettingsChanged(unsigned int portId); + void HandleBufferEmpty(COMPONENT_T *comp); + + static void OnBufferEmpty(void *instance, COMPONENT_T *comp); + static void OnPortSettingsChanged(void *instance, COMPONENT_T *comp, unsigned int data); + static void OnEndOfStream(void *instance, COMPONENT_T *comp, unsigned int data); + static void OnError(void *instance, COMPONENT_T *comp, unsigned int data); + +}; + +#endif |