/* Copyright (C) 2005-2019 Mario Stephan This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef MONITORPLAYER_H #define MONITORPLAYER_H #include #include #if defined(Q_OS_WIN32) #include #include #endif #define GST_DISABLE_LOADSAVE 1 #define GST_DISABLE_REGISTRY 1 #define GST_DISABLE_DEPRECATED 1 #include typedef QPair dsDevice; class MonitorPlayer: public QWidget { Q_OBJECT public: MonitorPlayer(QWidget *parent = nullptr); ~MonitorPlayer(); bool prepare(); bool ready(); bool canOpen(QString mime); void open(QUrl url); void play(); void stop(); void pause(); bool close(); void setPosition(QTime); QTime position(); double volume(); void setVolume(double); void disable(); void enable(); bool isDisabled(); QTime length(); bool isPlaying(); bool mediaPlayable(); QStringList outputDevices(); QString outputDeviceName(); QString outputDeviceID(); void setOutputDevice(QString deviceName); void readDevices(); QString defaultDeviceID(); double levelLeft(); double levelRight(); void newpad (GstElement *decodebin, GstPad *pad, gpointer data); static GstBusSyncReply bus_cb (GstBus *bus, GstMessage *msg, gpointer data); Q_SIGNALS: void finish(); void error(); void levelChanged(); void positionChanged(); void loadFinished(); private slots: void loadThreadFinished(); void messageReceived(GstMessage* message); private: struct MonitorPlayerPrivate *p; GstElement *pipeline; GstBus *bus; gint64 Gstart; gint64 Glength; void setLink(int, QUrl&); void asyncOpen(QUrl url); void cleanup(); void sync_set_state(GstElement*, GstState); }; #endif // MONITORPLAYER_H