Search
SailfishOS Open Build Service
>
Projects
>
home:wdehoog
>
qtmultimedia
> _service:tar_git:001-configure-pipeline-properties.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File _service:tar_git:001-configure-pipeline-properties.patch of Package qtmultimedia
- debug info on used flags - load playbin properties from settings - example .config/qtmultimedia/settings.conf [playbin] buffer-size=256000 ;buffer-duration=5000000 ;ring-buffer-max-size=64000 ;connection-speed=128000 flags=0x182 diff -u -r upstream\src\plugins\gstreamer\audiodecoder\audiodecoder.pro qtmultimedia-mer-5.6\src\plugins\gstreamer\audiodecoder\audiodecoder.pro --- src/plugins/gstreamer/audiodecoder/audiodecoder.pro Fri Sep 29 20:38:02 2017 +++ src/plugins/gstreamer/audiodecoder/audiodecoder.pro Fri Sep 29 22:24:11 2017 @@ -19,6 +19,8 @@ OTHER_FILES += \ audiodecoder.json +CONFIG += console + PLUGIN_TYPE = mediaservice PLUGIN_CLASS_NAME = QGstreamerAudioDecoderServicePlugin load(qt_plugin) diff -u -r upstream\src\plugins\gstreamer\audiodecoder\qgstreameraudiodecodersession.cpp qtmultimedia-mer-5.6\src\plugins\gstreamer\audiodecoder\qgstreameraudiodecodersession.cpp --- src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp Fri Sep 29 20:38:02 2017 +++ src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp Fri Sep 29 20:55:26 2017 @@ -51,6 +51,8 @@ #define MAX_BUFFERS_IN_QUEUE 4 +#include <iostream> + QT_BEGIN_NAMESPACE typedef enum { @@ -85,9 +87,15 @@ m_durationQueries(0) { // Create pipeline here + std::cerr << "QGstreamerAudioDecoderSession - try to make " << QT_GSTREAMER_PLAYBIN_ELEMENT_NAME; m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL); if (m_playbin != 0) { + + int flags = GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO; + QByteArray envFlags = qgetenv("QT_GSTREAMER_PLAYBIN_FLAGS"); + + g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL); // Sort out messages m_bus = gst_element_get_bus(m_playbin); m_busHelper = new QGstreamerBusHelper(m_bus, this); @@ -527,12 +535,24 @@ int flags = 0; if (m_playbin) { g_object_get(G_OBJECT(m_playbin), "flags", &flags, NULL); - // make sure not to use GST_PLAY_FLAG_NATIVE_AUDIO unless desired - // it prevents audio format conversion flags &= ~(GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_TEXT | GST_PLAY_FLAG_VIS | GST_PLAY_FLAG_NATIVE_AUDIO); - flags |= GST_PLAY_FLAG_AUDIO; + + QByteArray envFlags = qgetenv("QT_GSTREAMER_PLAYBIN_FLAGS"); + if (!envFlags.isEmpty()) { + bool ok; + flags |= envFlags.toInt(&ok, 0); + std::cerr << "QGstreamerPlayerSession - using configured flags: 0x" << std::hex << flags; +#if !GST_CHECK_VERSION(1,0,0) + } else { + std::cerr << "QGstreamerPlayerSession - using fixed flags"; + // make sure not to use GST_PLAY_FLAG_NATIVE_AUDIO unless desired + // it prevents audio format conversion + flags |= GST_PLAY_FLAG_AUDIO; +#endif + } + if (wantNativeAudio) - flags |= GST_PLAY_FLAG_NATIVE_AUDIO; + flags |= GST_PLAY_FLAG_NATIVE_AUDIO; g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL); } } diff -u -r upstream\src\plugins\gstreamer\mediaplayer\mediaplayer.pro qtmultimedia-mer-5.6\src\plugins\gstreamer\mediaplayer\mediaplayer.pro --- src/plugins/gstreamer/mediaplayer/mediaplayer.pro Fri Sep 29 20:38:05 2017 +++ src/plugins/gstreamer/mediaplayer/mediaplayer.pro Fri Sep 29 22:24:29 2017 @@ -25,6 +25,8 @@ OTHER_FILES += \ mediaplayer.json +CONFIG += console + PLUGIN_TYPE = mediaservice PLUGIN_CLASS_NAME = QGstreamerPlayerServicePlugin load(qt_plugin) diff -u -r upstream\src\plugins\gstreamer\mediaplayer\qgstreamerplayersession.cpp qtmultimedia-mer-5.6\src\plugins\gstreamer\mediaplayer\qgstreamerplayersession.cpp --- src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp Fri Sep 29 20:38:05 2017 +++ src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp Fri Sep 29 20:55:41 2017 @@ -56,6 +56,9 @@ #include <QtCore/qdir.h> #include <QtCore/qstandardpaths.h> +#include <iostream> +#include <QSettings> + //#define DEBUG_PLAYBIN //#define DEBUG_VO_BIN_DUMP @@ -145,7 +148,15 @@ Q_ASSERT(result == TRUE); Q_UNUSED(result); - m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL); + // any config? (.config/qtmultimedia/settings.conf) + QSettings settings("qtmultimedia", "settings"); + + QString playbinElementName = QT_GSTREAMER_PLAYBIN_ELEMENT_NAME; + if(settings.contains("playbin/playbin-name")) + playbinElementName = settings.value("playbin/playbin-name").toString(); + m_playbin = gst_element_factory_make(playbinElementName.toStdString().c_str(), NULL); + qInfo() << "QGstreamerPlayerSession - created " << playbinElementName; + if (m_playbin) { //GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale, //since those elements are included in the video output bin when necessary. @@ -156,16 +167,51 @@ int flags = GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO; QByteArray envFlags = qgetenv("QT_GSTREAMER_PLAYBIN_FLAGS"); if (!envFlags.isEmpty()) { - flags |= envFlags.toInt(); + bool ok; + flags |= envFlags.toInt(&ok, 0); + qInfo("QGstreamerPlayerSession - Loaded from QT_GSTREAMER_PLAYBIN_FLAGS flags: 0x%0X", flags); #if !GST_CHECK_VERSION(1,0,0) } else { flags |= GST_PLAY_FLAG_NATIVE_VIDEO; #endif } #endif + + if(settings.contains("playbin/buffer-duration")) { + int bufferDuration = settings.value("playbin/buffer-duration").toInt(); + g_object_set(G_OBJECT(m_playbin), "buffer-duration", bufferDuration, NULL); + qInfo() << "QGstreamerPlayerSession - Loaded from settings buffer-duration=" << bufferDuration; + } + if(settings.contains("playbin/buffer-size")) { + int bufferSize = settings.value("playbin/buffer-size").toInt(); + g_object_set(G_OBJECT(m_playbin), "buffer-size", bufferSize, NULL); + qInfo() << "QGstreamerPlayerSession - Loaded from settings buffer-size=" << bufferSize; + } + if(settings.contains("playbin/ring-buffer-max-size")) { + int ringBufferMaxSize = settings.value("playbin/ring-buffer-max-size").toInt(); + g_object_set(G_OBJECT(m_playbin), "ring-buffer-max-size", ringBufferMaxSize, NULL); + qInfo() << "QGstreamerPlayerSession - Loaded from settings ring-buffer-max-size=" << ringBufferMaxSize; + } + if(settings.contains("playbin/connection-speed")) { + int speed = settings.value("playbin/connection-speed").toInt(); + g_object_set(G_OBJECT(m_playbin), "connection-speed", speed, NULL); + qInfo() << "QGstreamerPlayerSession - Loaded from settings connection-speed=" << speed; + } + if(settings.contains("playbin/flags")) { + QString flagsString = settings.value("playbin/flags").toString(); + bool ok; + flags = flagsString.toInt(&ok, 0); + qInfo("QGstreamerPlayerSession - Loaded from settings flags: 0x%0X", flags); + } + g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL); - GstElement *audioSink = gst_element_factory_make("autoaudiosink", "audiosink"); + QString audioSinkName = "autoaudiosink"; + if(settings.contains("playbin/audiosink-name")) + audioSinkName = settings.value("playbin/audiosink-name").toString(); + GstElement *audioSink = gst_element_factory_make(audioSinkName.toStdString().c_str(), "audiosink"); + qInfo() << "QGstreamerPlayerSession - Created audiosink " << audioSinkName; + if (audioSink) { if (usePlaybinVolume()) { m_audioSink = audioSink;