Upgrade MediaPlayer with gstreamer playbin (for GST > 18)

Change implementation of gst pipeline in MediaPlayer to use gstreamer playbin. This makes everything works more smoothly (including instant rate change). This also opens the possibility to allow audio mixing. Other bugfixes include set play speed rate at start, add video effects on reopen media player.
This commit is contained in:
Bruno Herbelin
2023-08-07 19:40:08 +02:00
parent 1b658e9b40
commit 5419622c74
5 changed files with 282 additions and 150 deletions

View File

@@ -252,6 +252,12 @@ public:
* */
inline void setSyncToMetronome(Metronome::Synchronicity s) { metro_sync_ = s; }
inline Metronome::Synchronicity syncToMetronome() const { return metro_sync_; }
/**
* Adds a video effect into the gstreamer pipeline
* NB: setVideoEffect reopens the video
* */
void setVideoEffect(const std::string &pipeline_element);
inline std::string videoEffect() { return video_filter_; }
/**
* Accept visitors
* */
@@ -267,7 +273,6 @@ public:
static MediaInfo UriDiscoverer(const std::string &uri);
std::string log() const { return media_.log; }
bool setEffect(const std::string &pipeline_element);
private:
@@ -284,7 +289,6 @@ private:
// GST & Play status
GstClockTime position_;
gdouble rate_;
LoopMode loop_;
GstState desired_state_;
GstElement *pipeline_;
@@ -297,8 +301,18 @@ private:
bool enabled_;
bool rewind_on_disable_;
bool force_software_decoding_;
bool force_basic_speedchange_;
std::string decoder_name_;
std::string video_filter_;
// Play speed
gdouble rate_;
typedef enum {
RATE_CHANGE_NONE = 0,
RATE_CHANGE_INSTANT = 1,
RATE_CHANGE_FLUSH = 2
} RateChangeMode;
RateChangeMode rate_change_;
Metronome::Synchronicity metro_sync_;
// fps counter