1 /* 2 * Strawberry Music Player 3 * Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net> 4 * 5 * Strawberry is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Strawberry is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Strawberry. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef GSTSTARTUP_H 21 #define GSTSTARTUP_H 22 23 #include "config.h" 24 25 #include <glib.h> 26 #include <gst/gst.h> 27 28 #include <QtGlobal> 29 #include <QObject> 30 #include <QFuture> 31 32 class GstStartup : public QObject { 33 Q_OBJECT 34 35 public: 36 explicit GstStartup(QObject *parent = nullptr); 37 ~GstStartup() override; 38 EnsureInitialized()39 void EnsureInitialized() { initializing_.waitForFinished(); } 40 41 private: 42 static GThread *kGThread; 43 static gpointer GLibMainLoopThreadFunc(gpointer); 44 45 static void InitializeGStreamer(); 46 static void SetEnvironment(); 47 48 QFuture<void> initializing_; 49 50 }; 51 52 #endif // GSTSTARTUP_H 53