Skip to content

Instantly share code, notes, and snippets.

@phhusson
Created January 12, 2020 12:30
Show Gist options
  • Save phhusson/d04962cd61d799cf089dd4beecb9f2ab to your computer and use it in GitHub Desktop.
Save phhusson/d04962cd61d799cf089dd4beecb9f2ab to your computer and use it in GitHub Desktop.
List OMX codecs through treble HAL
#include <iostream>
#include <unistd.h>
#include <android/hardware/media/omx/1.0/IOmxStore.h>
using ::android::hardware::media::omx::V1_0::IOmxStore;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = IOmxStore::getService();
{
auto res = svc->getNodePrefix([](const auto& prefix) {
std::cout << "Got prefix " << prefix << std::endl;
});
if(!res.isOk()) exit(1);
}
auto res = svc->listRoles([](const auto& roles) {
for(auto role : roles) {
std::cout << "Role " << role.role << std::endl;
std::cout << "\tType: " << role.type << std::endl;
std::cout << "\tNodes:" << std::endl;
for(auto node : role.nodes) {
std::cout << "\t\t" << node.name << std::endl;
std::cout << "\t\t\t" << node.owner << std::endl;
for(auto attribute: node.attributes) {
std::cout << "\t\t\t" << attribute.key << "=" << attribute.value << std::endl;
}
}
}
} );
if(!res.isOk()) exit(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment