Loading media/libstagefright/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,14 @@ cc_library_shared { shared_libs: [ "libgui", "libhidlallocatorutils", "liblog", "libmedia_codeclist", "libstagefright_foundation", "libui", "libutils", "android.hardware.cas.native@1.0", "android.hardware.drm@1.0", ], sanitize: { Loading media/libstagefright/CodecBase.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #define LOG_TAG "CodecBase" #include <android/hardware/cas/native/1.0/IDescrambler.h> #include <android/hardware/drm/1.0/types.h> #include <hidlmemory/FrameworkUtils.h> #include <mediadrm/ICrypto.h> #include <media/stagefright/CodecBase.h> #include <utils/Log.h> Loading @@ -32,4 +34,18 @@ void BufferChannelBase::setDescrambler(const sp<IDescrambler> &descrambler) { mDescrambler = descrambler; } void BufferChannelBase::IMemoryToSharedBuffer( const sp<IMemory> &memory, int32_t heapSeqNum, hardware::drm::V1_0::SharedBuffer *buf) { ssize_t offset; size_t size; sp<hardware::HidlMemory> hidlMemory; hidlMemory = hardware::fromHeap(memory->getMemory(&offset, &size)); buf->bufferId = static_cast<uint32_t>(heapSeqNum); buf->offset = offset >= 0 ? offset : 0; buf->size = size; } } // namespace android media/libstagefright/include/media/stagefright/CodecBase.h +21 −1 Original line number Diff line number Diff line Loading @@ -42,12 +42,20 @@ struct PersistentSurface; struct RenderedFrameInfo; class Surface; struct ICrypto; class IMemory; namespace hardware { namespace cas { namespace native { namespace V1_0 { struct IDescrambler; }}}} }}} namespace drm { namespace V1_0 { struct SharedBuffer; }} } using hardware::cas::native::V1_0::IDescrambler; struct CodecBase : public AHandler, /* static */ ColorUtils { Loading Loading @@ -314,6 +322,18 @@ public: */ virtual void getOutputBufferArray(Vector<sp<MediaCodecBuffer>> *array) = 0; /** * Convert binder IMemory to drm SharedBuffer * * \param memory IMemory object to store encrypted content. * \param heapSeqNum Heap sequence number from ICrypto; -1 if N/A * \param buf SharedBuffer structure to fill. */ static void IMemoryToSharedBuffer( const sp<IMemory> &memory, int32_t heapSeqNum, hardware::drm::V1_0::SharedBuffer *buf); protected: std::unique_ptr<CodecBase::BufferCallback> mCallback; sp<ICrypto> mCrypto; Loading Loading
media/libstagefright/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,14 @@ cc_library_shared { shared_libs: [ "libgui", "libhidlallocatorutils", "liblog", "libmedia_codeclist", "libstagefright_foundation", "libui", "libutils", "android.hardware.cas.native@1.0", "android.hardware.drm@1.0", ], sanitize: { Loading
media/libstagefright/CodecBase.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #define LOG_TAG "CodecBase" #include <android/hardware/cas/native/1.0/IDescrambler.h> #include <android/hardware/drm/1.0/types.h> #include <hidlmemory/FrameworkUtils.h> #include <mediadrm/ICrypto.h> #include <media/stagefright/CodecBase.h> #include <utils/Log.h> Loading @@ -32,4 +34,18 @@ void BufferChannelBase::setDescrambler(const sp<IDescrambler> &descrambler) { mDescrambler = descrambler; } void BufferChannelBase::IMemoryToSharedBuffer( const sp<IMemory> &memory, int32_t heapSeqNum, hardware::drm::V1_0::SharedBuffer *buf) { ssize_t offset; size_t size; sp<hardware::HidlMemory> hidlMemory; hidlMemory = hardware::fromHeap(memory->getMemory(&offset, &size)); buf->bufferId = static_cast<uint32_t>(heapSeqNum); buf->offset = offset >= 0 ? offset : 0; buf->size = size; } } // namespace android
media/libstagefright/include/media/stagefright/CodecBase.h +21 −1 Original line number Diff line number Diff line Loading @@ -42,12 +42,20 @@ struct PersistentSurface; struct RenderedFrameInfo; class Surface; struct ICrypto; class IMemory; namespace hardware { namespace cas { namespace native { namespace V1_0 { struct IDescrambler; }}}} }}} namespace drm { namespace V1_0 { struct SharedBuffer; }} } using hardware::cas::native::V1_0::IDescrambler; struct CodecBase : public AHandler, /* static */ ColorUtils { Loading Loading @@ -314,6 +322,18 @@ public: */ virtual void getOutputBufferArray(Vector<sp<MediaCodecBuffer>> *array) = 0; /** * Convert binder IMemory to drm SharedBuffer * * \param memory IMemory object to store encrypted content. * \param heapSeqNum Heap sequence number from ICrypto; -1 if N/A * \param buf SharedBuffer structure to fill. */ static void IMemoryToSharedBuffer( const sp<IMemory> &memory, int32_t heapSeqNum, hardware::drm::V1_0::SharedBuffer *buf); protected: std::unique_ptr<CodecBase::BufferCallback> mCallback; sp<ICrypto> mCrypto; Loading