removed unused ts_packet functions

This commit is contained in:
wouter spruit 2015-02-24 09:33:12 +01:00 committed by Thulinma
parent 353bb301ca
commit 3ab38b22fc
2 changed files with 3 additions and 78 deletions

View file

@ -379,6 +379,7 @@ namespace TS {
strBuf[5] &= 0xBF; strBuf[5] &= 0xBF;
} }
} else { } else {
///\todo this code doesn't check for existing data, causing corruption.
if (strBuf.size() < 6) { if (strBuf.size() < 6) {
strBuf.resize(6); strBuf.resize(6);
} }
@ -433,48 +434,6 @@ namespace TS {
//Bits 7-0 time, 1 marker bit //Bits 7-0 time, 1 marker bit
strBuf += (char)(((time & 0x00000007FLL) << 1) | 0x01); strBuf += (char)(((time & 0x00000007FLL) << 1) | 0x01);
} }
/// Generates a PES Lead-in for a video frame.
/// Starts at the first Free byte.
/// \param len The length of this frame.
/// \param PTS The timestamp of the frame.
/// \param offset The timestamp of the frame.
void Packet::PESVideoLeadIn(unsigned int len, unsigned long long PTS, unsigned long long offset) {
len += (offset ? 13 : 8);
len = 0;
strBuf.append("\000\000\001\340", 4);
strBuf += (char)((len >> 8) & 0xFF);
strBuf += (char)(len & 0xFF);
strBuf.append("\204", 1);
strBuf += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags
strBuf += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength
encodePESTimestamp(strBuf, (offset ? 0x30 : 0x20), PTS + offset);
if (offset){
encodePESTimestamp(strBuf, 0x10, PTS);
}
}
/// Generates a PES Lead-in for a video frame.
/// Prepends the lead-in to variable toSend, assumes toSend's length is all other data.
/// \param toSend Data that is to be send, will be modified.
/// \param PTS The timestamp of the frame.
void Packet::PESVideoLeadIn(std::string & toSend, unsigned long long PTS, unsigned long long offset) {
unsigned int len = toSend.size() + (offset ? 13 : 8);
len = 0;
std::string tmpStr;
tmpStr.reserve(25);
tmpStr.append("\000\000\001\340", 4);
tmpStr += (char)((len >> 8) & 0xFF);
tmpStr += (char)(len & 0xFF);
tmpStr.append("\204", 1);
tmpStr += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags
tmpStr += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength
encodePESTimestamp(tmpStr, (offset ? 0x30 : 0x20), PTS + offset);
if (offset){
encodePESTimestamp(tmpStr, 0x10, PTS);
}
toSend.insert(0, tmpStr);
}
/// Generates a PES Lead-in for a video frame. /// Generates a PES Lead-in for a video frame.
/// Prepends the lead-in to variable toSend, assumes toSend's length is all other data. /// Prepends the lead-in to variable toSend, assumes toSend's length is all other data.
@ -499,36 +458,6 @@ namespace TS {
return tmpStr; return tmpStr;
} }
/// Generates a PES Lead-in for an audio frame.
/// Starts at the first Free byte.
/// \param len The length of this frame.
/// \param PTS The timestamp of the frame.
void Packet::PESAudioLeadIn(unsigned int len, unsigned long long PTS) {
len += 8;
strBuf.append("\000\000\001\300", 4);
strBuf += (char)((len & 0xFF00) >> 8); //PES PacketLength
strBuf += (char)(len & 0x00FF); //PES PacketLength (Cont)
strBuf.append("\204\200\005", 3);
encodePESTimestamp(strBuf, 0x20, PTS);
}
/// Generates a PES Lead-in for an audio frame.
/// Prepends the lead-in to variable toSend, assumes toSend's length is all other data.
/// \param toSend Data that is to be send, will be modified.
/// \param PTS The timestamp of the frame.
void Packet::PESAudioLeadIn(std::string & toSend, long long unsigned int PTS) {
std::string tmpStr;
tmpStr.reserve(14);
unsigned int len = toSend.size() + 8;
tmpStr.append("\000\000\001\300", 4);
tmpStr += (char)((len & 0xFF00) >> 8); //PES PacketLength
tmpStr += (char)(len & 0x00FF); //PES PacketLength (Cont)
tmpStr.append("\204\200\005", 3);
encodePESTimestamp(tmpStr, 0x20, PTS);
toSend.insert(0, tmpStr);
}
/// Generates a PES Lead-in for an audio frame. /// Generates a PES Lead-in for an audio frame.
/// Prepends the lead-in to variable toSend, assumes toSend's length is all other data. /// Prepends the lead-in to variable toSend, assumes toSend's length is all other data.
/// \param len The length of this frame. /// \param len The length of this frame.

View file

@ -85,12 +85,8 @@ namespace TS {
int getPayloadLength(); int getPayloadLength();
const char * ToString(); const char * ToString();
//PES helpers //PES helpers
void PESVideoLeadIn(unsigned int len, unsigned long long PTS, unsigned long long offset); static std::string & getPESVideoLeadIn(unsigned int len, unsigned long long PTS, unsigned long long offset);
static void PESVideoLeadIn(std::string & toSend, unsigned long long PTS, unsigned long long offset);
static std::string & getPESVideoLeadIn(unsigned int len, unsigned long long PTS, unsigned long long offset);
void PESAudioLeadIn(unsigned int len, unsigned long long PTS);
static void PESAudioLeadIn(std::string & toSend, unsigned long long PTS);
static std::string & getPESAudioLeadIn(unsigned int len, unsigned long long PTS); static std::string & getPESAudioLeadIn(unsigned int len, unsigned long long PTS);
protected: protected:
std::string strBuf;///< Internal string buffer std::string strBuf;///< Internal string buffer