@@ -599,6 +599,7 @@ static void convertTimeToDate(int64_t time_1904, String8 *s) {
599599}
600600
601601status_t MPEG4Extractor::parseChunk (off64_t *offset, int depth) {
602+ ALOGV (" entering parseChunk %lld/%d" , *offset, depth);
602603 uint32_t hdr[2 ];
603604 if (mDataSource ->readAt (*offset, hdr, 8 ) < 8 ) {
604605 return ERROR_IO;
@@ -625,6 +626,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
625626
626627 char chunk[5 ];
627628 MakeFourCCString (chunk_type, chunk);
629+ ALOGV (" chunk: %s @ %lld" , chunk, *offset);
628630
629631#if 0
630632 static const char kWhitespace[] = " ";
@@ -1302,6 +1304,8 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
13021304 break ;
13031305 }
13041306
1307+ case FOURCC (' m' , ' e' , ' a' , ' n' ):
1308+ case FOURCC (' n' , ' a' , ' m' , ' e' ):
13051309 case FOURCC (' d' , ' a' , ' t' , ' a' ):
13061310 {
13071311 if (mPath .size () == 6 && underMetaDataPath (mPath )) {
@@ -1437,6 +1441,15 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
14371441 break ;
14381442 }
14391443
1444+ case FOURCC (' -' , ' -' , ' -' , ' -' ):
1445+ {
1446+ mLastCommentMean .clear ();
1447+ mLastCommentName .clear ();
1448+ mLastCommentData .clear ();
1449+ *offset += chunk_size;
1450+ break ;
1451+ }
1452+
14401453 default :
14411454 {
14421455 *offset += chunk_size;
@@ -1553,6 +1566,9 @@ status_t MPEG4Extractor::parseMetaData(off64_t offset, size_t size) {
15531566 uint32_t flags = U32_AT (buffer);
15541567
15551568 uint32_t metadataKey = 0 ;
1569+ char chunk[5 ];
1570+ MakeFourCCString (mPath [4 ], chunk);
1571+ ALOGV (" meta: %s @ %lld" , chunk, offset);
15561572 switch (mPath [4 ]) {
15571573 case FOURCC (0xa9 , ' a' , ' l' , ' b' ):
15581574 {
@@ -1632,6 +1648,35 @@ status_t MPEG4Extractor::parseMetaData(off64_t offset, size_t size) {
16321648 }
16331649 break ;
16341650 }
1651+ case FOURCC (' -' , ' -' , ' -' , ' -' ):
1652+ {
1653+ buffer[size] = ' \0 ' ;
1654+ switch (mPath [5 ]) {
1655+ case FOURCC (' m' , ' e' , ' a' , ' n' ):
1656+ mLastCommentMean .setTo ((const char *)buffer + 4 );
1657+ break ;
1658+ case FOURCC (' n' , ' a' , ' m' , ' e' ):
1659+ mLastCommentName .setTo ((const char *)buffer + 4 );
1660+ break ;
1661+ case FOURCC (' d' , ' a' , ' t' , ' a' ):
1662+ mLastCommentData .setTo ((const char *)buffer + 8 );
1663+ break ;
1664+ }
1665+ if (mLastCommentMean == " com.apple.iTunes"
1666+ && mLastCommentName == " iTunSMPB"
1667+ && mLastCommentData .length () != 0 ) {
1668+ int32_t delay, padding;
1669+ if (sscanf (mLastCommentData ,
1670+ " %*x %x %x %*x" , &delay, &padding) == 2 ) {
1671+ mLastTrack ->meta ->setInt32 (kKeyEncoderDelay , delay);
1672+ mLastTrack ->meta ->setInt32 (kKeyEncoderPadding , padding);
1673+ }
1674+ mLastCommentMean .clear ();
1675+ mLastCommentName .clear ();
1676+ mLastCommentData .clear ();
1677+ }
1678+ break ;
1679+ }
16351680
16361681 default :
16371682 break ;
0 commit comments