Support changing rank of codecs

The used GStreamer codecs are picked using rank hierarchy. When there are 2 or more decoders available that can handle the same stream type, the one with higher rank is always picked. This commit adds a function for the codec rank manipulation that can be used for e.g. force disable/enable VAAPI. Should be a neat feature once we have a settings dialog where it can be used.
This commit is contained in:
Rafostar
2020-09-13 20:21:46 +02:00
parent c34df72f96
commit 71659491c0

View File

@@ -38,6 +38,8 @@ class ClapperPlayer extends GstPlayer.Player
this.dispatcher = dispatcher;
this.renderer = renderer;
this.gstRegistry = Gst.Registry.get();
this._playerSignals = [];
this._widgetSignals = [];
@@ -172,6 +174,20 @@ class ClapperPlayer extends GstPlayer.Player
pipeline.subtitle_font_desc = desc;
}
set_codec_rank(codec, rank)
{
debug(`changing rank of codec: ${codec}`);
let feature = this.gstRegistry.lookup_feature(codec);
if(!feature)
return debug(`codec unavailable: ${codec}`);
let oldRank = feature.get_rank();
feature.set_rank(rank);
debug(`changed rank: ${oldRank} -> ${rank} for ${codec}`);
}
connect(signal, fn)
{
this._playerSignals.push(super.connect(signal, fn));