This commit is contained in:
Bruno
2021-04-01 20:46:46 +02:00
3 changed files with 23 additions and 2 deletions

View File

@@ -142,8 +142,13 @@ string GstToolkit::gst_version()
};
const int N = 10;
#elif GST_GL_HAVE_PLATFORM_CGL
<<<<<<< HEAD
const char *plugins[1] = { "vtdec_hw" };
const int N = 1;
=======
const char *plugins[2] = { "vtdec_hw", "vtdechw" };
const int N = 2;
>>>>>>> 7344258b2f761d53d617e272473381625652d30a
#else
const char *plugins[0] = { };
const int N = 0;
@@ -188,6 +193,7 @@ std::string GstToolkit::used_gpu_decoding_plugins(GstElement *gstbin)
GstElement *e = static_cast<GstElement*>(g_value_peek_pointer(&value));
if (e) {
std::string e_name = gst_element_get_name(e);
// g_print(" - %s", e_name.c_str());
for (int i = 0; i < N; i++) {
if (e_name.find(plugins[i]) != std::string::npos) {
found = plugins[i];

View File

@@ -269,6 +269,21 @@ void MediaPlayer::execute_open()
return;
}
// GObject *dec = G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder") );
// auto it = gst_bin_iterate_elements(GST_BIN(pipeline_));
// GValue value = G_VALUE_INIT;
// for(GstIteratorResult r = gst_iterator_next(it, &value); r != GST_ITERATOR_DONE; r = gst_iterator_next(it, &value))
// {
// if ( r == GST_ITERATOR_OK )
// {
// GstElement *e = static_cast<GstElement*>(g_value_peek_pointer(&value));
// GstState current, pending;
// auto ret = gst_element_get_state(e, &current, &pending, 100000);
// g_print("%s(%s), status = %s, pending = %s\n", G_VALUE_TYPE_NAME(&value), gst_element_get_name(e), gst_element_state_get_name(current), gst_element_state_get_name(pending));
// }
// }
// setup uridecodebin
if (force_software_decoding_) {
g_object_set (G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder")), "force-sw-decoders", true, NULL);
@@ -716,7 +731,7 @@ void MediaPlayer::fill_texture(guint index)
// now that a frame is ready, and once only, browse into the decoder of the pipeline
// for possible hadrware decoding plugins used. Empty string means none.
GstElement *dec = GST_ELEMENT(gst_bin_get_by_name (GST_BIN (pipeline_), "decoder") );
hardware_decoder_ = GstToolkit::used_gpu_decoding_plugins(dec);
hardware_decoder_ = GstToolkit::used_gpu_decoding_plugins(dec).c_str();
}
else {

View File

@@ -1642,7 +1642,7 @@ void MediaController::Render()
// filename
ImGui::Text(" %s", mp_->filename().c_str());
// decoding info
if (Settings::application.render.gpu_decoding)
if (Settings::application.render.gpu_decoding && !mp_->hardwareDecoderName().empty() )
ImGui::Text(" %s (%s hardware decoder)", mp_->media().codec_name.c_str(), mp_->hardwareDecoderName().c_str());
else
ImGui::Text(" %s", mp_->media().codec_name.c_str());