Added SDTP box and AVCC::setPayload function
This commit is contained in:
parent
503f63af2b
commit
fbc59ba664
2 changed files with 37 additions and 3 deletions
29
lib/mp4.cpp
29
lib/mp4.cpp
|
@ -1641,9 +1641,34 @@ namespace MP4{
|
||||||
std::string AVCC::asAnnexB( ) {
|
std::string AVCC::asAnnexB( ) {
|
||||||
std::stringstream r;
|
std::stringstream r;
|
||||||
r << (char)0x00 << (char)0x00 << (char)0x00 << (char)0x01;
|
r << (char)0x00 << (char)0x00 << (char)0x00 << (char)0x01;
|
||||||
r << getSPS( );
|
r.write( getSPS( ), getSPSLen() );
|
||||||
r << (char)0x00 << (char)0x00 << (char)0x00 << (char)0x01;
|
r << (char)0x00 << (char)0x00 << (char)0x00 << (char)0x01;
|
||||||
r << getPPS( );
|
r.write( getPPS( ), getPPSLen() );
|
||||||
return r.str();
|
return r.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AVCC::setPayload( std::string newPayload ) {
|
||||||
|
if( ! reserve( 0, payloadSize(), newPayload.size() ) ) { return; }
|
||||||
|
memcpy( (char*)payload(), (char*)newPayload.c_str(), newPayload.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
SDTP::SDTP() {
|
||||||
|
memcpy(data + 4, "sdtp", 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDTP::setVersion( long newVersion ) {
|
||||||
|
setInt8( newVersion, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
long SDTP::getVersion( ) {
|
||||||
|
return getInt8( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDTP::setValue( long newValue, size_t index ) {
|
||||||
|
setInt8( newValue, index );
|
||||||
|
}
|
||||||
|
|
||||||
|
long SDTP::getValue( size_t index ) {
|
||||||
|
getInt8( index );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
11
lib/mp4.h
11
lib/mp4.h
|
@ -275,7 +275,6 @@ namespace MP4{
|
||||||
std::string toPrettyString(long indent = 0);
|
std::string toPrettyString(long indent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AVCC : public Box {
|
class AVCC : public Box {
|
||||||
public:
|
public:
|
||||||
AVCC();
|
AVCC();
|
||||||
|
@ -298,6 +297,16 @@ namespace MP4{
|
||||||
long getPPSLen( );
|
long getPPSLen( );
|
||||||
char* getPPS( );
|
char* getPPS( );
|
||||||
std::string asAnnexB( );
|
std::string asAnnexB( );
|
||||||
|
void setPayload( std::string newPayload );
|
||||||
std::string toPrettyString(long indent = 0);
|
std::string toPrettyString(long indent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SDTP : public Box {
|
||||||
|
public:
|
||||||
|
SDTP();
|
||||||
|
void setVersion( long newVersion );
|
||||||
|
long getVersion( );
|
||||||
|
void setValue( long newValue, size_t index );
|
||||||
|
long getValue( size_t index );
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue