diff --git a/GstToolkit.cpp b/GstToolkit.cpp index a814762..4e01c1a 100644 --- a/GstToolkit.cpp +++ b/GstToolkit.cpp @@ -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 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(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(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) + ", "; } } diff --git a/MediaPlayer.cpp b/MediaPlayer.cpp index af3282a..9695cc1 100644 --- a/MediaPlayer.cpp +++ b/MediaPlayer.cpp @@ -424,7 +424,7 @@ void MediaPlayer::execute_open() // all good 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(), timeline_.begin(), timeline_.end(), timeline_.numFrames(), timeline_.numGaps()); @@ -851,15 +851,12 @@ void MediaPlayer::init_texture(guint index) pbo_index_ = 0; pbo_next_index_ = 1; -// // now that a frame is ready, and once only, browse into the pipeline -// // for possible hadrware decoding plugins used. Empty string means none. -// 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 - + // initialize decoderName once + Log::Info("MediaPlayer %s Uses %s decoding and OpenGL PBO texturing.", std::to_string(id_).c_str(), decoderName().c_str()); } + else + Log::Info("MediaPlayer %s Uses %s decoding.", std::to_string(id_).c_str(), decoderName().c_str()); + glBindTexture(GL_TEXTURE_2D, 0); }