diff --git a/lib/ts_packet.cpp b/lib/ts_packet.cpp index ae063b8f..3a6ff8b2 100644 --- a/lib/ts_packet.cpp +++ b/lib/ts_packet.cpp @@ -50,7 +50,7 @@ namespace TS { ///the first 188 characters of a char array ///\param Data The char array that contains the data to be read into the packet ///\return true if successful (which always happens, or else a segmentation fault should occur) - bool Packet::FromPointer(char * Data) { + bool Packet::FromPointer(const char * Data) { strBuf = std::string(Data, 188); return true; } diff --git a/lib/ts_packet.h b/lib/ts_packet.h index cde0e488..cbdccc2c 100644 --- a/lib/ts_packet.h +++ b/lib/ts_packet.h @@ -34,7 +34,7 @@ namespace TS { Packet(); ~Packet(); bool FromString(std::string & Data); - bool FromPointer(char * Data); + bool FromPointer(const char * Data); bool FromFile(FILE * data); void PID(int NewPID); unsigned int PID(); @@ -108,6 +108,22 @@ namespace TS { std::string toPrettyString(size_t indent); }; + class ProgramMappingEntry { + public: + ProgramMappingEntry(char * begin, char * end); + + operator bool() const; + + int streamType(); + int elementaryPid(); + int ESInfoLength(); + char * ESInfo(); + void advance(); + private: + char* data; + char* boundary; + }; + class ProgramMappingTable : public Packet { public: ProgramMappingTable(); @@ -133,6 +149,7 @@ namespace TS { void setProgramInfoLength(short newVal); short getProgramCount(); void setProgramCount(short newVal); + ProgramMappingEntry getEntry(int index); char getStreamType(short index); void setStreamType(char newVal, short index); short getElementaryPID(short index);