Export support types from extractors
Make each extractor plugin export a list of file types it supports,
so we no longer need to hardcode such a list in the framework.
Test: manual
Change-Id: I1e41a5d477ea56960ad3e4bc35f5183c03c3fe3a
diff --git a/media/libmedia/IMediaExtractorService.cpp b/media/libmedia/IMediaExtractorService.cpp
index 0295abc..243b09d 100644
--- a/media/libmedia/IMediaExtractorService.cpp
+++ b/media/libmedia/IMediaExtractorService.cpp
@@ -29,6 +29,7 @@
enum {
MAKE_EXTRACTOR = IBinder::FIRST_CALL_TRANSACTION,
MAKE_IDATA_SOURCE_FD,
+ GET_SUPPORTED_TYPES,
};
class BpMediaExtractorService : public BpInterface<IMediaExtractorService>
@@ -68,6 +69,24 @@
}
return nullptr;
}
+
+ virtual std::unordered_set<std::string> getSupportedTypes() {
+ std::unordered_set<std::string> supportedTypes;
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaExtractorService::getInterfaceDescriptor());
+ status_t ret = remote()->transact(GET_SUPPORTED_TYPES, data, &reply);
+ if (ret == NO_ERROR) {
+ // process reply
+ while(true) {
+ const char *ext = reply.readCString();
+ if (!ext) {
+ break;
+ }
+ supportedTypes.insert(std::string(ext));
+ }
+ }
+ return supportedTypes;
+ }
};
IMPLEMENT_META_INTERFACE(MediaExtractorService, "android.media.IMediaExtractorService");
@@ -113,6 +132,15 @@
return NO_ERROR;
}
+ case GET_SUPPORTED_TYPES:
+ {
+ CHECK_INTERFACE(IMediaExtractorService, data, reply);
+ std::unordered_set<std::string> supportedTypes = getSupportedTypes();
+ for (auto it = supportedTypes.begin(); it != supportedTypes.end(); ++it) {
+ reply->writeCString((*it).c_str());
+ }
+ return NO_ERROR;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}