00001
00007 #ifndef HDHOMERUNRECORDER_H_
00008 #define HDHOMERUNRECORDER_H_
00009
00010 #include <qmutex.h>
00011 #include "dtvrecorder.h"
00012 #include "streamlisteners.h"
00013 #include "eitscanner.h"
00014
00015 class HDHRChannel;
00016 class ProgramMapTable;
00017
00018 typedef vector<uint> uint_vec_t;
00019
00020 class HDHRRecorder : public DTVRecorder,
00021 public DVBMainStreamListener,
00022 public ATSCMainStreamListener,
00023 public MPEGStreamListener,
00024 public MPEGSingleProgramStreamListener
00025 {
00026 public:
00027 HDHRRecorder(TVRec *rec, HDHRChannel *channel);
00028 ~HDHRRecorder();
00029
00030 void SetOptionsFromProfile(RecordingProfile *profile,
00031 const QString &videodev,
00032 const QString &audiodev,
00033 const QString &vbidev);
00034
00035 bool Open(void);
00036 bool StartData(void);
00037 void Close(void);
00038
00039 void StartRecording(void);
00040
00041 void SetStreamData(MPEGStreamData*);
00042 MPEGStreamData *GetStreamData(void) { return _stream_data; }
00043 ATSCStreamData *GetATSCStreamData(void);
00044
00045
00046 void HandlePAT(const ProgramAssociationTable*);
00047 void HandleCAT(const ConditionalAccessTable*) {}
00048 void HandlePMT(uint pid, const ProgramMapTable*);
00049 void HandleEncryptionStatus(uint , bool ) { }
00050
00051
00052 void HandleSingleProgramPAT(ProgramAssociationTable *pat);
00053 void HandleSingleProgramPMT(ProgramMapTable *pmt);
00054
00055
00056 void HandleSTT(const SystemTimeTable*) {}
00057 void HandleMGT(const MasterGuideTable *) {};
00058 void HandleVCT(uint, const VirtualChannelTable*) {}
00059
00060
00061 void HandleTDT(const TimeDateTable*) {}
00062 void HandleNIT(const NetworkInformationTable*) {}
00063 void HandleSDT(uint , const ServiceDescriptionTable*) {}
00064
00065 private:
00066 bool AdjustFilters(void);
00067 bool AdjustEITPIDs(void);
00068
00069 void ProcessTSData(const unsigned char *buffer, int len);
00070 bool ProcessTSPacket(const TSPacket& tspacket);
00071 void TeardownAll(void);
00072
00073 private:
00074 HDHRChannel *_channel;
00075 struct hdhomerun_video_sock_t *_video_socket;
00076 MPEGStreamData *_stream_data;
00077
00078 ProgramAssociationTable *_input_pat;
00079 ProgramMapTable *_input_pmt;
00080 bool _reset_pid_filters;
00081 uint_vec_t _eit_pids;
00082 mutable QMutex _pid_lock;
00083 };
00084
00085 #endif