diff options
Diffstat (limited to 'media')
7 files changed, 72 insertions, 43 deletions
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp index 23081f8..9fe0266 100755 --- a/media/jni/mediaeditor/VideoEditorMain.cpp +++ b/media/jni/mediaeditor/VideoEditorMain.cpp @@ -1707,12 +1707,19 @@ videoEditor_populateSettings( if (aFramingCtx->FramingYuv != M4OSA_NULL ) { - if (aFramingCtx->FramingYuv->pac_data != M4OSA_NULL) { - M4OSA_free((M4OSA_MemAddr32)aFramingCtx->FramingYuv->pac_data); - aFramingCtx->FramingYuv->pac_data = M4OSA_NULL; + if (aFramingCtx->FramingYuv[0].pac_data != M4OSA_NULL) { + M4OSA_free((M4OSA_MemAddr32)aFramingCtx->FramingYuv[0].pac_data); + aFramingCtx->FramingYuv[0].pac_data = M4OSA_NULL; } - } - if (aFramingCtx->FramingYuv != M4OSA_NULL) { + if (aFramingCtx->FramingYuv[1].pac_data != M4OSA_NULL) { + M4OSA_free((M4OSA_MemAddr32)aFramingCtx->FramingYuv[1].pac_data); + aFramingCtx->FramingYuv[1].pac_data = M4OSA_NULL; + } + if (aFramingCtx->FramingYuv[2].pac_data != M4OSA_NULL) { + M4OSA_free((M4OSA_MemAddr32)aFramingCtx->FramingYuv[2].pac_data); + aFramingCtx->FramingYuv[2].pac_data = M4OSA_NULL; + } + M4OSA_free((M4OSA_MemAddr32)aFramingCtx->FramingYuv); aFramingCtx->FramingYuv = M4OSA_NULL; } diff --git a/media/libstagefright/DRMExtractor.cpp b/media/libstagefright/DRMExtractor.cpp index 647cf43..2809df5 100644 --- a/media/libstagefright/DRMExtractor.cpp +++ b/media/libstagefright/DRMExtractor.cpp @@ -243,6 +243,7 @@ DRMExtractor::DRMExtractor(const sp<DataSource> &source, const char* mime) mDrmManagerClient(NULL) { mOriginalExtractor = MediaExtractor::Create(source, mime); mOriginalExtractor->setDrmFlag(true); + mOriginalExtractor->getMetaData()->setInt32(kKeyIsDRM, 1); source->getDrmInfo(&mDecryptHandle, &mDrmManagerClient); } diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index cf4cbe5..7b96d01 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -1596,6 +1596,14 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio( 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 + LOGE("MP3 track in MP4/3GPP file is not supported"); + return ERROR_UNSUPPORTED; + } + const uint8_t *csd; size_t csd_size; if (esds.getCodecSpecificInfo( diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp index d4651c4..23bad5b 100644 --- a/media/libstagefright/MediaExtractor.cpp +++ b/media/libstagefright/MediaExtractor.cpp @@ -67,6 +67,7 @@ sp<MediaExtractor> MediaExtractor::Create( mime, confidence); } + bool isDrm = false; // DRM MIME type syntax is "drm+type+original" where // type is "es_based" or "container_based" and // original is the content's cleartext MIME type @@ -78,39 +79,45 @@ sp<MediaExtractor> MediaExtractor::Create( } ++originalMime; if (!strncmp(mime, "drm+es_based+", 13)) { + // DRMExtractor sets container metadata kKeyIsDRM to 1 return new DRMExtractor(source, originalMime); } else if (!strncmp(mime, "drm+container_based+", 20)) { mime = originalMime; + isDrm = true; } else { return NULL; } } + MediaExtractor *ret = NULL; if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG4) || !strcasecmp(mime, "audio/mp4")) { - return new MPEG4Extractor(source); + ret = new MPEG4Extractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) { - return new MP3Extractor(source, meta); + ret = new MP3Extractor(source, meta); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB) || !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_WB)) { - return new AMRExtractor(source); + ret = new AMRExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC)) { - return new FLACExtractor(source); + ret = new FLACExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WAV)) { - return new WAVExtractor(source); + ret = new WAVExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_OGG)) { - return new OggExtractor(source); + ret = new OggExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MATROSKA)) { - return new MatroskaExtractor(source); + ret = new MatroskaExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2TS)) { - return new MPEG2TSExtractor(source); + ret = new MPEG2TSExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) { - return new WVMExtractor(source); + ret = new WVMExtractor(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) { - return new AACExtractor(source); + ret = new AACExtractor(source); + } + if (ret != NULL && isDrm) { + ret->getMetaData()->setInt32(kKeyIsDRM, 1); } - return NULL; + return ret; } } // namespace android diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 600de7c..ea3b801 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -272,6 +272,12 @@ VideoFrame *StagefrightMetadataRetriever::getFrameAtTime( return NULL; } + int32_t drm = 0; + if (mExtractor->getMetaData()->findInt32(kKeyIsDRM, &drm) && drm != 0) { + LOGE("frame grab not allowed."); + return NULL; + } + size_t n = mExtractor->countTracks(); size_t i; for (i = 0; i < n; ++i) { diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java index 4481d00..4c66a2d 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/VideoEditorPerformance.java @@ -217,21 +217,21 @@ public class VideoEditorPerformance extends videoItemStartTime, videoItemEndTime); timeTaken = calculateTimeTaken (startTime, NUM_OF_ITERATIONS); - loggingInfo[0] = "Time taken to Create Media Video Item\t" + + loggingInfo[0] = "Time taken to Create Media Video Item :" + timeTaken; /** Time Take for Addition of Media Video Item */ startTime = SystemClock.uptimeMillis(); addVideoItems(mediaVideoItem); timeTaken = calculateTimeTaken (startTime, NUM_OF_ITERATIONS); - loggingInfo[1] = "\n\tTime taken to Add Media Video Item\t" + loggingInfo[1] = "\n\tTime taken to Add Media Video Item :" + timeTaken; /** Time Take for Removal of Media Video Item */ startTime = SystemClock.uptimeMillis(); removeVideoItems(mediaVideoItem); timeTaken = calculateTimeTaken (startTime, NUM_OF_ITERATIONS); - loggingInfo[2] = "\n\tTime taken to remove Media Video Item\t" + loggingInfo[2] = "\n\tTime taken to remove Media Video Item :" + timeTaken; writeTimingInfo("testPerformanceAddRemoveVideoItem (in mSec)", loggingInfo); @@ -257,19 +257,19 @@ public class VideoEditorPerformance extends createImageItems(mediaImageItem, imageItemFileName, renderingMode, imageItemDuration); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[0] = "Time taken to Create Media Image Item\t" + + loggingInfo[0] = "Time taken to Create Media Image Item :" + timeTaken; beginTime = SystemClock.uptimeMillis(); addImageItems(mediaImageItem); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[1] = "\n\tTime taken to add Media Image Item\t" + + loggingInfo[1] = "\n\tTime taken to add Media Image Item :" + timeTaken; beginTime = SystemClock.uptimeMillis(); removeImageItems(mediaImageItem); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[2] = "\n\tTime taken to remove Media Image Item\t" + loggingInfo[2] = "\n\tTime taken to remove Media Image Item :" + timeTaken; writeTimingInfo("testPerformanceAddRemoveImageItem (in mSec)", @@ -333,7 +333,7 @@ public class VideoEditorPerformance extends transitionBehavior); } timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS * 10)); - loggingInfo[0] = "Time taken to Create CrossFade Transition\t" + + loggingInfo[0] = "Time taken to Create CrossFade Transition :" + timeTaken; beginTime = SystemClock.uptimeMillis(); @@ -341,7 +341,7 @@ public class VideoEditorPerformance extends mVideoEditor.addTransition(tranCrossfade[i]); } timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS * 10)); - loggingInfo[1] = "\n\tTime taken to add CrossFade Transition\t" + + loggingInfo[1] = "\n\tTime taken to add CrossFade Transition :" + timeTaken; beginTime = SystemClock.uptimeMillis(); @@ -350,7 +350,7 @@ public class VideoEditorPerformance extends .removeTransition(tranCrossfade[i].getId())); } timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS * 10)); - loggingInfo[2] = "\n\tTime taken to remove CrossFade Transition\t" + + loggingInfo[2] = "\n\tTime taken to remove CrossFade Transition :" + timeTaken; writeTimingInfo("testPerformanceAddRemoveTransition (in mSec)", loggingInfo); @@ -529,8 +529,8 @@ public class VideoEditorPerformance extends mVideoEditorHelper.checkDeleteExistingFile(outFilename); timeTaken = calculateTimeTaken(beginTime, 1); - loggingInfo[0] = "Time taken to do ONE export of storyboard duration\t" - + mVideoEditor.getDuration() + " is :\t" + timeTaken; + loggingInfo[0] = "Time taken to do ONE export of storyboard duration " + + mVideoEditor.getDuration() + " is :" + timeTaken; writeTimingInfo("testPerformanceExport (in mSec)", loggingInfo); mVideoEditorHelper.deleteProject(new File(mVideoEditor.getPath())); @@ -564,7 +564,7 @@ public class VideoEditorPerformance extends mediaVideoItem.getHeight() / 2, i); } timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[0] = "Duration taken to get Video Thumbnails\t" + + loggingInfo[0] = "Duration taken to get Video Thumbnails :" + timeTaken; writeTimingInfo("testPerformanceThumbnailVideoItem (in mSec)", loggingInfo); @@ -611,7 +611,7 @@ public class VideoEditorPerformance extends mediaVideoItem.addOverlay(overlayFrame[i]); } timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[0] = "Time taken to add & create Overlay\t" + timeTaken; + loggingInfo[0] = "Time taken to add & create Overlay :" + timeTaken; beginTime = SystemClock.uptimeMillis(); for (int i = 0; i < NUM_OF_ITERATIONS; i++) { @@ -619,7 +619,7 @@ public class VideoEditorPerformance extends mediaVideoItem.removeOverlay((overlayFrame[i].getId()))); } timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[1] = "\n\tTime taken to remove Overlay\t" + + loggingInfo[1] = "\n\tTime taken to remove Overlay :" + timeTaken; writeTimingInfo("testPerformanceOverlayVideoItem (in mSec)", loggingInfo); @@ -676,7 +676,7 @@ public class VideoEditorPerformance extends } } timeTaken = calculateTimeTaken(beginTime, (NUM_OF_ITERATIONS*10)); - loggingInfo[0] = "Time taken to get Media Properties\t" + loggingInfo[0] = "Time taken to get Media Properties :" + timeTaken; writeTimingInfo("testPerformanceVideoItemProperties:", loggingInfo); } @@ -727,7 +727,7 @@ public class VideoEditorPerformance extends final long durationToAddObjects = averageTime; final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; - loggingInfo[0] = "Time taken to Generate Preview with transition\t" + loggingInfo[0] = "Time taken to Generate Preview with transition :" + timeTaken; writeTimingInfo("testPerformanceGeneratePreviewWithTransitions:", loggingInfo); @@ -782,7 +782,7 @@ public class VideoEditorPerformance extends final long durationToAddObjects = (averageTime); final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; - loggingInfo[0] = "Time taken to Generate KenBurn Effect \t" + loggingInfo[0] = "Time taken to Generate KenBurn Effect :" + timeTaken; writeTimingInfo("testPerformanceWithKenBurn", loggingInfo); } @@ -850,7 +850,7 @@ public class VideoEditorPerformance extends final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; loggingInfo[0] = - "Time taken to testPerformanceEffectOverlappingTransition\t" + "Time taken to testPerformanceEffectOverlappingTransition :" + timeTaken; writeTimingInfo("testPerformanceEffectOverlappingTransition:", loggingInfo); @@ -920,7 +920,7 @@ public class VideoEditorPerformance extends final long durationToAddObjects = (averageTime); final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; - loggingInfo[0] = "Time taken to TransitionWithEffectOverlapping\t" + loggingInfo[0] = "Time taken to TransitionWithEffectOverlapping :" + timeTaken; writeTimingInfo("testPerformanceTransitionWithEffectOverlapping", loggingInfo); @@ -952,7 +952,7 @@ public class VideoEditorPerformance extends } final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; - loggingInfo[0] = "Time taken for Thumbnail generation \t" + loggingInfo[0] = "Time taken for Thumbnail generation :" + timeTaken; writeTimingInfo("testThumbnailH264NonIFrame", loggingInfo); } @@ -984,7 +984,7 @@ public class VideoEditorPerformance extends } final float timeTaken = (float)durationToAddObjects * 1.0f/(float)NUM_OF_ITERATIONS; - loggingInfo[0] = "Time taken Thumbnail generation \t" + loggingInfo[0] = "Time taken Thumbnail generation :" + timeTaken; writeTimingInfo("testThumbnailH264AnIFrame", loggingInfo); } @@ -1024,7 +1024,7 @@ public class VideoEditorPerformance extends } }); timeTaken = calculateTimeTaken(beginTime, 1); - loggingInfo[0] = "Time taken for 1st Audio Track (AACLC)\t" + loggingInfo[0] = "Time taken for 1st Audio Track (AACLC) :" + timeTaken; final AudioTrack audioTrack2 = new AudioTrack(mVideoEditor, @@ -1037,7 +1037,7 @@ public class VideoEditorPerformance extends } }); timeTaken = calculateTimeTaken(beginTime, 1); - loggingInfo[1] = "\n\tTime taken for 2nd Audio Track(AMRNB)\t" + loggingInfo[1] = "\n\tTime taken for 2nd Audio Track(AMRNB) :" + timeTaken; writeTimingInfo("testPerformanceWithAudioTrack", loggingInfo); @@ -1065,19 +1065,19 @@ public class VideoEditorPerformance extends createImageItems(mediaImageItem, imageItemFileName, renderingMode, imageItemDuration); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[0] = "Time taken to Create Media Image Item (640x480)\t" + loggingInfo[0] = "Time taken to Create Media Image Item (640x480) :" + timeTaken; beginTime = SystemClock.uptimeMillis(); addImageItems(mediaImageItem); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[1] = "\n\tTime taken to add Media Image Item (640x480)\t" + loggingInfo[1] = "\n\tTime taken to add Media Image Item (640x480) :" + timeTaken; beginTime = SystemClock.uptimeMillis(); removeImageItems(mediaImageItem); timeTaken = calculateTimeTaken(beginTime, NUM_OF_ITERATIONS); - loggingInfo[2] = "\n\tTime taken to remove Media Image Item (640x480)\t" + loggingInfo[2] = "\n\tTime taken to remove Media Image Item (640x480) :" + timeTaken; writeTimingInfo("testPerformanceAddRemoveImageItem640x480 (in mSec)", loggingInfo); } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java index 0e70dd3..432fb43 100755 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/VideoEditorStressTest.java @@ -597,7 +597,7 @@ public class VideoEditorStressTest if (i % 4 == 0) { final Bitmap[] thumbNails = mediaVideoItem.getThumbnailList(mediaVideoItem.getWidth()*3, - mediaVideoItem.getHeight()*2, i, 5000, 2); + mediaVideoItem.getHeight()/2, i, 5000, 2); // Recycle this Bitmap array for (int i1 = 0; i1 < thumbNails.length; i1++) { thumbNails[i1].recycle(); |