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

View File

@@ -424,7 +424,7 @@ void MediaPlayer::execute_open()
// all good // all good
Log::Info("MediaPlayer %s Opened '%s' (%s %d x %d)", std::to_string(id_).c_str(), Log::Info("MediaPlayer %s Opened '%s' (%s %d x %d)", std::to_string(id_).c_str(),
uri_.c_str(), media_.codec_name.c_str(), media_.width, media_.height); SystemToolkit::filename(uri_).c_str(), media_.codec_name.c_str(), media_.width, media_.height);
Log::Info("MediaPlayer %s Timeline [%ld %ld] %ld frames, %d gaps", std::to_string(id_).c_str(), Log::Info("MediaPlayer %s Timeline [%ld %ld] %ld frames, %d gaps", std::to_string(id_).c_str(),
timeline_.begin(), timeline_.end(), timeline_.numFrames(), timeline_.numGaps()); timeline_.begin(), timeline_.end(), timeline_.numFrames(), timeline_.numGaps());
@@ -851,15 +851,12 @@ void MediaPlayer::init_texture(guint index)
pbo_index_ = 0; pbo_index_ = 0;
pbo_next_index_ = 1; pbo_next_index_ = 1;
// // now that a frame is ready, and once only, browse into the pipeline // initialize decoderName once
// // for possible hadrware decoding plugins used. Empty string means none. Log::Info("MediaPlayer %s Uses %s decoding and OpenGL PBO texturing.", std::to_string(id_).c_str(), decoderName().c_str());
// hardware_decoder_ = GstToolkit::used_gpu_decoding_plugins(pipeline_);
#ifdef MEDIA_PLAYER_DEBUG
Log::Info("MediaPlayer %s uses OpenGL PBO texturing.", std::to_string(id_).c_str());
#endif
} }
else
Log::Info("MediaPlayer %s Uses %s decoding.", std::to_string(id_).c_str(), decoderName().c_str());
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
} }