MythTV  master
privatedecoder_omx.h
Go to the documentation of this file.
1 #ifndef PRIVATEDECODER_OMX_H
2 #define PRIVATEDECODER_OMX_H
3 
4 #include "privatedecoder.h"
5 
6 #include <OMX_Types.h>
7 #include <OMX_Core.h>
8 #include <OMX_Component.h>
9 #ifdef USING_BROADCOM
10 #include <OMX_Broadcom.h>
11 #endif
12 
13 #include <QMutex>
14 #include <QSemaphore>
15 #include <QVector>
16 #include <QList>
17 
18 #include "omxcontext.h"
19 
20 struct AVBitStreamFilterContext;
21 
23 {
24  public:
25  static void GetDecoders(render_opts &opts);
26  static QString const s_name; // ="openmax"
27 
29  virtual ~PrivateDecoderOMX();
30 
31  // PrivateDecoder implementation
32  QString GetName(void) override; // PrivateDecoder
33  bool Init(const QString &decoder,
34  PlayerFlags flags,
35  AVCodecContext *avctx) override; // PrivateDecoder
36  bool Reset(void) override; // PrivateDecoder
37  int GetFrame(AVStream *stream,
38  AVFrame *picture,
39  int *got_picture_ptr,
40  AVPacket *pkt) override; // PrivateDecoder
41  bool HasBufferedFrames(void) override; // PrivateDecoder
42  bool NeedsReorderedPTS(void) override // PrivateDecoder
43  { return true; }
44 
45  private:
46  // OMXComponentCtx implementation
47  OMX_ERRORTYPE Event(OMXComponent&, OMX_EVENTTYPE, OMX_U32, OMX_U32, OMX_PTR) override; // OMXComponentCtx
48  OMX_ERRORTYPE EmptyBufferDone(OMXComponent&, OMX_BUFFERHEADERTYPE*) override; // OMXComponentCtx
49  OMX_ERRORTYPE FillBufferDone(OMXComponent&, OMX_BUFFERHEADERTYPE*) override; // OMXComponentCtx
50  void ReleaseBuffers(OMXComponent&) override; // OMXComponentCtx
51 
52  private:
53  // OMXComponentCB actions
54  typedef OMX_ERRORTYPE ComponentCB();
58 
59  OMX_ERRORTYPE FillOutputBuffers();
60  OMX_ERRORTYPE SettingsChanged(AVCodecContext *);
61  OMX_ERRORTYPE SetNalType(AVCodecContext *);
62  OMX_ERRORTYPE GetAspect(OMX_CONFIG_POINTTYPE &, int index) const;
63 #ifdef USING_BROADCOM
64  OMX_ERRORTYPE GetInterlace(OMX_CONFIG_INTERLACETYPE &, int index) const;
65 #endif
66  int ProcessPacket(AVStream *, AVPacket *);
67  int GetBufferedFrame(AVStream *, AVFrame *);
68  bool CreateFilter(AVCodecContext *);
69 
70  private:
72  AVBitStreamFilterContext *m_filter;
74  AVCodecContext *m_avctx;
75 
76  QMutex mutable m_lock; // Protects data following
79 
80  // video decoder buffers
81  QSemaphore m_ibufs_sema; // EmptyBufferCB signal
82  QSemaphore m_obufs_sema; // FillBufferCB signal
83  QList<OMX_BUFFERHEADERTYPE*> m_ibufs, m_obufs;
84 };
85 
86 #endif // ndef PRIVATEDECODER_OMX_H
87 /* EOF */
int ProcessPacket(AVStream *, AVPacket *)
PlayerFlags
Definition: mythplayer.h:88
QList< OMX_BUFFERHEADERTYPE * > m_ibufs
struct AVFrame AVFrame
bool Reset(void) override
bool CreateFilter(AVCodecContext *)
OMX_ERRORTYPE Event(OMXComponent &, OMX_EVENTTYPE, OMX_U32, OMX_U32, OMX_PTR) override
OMXComponentCtx.
ComponentCB UseBuffersCB
int GetFrame(AVStream *stream, AVFrame *picture, int *got_picture_ptr, AVPacket *pkt) override
OMX_ERRORTYPE EmptyBufferDone(OMXComponent &, OMX_BUFFERHEADERTYPE *) override
ComponentCB AllocBuffersCB
OMX_ERRORTYPE SetNalType(AVCodecContext *)
AVCodecContext * m_avctx
bool Init(const QString &decoder, PlayerFlags flags, AVCodecContext *avctx) override
static void GetDecoders(render_opts &opts)
ComponentCB FreeOutputBuffersCB
static QString const s_name
ComponentCB AllocOutputBuffersCB
void ReleaseBuffers(OMXComponent &) override
QString GetName(void) override
QList< OMX_BUFFERHEADERTYPE * > m_obufs
bool NeedsReorderedPTS(void) override
OMX_ERRORTYPE FillOutputBuffers()
OMX_ERRORTYPE FillBufferDone(OMXComponent &, OMX_BUFFERHEADERTYPE *) override
OMX_ERRORTYPE ComponentCB()
bool HasBufferedFrames(void) override
OMX_ERRORTYPE SettingsChanged(AVCodecContext *)
AVBitStreamFilterContext * m_filter
OMX_ERRORTYPE GetAspect(OMX_CONFIG_POINTTYPE &, int index) const
int GetBufferedFrame(AVStream *, AVFrame *)