Implemented ES priority flag in accordance with HBBTV spec
This commit is contained in:
parent
c78cbc22ea
commit
a73f97e065
3 changed files with 41 additions and 9 deletions
|
@ -258,6 +258,9 @@ namespace TS {
|
|||
if (getRandomAccess()){
|
||||
output << " [RandomXS]";
|
||||
}
|
||||
if (getESPriority()){
|
||||
output << " [ESPriority]";
|
||||
}
|
||||
if (hasPCR()) {
|
||||
output << " [PCR " << (double)getPCR() / 27000000 << "s]";
|
||||
}
|
||||
|
@ -286,7 +289,7 @@ namespace TS {
|
|||
return output.str();
|
||||
}
|
||||
|
||||
if (detailLevel >= 3){
|
||||
if (detailLevel >= 10){
|
||||
output << std::string(indent+2, ' ') << "Raw data bytes:";
|
||||
unsigned int size = getDataSize();
|
||||
|
||||
|
@ -325,12 +328,6 @@ namespace TS {
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets the elementary stream priority indicator of a Packet
|
||||
/// \return The elementary stream priority indicator of a Packet
|
||||
bool Packet::hasESpriority() const{
|
||||
return strBuf[5] & 0x20;
|
||||
}
|
||||
|
||||
bool Packet::hasDiscontinuity() const{
|
||||
return strBuf[5] & 0x80;
|
||||
}
|
||||
|
@ -366,6 +363,15 @@ namespace TS {
|
|||
return strBuf[5] & 0x40;
|
||||
}
|
||||
|
||||
/// Gets whether this Packet has the priority bit set
|
||||
/// \return Whether or not this Packet has the priority bit set
|
||||
bool Packet::getESPriority() const{
|
||||
if (getAdaptationField() < 2) {
|
||||
return false;
|
||||
}
|
||||
return strBuf[5] & 0x20;
|
||||
}
|
||||
|
||||
///Gets the value of the PCR flag
|
||||
///\return true if there is a PCR, false otherwise
|
||||
bool Packet::hasPCR() const{
|
||||
|
@ -408,6 +414,30 @@ namespace TS {
|
|||
}
|
||||
}
|
||||
|
||||
///Gets the value of the ES priority flag
|
||||
///\return the value of the ES priority flag
|
||||
void Packet::setESPriority(bool NewVal) {
|
||||
updPos(6);
|
||||
if (getAdaptationField() == 3) {
|
||||
if (!strBuf[4]) {
|
||||
strBuf[4] = 1;
|
||||
}
|
||||
if (NewVal) {
|
||||
strBuf[5] |= 0x20;
|
||||
} else {
|
||||
strBuf[5] &= 0xDF;
|
||||
}
|
||||
} else {
|
||||
setAdaptationField(3);
|
||||
strBuf[4] = 1;
|
||||
if (NewVal) {
|
||||
strBuf[5] = 0x20;
|
||||
} else {
|
||||
strBuf[5] = 0x00;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Transforms the Packet into a standard Program Association Table
|
||||
void Packet::setDefaultPAT() {
|
||||
static int MyCntr = 0;
|
||||
|
|
|
@ -45,6 +45,8 @@ namespace TS {
|
|||
bool getUnitStart() const;
|
||||
void setRandomAccess(bool newVal);
|
||||
bool getRandomAccess() const;
|
||||
void setESPriority(bool newVal);
|
||||
bool getESPriority() const;
|
||||
|
||||
void setDiscontinuity(bool newVal);
|
||||
bool hasDiscontinuity() const;
|
||||
|
@ -53,7 +55,6 @@ namespace TS {
|
|||
bool hasSplicingPoint() const;
|
||||
bool hasTransportError() const;
|
||||
bool hasPriority() const;
|
||||
bool hasESpriority() const;
|
||||
|
||||
//Helper functions
|
||||
operator bool() const;
|
||||
|
|
|
@ -39,7 +39,8 @@ namespace Mist {
|
|||
packData.setDiscontinuity(true);
|
||||
if (myMeta.tracks[thisPacket.getTrackId()].type == "video"){
|
||||
if (thisPacket.getInt("keyframe")){
|
||||
packData.setRandomAccess(1);
|
||||
packData.setRandomAccess(true);
|
||||
packData.setESPriority(true);
|
||||
}
|
||||
packData.setPCR(thisPacket.getTime() * 27000);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue