mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
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:
@@ -38,6 +38,8 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
this.dispatcher = dispatcher;
|
this.dispatcher = dispatcher;
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
|
|
||||||
|
this.gstRegistry = Gst.Registry.get();
|
||||||
|
|
||||||
this._playerSignals = [];
|
this._playerSignals = [];
|
||||||
this._widgetSignals = [];
|
this._widgetSignals = [];
|
||||||
|
|
||||||
@@ -172,6 +174,20 @@ class ClapperPlayer extends GstPlayer.Player
|
|||||||
pipeline.subtitle_font_desc = desc;
|
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)
|
connect(signal, fn)
|
||||||
{
|
{
|
||||||
this._playerSignals.push(super.connect(signal, fn));
|
this._playerSignals.push(super.connect(signal, fn));
|
||||||
|
Reference in New Issue
Block a user