00001 // -*- Mode: c++ -*- 00002 #ifndef _V4L_RECORDER_H_ 00003 #define _V4L_RECORDER_H_ 00004 00005 #include "dtvrecorder.h" 00006 #include "cc608decoder.h" 00007 #include "vbitext/vt.h" 00008 #include "mthread.h" 00009 00010 class VBI608Extractor; 00011 class VBIThread; 00012 class TVRec; 00013 00014 struct vbi; 00015 struct VBIData 00016 { 00017 RecorderBase *nvr; 00018 vt_page teletextpage; 00019 bool foundteletextpage; 00020 }; 00021 00023 class MTV_PUBLIC V4LRecorder : public DTVRecorder 00024 { 00025 friend class VBIThread; 00026 public: 00027 V4LRecorder(TVRec *rec); 00028 virtual ~V4LRecorder(); 00029 00030 virtual void StopRecording(void); // RecorderBase 00031 virtual void SetOption( 00032 const QString &name, const QString &value); // RecorderBase 00033 virtual void SetOption(const QString &name, int value) 00034 { DTVRecorder::SetOption(name, value); } // RecorderBase 00035 00036 protected: 00037 int OpenVBIDevice(void); 00038 void CloseVBIDevice(void); 00039 void RunVBIDevice(void); 00040 00041 virtual bool IsHelperRequested(void) const; 00042 virtual void FormatTT(struct VBIData *vbidata) {} 00043 virtual void FormatCC(uint code1, uint code2) {} 00044 00045 protected: 00046 QString audiodevice; 00047 QString vbidevice; 00048 int vbimode; 00049 struct VBIData *pal_vbi_cb; 00050 struct vbi *pal_vbi_tt; 00051 uint ntsc_vbi_width; 00052 uint ntsc_vbi_start_line; 00053 uint ntsc_vbi_line_count; 00054 VBI608Extractor *vbi608; 00055 VBIThread *vbi_thread; 00056 QList<struct txtbuffertype*> textbuffer; 00057 int vbi_fd; 00058 volatile bool request_helper; 00059 }; 00060 00061 class VBIThread : public MThread 00062 { 00063 public: 00064 VBIThread(V4LRecorder *_parent) : 00065 MThread("VBIThread"), parent(_parent) 00066 { 00067 start(); 00068 } 00069 00070 virtual ~VBIThread() 00071 { 00072 while (isRunning()) 00073 { 00074 parent->StopRecording(); 00075 wait(1000); 00076 } 00077 } 00078 00079 virtual void run(void) 00080 { 00081 RunProlog(); 00082 parent->RunVBIDevice(); 00083 RunEpilog(); 00084 } 00085 00086 private: 00087 V4LRecorder *parent; 00088 }; 00089 00090 #endif // _V4L_RECORDER_H_
1.6.3