diff options
author | Tim Blechmann <tim@klingt.org> | 2024-02-16 11:59:19 +0800 |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2024-02-21 18:19:52 +0800 |
commit | a43f30ee4c4aedefaee7e870edbd309180c48ccb (patch) | |
tree | 6853f3c14176ff431c9b67725e0d3959e6e3ae36 /src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp | |
parent | 6e2503b866373e8dc747764a49e003c1f36c0b3f (diff) |
gstreamer: separate out handle types
We have a few (unique) handles based on QUniqueHandle. Separating them
out into a new header and consolidating their use to make the codebase
easier to reason about.
Pick-to: 6.5 6.6 6.7
Change-Id: Id89150e8178723ff68eb3921eb05a3dd83fe7694
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp')
-rw-r--r-- | src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp b/src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp index e52debcef..5f3aefe4b 100644 --- a/src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp +++ b/src/plugins/multimedia/gstreamer/audio/qgstreameraudiosink.cpp @@ -11,11 +11,11 @@ #include <sys/types.h> #include <unistd.h> -#include <qgstpipeline_p.h> +#include <qgst_debug_p.h> #include <qgstappsrc_p.h> - -#include <qgstutils_p.h> +#include <qgstpipeline_p.h> #include <qgstreamermessage_p.h> +#include <qgstutils_p.h> #include <utility> @@ -61,7 +61,7 @@ QGStreamerAudioSink::QGStreamerAudioSink(const QAudioDevice &device, QGstAppSrc // g_signal_connect (gstDecodeBin, "pad-added", (GCallback) padAdded, conv); const auto *audioInfo = static_cast<const QGStreamerAudioDeviceInfo *>(device.handle()); - gstOutput = QGstElement(gst_device_create_element(audioInfo->gstDevice, nullptr)); + gstOutput = QGstElement(gst_device_create_element(audioInfo->gstDevice.get(), nullptr)); gstPipeline.add(gstAppSrc, queue, /*gstDecodeBin, */ audioconvert, gstVolume, gstOutput); gstAppSrc.link(queue, audioconvert, gstVolume, gstOutput); @@ -159,9 +159,8 @@ static void padAdded(GstElement *element, GstPad *pad, gpointer data) { GstElement *other = static_cast<GstElement *>(data); - gchar *name = gst_pad_get_name(pad); + QGString name { gst_pad_get_name(pad)}; qDebug("A new pad %s was created for %s\n", name, gst_element_get_name(element)); - g_free(name); qDebug("element %s will be linked to %s\n", gst_element_get_name(element), @@ -179,14 +178,11 @@ bool QGStreamerAudioSink::processBusMessage(const QGstreamerMessage &message) break; case GST_MESSAGE_ERROR: { setError(QAudio::IOError); - gchar *debug; - GError *error; - - gst_message_parse_error (msg, &error, &debug); - g_free (debug); + QUniqueGErrorHandle error; + QGString debug; - qDebug("Error: %s\n", error->message); - g_error_free (error); + gst_message_parse_error(msg, &error, &debug); + qDebug() << "Error:" << error; break; } |