Changed behavior of MediaPlayer: offer to either follow the active

source or to show a fixed MediaPlayer. List of available mediaplayers is
maintained statically at the level of MediaPlayer class.
This commit is contained in:
brunoherbelin
2020-07-10 19:01:17 +02:00
parent 9be5495a05
commit b837e7bf8b
5 changed files with 203 additions and 104 deletions

View File

@@ -6,6 +6,7 @@
#include <sstream>
#include <set>
#include <list>
#include <map>
#include <utility>
#include <gst/gst.h>
@@ -215,12 +216,21 @@ public:
* Get name of the media
* */
std::string uri() const;
std::string filename() const;
/**
* Accept visitors
* */
void accept(Visitor& v);
/**
* @brief registered
* @return list of media players currently registered
*/
static std::list<MediaPlayer*> registered() { return registered_; }
static std::list<MediaPlayer*>::const_iterator begin() { return registered_.cbegin(); }
static std::list<MediaPlayer*>::const_iterator end() { return registered_.cend(); }
private:
bool addPlaySegment(GstClockTime begin, GstClockTime end);
@@ -230,6 +240,7 @@ private:
std::list< std::pair<guint64, guint64> > getPlaySegments() const;
std::string id_;
std::string filename_;
std::string uri_;
guint textureindex_;
guint width_;
@@ -279,6 +290,7 @@ private:
static void callback_discoverer_process (GstDiscoverer *discoverer, GstDiscovererInfo *info, GError *err, MediaPlayer *m);
static void callback_discoverer_finished(GstDiscoverer *discoverer, MediaPlayer *m);
static std::list<MediaPlayer*> registered_;
};