MythTV  master
privatedecoder_crystalhd.h
Go to the documentation of this file.
1 #ifndef PRIVATEDECODER_CRYSTALHD_H
2 #define PRIVATEDECODER_CRYSTALHD_H
3 
4 #include "mthread.h"
5 
6 #if defined(WIN32)
7 typedef void *HANDLE;
8 #else
9 #ifndef __LINUX_USER__
10 #define __LINUX_USER__
11 #endif
12 #endif
13 
14 #include "mythframe.h"
15 #include <libcrystalhd/bc_dts_types.h>
16 #include <libcrystalhd/bc_dts_defs.h>
17 #include <libcrystalhd/libcrystalhd_if.h>
18 #include "privatedecoder.h"
19 
21 class FetcherThread : public MThread
22 {
23  public:
25  : MThread("Fetcher"), m_dec(dec) { }
26 
27  protected:
28  void run(void) override; // MThread
29 
30  private:
32 };
33 
34 typedef struct PacketBuffer_
35 {
36  uint8_t *buf;
37  int size;
38  int64_t pts;
39 } PacketBuffer;
40 
42 {
43  BC_70012 = 0,
44  BC_70015 = 1,
45 };
46 
48 {
49  friend class FetcherThread;
50 
51  public:
52  static void GetDecoders(render_opts &opts);
54  virtual ~PrivateDecoderCrystalHD();
55  QString GetName(void) override // PrivateDecoder
56  { return QString("crystalhd"); }
57  bool Init(const QString &decoder,
58  PlayerFlags flags,
59  AVCodecContext *avctx) override; // PrivateDecoder
60  bool Reset(void) override; // PrivateDecoder
61  int GetFrame(AVStream *stream,
62  AVFrame *picture,
63  int *got_picture_ptr,
64  AVPacket *pkt) override; // PrivateDecoder
65  bool HasBufferedFrames(void) override; // PrivateDecoder
66  bool NeedsReorderedPTS(void) override // PrivateDecoder
67  { return true; }
68 
69  private:
70  void FetchFrames(void);
71  bool StartFetcherThread(void);
72  int ProcessPacket(AVStream *stream, AVPacket *pkt);
73 
74  bool CreateFilter(AVCodecContext *avctx);
75  void FillFrame(BC_DTS_PROC_OUT *out);
76  void AddFrameToQueue(void);
77  void CheckProcOutput(BC_DTS_PROC_OUT *out);
78  void CheckPicInfo(BC_DTS_PROC_OUT *out);
79  void CheckStatus(void);
80  int GetTxFreeSize(bool hwsel);
81 
82  HANDLE m_device;
84  BC_OUTPUT_FORMAT m_pix_fmt;
85  QList<VideoFrame*> m_decoded_frames;
86  QList<PacketBuffer*> m_packet_buffers;
93  AVBitStreamFilterContext *m_filter;
94 };
95 
96 #endif // PRIVATEDECODER_CRYSTALHD_H
struct PacketBuffer_ PacketBuffer
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
PlayerFlags
Definition: mythplayer.h:88
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
void CheckProcOutput(BC_DTS_PROC_OUT *out)
int ProcessPacket(AVStream *stream, AVPacket *pkt)
struct AVFrame AVFrame
QList< PacketBuffer * > m_packet_buffers
QList< VideoFrame * > m_decoded_frames
void FillFrame(BC_DTS_PROC_OUT *out)
PrivateDecoderCrystalHD * m_dec
bool CreateFilter(AVCodecContext *avctx)
AVBitStreamFilterContext * m_filter
void CheckPicInfo(BC_DTS_PROC_OUT *out)
int GetFrame(AVStream *stream, AVFrame *picture, int *got_picture_ptr, AVPacket *pkt) override
QString GetName(void) override
bool NeedsReorderedPTS(void) override
static void GetDecoders(render_opts &opts)
FetcherThread(PrivateDecoderCrystalHD *dec)
bool Init(const QString &decoder, PlayerFlags flags, AVCodecContext *avctx) override