diff options
author | Glenn Kasten <gkasten@google.com> | 2011-02-21 09:37:13 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2011-02-28 08:39:13 -0800 |
commit | 8ddeebb93cb41e7a8e9fe763afb6c6016b21fa61 (patch) | |
tree | 808255cd5bf6a072306cc1c2d203b01baf7b46e6 /media/libstagefright | |
parent | 60181854194007eef9471c2774a9912ce8c42cfa (diff) | |
download | frameworks_av-8ddeebb93cb41e7a8e9fe763afb6c6016b21fa61.zip frameworks_av-8ddeebb93cb41e7a8e9fe763afb6c6016b21fa61.tar.gz frameworks_av-8ddeebb93cb41e7a8e9fe763afb6c6016b21fa61.tar.bz2 |
Bug 3447027 Limit previews for DRM video
Change-Id: I5b15cf6a15623cf73f007c59143ab5e3fa5a07e8
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/DRMExtractor.cpp | 1 | ||||
-rw-r--r-- | media/libstagefright/MediaExtractor.cpp | 29 | ||||
-rw-r--r-- | media/libstagefright/StagefrightMetadataRetriever.cpp | 6 |
3 files changed, 25 insertions, 11 deletions
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/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) { |