Fixes to MP4 library. Now works and includes test program.

This commit is contained in:
Thulinma 2012-09-28 15:12:05 +02:00
parent 98fdf3fa8d
commit cac5dcc9a1
3 changed files with 585 additions and 248 deletions

View file

@ -146,6 +146,7 @@ namespace MP4{
index += payloadOffset;
if (index >= boxedSize()){
if (!reserve(index, 0, 1)){return 0;}
setInt8(0, index-payloadOffset);
}
return data[index];
}
@ -169,6 +170,7 @@ namespace MP4{
index += payloadOffset;
if (index+1 >= boxedSize()){
if (!reserve(index, 0, 2)){return 0;}
setInt16(0, index-payloadOffset);
}
short result;
memcpy( (char*)&result, data + index, 2 );
@ -195,6 +197,7 @@ namespace MP4{
index += payloadOffset;
if (index+2 >= boxedSize()){
if (!reserve(index, 0, 3)){return 0;}
setInt24(0, index-payloadOffset);
}
long result = data[index];
result <<= 8;
@ -211,6 +214,7 @@ namespace MP4{
index += payloadOffset;
if (index+3 >= boxedSize()){
if (!reserve(index, 0, 4)){return;}
setInt32(0, index-payloadOffset);
}
newData = htonl( newData );
memcpy( data + index, (char*)&newData, 4 );
@ -236,6 +240,7 @@ namespace MP4{
index += payloadOffset;
if (index+7 >= boxedSize()){
if (!reserve(index, 0, 8)){return;}
setInt64(0, index-payloadOffset);
}
///\todo Fix 64 bit conversion
// *((int*)(data[index])) = htonl((int)(newData>>32));
@ -306,6 +311,41 @@ namespace MP4{
return strlen(data+index);
}
/// Gets a reference to the box at the given index.
/// Do not store or copy this reference, for there will be raptors.
/// Will attempt to resize if out of range.
/// Returns an 8-byte error box if resizing failed.
Box & Box::getBox(size_t index){
static Box retbox;
index += payloadOffset;
if (index+8 > boxedSize()){
if (!reserve(index, 0, 8)){
retbox = Box((char*)"\000\000\000\010erro", false);
return retbox;
}
memcpy(data+index, "\000\000\000\010erro", 8);
}
retbox = Box(data+index, false);
return retbox;
}
/// Returns the size of the box at the given position.
/// Returns undefined values if there is no box at the given position.
/// Returns 0 if out of range.
size_t Box::getBoxLen(size_t index){
if (index+payloadOffset+8 > boxedSize()){return 0;}
return getBox(index).boxedSize();
}
/// Replaces the existing box at the given index by the new box newEntry.
/// Will resize if needed, will reserve new space if out of range.
void Box::setBox(Box & newEntry, size_t index){
int oldlen = getBoxLen(index);
int newlen = newEntry.boxedSize();
if (oldlen != newlen && !reserve(index+payloadOffset, oldlen, newlen)){return;}
memcpy(data+index+payloadOffset, newEntry.asBox(), newlen);
}
/// Attempts to reserve enough space for wanted bytes of data at given position, where current bytes of data is now reserved.
/// This will move any existing data behind the currently reserved space to the proper location after reserving.
/// \returns True on success, false otherwise.
@ -323,7 +363,7 @@ namespace MP4{
}
}
//move data behind, if any
if (boxedSize() - (position+current) > 0){
if (boxedSize() > (position+current)){
memmove(data+position+wanted, data+position+current, boxedSize() - (position+current));
}
//calculate and set new size
@ -347,6 +387,8 @@ namespace MP4{
setSmpteTimeCodeOffset( 0 );
std::string empty;
setMovieIdentifier( empty );
setInt8(0, 30);//set serverentrycount to 0
setInt8(0, 31);//set qualityentrycount to 0
setDrmData( empty );
setMetaData( empty );
}
@ -408,61 +450,65 @@ namespace MP4{
void ABST::setServerEntry(std::string & newEntry, long no){
int countLoc = 29 + getStringLen(29)+1;
int tempLoc = countLoc+1;
for (int i = 0; i < no; i++){
if (i < getServerEntryCount()){
tempLoc += getStringLen(tempLoc)+1;
} else {
if(!reserve(tempLoc, 0, no - getServerEntryCount())){return;};
memset(data+tempLoc, 0, no - getServerEntryCount());
tempLoc += (no-1) - getServerEntryCount();
setInt8(no+1, countLoc);//set new serverEntryCount
break;
}
//attempt to reach the wanted position
int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getStringLen(tempLoc)+1;
}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getInt8(countLoc)){
int amount = no+1-getInt8(countLoc);
if(!reserve(payloadOffset+tempLoc, 0, amount)){return;};
memset(data+payloadOffset+tempLoc, 0, amount);
setInt8(no+1, countLoc);//set new qualityEntryCount
tempLoc += no-i;
}
//now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
setString(newEntry, tempLoc);
}
///\return Empty string if no > serverEntryCount(), serverEntry[no] otherwise.
const char* ABST::getServerEntry(long no){
if (no > getServerEntryCount()){return "";}
int tempLoc = 29+getStringLen(29)+1 + 1;//position of entry count;
if (no+1 > getServerEntryCount()){return "";}
int tempLoc = 29+getStringLen(29)+1 + 1;//position of first entry
for (int i = 0; i < no; i++){tempLoc += getStringLen(tempLoc)+1;}
return getString(tempLoc);
}
long ABST::getQualityEntryCount(){
int countLoc = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
countLoc += getStringLen(countLoc)+1;
}
for (int i = 0; i< getServerEntryCount(); i++){countLoc += getStringLen(countLoc)+1;}
return getInt8(countLoc);
}
void ABST::setQualityEntry(std::string & newEntry, long no){
int countLoc = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
countLoc += getStringLen(countLoc)+1;
}
for (int i = 0; i< getServerEntryCount(); i++){countLoc += getStringLen(countLoc)+1;}
int tempLoc = countLoc+1;
for (int i = 0; i < no; i++){
if (i < getQualityEntryCount()){
tempLoc += getStringLen(tempLoc)+1;
} else {
if(!reserve(tempLoc, 0, no - getQualityEntryCount())){return;};
memset(data+tempLoc, 0, no - getQualityEntryCount());
tempLoc += (no-1) - getQualityEntryCount();
setInt8(no+1, countLoc);//set new qualityEntryCount
break;
}
//attempt to reach the wanted position
int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){
tempLoc += getStringLen(tempLoc)+1;
}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getInt8(countLoc)){
int amount = no+1-getInt8(countLoc);
if(!reserve(payloadOffset+tempLoc, 0, amount)){return;};
memset(data+payloadOffset+tempLoc, 0, amount);
setInt8(no+1, countLoc);//set new qualityEntryCount
tempLoc += no-i;
}
//now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
setString(newEntry, tempLoc);
}
const char* ABST::getQualityEntry(long no){
if (no > getQualityEntryCount()){return "";}
int tempLoc = 29+getStringLen(29)+1 + 1;//position of serverentry count;
int tempLoc = 29+getStringLen(29)+1 + 1;//position of serverentries;
for (int i = 0; i < getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc += 1;
tempLoc += 1;//first qualityentry
for (int i = 0; i < no; i++){tempLoc += getStringLen(tempLoc)+1;}
return getString(tempLoc);
}
@ -511,7 +557,7 @@ namespace MP4{
return getInt8(tempLoc);
}
void ABST::setSegmentRunTable( ASRT newSegment, long no ) {
void ABST::setSegmentRunTable( ASRT & newSegment, long no ) {
long tempLoc = 29 + getStringLen(29)+1 + 1;
for (int i = 0; i< getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc++;
@ -520,25 +566,23 @@ namespace MP4{
tempLoc+=getStringLen(tempLoc)+1;//MetaData
int countLoc = tempLoc;
tempLoc++;//skip segmentRuntableCount
for (int i = 0; i < no; i++){
if (i < getSegmentRunTableCount()){
////Rewritten Tot Hier
tempLoc += Box(data+8+tempLoc,false).boxedSize();
} else {
if(!reserve(tempLoc, 0, 8 * (no - getSegmentRunTableCount()))){return;};
for( int j = 0; j < (no - getSegmentRunTableCount())*8; j += 8 ) {
setInt32(8,tempLoc+j);
}
tempLoc += (no - getSegmentRunTableCount() ) * 8;
setInt8(no, countLoc);//set new serverEntryCount
break;
//attempt to reach the wanted position
int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){tempLoc += getBoxLen(tempLoc);}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getInt8(countLoc)){
int amount = no+1-getInt8(countLoc);
if(!reserve(payloadOffset+tempLoc, 0, amount*8)){return;};
//set empty erro boxes as contents
for (int j = 0; j < amount; ++j){
memcpy(data+payloadOffset+tempLoc+j*8, "\000\000\000\010erro", 8);
}
setInt8(no+1, countLoc);//set new count
tempLoc += (no-i)*8;
}
Box oldSegment = Box(data+8+tempLoc,false);
if(!reserve(tempLoc,oldSegment.boxedSize(),newSegment.boxedSize())){return;}
memcpy( data+8+tempLoc, newSegment.asBox(), newSegment.boxedSize() );
//now, tempLoc is at position for string number no, and we have at least an erro box reserved.
setBox(newSegment, tempLoc);
}
ASRT & ABST::getSegmentRunTable( long no ) {
@ -547,115 +591,83 @@ namespace MP4{
static Box res;
return (ASRT&)res;
}
long offset = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset++;
for( int i = 0; i< getQualityEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset+=getStringLen(offset)+1;//DrmData
offset+=getStringLen(offset)+1;//MetaData
int countLoc = offset;
int tempLoc = countLoc + 1;//segmentRuntableCount
for (int i = 0; i < no; i++){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
}
result = Box(data+8+tempLoc,false);
return (ASRT&)result;
long tempLoc = 29 + getStringLen(29)+1 + 1;
for (int i = 0; i< getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc++;
for (int i = 0; i< getQualityEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc+=getStringLen(tempLoc)+1;//DrmData
tempLoc+=getStringLen(tempLoc)+1;//MetaData
int countLoc = tempLoc;
tempLoc++;//segmentRuntableCount
for (int i = 0; i < no; ++i){tempLoc += getBoxLen(tempLoc);}
return (ASRT&)getBox(tempLoc);
}
long ABST::getFragmentRunTableCount() {
long offset = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset++;
for( int i = 0; i< getQualityEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset+=getStringLen(offset)+1;//DrmData
offset+=getStringLen(offset)+1;//MetaData
int countLoc = offset;
int tempLoc = countLoc + 1;//segmentRuntableCount
for (int i = 0; i < getSegmentRunTableCount(); i++){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
}
long tempLoc = 29 + getStringLen(29)+1 + 1;
for (int i = 0; i< getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc++;
for (int i = 0; i< getQualityEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc+=getStringLen(tempLoc)+1;//DrmData
tempLoc+=getStringLen(tempLoc)+1;//MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){tempLoc += getBoxLen(tempLoc);}
return getInt8( tempLoc );
}
void ABST::setFragmentRunTable( AFRT newFragment, long no ) {
long offset = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset++;
for( int i = 0; i< getQualityEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset+=getStringLen(offset)+1;//DrmData
offset+=getStringLen(offset)+1;//MetaData
int tempLoc = offset + 1;//segmentRuntableCount
for (int i = 0; i < getSegmentRunTableCount(); i++ ) {
tempLoc += Box(data+8+tempLoc,false).boxedSize();//walk through all segments
}
void ABST::setFragmentRunTable( AFRT & newFragment, long no ) {
long tempLoc = 29 + getStringLen(29)+1 + 1;
for (int i = 0; i< getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc++;
for (int i = 0; i< getQualityEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc+=getStringLen(tempLoc)+1;//DrmData
tempLoc+=getStringLen(tempLoc)+1;//MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){tempLoc += getBoxLen(tempLoc);}
int countLoc = tempLoc;
tempLoc += 1;
for (int i = 0; i < no; i++){
if (i < getFragmentRunTableCount()){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
} else {
if(!reserve(tempLoc, 0, 8 * (no - getFragmentRunTableCount()))){return;};
for( int j = 0; j < (no - getFragmentRunTableCount())*8; j += 8 ) {
setInt32(8,tempLoc+j);
}
tempLoc += (no - getFragmentRunTableCount() ) * 8;
setInt8(no, countLoc);//set new serverEntryCount
break;
tempLoc++;
//attempt to reach the wanted position
int i;
for (i = 0; i < getInt8(countLoc) && i < no; ++i){tempLoc += getBoxLen(tempLoc);}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getInt8(countLoc)){
int amount = no+1-getInt8(countLoc);
if(!reserve(payloadOffset+tempLoc, 0, amount*8)){return;};
//set empty erro boxes as contents
for (int j = 0; j < amount; ++j){
memcpy(data+payloadOffset+tempLoc+j*8, "\000\000\000\010erro", 8);
}
setInt8(no+1, countLoc);//set new count
tempLoc += (no-i)*8;
}
Box oldFragment = Box(data+8+tempLoc,false);
if(!reserve(tempLoc,oldFragment.boxedSize(),newFragment.boxedSize())){return;}
memcpy( data+8+tempLoc, newFragment.asBox(), newFragment.boxedSize() );
//now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
setBox(newFragment, tempLoc);
}
AFRT & ABST::getFragmentRunTable( long no ) {
static Box result;
if( no > getFragmentRunTableCount() ) {
if (no >= getFragmentRunTableCount()){
static Box res;
return (AFRT&)res;
}
long offset = 29 + getStringLen(29)+1 + 1;
for( int i = 0; i< getServerEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset++;
for( int i = 0; i< getQualityEntryCount(); i++ ) {
offset += getStringLen(offset)+1;
}
offset+=getStringLen(offset)+1;//DrmData
offset+=getStringLen(offset)+1;//MetaData
int countLoc = offset;
int tempLoc = countLoc + 1;//segmentRuntableCount
for (int i = 0; i < getSegmentRunTableCount(); i++){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
}
tempLoc ++;//segmentRuntableCount
for (int i = 0; i < no; i++){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
}
result = Box(data+8+tempLoc,false);
return (AFRT&)result;
long tempLoc = 29 + getStringLen(29)+1 + 1;
for (int i = 0; i< getServerEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc++;
for (int i = 0; i< getQualityEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
tempLoc+=getStringLen(tempLoc)+1;//DrmData
tempLoc+=getStringLen(tempLoc)+1;//MetaData
for (int i = getInt8(tempLoc++); i != 0; --i){tempLoc += getBoxLen(tempLoc);}
int countLoc = tempLoc;
tempLoc++;
for (int i = 0; i < no; i++){tempLoc += getBoxLen(tempLoc);}
return (AFRT&)getBox(tempLoc);
}
std::string ABST::toPrettyString( long indent ) {
std::stringstream r;
r << std::string(indent, ' ') << "[abst] Bootstrap Info" << std::endl;
r << std::string(indent+1, ' ') << "Version " << getVersion() << std::endl;
r << std::string(indent, ' ') << "[abst] Bootstrap Info (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << (int)getVersion() << std::endl;
r << std::string(indent+1, ' ') << "BootstrapinfoVersion " << getBootstrapinfoVersion() << std::endl;
r << std::string(indent+1, ' ') << "Profile " << getProfile() << std::endl;
r << std::string(indent+1, ' ') << "Profile " << (int)getProfile() << std::endl;
if( getLive() ) {
r << std::string(indent+1, ' ' ) << "Live" << std::endl;
}else{
@ -672,11 +684,11 @@ namespace MP4{
r << std::string(indent+1, ' ') << "MovieIdentifier " << getMovieIdentifier() << std::endl;
r << std::string(indent+1, ' ') << "ServerEntryTable (" << getServerEntryCount() << ")" << std::endl;
for( int i = 0; i < getServerEntryCount(); i++ ) {
r << std::string(indent+2, ' ') << getServerEntry(i) << std::endl;
r << std::string(indent+2, ' ') << i << ": " << getServerEntry(i) << std::endl;
}
r << std::string(indent+1, ' ') << "QualityEntryTable (" << getQualityEntryCount() << ")" << std::endl;
for( int i = 0; i < getQualityEntryCount(); i++ ) {
r << std::string(indent+2, ' ') << getQualityEntry(i) << std::endl;
r << std::string(indent+2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent+1, ' ') << "DrmData " << getDrmData() << std::endl;
r << std::string(indent+1, ' ') << "MetaData " << getMetaData() << std::endl;
@ -693,11 +705,9 @@ namespace MP4{
AFRT::AFRT(){
memcpy(data + 4, "afrt", 4);
setVersion( 0 );
setUpdate( 0 );
setTimeScale( 1000 );
setInt8(0,9);
setInt32(0,10);
setVersion(0);
setUpdate(0);
setTimeScale(1000);
}
void AFRT::setVersion(char newVersion){setInt8(newVersion, 0);}
@ -717,22 +727,26 @@ namespace MP4{
void AFRT::setQualityEntry(std::string & newEntry, long no){
int countLoc = 8;
int tempLoc = countLoc+1;
for (int i = 0; i < no; i++){
if (i < getQualityEntryCount()){
tempLoc += getStringLen(tempLoc)+1;
} else {
if(!reserve(tempLoc, 0, no - getQualityEntryCount())){return;};
memset(data+tempLoc, 0, no - getQualityEntryCount());
tempLoc += no - getQualityEntryCount();
setInt8(no, countLoc);//set new qualityEntryCount
break;
}
//attempt to reach the wanted position
int i;
for (i = 0; i < getQualityEntryCount() && i < no; ++i){
tempLoc += getStringLen(tempLoc)+1;
}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getQualityEntryCount()){
int amount = no+1-getQualityEntryCount();
if(!reserve(payloadOffset+tempLoc, 0, amount)){return;};
memset(data+payloadOffset+tempLoc, 0, amount);
setInt8(no+1, countLoc);//set new qualityEntryCount
tempLoc += no-i;
}
//now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
setString(newEntry, tempLoc);
}
const char* AFRT::getQualityEntry(long no){
if (no > getQualityEntryCount()){return "";}
if (no+1 > getQualityEntryCount()){return "";}
int tempLoc = 9;//position of first quality entry
for (int i = 0; i < no; i++){tempLoc += getStringLen(tempLoc)+1;}
return getString(tempLoc);
@ -740,34 +754,27 @@ namespace MP4{
long AFRT::getFragmentRunCount(){
int tempLoc = 9;
for( int i = 0; i < getQualityEntryCount(); i++ ){
tempLoc += getStringLen(tempLoc)+1;
}
for (int i = 0; i < getQualityEntryCount(); ++i){tempLoc += getStringLen(tempLoc)+1;}
return getInt32(tempLoc);
}
void AFRT::setFragmentRun( afrt_runtable newRun, long no ) {
int tempLoc = 9;
for( int i = 0; i < getQualityEntryCount(); i++ ){
for (int i = 0; i < getQualityEntryCount(); ++i){
tempLoc += getStringLen(tempLoc)+1;
}
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){
if (i < getFragmentRunCount()){
tempLoc += 17;
} else {
if(!reserve(tempLoc, 0, 17 * (no - getQualityEntryCount()))){return;};
memset(data+tempLoc, 0, 17 * (no - getQualityEntryCount()));
tempLoc += 17 * ((no-1) - getQualityEntryCount());
setInt32((no+1), countLoc);//set new qualityEntryCount
break;
}
if (getInt32(tempLoc+12) == 0){tempLoc += 17;}else{tempLoc += 16;}
}
setInt32(newRun.firstFragment,tempLoc);
setInt64(newRun.firstTimestamp,tempLoc+4);
setInt32(newRun.duration,tempLoc+12);
setInt8(newRun.discontinuity,tempLoc+16);
if (newRun.duration == 0){
setInt8(newRun.discontinuity,tempLoc+16);
}
if (getInt32(countLoc) < no+1){setInt32(no+1, countLoc);}
}
afrt_runtable AFRT::getFragmentRun( long no ) {
@ -780,8 +787,7 @@ namespace MP4{
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){
if (getInt32(tempLoc+12) == 0 ) { tempLoc++;}
tempLoc += 16;
if (getInt32(tempLoc+12) == 0){tempLoc += 17;}else{tempLoc += 16;}
}
res.firstFragment = getInt32(tempLoc);
res.firstTimestamp = getInt64(tempLoc+4);
@ -796,7 +802,8 @@ namespace MP4{
std::string AFRT::toPrettyString(int indent){
std::stringstream r;
r << std::string(indent, ' ') << "[afrt] Fragment Run Table" << std::endl;
r << std::string(indent, ' ') << "[afrt] Fragment Run Table (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << (int)getVersion() << std::endl;
if (getUpdate()){
r << std::string(indent+1, ' ') << "Update" << std::endl;
}else{
@ -805,15 +812,16 @@ namespace MP4{
r << std::string(indent+1, ' ') << "Timescale " << getTimeScale() << std::endl;
r << std::string(indent+1, ' ') << "QualitySegmentUrlModifiers (" << getQualityEntryCount() << ")" << std::endl;
for( int i = 0; i < getQualityEntryCount(); i++ ) {
r << std::string(indent+2, ' ') << getQualityEntry(i) << std::endl;
r << std::string(indent+2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent+1, ' ') << "FragmentRunEntryTable (" << getFragmentRunCount() << ")" << std::endl;
for( int i = 0; i < getFragmentRunCount(); i ++ ) {
afrt_runtable myRun = getFragmentRun(i);
r << std::string(indent+2, ' ') << "First Fragment " << myRun.firstFragment << std::endl;
r << std::string(indent+2, ' ') << "First Timestamp " << myRun.firstTimestamp << std::endl;
r << std::string(indent+2, ' ') << "Duration " << myRun.duration << std::endl;
r << std::string(indent+2, ' ') << "Discontinuity " << myRun.discontinuity << std::endl;
if (myRun.duration){
r << std::string(indent+2, ' ') << i << ": " << myRun.firstFragment << " is at " << ((double)myRun.firstTimestamp / (double)getTimeScale()) << "s, " << ((double)myRun.duration / (double)getTimeScale()) << "s per fragment." << std::endl;
}else{
r << std::string(indent+2, ' ') << i << ": " << myRun.firstFragment << " is at " << ((double)myRun.firstTimestamp / (double)getTimeScale()) << "s, discontinuity type " << myRun.discontinuity << std::endl;
}
}
return r.str();
}
@ -843,17 +851,21 @@ namespace MP4{
void ASRT::setQualityEntry(std::string & newEntry, long no){
int countLoc = 4;
int tempLoc = countLoc+1;
for (int i = 0; i < no; i++){
if (i < getQualityEntryCount()){
tempLoc += getStringLen(tempLoc)+1;
} else {
if(!reserve(tempLoc, 0, no - getQualityEntryCount())){return;};
memset(data+tempLoc, 0, no - getQualityEntryCount());
tempLoc += no - getQualityEntryCount();
setInt8(no, countLoc);//set new qualityEntryCount
break;
}
//attempt to reach the wanted position
int i;
for (i = 0; i < getQualityEntryCount() && i < no; ++i){
tempLoc += getStringLen(tempLoc)+1;
}
//we are now either at the end, or at the right position
//let's reserve any unreserved space...
if (no+1 > getQualityEntryCount()){
int amount = no+1-getQualityEntryCount();
if(!reserve(payloadOffset+tempLoc, 0, amount)){return;};
memset(data+payloadOffset+tempLoc, 0, amount);
setInt8(no+1, countLoc);//set new qualityEntryCount
tempLoc += no-i;
}
//now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
setString(newEntry, tempLoc);
}
@ -874,17 +886,9 @@ namespace MP4{
int tempLoc = 5;//position of qualityentry count;
for (int i = 0; i < getQualityEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){
if (i < getSegmentRunEntryCount()){
tempLoc += 8;
} else {
if(!reserve(tempLoc, 0, (no - getSegmentRunEntryCount())*8)){return;};
memset(data+tempLoc, 0, (no - getSegmentRunEntryCount())*8);
tempLoc += (no - getSegmentRunEntryCount())*8;
setInt32(no, countLoc);//set new qualityEntryCount
break;
}
tempLoc += 4 + no*8;
if (no+1 < getSegmentRunEntryCount()){
setInt32(no+1, countLoc);//set new qualityEntryCount
}
setInt32(firstSegment,tempLoc);
setInt32(fragmentsPerSegment,tempLoc+4);
@ -892,12 +896,11 @@ namespace MP4{
asrt_runtable ASRT::getSegmentRun( long no ) {
asrt_runtable res;
if( no > getSegmentRunEntryCount() ) { return res; }
if (no >= getSegmentRunEntryCount()){return res;}
int tempLoc = 5;//position of qualityentry count;
for (int i = 0; i < getSegmentRunEntryCount(); i++){tempLoc += getStringLen(tempLoc)+1;}
for (int i = 0; i < getQualityEntryCount(); ++i){tempLoc += getStringLen(tempLoc)+1;}
int countLoc = tempLoc;
tempLoc += 4;
for (int i = 0; i < no; i++){tempLoc += 8;}
tempLoc += 4 + 8*no;
res.firstSegment = getInt32(tempLoc);
res.fragmentsPerSegment = getInt32(tempLoc+4);
return res;
@ -905,7 +908,7 @@ namespace MP4{
std::string ASRT::toPrettyString(int indent){
std::stringstream r;
r << std::string(indent, ' ') << "[asrt] Segment Run Table" << std::endl;
r << std::string(indent, ' ') << "[asrt] Segment Run Table (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << getVersion() << std::endl;
if (getUpdate()){
r << std::string(indent+1, ' ') << "Update" << std::endl;
@ -914,12 +917,11 @@ namespace MP4{
}
r << std::string(indent+1, ' ') << "QualityEntryTable (" << getQualityEntryCount() << ")" << std::endl;
for( int i = 0; i < getQualityEntryCount(); i++ ) {
r << std::string(indent+2, ' ') << getQualityEntry(i) << std::endl;
r << std::string(indent+2, ' ') << i << ": " << getQualityEntry(i) << std::endl;
}
r << std::string(indent+1, ' ') << "SegmentRunEntryTable (" << getSegmentRunEntryCount()<< ")" << std::endl;
for( int i = 0; i < getSegmentRunEntryCount(); i ++ ) {
r << std::string(indent+2, ' ') << "FirstSegment " << getSegmentRun(i).firstSegment << std::endl;
r << std::string(indent+2, ' ') << "FragmentsPerSegment " << getSegmentRun(i).fragmentsPerSegment << std::endl;
r << std::string(indent+2, ' ') << i << ": First=" << getSegmentRun(i).firstSegment << ", FragmentsPerSegment=" << getSegmentRun(i).fragmentsPerSegment << std::endl;
}
return r.str();
}
@ -935,7 +937,7 @@ namespace MP4{
std::string MFHD::toPrettyString( int indent ) {
std::stringstream r;
r << std::string(indent, ' ') << "[mfhd] Movie Fragment Header" << std::endl;
r << std::string(indent, ' ') << "[mfhd] Movie Fragment Header (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "SequenceNumber " << getSequenceNumber() << std::endl;
return r.str();
}
@ -947,19 +949,19 @@ namespace MP4{
long MOOF::getContentCount() {
int res = 0;
int tempLoc = 0;
while( tempLoc < boxedSize()-8 ){
res ++;
tempLoc += Box(data+8+tempLoc, false).boxedSize();
while (tempLoc < boxedSize()-8){
res++;
tempLoc += getBoxLen(tempLoc);
}
return res;
}
void MOOF::setContent( Box newContent, long no ) {
void MOOF::setContent(Box & newContent, long no){
int tempLoc = 0;
int contentCount = getContentCount();
for (int i = 0; i < no; i++){
if (i < contentCount){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
tempLoc += getBoxLen(tempLoc);
} else {
if(!reserve(tempLoc, 0, (no - contentCount)*8)){return;};
memset(data+tempLoc, 0, (no - contentCount)*8);
@ -967,32 +969,31 @@ namespace MP4{
break;
}
}
Box oldContent = Box( data+8+tempLoc, false );
if( !reserve( tempLoc, oldContent.boxedSize(), newContent.boxedSize() ) ) { return; }
memcpy( data+8+tempLoc, newContent.asBox(), newContent.boxedSize() );
setBox(newContent, tempLoc);
}
Box MOOF::getContent( long no ){
if( no > getContentCount() ) { return Box(); }
Box & MOOF::getContent(long no){
static Box ret = Box((char*)"\000\000\000\010erro", false);
if (no > getContentCount()){return ret;}
int i = 0;
int tempLoc = 0;
while( i < no ) {
tempLoc += Box( data+8+tempLoc, false).boxedSize();
while (i < no){
tempLoc += getBoxLen(tempLoc);
i++;
}
return Box(data+8+tempLoc, false);
return getBox(tempLoc);
}
std::string MOOF::toPrettyString( int indent ) {
std::stringstream r;
r << std::string(indent, ' ') << "[moof] Movie Fragment Box" << std::endl;
r << std::string(indent, ' ') << "[moof] Movie Fragment Box (" << boxedSize() << ")" << std::endl;
Box curBox;
int tempLoc = 0;
int contentCount = getContentCount();
for( int i = 0; i < contentCount; i++ ) {
curBox = getContent(i);
r << curBox.toPrettyString(indent+1);
tempLoc += curBox.boxedSize();
tempLoc += getBoxLen(tempLoc);
}
return r.str();
}
@ -1004,19 +1005,19 @@ namespace MP4{
long TRAF::getContentCount() {
int res = 0;
int tempLoc = 0;
while( tempLoc < boxedSize()-8 ){
res ++;
tempLoc += Box(data+8+tempLoc, false).boxedSize();
while (tempLoc < boxedSize()-8){
res++;
tempLoc += getBoxLen(tempLoc);
}
return res;
}
void TRAF::setContent( Box newContent, long no ) {
void TRAF::setContent(Box & newContent, long no){
int tempLoc = 0;
int contentCount = getContentCount();
for (int i = 0; i < no; i++){
if (i < contentCount){
tempLoc += Box(data+8+tempLoc,false).boxedSize();
tempLoc += getBoxLen(tempLoc);
} else {
if(!reserve(tempLoc, 0, (no - contentCount)*8)){return;};
memset(data+tempLoc, 0, (no - contentCount)*8);
@ -1024,25 +1025,24 @@ namespace MP4{
break;
}
}
Box oldContent = Box( data+8+tempLoc, false );
if( !reserve( tempLoc, oldContent.boxedSize(), newContent.boxedSize() ) ) { return; }
memcpy( data+8+tempLoc, newContent.asBox(), newContent.boxedSize() );
setBox(newContent, tempLoc);
}
Box TRAF::getContent( long no ){
if( no > getContentCount() ) { return Box(); }
Box & TRAF::getContent( long no ){
static Box ret = Box((char*)"\000\000\000\010erro", false);
if (no > getContentCount()){return ret;}
int i = 0;
int tempLoc = 0;
while( i < no ) {
tempLoc += Box( data+8+tempLoc, false).boxedSize();
while (i < no){
tempLoc += getBoxLen(tempLoc);
i++;
}
return Box(data+8+tempLoc, false);
return getBox(tempLoc);
}
std::string TRAF::toPrettyString( int indent ) {
std::stringstream r;
r << std::string(indent, ' ') << "[traf] Track Fragment Box" << std::endl;
r << std::string(indent, ' ') << "[traf] Track Fragment Box (" << boxedSize() << ")" << std::endl;
Box curBox;
int tempLoc = 0;
int contentCount = getContentCount();
@ -1175,8 +1175,8 @@ namespace MP4{
std::string TRUN::toPrettyString(long indent){
std::stringstream r;
r << std::string(indent, ' ') << "[trun] Track Fragment Run" << std::endl;
r << std::string(indent+1, ' ') << "Version " << getInt8(0) << std::endl;
r << std::string(indent, ' ') << "[trun] Track Fragment Run (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << (int)getInt8(0) << std::endl;
long flags = getFlags();
r << std::string(indent+1, ' ') << "Flags";
@ -1328,8 +1328,8 @@ namespace MP4{
std::string TFHD::toPrettyString(long indent){
std::stringstream r;
r << std::string(indent, ' ') << "[tfhd] Track Fragment Header" << std::endl;
r << std::string(indent+1, ' ') << "Version " << getInt8(0) << std::endl;
r << std::string(indent, ' ') << "[tfhd] Track Fragment Header (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << (int)getInt8(0) << std::endl;
long flags = getFlags();
r << std::string(indent+1, ' ') << "Flags";
@ -1508,7 +1508,7 @@ namespace MP4{
std::string AFRA::toPrettyString(long indent){
std::stringstream r;
r << std::string(indent, ' ') << "[afra] Fragment Random Access" << std::endl;
r << std::string(indent, ' ') << "[afra] Fragment Random Access (" << boxedSize() << ")" << std::endl;
r << std::string(indent+1, ' ') << "Version " << getVersion() << std::endl;
r << std::string(indent+1, ' ') << "Flags " << getFlags() << std::endl;
r << std::string(indent+1, ' ') << "Long IDs " << getLongIDs() << std::endl;

View file

@ -42,7 +42,9 @@ namespace MP4{
char * getString(size_t index);
size_t getStringLen(size_t index);
//box functions
Box getBox(size_t index);
Box & getBox(size_t index);
size_t getBoxLen(size_t index);
void setBox(Box & newEntry, size_t index);
//data functions
bool reserve(size_t position, size_t current, size_t wanted);
//internal variables
@ -135,10 +137,10 @@ namespace MP4{
void setMetaData(std::string newMetaData);
char * getMetaData();
long getSegmentRunTableCount();
void setSegmentRunTable(ASRT table, long no);
void setSegmentRunTable(ASRT & table, long no);
ASRT & getSegmentRunTable(long no);
long getFragmentRunTableCount();
void setFragmentRunTable(AFRT table, long no);
void setFragmentRunTable(AFRT & table, long no);
AFRT & getFragmentRunTable(long no);
std::string toPrettyString(long indent = 0);
};//ABST Box
@ -155,8 +157,8 @@ namespace MP4{
public:
MOOF();
long getContentCount();
void setContent( Box newContent, long no );
Box getContent( long no );
void setContent(Box & newContent, long no);
Box & getContent(long no);
std::string toPrettyString(int indent = 0);
};//MOOF Box
@ -164,8 +166,8 @@ namespace MP4{
public:
TRAF();
long getContentCount();
void setContent( Box newContent, long no );
Box getContent( long no );
void setContent(Box & newContent, long no);
Box & getContent(long no);
std::string toPrettyString(int indent = 0);
};//TRAF Box

335
test/abst_test.cpp Normal file
View file

@ -0,0 +1,335 @@
/// \file abst_test.cpp
/// Tests the bootstrap generation functions by comparing to a known good bootstrap.
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
#include <mist/mp4.h>
/// This is a known good bootstrap retrieved from a wowza demo server.
unsigned char __data[] = {
0x00, 0x00, 0x0c, 0xce, 0x61, 0x62, 0x73, 0x74, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0xe8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x09, 0x19, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1a, 0x61, 0x73, 0x72, 0x74, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc7, 0x01,
0x00, 0x00, 0x0c, 0x86, 0x61, 0x66, 0x72, 0x74, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x17, 0x70, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x28, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2e, 0xe0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x50, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x52, 0x08, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5d, 0xc0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x78, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x75, 0x30, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xe8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0xa0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x98, 0x58, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa4, 0x10, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0xc8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xbb, 0x80, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc7, 0x38, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0xf0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xde, 0xa8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xea, 0x60, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x18, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0xd0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x0d, 0x88, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x19, 0x40, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x24, 0xf8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x30, 0xb0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x68, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x48, 0x20, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x53, 0xd8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x5f, 0x90, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x6b, 0x48, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x77, 0x00, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x82, 0xb8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x8e, 0x70, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x9a, 0x28, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xa5, 0xe0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xb1, 0x98, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xbd, 0x50, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc9, 0x08, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xd4, 0xc0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xe0, 0x78, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xec, 0x30, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xf7, 0xe8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x03, 0xa0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0f, 0x58, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x1b, 0x10, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x26, 0xc8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x32, 0x80, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x3e, 0x38, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x49, 0xf0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x55, 0xa8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x61, 0x60, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x6d, 0x18, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x78, 0xd0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x84, 0x88, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x90, 0x40, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x9b, 0xf8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0xa7, 0xb0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xb3, 0x68, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xbf, 0x20, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0xca, 0xd8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xd6, 0x90, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe2, 0x48, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0xee, 0x00, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xf9, 0xb8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x70, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x11, 0x28, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x1c, 0xe0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x28, 0x98, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x34, 0x50, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x40, 0x08, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4b, 0xc0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x57, 0x78, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x63, 0x30, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x6e, 0xe8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x7a, 0xa0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x86, 0x58, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x92, 0x10, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x9d, 0xc8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xa9, 0x80, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xb5, 0x38, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xc0, 0xf0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xcc, 0xa8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x60, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0xe4, 0x18, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xef, 0xd0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x88, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x07, 0x40, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x12, 0xf8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1e, 0xb0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x2a, 0x68, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x36, 0x20, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41, 0xd8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x4d, 0x90, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x59, 0x48, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x65, 0x00, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x70, 0xb8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x7c, 0x70, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x88, 0x28, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x93, 0xe0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x9f, 0x98, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xab, 0x50, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0xb7, 0x08, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0xc2, 0xc0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xce, 0x78, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0xda, 0x30, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0xe5, 0xe8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf1, 0xa0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0xfd, 0x58, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x09, 0x10, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x14, 0xc8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x20, 0x80, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x2c, 0x38, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x37, 0xf0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x43, 0xa8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x4f, 0x60, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x5b, 0x18, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x66, 0xd0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x72, 0x88, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x7e, 0x40, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x89, 0xf8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x95, 0xb0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xa1, 0x68, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0xad, 0x20, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0xb8, 0xd8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xc4, 0x90, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0xd0, 0x48, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0xdc, 0x00, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xe7, 0xb8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0xf3, 0x70, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0xff, 0x28, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0a, 0xe0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x16, 0x98, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x22, 0x50, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x2e, 0x08, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x39, 0xc0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x45, 0x78, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x51, 0x30, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x5c, 0xe8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x68, 0xa0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0x58, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x80, 0x10, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x8b, 0xc8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x97, 0x80, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0xa3, 0x38, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0xae, 0xf0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xba, 0xa8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0xc6, 0x60, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0xd2, 0x18, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xdd, 0xd0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0xe9, 0x88, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0xf5, 0x40, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xf8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x0c, 0xb0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x18, 0x68, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x24, 0x20, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x2f, 0xd8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x3b, 0x90, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0x48, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x53, 0x00, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x5e, 0xb8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x6a, 0x70, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x76, 0x28, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x81, 0xe0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x8d, 0x98, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x99, 0x50, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xa5, 0x08, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xb0, 0xc0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0xbc, 0x78, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xc8, 0x30, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xd3, 0xe8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0xdf, 0xa0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xeb, 0x58, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf7, 0x10, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x02, 0xc8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x0e, 0x80, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1a, 0x38, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x25, 0xf0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x31, 0xa8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3d, 0x60, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x49, 0x18, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x54, 0xd0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x60, 0x88, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x6c, 0x40, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x77, 0xf8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x83, 0xb0, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x8f, 0x68, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x9b, 0x20, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa6, 0xd8, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0xb2, 0x90, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0xbe, 0x48, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xca, 0x00, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0xd5, 0xb8, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0xe1, 0x70, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xed, 0x28, 0x00, 0x00,
0x0b, 0xb8, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0xf8, 0xe0, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0x04, 0x98, 0x00, 0x00, 0x0b, 0xb8, 0x00, 0x00,
0x00, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x10, 0x50, 0x00, 0x00,
0x09, 0x9a
};
unsigned int __data_len = 3278;
/// Generates a bootstrap equal to the above file, then compares.
/// \returns Zero if they are equal (test success), other values otherwise.
int main(int argc, char ** argv) {
std::string temp;
MP4::ASRT asrt;
asrt.setVersion(1);
asrt.setQualityEntry(temp, 0);
asrt.setSegmentRun(1, 199, 0);
MP4::AFRT afrt;
afrt.setVersion(1);
afrt.setTimeScale(1000);
afrt.setQualityEntry(temp, 0);
MP4::afrt_runtable afrtrun;
for (int i = 0; i < 198; i++){
afrtrun.firstFragment = i+1;
afrtrun.firstTimestamp = 3000*i;
afrtrun.duration = 3000;
afrt.setFragmentRun(afrtrun, i);
}
afrtrun.firstFragment = 199;
afrtrun.firstTimestamp = 594000;
afrtrun.duration = 2458;
afrt.setFragmentRun(afrtrun, 198);
MP4::ABST abst;
abst.setVersion(1);
abst.setBootstrapinfoVersion(1);
abst.setProfile(0);
abst.setLive(false);
abst.setUpdate(false);
abst.setTimeScale(1000);
abst.setCurrentMediaTime(596458);
abst.setSmpteTimeCodeOffset(0);
abst.setMovieIdentifier(temp);
abst.setServerEntry(temp, 0);
abst.setQualityEntry(temp, 0);
abst.setDrmData(temp);
abst.setMetaData(temp);
abst.setSegmentRunTable(asrt, 0);
abst.setFragmentRunTable(afrt, 0);
if (abst.boxedSize() != __data_len){return 42;}
return memcmp(abst.asBox(), __data, __data_len) << std::endl;
}