Codec2: adjust to API style/namespace fixes
C2P::alloc_unique => AllocUnique
C2FSVQ::field => field()
C2FSVQ::type => type()
android::C2Component.. => C2Component..
Bug: 64121714
Test: Build
Change-Id: Ied33cb6fa3bea23db3ad4a98930997e3d97be911
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index c935596..697007f 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -42,7 +42,7 @@
template <class T>
std::unique_ptr<T> allocUniqueCstr(const char* cstr) {
size_t len = strlen(cstr);
- std::unique_ptr<T> ptr = T::alloc_unique(len);
+ std::unique_ptr<T> ptr = T::AllocUnique(len);
memcpy(ptr->m.value, cstr, len);
return ptr;
}
@@ -122,7 +122,7 @@
mInputFormat(0u, C2FormatCompressed),
mOutputFormat(0u, C2FormatVideo),
mOutputPortMime(allocUniqueCstr<C2PortMimeConfig::output>(MEDIA_MIMETYPE_VIDEO_RAW)),
- mOutputBlockPools(C2PortBlockPoolsTuning::output::alloc_unique({})) {
+ mOutputBlockPools(C2PortBlockPoolsTuning::output::AllocUnique({})) {
// TODO(johnylin): use factory function to determine whether V4L2 stream or slice API is.
uint32_t inputFormatFourcc;
if (name == kH264DecoderName) {
@@ -361,13 +361,13 @@
UNUSED(mayBlock);
c2_status_t err = C2_OK;
for (auto& query : fields) {
- if (mSupportedValues.count(query.field) == 0) {
+ if (mSupportedValues.count(query.field()) == 0) {
query.status = C2_BAD_INDEX;
err = C2_BAD_INDEX;
continue;
}
query.status = C2_OK;
- query.values = mSupportedValues.at(query.field);
+ query.values = mSupportedValues.at(query.field());
}
return err;
}
@@ -1368,32 +1368,32 @@
};
} // namespace android
-extern "C" ::android::C2ComponentFactory* CreateC2VDAH264Factory() {
+extern "C" ::C2ComponentFactory* CreateC2VDAH264Factory() {
ALOGV("in %s", __func__);
return new ::android::C2VDAComponentFactory(android::kH264DecoderName);
}
-extern "C" void DestroyC2VDAH264Factory(::android::C2ComponentFactory* factory) {
+extern "C" void DestroyC2VDAH264Factory(::C2ComponentFactory* factory) {
ALOGV("in %s", __func__);
delete factory;
}
-extern "C" ::android::C2ComponentFactory* CreateC2VDAVP8Factory() {
+extern "C" ::C2ComponentFactory* CreateC2VDAVP8Factory() {
ALOGV("in %s", __func__);
return new ::android::C2VDAComponentFactory(android::kVP8DecoderName);
}
-extern "C" void DestroyC2VDAVP8Factory(::android::C2ComponentFactory* factory) {
+extern "C" void DestroyC2VDAVP8Factory(::C2ComponentFactory* factory) {
ALOGV("in %s", __func__);
delete factory;
}
-extern "C" ::android::C2ComponentFactory* CreateC2VDAVP9Factory() {
+extern "C" ::C2ComponentFactory* CreateC2VDAVP9Factory() {
ALOGV("in %s", __func__);
return new ::android::C2VDAComponentFactory(android::kVP9DecoderName);
}
-extern "C" void DestroyC2VDAVP9Factory(::android::C2ComponentFactory* factory) {
+extern "C" void DestroyC2VDAVP9Factory(::C2ComponentFactory* factory) {
ALOGV("in %s", __func__);
delete factory;
}
diff --git a/C2VDAComponentStore.cpp b/C2VDAComponentStore.cpp
index 970aa72..88ef65a 100644
--- a/C2VDAComponentStore.cpp
+++ b/C2VDAComponentStore.cpp
@@ -201,7 +201,7 @@
c2_status_t C2VDAComponentStore::ComponentModule::createComponent(
c2_node_id_t id, std::shared_ptr<C2Component>* component,
- std::function<void(::android::C2Component*)> deleter) {
+ std::function<void(::C2Component*)> deleter) {
UNUSED(deleter);
component->reset();
if (mInit != C2_OK) {
@@ -213,7 +213,7 @@
c2_status_t C2VDAComponentStore::ComponentModule::createInterface(
c2_node_id_t id, std::shared_ptr<C2ComponentInterface>* interface,
- std::function<void(::android::C2ComponentInterface*)> deleter) {
+ std::function<void(::C2ComponentInterface*)> deleter) {
UNUSED(deleter);
interface->reset();
if (mInit != C2_OK) {
diff --git a/cmds/codec2.cpp b/cmds/codec2.cpp
index 33bcd07..947512d 100644
--- a/cmds/codec2.cpp
+++ b/cmds/codec2.cpp
@@ -68,7 +68,7 @@
class C2VDALinearBuffer : public C2Buffer {
public:
explicit C2VDALinearBuffer(const std::shared_ptr<C2LinearBlock>& block)
- : C2Buffer({block->share(block->offset(), block->size(), ::android::C2Fence())}) {}
+ : C2Buffer({block->share(block->offset(), block->size(), ::C2Fence())}) {}
};
class Listener;
@@ -241,7 +241,7 @@
std::shared_ptr<C2Component> component(std::make_shared<C2VDAComponent>(kComponentName, 0));
component->setListener_vb(mListener, C2_DONT_BLOCK);
std::unique_ptr<C2PortBlockPoolsTuning::output> pools =
- C2PortBlockPoolsTuning::output::alloc_unique(
+ C2PortBlockPoolsTuning::output::AllocUnique(
{static_cast<uint64_t>(C2BlockPool::BASIC_GRAPHIC)});
std::vector<std::unique_ptr<C2SettingResult>> result;
(void)component->intf()->config_vb({pools.get()}, C2_DONT_BLOCK, &result);
diff --git a/tests/C2VDACompIntf_test.cpp b/tests/C2VDACompIntf_test.cpp
index 402c1d8..2c00838 100644
--- a/tests/C2VDACompIntf_test.cpp
+++ b/tests/C2VDACompIntf_test.cpp
@@ -23,7 +23,7 @@
template <class T>
std::unique_ptr<T> alloc_unique_cstr(const char* cstr) {
size_t len = strlen(cstr);
- std::unique_ptr<T> ptr = T::alloc_unique(len);
+ std::unique_ptr<T> ptr = T::AllocUnique(len);
memcpy(ptr->m.value, cstr, len);
return ptr;
}
diff --git a/tests/C2VDAComponent_test.cpp b/tests/C2VDAComponent_test.cpp
index 49a22ef..4c11ab6 100644
--- a/tests/C2VDAComponent_test.cpp
+++ b/tests/C2VDAComponent_test.cpp
@@ -451,7 +451,7 @@
std::make_shared<C2VDAComponent>(mTestVideoFile->mComponentName, 0));
ASSERT_EQ(component->setListener_vb(mListener, C2_DONT_BLOCK), C2_OK);
std::unique_ptr<C2PortBlockPoolsTuning::output> pools =
- C2PortBlockPoolsTuning::output::alloc_unique(
+ C2PortBlockPoolsTuning::output::AllocUnique(
{static_cast<uint64_t>(C2BlockPool::BASIC_GRAPHIC)});
std::vector<std::unique_ptr<C2SettingResult>> result;
ASSERT_EQ(component->intf()->config_vb({pools.get()}, C2_DONT_BLOCK, &result), C2_OK);