Implemented a detection of hardware decoding used in pipeline

Simple check for names of decoder inside uridecodebin and cross check
with the list of known hardware Decoder Names
This commit is contained in:
brunoherbelin
2021-04-01 00:11:05 +02:00
parent 649d2b7ef7
commit c59994b7e5
6 changed files with 92 additions and 35 deletions

View File

@@ -36,6 +36,7 @@ MediaPlayer::MediaPlayer()
seeking_ = false;
enabled_ = true;
force_software_decoding_ = false;
hardware_decoder_ = "";
rate_ = 1.0;
position_ = GST_CLOCK_TIME_NONE;
desired_state_ = GST_STATE_PAUSED;
@@ -473,6 +474,10 @@ bool MediaPlayer::isImage() const
return media_.isimage;
}
std::string MediaPlayer::hardwareDecoderName()
{
return hardware_decoder_;
}
bool MediaPlayer::softwareDecodingForced()
{
@@ -708,6 +713,11 @@ void MediaPlayer::fill_texture(guint index)
// initialize texture
init_texture(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);
}
else {
glBindTexture(GL_TEXTURE_2D, textureindex_);