Add an abstracted interface around android-specific handling

* This makes it easier to use the same kind of interface to manage other kinds
  of devices.
This commit is contained in:
baldurk
2019-07-29 16:54:36 +01:00
parent 06f2e61b8f
commit e2704fa2eb
34 changed files with 2340 additions and 1492 deletions
+37
View File
@@ -1038,6 +1038,16 @@ void RenderDoc::RegisterCaptureImportExporter(CaptureImporter importer, CaptureE
m_Exporters[filetype] = exporter;
}
void RenderDoc::RegisterDeviceProtocol(const rdcstr &protocol, ProtocolHandler handler)
{
if(m_Protocols[protocol] != NULL)
{
RDCERR("Duplicate protocol registration: %s", protocol.c_str());
return;
}
m_Protocols[protocol] = handler;
}
StructuredProcessor RenderDoc::GetStructuredProcessor(RDCDriver driver)
{
auto it = m_StructProcesssors.find(driver);
@@ -1074,6 +1084,33 @@ CaptureImporter RenderDoc::GetCaptureImporter(const char *filetype)
return it->second;
}
rdcarray<rdcstr> RenderDoc::GetSupportedDeviceProtocols()
{
rdcarray<rdcstr> ret;
for(auto it = m_Protocols.begin(); it != m_Protocols.end(); ++it)
ret.push_back(it->first);
return ret;
}
IDeviceProtocolHandler *RenderDoc::GetDeviceProtocol(const rdcstr &protocol)
{
rdcstr p = protocol;
// allow passing in an URL with ://
int32_t offs = p.find("://");
if(offs >= 0)
p.erase(offs, p.size() - offs);
auto it = m_Protocols.find(p);
if(it != m_Protocols.end())
return it->second();
return NULL;
}
std::vector<CaptureFileFormat> RenderDoc::GetCaptureFileFormats()
{
std::vector<CaptureFileFormat> ret = m_ImportExportFormats;