00001 #ifndef PRIVATEDECODER_CRYSTALHD_H 00002 #define PRIVATEDECODER_CRYSTALHD_H 00003 00004 #include "mthread.h" 00005 00006 #if defined(WIN32) 00007 typedef void *HANDLE; 00008 #else 00009 #ifndef __LINUX_USER__ 00010 #define __LINUX_USER__ 00011 #endif 00012 #endif 00013 00014 #include "frame.h" 00015 #include <libcrystalhd/bc_dts_types.h> 00016 #include <libcrystalhd/bc_dts_defs.h> 00017 #include <libcrystalhd/libcrystalhd_if.h> 00018 #include "privatedecoder.h" 00019 00020 class PrivateDecoderCrystalHD; 00021 class FetcherThread : public MThread 00022 { 00023 public: 00024 FetcherThread(PrivateDecoderCrystalHD *dec) 00025 : MThread("Fetcher"), m_dec(dec) { } 00026 00027 protected: 00028 virtual void run(void); 00029 00030 private: 00031 PrivateDecoderCrystalHD *m_dec; 00032 }; 00033 00034 typedef struct PacketBuffer_ 00035 { 00036 uint8_t *buf; 00037 int size; 00038 int64_t pts; 00039 } PacketBuffer; 00040 00041 enum BC_DEVICE_TYPE 00042 { 00043 BC_70012 = 0, 00044 BC_70015 = 1, 00045 }; 00046 00047 class PrivateDecoderCrystalHD : public PrivateDecoder 00048 { 00049 friend class FetcherThread; 00050 00051 public: 00052 static void GetDecoders(render_opts &opts); 00053 PrivateDecoderCrystalHD(); 00054 virtual ~PrivateDecoderCrystalHD(); 00055 virtual QString GetName(void) { return QString("crystalhd"); } 00056 virtual bool Init(const QString &decoder, 00057 PlayerFlags flags, 00058 AVCodecContext *avctx); 00059 virtual bool Reset(void); 00060 virtual int GetFrame(AVStream *stream, 00061 AVFrame *picture, 00062 int *got_picture_ptr, 00063 AVPacket *pkt); 00064 virtual bool HasBufferedFrames(void); 00065 virtual bool NeedsReorderedPTS(void) { return true; } 00066 00067 private: 00068 void FetchFrames(void); 00069 bool StartFetcherThread(void); 00070 int ProcessPacket(AVStream *stream, AVPacket *pkt); 00071 00072 bool CreateFilter(AVCodecContext *avctx); 00073 void FillFrame(BC_DTS_PROC_OUT *out); 00074 void AddFrameToQueue(void); 00075 void CheckProcOutput(BC_DTS_PROC_OUT *out); 00076 void CheckPicInfo(BC_DTS_PROC_OUT *out); 00077 void CheckStatus(void); 00078 int GetTxFreeSize(bool hwsel); 00079 00080 HANDLE m_device; 00081 BC_DEVICE_TYPE m_device_type; 00082 BC_OUTPUT_FORMAT m_pix_fmt; 00083 QList<VideoFrame*> m_decoded_frames; 00084 QList<PacketBuffer*> m_packet_buffers; 00085 QMutex m_decoded_frames_lock; 00086 FetcherThread *m_fetcher_thread; 00087 bool m_fetcher_pause; 00088 bool m_fetcher_paused; 00089 bool m_fetcher_stop; 00090 VideoFrame *m_frame; 00091 AVBitStreamFilterContext *m_filter; 00092 }; 00093 00094 #endif // PRIVATEDECODER_CRYSTALHD_H
1.6.3