started on ESDS box

This commit is contained in:
Oswald Auguste de Bruin 2013-07-03 16:17:32 +02:00 committed by Erik Zandvliet
parent 7f47a746fb
commit 1c796c8f30
2 changed files with 196 additions and 2 deletions

View file

@ -2279,6 +2279,158 @@ namespace MP4 {
memcpy((char*)payload(), (char*)newPayload.c_str(), newPayload.size()); memcpy((char*)payload(), (char*)newPayload.c_str(), newPayload.size());
} }
//fullbox, start at 4
ESDS::ESDS(){
memcpy(data + 4, "esds", 4);
setESDescriptorType(0x03);
setExtendedDescriptorType(0x8000FE);
}
char ESDS::getESDescriptorType(){
return getInt8(4);
}
void ESDS::setESDescriptorType(char newVal){
setInt8(newVal,4);
}
uint32_t ESDS::getExtendedDescriptorType(){
return getInt24(5);
}
//3 bytes
void ESDS::setExtendedDescriptorType(uint32_t newVal){
setInt24(newVal,5);
}
//3 bytes
char ESDS::getESDescriptorTypeLength(){
return getInt8(8);
}
void ESDS::setESDescriptorTypeLength(char newVal){
setInt8(newVal,8);
}
char ESDS::getByteObjectTypeID(){
return getInt8(9);
}
void ESDS::setByteObjectTypeID(char newVal){
setInt8(newVal,9);
}
char ESDS::getStreamType(){
return getInt8(10) >> 2;
}
//6 bits
void ESDS::setStreamType(char newVal){
setInt8(newVal<<2 + ((uint8_t)getUpstreamFlag() << 1) + (uint8_t)getReservedFlag() , 10);
}
//6 bits
bool ESDS::getUpstreamFlag(){
return (((getInt8(10) >> 1) & 0x01) == 1);
}
void ESDS::setUpstreamFlag(bool newVal){
setInt8(getStreamType()<<2 + ((uint8_t)newVal << 1) + (uint8_t)getReservedFlag() , 10);
}
bool ESDS::getReservedFlag(){
return ((getInt8(10) & 0x01) == 1);
}
void ESDS::setReservedFlag(bool newVal){
setInt8((getStreamType()<<2) + ((uint8_t)getUpstreamFlag() << 1) + (uint8_t)newVal , 10);
}
uint32_t ESDS::getBufferSize(){
return getInt24(11);
}
//3 bytes
void ESDS::setBufferSize(uint32_t newVal){
setInt24(newVal,11);
}
//3 bytes
uint32_t ESDS::getMaximumBitRate(){
return getInt32(14);
}
void ESDS::getMaximumBitRate(uint32_t newVal){
setInt32(newVal,14);
}
uint32_t ESDS::getAverageBitRate(){
return getInt32(18);
}
void ESDS::setAverageBitRate(uint32_t newVal){
setInt32(newVal,18);
}
char ESDS::getDescriptorTypeTag(){
return getInt8(22);
}
void ESDS::setDescriptorTypeTag(char newVal){
setInt8(newVal,22);
}
uint32_t ESDS::getExtendedDescriptorTypeTag(){
return getInt24(23);
}
//3 bytes
void ESDS::setExtendedDescriptorTypeTag(uint32_t newVal){
setInt24(newVal, 23);
}
//3 bytes
char ESDS::getConfigDescriptorTypeLength(){
return getInt8(26);
}
void ESDS::setConfigDescriptorTypeLength(char newVal){
setInt8(newVal, 26);
}
uint16_t ESDS::getESHeaderStartCodes(){
return getInt16(27);
}
void ESDS::setESHeaderStartCodes(uint16_t newVal){
setInt16(newVal,27);
}
char ESDS::getSLConfigDescriptorTypeTag(){
return getInt16(29);
}
void ESDS::setSLConfigDescriptorTypeTag(char newVal){
setInt16(newVal, 29);
}
uint32_t ESDS::getSLConfigExtendedDescriptorTypeTag(){
return getInt24(31);
}
//3 bytes
void ESDS::setSLConfigExtendedDescriptorTypeTag(uint32_t newVal){
setInt24(newVal, 31);
}
//3 bytes
char ESDS::getSLDescriptorTypeLength(){
return getInt8(34);
}
void ESDS::setSLDescriptorTypeLength(char newVal){
setInt8(newVal, 34);
}
char ESDS::getSLValue(){
return getInt8(35);
}
void ESDS::setSLValue(char newVal){
setInt8(newVal, 35);
}
SDTP::SDTP(){ SDTP::SDTP(){
memcpy(data + 4, "sdtp", 4); memcpy(data + 4, "sdtp", 4);
} }

View file

@ -344,6 +344,48 @@ namespace MP4 {
std::string toPrettyString(uint32_t indent = 0); std::string toPrettyString(uint32_t indent = 0);
}; };
///\todo : ESDS is filthy implemented, clean up when optimising
class ESDS: public fullBox{
public:
ESDS();
char getESDescriptorType();
void setESDescriptorType(char newVal);
uint32_t getExtendedDescriptorType();//3 bytes
void setExtendedDescriptorType(uint32_t newVal);//3 bytes
char getESDescriptorTypeLength();
void setESDescriptorTypeLength(char newVal);
char getByteObjectTypeID();
void setByteObjectTypeID(char newVal);
char getStreamType();//6 bits
void setStreamType(char newVal);//6 bits
bool getUpstreamFlag();
void setUpstreamFlag(bool newVal);
bool getReservedFlag();
void setReservedFlag(bool newVal);
uint32_t getBufferSize();//3 bytes
void setBufferSize(uint32_t newVal);//3 bytes
uint32_t getMaximumBitRate();
void getMaximumBitRate(uint32_t newVal);
uint32_t getAverageBitRate();
void setAverageBitRate(uint32_t newVal);
char getDescriptorTypeTag();
void setDescriptorTypeTag(char newVal);
uint32_t getExtendedDescriptorTypeTag();//3 bytes
void setExtendedDescriptorTypeTag(uint32_t newVal);//3 bytes
char getConfigDescriptorTypeLength();
void setConfigDescriptorTypeLength(char newVal);
uint16_t getESHeaderStartCodes();
void setESHeaderStartCodes(uint16_t newVal);
char getSLConfigDescriptorTypeTag();
void setSLConfigDescriptorTypeTag(char newVal);
uint32_t getSLConfigExtendedDescriptorTypeTag();//3 bytes
void setSLConfigExtendedDescriptorTypeTag(uint32_t newVal);//3 bytes
char getSLDescriptorTypeLength();
void setSLDescriptorTypeLength(char newVal);
char getSLValue();
void setSLValue(char newVal);
};
class SDTP: public Box{ class SDTP: public Box{
public: public:
SDTP(); SDTP();