diff --git a/lib/libcoolstream/dmx_cs.h b/lib/libcoolstream/dmx_cs.h index 2ec7d696b..66e093a7c 100644 --- a/lib/libcoolstream/dmx_cs.h +++ b/lib/libcoolstream/dmx_cs.h @@ -10,19 +10,14 @@ #define __DEMUX_CS_H_ #include +#include "cs_types.h" #define DEMUX_POLL_TIMEOUT 0 // timeout in ms #define MAX_FILTER_LENGTH 12 // maximum number of filters #ifndef DMX_FILTER_SIZE #define DMX_FILTER_SIZE MAX_FILTER_LENGTH #endif -#define MAX_DMX_UNITS 4 //DMX_NUM_TSS_INPUTS_REVB - -#ifndef CS_DMX_PDATA -#define CS_DMX_PDATA void -#endif - -#include "cs_types.h" +#define MAX_DMX_UNITS 4 typedef enum { DMX_VIDEO_CHANNEL = 1, @@ -34,45 +29,48 @@ typedef enum { DMX_PCR_ONLY_CHANNEL } DMX_CHANNEL_TYPE; +class cDemuxData; + class cDemux { private: - int timeout; - unsigned short pid; - bool nb; // non block - pthread_cond_t read_cond; - pthread_mutex_t mutex; - AVSYNC_TYPE syncMode; - int uLength; - bool enabled; - int unit; + DMX_CHANNEL_TYPE type; + int timeout; + unsigned short pid; + AVSYNC_TYPE syncMode; + bool enabled; + int unit; - DMX_CHANNEL_TYPE type; - CS_DMX_PDATA *privateData; + cDemuxData * dd; public: cDemux(int num = 0); ~cDemux(); // - bool Open(DMX_CHANNEL_TYPE pes_type, void * hVideoBuffer = NULL, int uBufferSize = 8192); - void Close(void); - bool Start(void); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - void SignalRead(int len); - unsigned short GetPID(void) { return pid; } + bool Open(DMX_CHANNEL_TYPE pes_type, void * hVideoBuffer = NULL, int uBufferSize = 8192); + void Close(void); + bool Start(bool record = false); + bool Stop(void); + int Read(unsigned char *buff, int len, int Timeout = 0); + bool SetSource(int source); + + bool sectionFilter(unsigned short Pid, const unsigned char * const Tid, const unsigned char * const Mask, int len, int Timeout = DEMUX_POLL_TIMEOUT, const unsigned char * const nMask = NULL); + bool AddSectionFilter(unsigned short Pid, const unsigned char * const Filter, const unsigned char * const Mask, int len, const unsigned char * const nMask = NULL); + + bool pesFilter(const unsigned short Pid); + bool addPid(unsigned short Pid); + void SetSyncMode(AVSYNC_TYPE SyncMode); + void *getBuffer(void); + void *getChannel(void); + void getSTC(int64_t *STC); + + DMX_CHANNEL_TYPE getChannelType(void) { return type; }; + int getUnit(void) { return unit; }; + unsigned short GetPID(void) { return pid; } + // +#if 0 const unsigned char *GetFilterTID(u8 FilterIndex = 0); const unsigned char *GetFilterMask(u8 FilterIndex = 0); - unsigned int GetFilterLength(u8 FilterIndex = 0); + const unsigned int GetFilterLength(u8 FilterIndex = 0); unsigned int GetFilterCount(void); - bool AddSectionFilter(unsigned short Pid, const unsigned char * const Filter, const unsigned char * const Mask, int len, const unsigned char * const nMask = NULL); - bool sectionFilter(unsigned short Pid, const unsigned char * const Tid, const unsigned char * const Mask, int len, int Timeout = DEMUX_POLL_TIMEOUT, const unsigned char * const nMask = NULL); - bool pesFilter(const unsigned short Pid); - void SetSyncMode(AVSYNC_TYPE SyncMode); - void *getBuffer(void); - void *getChannel(void); - DMX_CHANNEL_TYPE getChannelType(void); - void addPid(unsigned short Pid); - void getSTC(int64_t *STC); - int getUnit(void); - // +#endif }; #endif //__DMX_CS_H_ diff --git a/lib/libcoolstream/playback_cs.h b/lib/libcoolstream/playback_cs.h index fc8bad063..6cdfa05f7 100644 --- a/lib/libcoolstream/playback_cs.h +++ b/lib/libcoolstream/playback_cs.h @@ -11,28 +11,23 @@ #include -#ifndef CS_PLAYBACK_PDATA -#define CS_PLAYBACK_PDATA void -#endif - typedef enum { PLAYMODE_TS = 0, PLAYMODE_FILE } playmode_t; +class cPlaybackData; + class cPlayback { private: - int timeout; - pthread_cond_t read_cond; - pthread_mutex_t mutex; - CS_PLAYBACK_PDATA * privateData; + cPlaybackData * pd; + bool enabled; bool paused; bool playing; int unit; int nPlaybackFD; int video_type; - int nPlaybackSpeed; int mSpeed; playmode_t playMode; // @@ -40,8 +35,9 @@ private: void Detach(void); bool SetAVDemuxChannel(bool On, bool Video = true, bool Audio = true); public: - void PlaybackNotify (int Event, void *pData, void *pTag); - void DMNotify(int Event, void *pTsBuf, void *Tag); + cPlayback(int num = 0); + ~cPlayback(); + bool Open(playmode_t PlayMode); void Close(void); bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, int audio_flag, unsigned int duration = 0); @@ -54,13 +50,8 @@ public: bool SetPosition(int position, bool absolute = false); bool IsPlaying(void) const { return playing; } bool IsEnabled(void) const { return enabled; } - void * GetHandle(void); - void * GetDmHandle(void); - int GetCurrPlaybackSpeed(void) const { return nPlaybackSpeed; } void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); - // - cPlayback(int num = 0); - ~cPlayback(); + }; #endif // __PLAYBACK_CS_H_ diff --git a/lib/libcoolstream/record_cs.h b/lib/libcoolstream/record_cs.h index 044d2661a..51b28bfe6 100644 --- a/lib/libcoolstream/record_cs.h +++ b/lib/libcoolstream/record_cs.h @@ -11,13 +11,11 @@ #include -#ifndef CS_RECORD_PDATA -#define CS_RECORD_PDATA void -#endif +class cRecordData; class cRecord { private: - CS_RECORD_PDATA * privateData; + cRecordData * rd; bool enabled; int num_apids; int unit; @@ -27,11 +25,11 @@ public: cRecord(int num = 0); ~cRecord(); - bool Open(int numpids); + bool Open(); void Close(void); bool Start(int fd, unsigned short vpid, unsigned short * apids, int numapids); bool Stop(void); - void RecordNotify(int Event, void *pData); + bool AddPid(unsigned short pid); /* not tested */ bool ChangePids(unsigned short vpid, unsigned short * apids, int numapids); }; diff --git a/lib/libcoolstream/video_cs.h b/lib/libcoolstream/video_cs.h index 1946710a3..5b3ca08a5 100644 --- a/lib/libcoolstream/video_cs.h +++ b/lib/libcoolstream/video_cs.h @@ -213,7 +213,7 @@ public: void SetCECAutoStandby(bool OnOff); void ShowPicture(const char * fname); void StopPicture(); - void Standby(unsigned int bOn); + void Standby(bool bOn); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600); void SetControl(int num, int val); bool ReceivedDRMDelay(void) { return receivedDRMDelay; } diff --git a/src/Makefile.am b/src/Makefile.am index 5d416bcbb..c7b9d999a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -92,7 +92,7 @@ neutrino_LDADD = \ if BOXTYPE_COOL neutrino_LDADD += \ - -lcoolstream \ + -lcoolstream-mt \ -lOpenThreads \ -lnxp