MythTV  master
privatedecoder_vda.h
Go to the documentation of this file.
1 #ifndef PRIVATEDECODER_VDA_H
2 #define PRIVATEDECODER_VDA_H
3 
4 #include <QSize>
5 #include <QLibrary>
6 #include <QList>
7 
8 #import "CoreFoundation/CoreFoundation.h"
9 #import "CoreVideo/CoreVideo.h"
11 #include "privatedecoder.h"
12 
14 {
15  public:
16  static MTV_PUBLIC VDALibrary* GetVDALibrary(void);
17  VDALibrary();
18  bool IsValid(void) const { return m_valid; }
19 
24  CFStringRef *decoderConfigWidth;
25  CFStringRef *decoderConfigHeight;
26  CFStringRef *decoderConfigSourceFmt;
27  CFStringRef *decoderConfigAVCCData;
28  QLibrary *m_lib;
29  bool m_valid;
30 
31 private:
32  VDALibrary(const VDALibrary &) = delete; // not copyable
33  VDALibrary &operator=(const VDALibrary &) = delete; // not copyable
34 };
35 
36 class VDAFrame
37 {
38  public:
39  VDAFrame(CVPixelBufferRef buf, FourCharCode fmt, int64_t pres,
40  int8_t interlaced, int8_t top_field, int8_t repeat)
41  : buffer(buf), format(fmt), pts(pres),
42  interlaced_frame(interlaced), top_field_first(top_field),
43  repeat_pict(repeat) { }
44 
45  CVPixelBufferRef buffer;
46  FourCharCode format;
47  int64_t pts;
50  int8_t repeat_pict;
51 };
52 
54 {
55  public:
56  static void GetDecoders(render_opts &opts);
58  virtual ~PrivateDecoderVDA();
59  QString GetName(void) override { return "vda"; } // PrivateDecoder
60  bool Init(const QString &decoder,
61  PlayerFlags flags,
62  AVCodecContext *avctx) override; // PrivateDecoder
63  bool Reset(void) override; // PrivateDecoder
64  int GetFrame(AVStream *stream,
65  AVFrame *picture,
66  int *got_picture_ptr,
67  AVPacket *pkt) override; // PrivateDecoder
68  bool HasBufferedFrames(void) override; // PrivateDecoder
69  bool NeedsReorderedPTS(void) override // PrivateDecoder
70  { return true; }
71 
72  static void VDADecoderCallback(void *decompressionOutputRefCon,
73  CFDictionaryRef frameInfo,
74  OSStatus status,
75  uint32_t infoFlags,
76  CVImageBufferRef imageBuffer);
77 
78  protected:
79  void PopDecodedFrame(void);
80  bool RewriteAvcc(uint8_t **data, int &len, CFDataRef &data_out);
81  bool RewritePacket(uint8_t *data, int len, CFDataRef &data_out);
82 
85  QSize m_size;
86  QMutex m_frame_lock;
88  QList<VDAFrame> m_decoded_frames;
89  bool m_annexb; //m_convert_bytestream
90  uint32_t m_slice_count;
93 };
94 
95 #endif // PRIVATEDECODER_VDA_H
int8_t interlaced_frame
CFStringRef * decoderConfigAVCCData
VDAFrame(CVPixelBufferRef buf, FourCharCode fmt, int64_t pres, int8_t interlaced, int8_t top_field, int8_t repeat)
bool Init(const QString &decoder, PlayerFlags flags, AVCodecContext *avctx) override
static void VDADecoderCallback(void *decompressionOutputRefCon, CFDictionaryRef frameInfo, OSStatus status, uint32_t infoFlags, CVImageBufferRef imageBuffer)
PlayerFlags
Definition: mythplayer.h:88
CVPixelBufferRef buffer
struct AVFrame AVFrame
FourCharCode format
MYTH_VDADECODERCREATE decoderCreate
CFStringRef * decoderConfigSourceFmt
VDALibrary & operator=(const VDALibrary &)=delete
struct OpaqueVDADecoder * VDADecoder
MYTH_VDADECODERDESTROY decoderDestroy
OSStatus(* MYTH_VDADECODERDECODE)(VDADecoder decoder, uint32_t decodeFlags, CFTypeRef compressedBuffer, CFDictionaryRef frameInfo)
OSStatus(* MYTH_VDADECODERCREATE)(CFDictionaryRef decoderConfiguration, CFDictionaryRef destinationImageBufferAttributes, VDADecoderOutputCallback *outputCallback, void *decoderOutputCallbackRefcon, VDADecoder *decoderOut)
CFStringRef * decoderConfigHeight
VDADecoder * m_decoder
CFStringRef * decoderConfigWidth
bool NeedsReorderedPTS(void) override
bool Reset(void) override
OSStatus(* MYTH_VDADECODERDESTROY)(VDADecoder decoder)
QLibrary * m_lib
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QList< VDAFrame > m_decoded_frames
OSStatus(* MYTH_VDADECODERFLUSH)(VDADecoder decoder, uint32_t flushFlags)
int8_t repeat_pict
bool RewriteAvcc(uint8_t **data, int &len, CFDataRef &data_out)
int GetFrame(AVStream *stream, AVFrame *picture, int *got_picture_ptr, AVPacket *pkt) override
bool RewritePacket(uint8_t *data, int len, CFDataRef &data_out)
bool IsValid(void) const
int8_t top_field_first
static MTV_PUBLIC VDALibrary * GetVDALibrary(void)
static void GetDecoders(render_opts &opts)
MYTH_VDADECODERFLUSH decoderFlush
QString GetName(void) override
bool HasBufferedFrames(void) override
MYTH_VDADECODERDECODE decoderDecode