Loading include/media/stagefright/OMXCodec.h +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ struct OMXCodec : public MediaSource, // Only submit one input buffer at one time. kOnlySubmitOneInputBufferAtOneTime = 64, // Enable GRALLOC_USAGE_PROTECTED for output buffers from native window kEnableGrallocUsageProtected = 128, }; static sp<MediaSource> Create( const sp<IOMX> &omx, Loading Loading @@ -197,6 +200,7 @@ private: bool mIsMetaDataStoredInVideoBuffers; bool mOnlySubmitOneBufferAtOneTime; bool mEnableGrallocUsageProtected; OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, uint32_t quirks, bool isEncoder, const char *mime, const char *componentName, Loading media/libstagefright/AwesomePlayer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -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> Loading Loading @@ -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 Loading media/libstagefright/OMXCodec.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading Loading
include/media/stagefright/OMXCodec.h +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ struct OMXCodec : public MediaSource, // Only submit one input buffer at one time. kOnlySubmitOneInputBufferAtOneTime = 64, // Enable GRALLOC_USAGE_PROTECTED for output buffers from native window kEnableGrallocUsageProtected = 128, }; static sp<MediaSource> Create( const sp<IOMX> &omx, Loading Loading @@ -197,6 +200,7 @@ private: bool mIsMetaDataStoredInVideoBuffers; bool mOnlySubmitOneBufferAtOneTime; bool mEnableGrallocUsageProtected; OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, uint32_t quirks, bool isEncoder, const char *mime, const char *componentName, Loading
media/libstagefright/AwesomePlayer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -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> Loading Loading @@ -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 Loading
media/libstagefright/OMXCodec.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading