summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-03-11 08:44:35 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-11 08:44:35 -0800
commit203616faff0be6c2306f02d82f3ce305746beb49 (patch)
treec54ef9ad6a5166f7a8b3c42a134370b874f12c07 /media
parent0592e3cc541aa0c6477e00ddb052558a5a3e17c1 (diff)
parent2eb62955eb84b97695e8a7e56e14310cbb86412b (diff)
downloadframeworks_av-203616faff0be6c2306f02d82f3ce305746beb49.zip
frameworks_av-203616faff0be6c2306f02d82f3ce305746beb49.tar.gz
frameworks_av-203616faff0be6c2306f02d82f3ce305746beb49.tar.bz2
am 92f2f3ff: Merge "Bug 3012968 DRM output control" into honeycomb-mr1
* commit '92f2f3ff2ea5c5b474722f2055cfee4916010e26': Bug 3012968 DRM output control
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp14
-rw-r--r--media/libstagefright/OMXCodec.cpp10
2 files changed, 24 insertions, 0 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 4c744bd..5734c7e 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -45,6 +45,7 @@
#include <surfaceflinger/Surface.h>
#include <gui/ISurfaceTexture.h>
#include <gui/SurfaceTextureClient.h>
+#include <surfaceflinger/ISurfaceComposer.h>
#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
@@ -1189,6 +1190,19 @@ void AwesomePlayer::setVideoSource(sp<MediaSource> source) {
}
status_t AwesomePlayer::initVideoDecoder(uint32_t flags) {
+
+ // Either the application or the DRM system can independently say
+ // that there must be a hardware-protected path to an external video sink.
+ // For now we always require a hardware-protected path to external video sink
+ // if content is DRMed, but eventually this could be optional per DRM agent.
+ // When the application wants protection, then
+ // (USE_SURFACE_ALLOC && (mSurface != 0) &&
+ // (mSurface->getFlags() & ISurfaceComposer::eProtectedByApp))
+ // will be true, but that part is already handled by SurfaceFlinger.
+ if (mDecryptHandle != NULL) {
+ flags |= OMXCodec::kEnableGrallocUsageProtected;
+ }
+ LOGV("initVideoDecoder flags=0x%x", flags);
mVideoSource = OMXCodec::Create(
mClient.interface(), mVideoTrack->getFormat(),
false, // createEncoder
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 4a94e0d..3e26a95 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -528,6 +528,12 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta, uint32_t flags) {
mOnlySubmitOneBufferAtOneTime = true;
}
+ mEnableGrallocUsageProtected = false;
+ if (flags & kEnableGrallocUsageProtected) {
+ mEnableGrallocUsageProtected = true;
+ }
+ LOGV("configureCodec protected=%d", mEnableGrallocUsageProtected);
+
if (!(flags & kIgnoreCodecSpecificData)) {
uint32_t type;
const void *data;
@@ -1751,7 +1757,11 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
// XXX: Currently this error is logged, but not fatal.
usage = 0;
}
+ if (mEnableGrallocUsageProtected) {
+ usage |= GRALLOC_USAGE_PROTECTED;
+ }
+ LOGV("native_window_set_usage usage=0x%x", usage);
err = native_window_set_usage(
mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
if (err != 0) {