diff options
author | Jeff Tinker <jtinker@google.com> | 2014-11-03 13:29:35 -0800 |
---|---|---|
committer | Jeff Tinker <jtinker@google.com> | 2014-11-03 18:39:23 -0800 |
commit | 2514d080c8a54ff603a45d7e336de668fe7329db (patch) | |
tree | c02e8521f99240935f7c672c9d79846addd785cb /media | |
parent | 3c1285e8f86bd497e14c14fb6df7b42072ef52bd (diff) | |
download | frameworks_av-2514d080c8a54ff603a45d7e336de668fe7329db.zip frameworks_av-2514d080c8a54ff603a45d7e336de668fe7329db.tar.gz frameworks_av-2514d080c8a54ff603a45d7e336de668fe7329db.tar.bz2 |
Pass resolution to Crypto plugin on format change
Change-Id: I56cd557ce3525fe625db8c312d2557d3c8b51101
related-to-bug: 16034599
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/ICrypto.cpp | 22 | ||||
-rw-r--r-- | media/libmediaplayerservice/Crypto.cpp | 8 | ||||
-rw-r--r-- | media/libmediaplayerservice/Crypto.h | 2 | ||||
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 10 |
4 files changed, 41 insertions, 1 deletions
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp index 0d5f990..c26c5bf 100644 --- a/media/libmedia/ICrypto.cpp +++ b/media/libmedia/ICrypto.cpp @@ -33,6 +33,7 @@ enum { DESTROY_PLUGIN, REQUIRES_SECURE_COMPONENT, DECRYPT, + NOTIFY_RESOLUTION, }; struct BpCrypto : public BpInterface<ICrypto> { @@ -149,6 +150,15 @@ struct BpCrypto : public BpInterface<ICrypto> { return result; } + virtual void notifyResolution( + uint32_t width, uint32_t height) { + Parcel data, reply; + data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); + data.writeInt32(width); + data.writeInt32(height); + remote()->transact(NOTIFY_RESOLUTION, data, &reply); + } + private: DISALLOW_EVIL_CONSTRUCTORS(BpCrypto); }; @@ -290,10 +300,20 @@ status_t BnCrypto::onTransact( return OK; } + case NOTIFY_RESOLUTION: + { + CHECK_INTERFACE(ICrypto, data, reply); + + int32_t width = data.readInt32(); + int32_t height = data.readInt32(); + notifyResolution(width, height); + + return OK; + } + default: return BBinder::onTransact(code, data, reply, flags); } } } // namespace android - diff --git a/media/libmediaplayerservice/Crypto.cpp b/media/libmediaplayerservice/Crypto.cpp index 62593b2..8ee7c0b 100644 --- a/media/libmediaplayerservice/Crypto.cpp +++ b/media/libmediaplayerservice/Crypto.cpp @@ -257,4 +257,12 @@ ssize_t Crypto::decrypt( errorDetailMsg); } +void Crypto::notifyResolution(uint32_t width, uint32_t height) { + Mutex::Autolock autoLock(mLock); + + if (mInitCheck == OK && mPlugin != NULL) { + mPlugin->notifyResolution(width, height); + } +} + } // namespace android diff --git a/media/libmediaplayerservice/Crypto.h b/media/libmediaplayerservice/Crypto.h index c44ae34..0037c2e 100644 --- a/media/libmediaplayerservice/Crypto.h +++ b/media/libmediaplayerservice/Crypto.h @@ -45,6 +45,8 @@ struct Crypto : public BnCrypto { virtual bool requiresSecureDecoderComponent( const char *mime) const; + virtual void notifyResolution(uint32_t width, uint32_t height); + virtual ssize_t decrypt( bool secure, const uint8_t key[16], diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index df47bd5..d7ddc89 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -1011,6 +1011,16 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { mFlags |= kFlagOutputFormatChanged; postActivityNotificationIfPossible(); } + + // Notify mCrypto of video resolution changes + if (mCrypto != NULL) { + int32_t height, width; + if (mOutputFormat->findInt32("height", &height) && + mOutputFormat->findInt32("width", &width)) { + mCrypto->notifyResolution(width, height); + } + } + break; } |