summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-01-08 17:57:36 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-08 17:57:36 +0000
commit7993d6b343f2723872dac085756743630371454d (patch)
tree3577f12b2dee471ed021462b9ca731fb5e85a51d
parent27a78b56e1cf9814971192883cb7d15c186465f7 (diff)
parente03447548d1c56fa9875cac7d500f1012a6b5c26 (diff)
downloadframeworks_av-7993d6b343f2723872dac085756743630371454d.zip
frameworks_av-7993d6b343f2723872dac085756743630371454d.tar.gz
frameworks_av-7993d6b343f2723872dac085756743630371454d.tar.bz2
am e0344754: am 468977f0: Merge "mark any copyrighted content as protected to disable capture" into lmp-mr1-dev
* commit 'e03447548d1c56fa9875cac7d500f1012a6b5c26': mark any copyrighted content as protected to disable capture
-rw-r--r--include/media/stagefright/ACodec.h1
-rw-r--r--media/libmediaplayerservice/nuplayer/GenericSource.cpp1
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp4
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerSource.h1
-rw-r--r--media/libstagefright/ACodec.cpp13
5 files changed, 19 insertions, 1 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index 4d4ce90..faa2caf 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -131,6 +131,7 @@ private:
enum {
kFlagIsSecure = 1,
kFlagPushBlankBuffersToNativeWindowOnShutdown = 2,
+ kFlagIsGrallocUsageProtected = 4,
};
struct BufferInfo {
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index dd79b50..76b80bb 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -391,6 +391,7 @@ void NuPlayer::GenericSource::onPrepareAsync() {
notifyFlagsChanged(
(mIsSecure ? FLAG_SECURE : 0)
+ | (mDecryptHandle != NULL ? FLAG_PROTECTED : 0)
| FLAG_CAN_PAUSE
| FLAG_CAN_SEEK_BACKWARD
| FLAG_CAN_SEEK_FORWARD
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index a28591e..e02a2d5 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1190,6 +1190,10 @@ status_t NuPlayer::instantiateDecoder(bool audio, sp<DecoderBase> *decoder) {
if (mSourceFlags & Source::FLAG_SECURE) {
format->setInt32("secure", true);
}
+
+ if (mSourceFlags & Source::FLAG_PROTECTED) {
+ format->setInt32("protected", true);
+ }
}
if (audio) {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
index e92cd36..c81d3b9 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
@@ -38,6 +38,7 @@ struct NuPlayer::Source : public AHandler {
FLAG_CAN_SEEK = 8, // the "seek bar"
FLAG_DYNAMIC_DURATION = 16,
FLAG_SECURE = 32,
+ FLAG_PROTECTED = 64,
};
enum {
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index dfb0101..5999489 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -670,7 +670,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow(
usage = 0;
}
- if (mFlags & kFlagIsSecure) {
+ if (mFlags & kFlagIsGrallocUsageProtected) {
usage |= GRALLOC_USAGE_PROTECTED;
}
@@ -1261,6 +1261,16 @@ status_t ACodec::configureCodec(
mStoreMetaDataInOutputBuffers = false;
if (video && !encoder) {
inputFormat->setInt32("adaptive-playback", false);
+
+ int32_t usageProtected;
+ if (msg->findInt32("protected", &usageProtected) && usageProtected) {
+ if (!haveNativeWindow) {
+ ALOGE("protected output buffers must be sent to an ANativeWindow");
+ return PERMISSION_DENIED;
+ }
+ mFlags |= kFlagIsGrallocUsageProtected;
+ mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown;
+ }
}
if (!encoder && video && haveNativeWindow) {
sp<NativeWindowWrapper> windowWrapper(
@@ -4624,6 +4634,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
if (componentName.endsWith(".secure")) {
mCodec->mFlags |= kFlagIsSecure;
+ mCodec->mFlags |= kFlagIsGrallocUsageProtected;
mCodec->mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown;
}