mirror of
https://github.com/KDE/kasts.git
synced 2025-01-28 16:19:56 +01:00
[KMediaSession] disable video output for now
This commit is contained in:
parent
eb07e67f70
commit
e06a90743e
@ -27,6 +27,7 @@ private:
|
||||
GstElement *m_playbin = nullptr;
|
||||
GstElement *m_audioBin = nullptr;
|
||||
GstElement *m_audioSink = nullptr;
|
||||
GstElement *m_videoBin = nullptr;
|
||||
GstElement *m_videoSink = nullptr;
|
||||
GstElement *m_scaleTempo = nullptr;
|
||||
GstElement *m_audioConvert = nullptr;
|
||||
@ -86,23 +87,38 @@ GstMediaBackend::GstMediaBackend(QObject *parent)
|
||||
d->m_scaleTempo = gst_element_factory_make("scaletempo", "scale_tempo");
|
||||
d->m_audioConvert = gst_element_factory_make("audioconvert", "convert");
|
||||
d->m_audioSink = gst_element_factory_make("autoaudiosink", "audio_sink");
|
||||
if (!d->m_scaleTempo || !d->m_audioConvert || !d->m_audioSink) {
|
||||
d->m_videoSink = gst_element_factory_make("fakevideosink", "video_sink");
|
||||
if (!d->m_scaleTempo || !d->m_audioConvert || !d->m_audioSink || !d->m_videoSink) {
|
||||
qCDebug(GstMediaBackendLog) << "Not all elements could be created.";
|
||||
}
|
||||
|
||||
/* Create the sink bin, add the elements and link them */
|
||||
/* Create the audio sink bin, add the elements and link them */
|
||||
d->m_audioBin = gst_bin_new("audio_sink_bin");
|
||||
gst_bin_add_many(GST_BIN(d->m_audioBin), d->m_scaleTempo, d->m_audioConvert, d->m_audioSink, NULL);
|
||||
gst_element_link_many(d->m_scaleTempo, d->m_audioConvert, d->m_audioSink, nullptr);
|
||||
GstPad *pad = gst_element_get_static_pad(d->m_scaleTempo, "sink");
|
||||
GstPad *ghost_pad = gst_ghost_pad_new("sink", pad);
|
||||
gst_pad_set_active(ghost_pad, TRUE);
|
||||
gst_element_add_pad(d->m_audioBin, ghost_pad);
|
||||
gst_object_unref(pad);
|
||||
GstPad *pad_audio = gst_element_get_static_pad(d->m_scaleTempo, "sink");
|
||||
GstPad *ghost_pad_audio = gst_ghost_pad_new("sink", pad_audio);
|
||||
gst_pad_set_active(ghost_pad_audio, TRUE);
|
||||
gst_element_add_pad(d->m_audioBin, ghost_pad_audio);
|
||||
gst_object_unref(pad_audio);
|
||||
|
||||
/* Set playbin's audio sink to be our sink bin */
|
||||
g_object_set(GST_OBJECT(d->m_pipeline), "audio-sink", d->m_audioBin, nullptr);
|
||||
|
||||
/* Create the video sink bin, add the elements and link them */
|
||||
// TODO: handle video (using fakevideosink currently)
|
||||
d->m_videoBin = gst_bin_new("video_sink_bin");
|
||||
gst_bin_add_many(GST_BIN(d->m_audioBin), d->m_videoSink, NULL);
|
||||
// gst_element_link_many(d->m_videoSink, nullptr); // only needed when > 1 element
|
||||
GstPad *pad_video = gst_element_get_static_pad(d->m_videoSink, "sink");
|
||||
GstPad *ghost_pad_video = gst_ghost_pad_new("sink", pad_video);
|
||||
gst_pad_set_active(ghost_pad_video, TRUE);
|
||||
gst_element_add_pad(d->m_videoBin, ghost_pad_video);
|
||||
gst_object_unref(pad_video);
|
||||
|
||||
/* Set playbin's audio sink to be our sink bin */
|
||||
g_object_set(GST_OBJECT(d->m_pipeline), "video-sink", d->m_videoBin, nullptr);
|
||||
|
||||
// get bus and connect to get messages sent through callbacks
|
||||
// TODO: implement fallback in case gmainloop support is not available in qt
|
||||
d->m_bus = gst_element_get_bus(d->m_pipeline);
|
||||
|
@ -92,7 +92,10 @@ VlcMediaBackend::VlcMediaBackend(QObject *parent)
|
||||
qCDebug(VlcMediaBackendLog) << "VlcMediaBackend::VlcMediaBackend";
|
||||
d->mKMediaSession = static_cast<KMediaSession *>(parent);
|
||||
d->mParent = this;
|
||||
d->mInstance = libvlc_new(0, nullptr);
|
||||
|
||||
// TODO: handle video playback
|
||||
const char *cmdLineOption = "--no-video";
|
||||
d->mInstance = libvlc_new(1, &cmdLineOption);
|
||||
|
||||
libvlc_set_user_agent(d->mInstance, d->mKMediaSession->playerName().toUtf8().constData(), d->mKMediaSession->playerName().toUtf8().constData());
|
||||
libvlc_set_app_id(d->mInstance, d->mKMediaSession->desktopEntryName().toUtf8().constData(), "1.0", d->mKMediaSession->playerName().toUtf8().constData());
|
||||
|
Loading…
x
Reference in New Issue
Block a user