added setDiscontinuity function to ts_packet, added DEBUG MSG level shortcuts

This commit is contained in:
wouter spruit 2015-03-05 13:35:17 +01:00 committed by Thulinma
parent 6a6a8915d2
commit 12b0d9a930
3 changed files with 29 additions and 0 deletions

View file

@ -47,6 +47,12 @@ static const char * DBG_LVL_LIST[] = {"NONE", "FAIL", "ERROR", "WARN", "INFO", "
#define WARN_MSG(msg, ...) DEBUG_MSG(DLVL_WARN, msg, ##__VA_ARGS__)
#define DEVEL_MSG(msg, ...) DEBUG_MSG(DLVL_DEVEL, msg, ##__VA_ARGS__)
#define INFO_MSG(msg, ...) DEBUG_MSG(DLVL_DEVEL, msg, ##__VA_ARGS__)
#define MEDIUM_MSG(msg, ...) DEBUG_MSG(DLVL_MEDIUM, msg, ##__VA_ARGS__)
#define HIGH_MSG(msg, ...) DEBUG_MSG(DLVL_HIGH, msg, ##__VA_ARGS__)
#define VERYHIGH_MSG(msg, ...) DEBUG_MSG(DLVL_VERYHIGH, msg, ##__VA_ARGS__)
#define EXTREME_MSG(msg, ...) DEBUG_MSG(DLVL_EXTREME, msg, ##__VA_ARGS__)
#define INSANE_MSG(msg, ...) DEBUG_MSG(DLVL_INSANE, msg, ##__VA_ARGS__)
#define DONTEVEN_MSG(msg, ...) DEBUG_MSG(DLVL_DONTEVEN, msg, ##__VA_ARGS__)
#endif

View file

@ -330,6 +330,28 @@ namespace TS {
return strBuf[5] & 0x80;
}
void Packet::setDiscontinuity(bool newVal){
updPos(6);
if (getAdaptationField() == 3) {
if (!strBuf[4]) {
strBuf[4] = 1;
}
if (newVal) {
strBuf[5] |= 0x80;
} else {
strBuf[5] &= 0x7F;
}
} else {
setAdaptationField(3);
strBuf[4] = 1;
if (newVal) {
strBuf[5] = 0x80;
} else {
strBuf[5] = 0x00;
}
}
}
/// Gets whether this Packet can be accessed at random (indicates keyframe).
/// \return Whether or not this Packet contains a keyframe.
bool Packet::getRandomAccess() const{

View file

@ -45,6 +45,7 @@ namespace TS {
void setRandomAccess(bool newVal);
bool getRandomAccess() const;
void setDiscontinuity(bool newVal);
bool hasDiscontinuity() const;
bool hasPCR() const;
bool hasOPCR() const;