Improved ordering of hardware decoding and log info

This commit is contained in:
Bruno Herbelin
2021-12-04 00:23:27 +01:00
parent d359cf33d1
commit ebd9fab312
2 changed files with 14 additions and 20 deletions

View File

@@ -213,11 +213,11 @@ string GstToolkit::gst_version()
#if GST_GL_HAVE_PLATFORM_GLX
// https://gstreamer.freedesktop.org/documentation/nvcodec/index.html?gi-language=c#plugin-nvcodec
const char *plugins[11] = { "omxmpeg4videodec", "omxmpeg2dec", "omxh264dec", "vaapidecodebin", "vdpaumpegdec",
"nvh264dec", "nvh265dec", "nvmpeg2videodec",
"nvmpeg4videodec", "nvvp8dec", "nvvp9dec"
// list ordered with higher priority first (e.g. nvidia proprietary before vaapi)
const char *plugins[12] = { "nvh264dec", "nvh265dec", "nvmpeg2videodec", "nvmpeg4videodec", "nvvp8dec", "nvvp9dec", "nvjpegdec",
"vaapidecodebin", "omxmpeg4videodec", "omxmpeg2dec", "omxh264dec", "vdpaumpegdec",
};
const int N = 11;
const int N = 12;
#elif GST_GL_HAVE_PLATFORM_CGL
const char *plugins[2] = { "vtdec_hw", "vtdechw" };
const int N = 2;
@@ -243,7 +243,7 @@ std::list<std::string> GstToolkit::enable_gpu_decoding_plugins(bool enable)
GstPluginFeature* feature = gst_registry_lookup_feature(plugins_register, plugins[i]);
if(feature != NULL) {
plugins_list_.push_front( string( plugins[i] ) );
gst_plugin_feature_set_rank(feature, enable ? GST_RANK_PRIMARY + 1 : GST_RANK_MARGINAL);
gst_plugin_feature_set_rank(feature, enable ? GST_RANK_PRIMARY + (N-i) : GST_RANK_MARGINAL);
gst_object_unref(feature);
}
}
@@ -265,12 +265,9 @@ std::string GstToolkit::used_gpu_decoding_plugins(GstElement *gstbin)
{
GstElement *e = static_cast<GstElement*>(g_value_peek_pointer(&value));
if (e) {
gchar *name = gst_element_get_name(e);
// g_print(" - %s", name);
std::string e_name(name);
g_free(name);
const gchar *name = gst_element_get_name(e);
for (int i = 0; i < N; i++) {
if (e_name.find(plugins[i]) != std::string::npos) {
if (std::string(name).find(plugins[i]) != std::string::npos) {
found = plugins[i];
break;
}
@@ -298,7 +295,7 @@ std::string GstToolkit::used_decoding_plugins(GstElement *gstbin)
{
GstElement *e = static_cast<GstElement*>(g_value_peek_pointer(&value));
if (e) {
gchar *name = gst_element_get_name(e);
const gchar *name = gst_element_get_name(e);
found += std::string(name) + ", ";
}
}