summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/MPEG4Extractor.cpp')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp85
1 files changed, 78 insertions, 7 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index dc8e4a3..488c2a3 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -40,6 +40,9 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
#include <utils/String8.h>
+#ifdef QCOM_HARDWARE
+#include <QCMediaDefs.h>
+#endif
namespace android {
@@ -240,6 +243,9 @@ static const char *FourCC2MIME(uint32_t fourcc) {
case FOURCC('m', 'p', '4', 'a'):
return MEDIA_MIMETYPE_AUDIO_AAC;
+ case FOURCC('.', 'm', 'p', '3'):
+ return MEDIA_MIMETYPE_AUDIO_MPEG;
+
case FOURCC('s', 'a', 'm', 'r'):
return MEDIA_MIMETYPE_AUDIO_AMR_NB;
@@ -257,6 +263,28 @@ static const char *FourCC2MIME(uint32_t fourcc) {
case FOURCC('a', 'v', 'c', '1'):
return MEDIA_MIMETYPE_VIDEO_AVC;
+#ifdef QCOM_HARDWARE
+ case FOURCC('s', 'q', 'c', 'p'):
+ return MEDIA_MIMETYPE_AUDIO_QCELP;
+
+ case FOURCC('s', 'e', 'v', 'c'):
+ return MEDIA_MIMETYPE_AUDIO_EVRC;
+
+ case FOURCC('d', 't', 's', 'c'):
+ case FOURCC('d', 't', 's', 'h'):
+ case FOURCC('d', 't', 's', 'l'):
+ return MEDIA_MIMETYPE_AUDIO_DTS;
+
+ case FOURCC('d', 't', 's', 'e'):
+ return MEDIA_MIMETYPE_AUDIO_DTS_LBR;
+
+ case FOURCC('a', 'c', '-', '3'):
+ return MEDIA_MIMETYPE_AUDIO_AC3;
+
+ case FOURCC('e', 'c', '-', '3'):
+ return MEDIA_MIMETYPE_AUDIO_EAC3;
+#endif
+
default:
CHECK(!"should not be here.");
return NULL;
@@ -921,6 +949,17 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
case FOURCC('m', 'p', '4', 'a'):
case FOURCC('s', 'a', 'm', 'r'):
case FOURCC('s', 'a', 'w', 'b'):
+#ifdef QCOM_HARDWARE
+ case FOURCC('.', 'm', 'p', '3'):
+ case FOURCC('s', 'e', 'v', 'c'):
+ case FOURCC('s', 'q', 'c', 'p'):
+ case FOURCC('d', 't', 's', 'c'):
+ case FOURCC('d', 't', 's', 'h'):
+ case FOURCC('d', 't', 's', 'l'):
+ case FOURCC('d', 't', 's', 'e'):
+ case FOURCC('a', 'c', '-', '3'):
+ case FOURCC('e', 'c', '-', '3'):
+#endif
{
uint8_t buffer[8 + 20];
if (chunk_data_size < (ssize_t)sizeof(buffer)) {
@@ -961,7 +1000,16 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
mLastTrack->meta->setInt32(kKeySampleRate, sample_rate);
off64_t stop_offset = *offset + chunk_size;
- *offset = data_offset + sizeof(buffer);
+#ifdef QCOM_HARDWARE
+ if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_MPEG, FourCC2MIME(chunk_type)) ||
+ !strcasecmp(MEDIA_MIMETYPE_AUDIO_AMR_WB, FourCC2MIME(chunk_type))) {
+ // ESD is not required in mp3
+ // amr wb with damr atom corrupted can cause the clip to not play
+ *offset = stop_offset;
+ } else
+#endif
+ *offset = data_offset + sizeof(buffer);
+
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
if (err != OK) {
@@ -1219,6 +1267,18 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
break;
}
+#ifdef QCOM_HARDWARE
+ case FOURCC('d', 'd', 't', 's'):
+ case FOURCC('d', 'a', 'c', '3'):
+ case FOURCC('d', 'e', 'c', '3'):
+ {
+ //no information need to be passed here, just log and end
+ ALOGV("ddts/dac3/dec3 pass from mpeg4 extractor");
+ *offset += chunk_size;
+ break;
+ }
+#endif
+
case FOURCC('a', 'v', 'c', 'C'):
{
char buffer[256];
@@ -1799,18 +1859,26 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio(
return ERROR_MALFORMED;
}
+#ifdef QCOM_HARDWARE
+ if (objectTypeIndication == 0xA0) {
+ // This isn't MPEG4 audio at all, it's EVRC
+ mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_EVRC);
+ return OK;
+ }
+#endif
+
if (objectTypeIndication == 0xe1) {
// This isn't MPEG4 audio at all, it's QCELP 14k...
mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_QCELP);
return OK;
}
- if (objectTypeIndication == 0x6b) {
- // The media subtype is MP3 audio
- // Our software MP3 audio decoder may not be able to handle
- // packetized MP3 audio; for now, lets just return ERROR_UNSUPPORTED
- ALOGE("MP3 track in MP4/3GPP file is not supported");
- return ERROR_UNSUPPORTED;
+ if (objectTypeIndication == 0x6b
+ || objectTypeIndication == 0x69) {
+ // This is mpeg1/2 audio content, set mimetype to mpeg
+ mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_MPEG);
+ ALOGD("objectTypeIndication:0x%x, set mimetype to mpeg ",objectTypeIndication);
+ return OK;
}
const uint8_t *csd;
@@ -2313,6 +2381,9 @@ static bool LegacySniffMPEG4(
}
if (!memcmp(header, "ftyp3gp", 7) || !memcmp(header, "ftypmp42", 8)
+#ifdef QCOM_HARDWARE
+ || !memcmp(header, "ftyp3g2a", 8) || !memcmp(header, "ftyp3g2b", 8) || !memcmp(header, "ftyp3g2c", 8)
+#endif
|| !memcmp(header, "ftyp3gr6", 8) || !memcmp(header, "ftyp3gs6", 8)
|| !memcmp(header, "ftyp3ge6", 8) || !memcmp(header, "ftyp3gg6", 8)
|| !memcmp(header, "ftypisom", 8) || !memcmp(header, "ftypM4V ", 8)