codec2: Update Adaptor API
Bug: 63828240
Test: mmm external/v4l2_codec2
Change-Id: Id686eb1f9923dad535b7b0c8daee3ce8e9a00559
diff --git a/C2VDAAdaptor.cpp b/C2VDAAdaptor.cpp
index bc6b28d..90b9a1f 100644
--- a/C2VDAAdaptor.cpp
+++ b/C2VDAAdaptor.cpp
@@ -27,7 +27,9 @@
}
VideoDecodeAcceleratorAdaptor::Result C2VDAAdaptor::initialize(
- media::VideoCodecProfile profile, VideoDecodeAcceleratorAdaptor::Client* client) {
+ media::VideoCodecProfile profile, bool secureMode,
+ VideoDecodeAcceleratorAdaptor::Client* client) {
+ // TODO: use secureMode here, or ignore?
if (mVDA) {
ALOGE("Re-initialize() is not allowed");
return ILLEGAL_STATE;
@@ -194,4 +196,3 @@
}
} // namespace android
-
diff --git a/C2VDAAdaptor.h b/C2VDAAdaptor.h
index 3027615..e54d6c1 100644
--- a/C2VDAAdaptor.h
+++ b/C2VDAAdaptor.h
@@ -21,10 +21,11 @@
// Implementation of the VideoDecodeAcceleratorAdaptor interface.
Result initialize(media::VideoCodecProfile profile,
+ bool secureMode,
VideoDecodeAcceleratorAdaptor::Client* client) override;
- void decode(int32_t bitstreamId, int ashmemFd, off_t offset, uint32_t bytesUsed) override;
+ void decode(int32_t bitstreamId, int handleFd, off_t offset, uint32_t bytesUsed) override;
void assignPictureBuffers(uint32_t numOutputBuffers) override;
- void importBufferForPicture(int32_t pictureBufferId, int dmabufFd,
+ void importBufferForPicture(int32_t pictureBufferId, int handleFd,
const std::vector<VideoFramePlane>& planes) override;
void reusePictureBuffer(int32_t pictureBufferId) override;
void flush() override;
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index ee94f5d..cd8d7e1 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -481,8 +481,10 @@
void C2VDAComponent::onStart(media::VideoCodecProfile profile, base::WaitableEvent* done) {
DCHECK(mTaskRunner->BelongsToCurrentThread());
ALOGV("onStart");
- CHECK(mComponentState == ComponentState::UNINITIALIZED);
- mVDAInitResult = mVDAAdaptor->initialize(profile, this);
+ CHECK_EQ(mComponentState, ComponentState::UNINITIALIZED);
+ // TODO: Set secureMode value dynamically.
+ bool secureMode = false;
+ mVDAInitResult = mVDAAdaptor->initialize(profile, secureMode, this);
if (mVDAInitResult == VideoDecodeAcceleratorAdaptor::Result::SUCCESS) {
mComponentState = ComponentState::STARTED;
}
diff --git a/VideoDecodeAcceleratorAdaptor.h b/VideoDecodeAcceleratorAdaptor.h
index d76a38f..6d1322d 100644
--- a/VideoDecodeAcceleratorAdaptor.h
+++ b/VideoDecodeAcceleratorAdaptor.h
@@ -70,16 +70,16 @@
// Initializes the video decoder with specific profile. This call is synchronous and returns
// SUCCESS iff initialization is successful.
- virtual Result initialize(media::VideoCodecProfile profile, Client* client) = 0;
+ virtual Result initialize(media::VideoCodecProfile profile, bool secureMode, Client* client) = 0;
- // Decodes given shared memory buffer with bitstream ID.
- virtual void decode(int32_t bitstreamId, int ashmemFd, off_t offset, uint32_t bytesUsed) = 0;
+ // Decodes given buffer handle with bitstream ID.
+ virtual void decode(int32_t bitstreamId, int handleFd, off_t offset, uint32_t bytesUsed) = 0;
// Assigns a specified number of picture buffer set to the video decoder.
virtual void assignPictureBuffers(uint32_t numOutputBuffers) = 0;
// Imports planes as backing memory for picture buffer with specified ID.
- virtual void importBufferForPicture(int32_t pictureBufferId, int dmabufFd,
+ virtual void importBufferForPicture(int32_t pictureBufferId, int handleFd,
const std::vector<VideoFramePlane>& planes) = 0;
// Sends picture buffer to be reused by the decoder by its piture ID.