本文整理汇总了C++中Manifest::CanDecode方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::CanDecode方法的具体用法?C++ Manifest::CanDecode怎么用?C++ Manifest::CanDecode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest::CanDecode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decoder
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource,
const MediaContentType& aMimeType)
{
NS_ENSURE_TRUE(aResource, nullptr);
nsAutoPtr<Decoder> decoder(new Decoder());
if (!decoder) {
return nullptr;
}
const char *chars;
size_t len = NS_CStringGetData(aMimeType.Type().AsString(), &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (!plugin->CanDecode(chars, len, &codecs)) {
continue;
}
nsCString url;
nsresult rv = mResourceServer->AddResource(aResource, url);
if (NS_FAILED (rv)) continue;
decoder->mResource = strdup(url.get());
if (plugin->CreateDecoder(&sPluginHost, decoder, chars, len)) {
return decoder.forget();
}
}
return nullptr;
}
示例2: FindDecoder
bool MediaPluginHost::FindDecoder(const nsACString& aMimeType, const char* const** aCodecs)
{
const char *chars;
size_t len = NS_CStringGetData(aMimeType, &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (plugin->CanDecode(chars, len, &codecs)) {
if (aCodecs)
*aCodecs = codecs;
return true;
}
}
return false;
}
示例3: Decoder
MPAPI::Decoder *MediaPluginHost::CreateDecoder(MediaResource *aResource, const nsACString& aMimeType)
{
const char *chars;
size_t len = NS_CStringGetData(aMimeType, &chars, nullptr);
Decoder *decoder = new Decoder();
if (!decoder) {
return nullptr;
}
decoder->mResource = aResource;
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (!plugin->CanDecode(chars, len, &codecs)) {
continue;
}
if (plugin->CreateDecoder(&sPluginHost, decoder, chars, len)) {
return decoder;
}
}
return nullptr;
}
示例4: FindDecoder
bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
MediaCodecs* aCodecs)
{
const char *chars;
size_t len = NS_CStringGetData(aMimeType.Type().AsString(), &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (plugin->CanDecode(chars, len, &codecs)) {
if (aCodecs) {
nsString codecsString;
for (const char* const* codec = codecs; *codec; ++codec) {
if (codecsString.IsEmpty()) {
codecsString += ',';
}
codecsString.AppendASCII(*codec);
}
*aCodecs = MediaCodecs(codecsString);
}
return true;
}
}
return false;
}