X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fdvb%2Fpmt.h;h=aa5d34d9c0e9f61e0df7aaf0e64d5d9b7b6fb4ce;hp=d1e28703ef26654b85f87a3065efa792c093509e;hb=eb510064c67c19fec47fd04ea03017c17569e3c5;hpb=9a262588610fbdf0c7e8ad1c6fa393adcbc35399 diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index d1e2870..fc5d849 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -3,11 +3,13 @@ #ifndef SWIG #include +#include #include #include #include #include #include +#include #include #include @@ -20,10 +22,43 @@ class eDVBCAService; class eDVBScan; +#include +class OCSection : public LongCrcSection +{ +protected: + void *data; + +public: + OCSection(const uint8_t * const buffer) + : LongCrcSection(buffer) + { + data = malloc(getSectionLength()); + memcpy(data, buffer, getSectionLength()); + } + ~OCSection() + { + free(data); + } + void *getData() { return data; } +}; + +struct channel_data: public Object +{ + ePtr m_channel; + ePtr m_stateChangedConn; + int m_prevChannelState; + int m_dataDemux; +}; + +// TODO .. put all static stuff into a 'eDVBCAServiceHandler class' + typedef std::map CAServiceMap; +typedef std::map ChannelMap; class eDVBCAService: public Object { + eIOBuffer m_buffer; + ePtr m_sn; eServiceReferenceDVB m_service; uint8_t m_used_demux[32]; unsigned int m_prev_build_hash; @@ -32,14 +67,22 @@ class eDVBCAService: public Object struct sockaddr_un m_servaddr; unsigned int m_sendstate; unsigned char m_capmt[2048]; - eTimer m_retryTimer; + ePtr m_retryTimer; void sendCAPMT(); void Connect(); + void socketCB(int what); + static void DVBChannelAdded(eDVBChannel*); + static void DVBChannelStateChanged(iDVBChannel*); static CAServiceMap exist; + static ChannelMap exist_channels; + static ePtr m_chanAddedConn; + static channel_data *getChannelData(eDVBChannelID &chid); + eDVBCAService(); ~eDVBCAService(); public: + static void registerChannelCallback(eDVBResourceManager *res_mgr); static RESULT register_service( const eServiceReferenceDVB &ref, int demux_nums[2], eDVBCAService *&caservice ); static RESULT unregister_service( const eServiceReferenceDVB &ref, int demux_nums[2], eTable *ptr ); void buildCAPMT(eTable *ptr); @@ -47,6 +90,27 @@ public: #endif +#include +#include +class HbbTVApplicationInfo +{ +public: + int m_OrgId; + int m_AppId; + int m_ControlCode; + short m_ProfileCode; + std::string m_HbbTVUrl; + std::string m_ApplicationName; +public: + HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName, int profileCode) + : m_ControlCode(controlCode), m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName), m_OrgId(orgid), + m_AppId(appid), m_ProfileCode(profileCode) + {} +}; +typedef std::list HbbTVApplicationInfoList; +typedef HbbTVApplicationInfoList::iterator HbbTVApplicationInfoListIterator; +typedef HbbTVApplicationInfoList::const_iterator HbbTVApplicationInfoListConstIterator; + class eDVBServicePMTHandler: public Object { #ifndef SWIG @@ -56,7 +120,7 @@ class eDVBServicePMTHandler: public Object int m_last_channel_state; eDVBCAService *m_ca_servicePtr; - eDVBScan *m_dvb_scan; // for sdt scan + ePtr m_dvb_scan; // for sdt scan eAUTable > m_PMT; eAUTable > m_PAT; @@ -64,8 +128,8 @@ class eDVBServicePMTHandler: public Object eUsePtr m_channel; eUsePtr m_pvr_channel; ePtr m_resourceManager; - ePtr m_demux; - + ePtr m_demux, m_pvr_demux_tmp; + void channelStateChanged(iDVBChannel *); ePtr m_channelStateChanged_connection; void channelEvent(iDVBChannel *, int event); @@ -73,13 +137,31 @@ class eDVBServicePMTHandler: public Object void SDTScanEvent(int); ePtr m_scan_event_connection; + eAUTable > m_AIT; + eAUTable > m_OC; + + void registerCAService(); void PMTready(int error); void PATready(int error); int m_pmt_pid; + void AITready(int error); + void OCready(int error); + int m_dsmcc_pid; + int m_ait_pid; + HbbTVApplicationInfoList m_HbbTVApplications; + std::string m_HBBTVUrl; + std::string m_ApplicationName; + unsigned char m_AITData[4096]; + int m_use_decode_demux; uint8_t m_decode_demux_num; + ePtr m_no_pat_entry_delay; + uint8_t mDemuxId; + + bool m_pmt_ready; + bool m_ca_disabled; public: eDVBServicePMTHandler(); ~eDVBServicePMTHandler(); @@ -101,8 +183,16 @@ public: eventNewProgramInfo, // we just received a PMT eventTuned, // a channel was sucessfully (re-)tuned in, you may start additional filters now + eventPreStart, // before start filepush thread eventSOF, // seek pre start eventEOF, // a file playback did end + + eventHBBTVInfo, /* HBBTV information was detected in the AIT */ + + eventMisconfiguration, // a channel was not found in any list, or no frontend was found which could provide this channel + eventNoDiskSpace, // no disk space available + eventStartPvrDescramble, // start PVR Descramble Convert + eventChannelAllocated, }; #ifndef SWIG Signal1 serviceEvent; @@ -111,14 +201,15 @@ public: { int pid; int component_tag; - enum { vtMPEG2, vtMPEG4_H264 }; + enum { vtMPEG2, vtMPEG4_H264, vtMPEG1, vtMPEG4_Part2, vtVC1, vtVC1_SM, vtH265_HEVC }; int type; }; struct audioStream { - int pid; - enum { atMPEG, atAC3, atDTS, atAAC }; + int pid, + rdsPid; // hack for some radio services which transmit radiotext on different pid (i.e. harmony fm, HIT RADIO FFH, ...) + enum { atMPEG, atAC3, atDTS, atAAC, atAACHE, atLPCM, atDTSHD, atDDP }; int type; // mpeg2, ac3, dts, ... int component_tag; @@ -155,23 +246,32 @@ public: struct program { + struct capid_pair + { + uint16_t caid; + int capid; + bool operator< (const struct capid_pair &t) const { return t.caid < caid; } + }; std::vector videoStreams; std::vector audioStreams; int defaultAudioStream; std::vector subtitleStreams; - std::set caids; + std::list caids; int pcrPid; int pmtPid; int textPid; + int aitPid; + int pmtVersion; + bool isCached; bool isCrypted() { return !caids.empty(); } - PyObject *createPythonObject(); }; - int getProgramInfo(struct program &program); + int getProgramInfo(program &program); int getDataDemux(ePtr &demux); int getDecodeDemux(ePtr &demux); - PyObject *getCaIds(); + PyObject *getCaIds(bool pair=false); // caid / ecmpid pair + PyObject *getHbbTVApplications(void); int getPVRChannel(ePtr &pvr_channel); int getServiceReference(eServiceReferenceDVB &service) { service = m_reference; return 0; } @@ -179,12 +279,44 @@ public: int getPMT(ePtr > &ptr) { return m_PMT.getCurrent(ptr); } int getChannel(eUsePtr &channel); void resetCachedProgram() { m_have_cached_program = false; } + void sendEventNoPatEntry(); + + void getHBBTVUrl(std::string &ret) { ret = m_HBBTVUrl; } + void getDemuxID(int &id) { id = mDemuxId; } + void setCaDisable(bool disable) { m_ca_disabled = disable; } + + enum serviceType + { + livetv = 0, + recording = 1, + scrambled_recording = 2, + playback = 3, + timeshift_recording = 4, + scrambled_timeshift_recording = 5, + timeshift_playback = 6, + streamserver = 7, + scrambled_streamserver = 8, + streamclient = 9, + offline = 10, + pvrDescramble = 11, + }; + + /* deprecated interface */ + int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0, serviceType type = livetv, bool descramble = true); + + /* new interface */ + int tuneExt(eServiceReferenceDVB &ref, int use_decode_demux, ePtr &, const char *streaminfo_file, eCueSheet *sg=0, bool simulate=false, eDVBService *service = 0, serviceType type = livetv, bool descramble=true); - int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0); void free(); + void addCaHandler(); + void removeCaHandler(); + bool isCiConnected(); + bool isPmtReady() { return m_pmt_ready; } private: bool m_have_cached_program; program m_cached_program; + bool m_descramble; + serviceType m_service_type; #endif };