Flow of PAUSE request from gstreamer to upper QT application.

Sebastian Dröge sebastian at centricular.com
Mon Dec 2 00:10:44 PST 2013


On Sa, 2013-11-30 at 03:16 -0800, sathish wrote:
> Hi,
> 
> I have a request to CORK/PAUSE from Pulseaudio. This initiates the function
> "gst_pulsering_stream_event_cb" in program pulsesink.c. I have pasted the
> function below..
> 
> static void
> gst_pulsering_stream_event_cb (pa_stream * p, const char *name,
>     pa_proplist * pl, void *userdata)
> {
>   GstPulseSink *psink;
>   GstPulseRingBuffer *pbuf;
> 
>   pbuf = GST_PULSERING_BUFFER_CAST (userdata);
>   psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
> 
>  * if (!strcmp (name, PA_STREAM_EVENT_REQUEST_CORK)) {
>     /* the stream wants to PAUSE, post a message for the application. */
>     GST_DEBUG_OBJECT (psink, "got request for CORK");
>     gst_element_post_message (GST_ELEMENT_CAST (psink),
>         gst_message_new_request_state (GST_OBJECT_CAST (psink),
>             GST_STATE_PAUSED));
> *
>   } else if (!strcmp (name, PA_STREAM_EVENT_REQUEST_UNCORK)) {
>     GST_DEBUG_OBJECT (psink, "got request for UNCORK");
>     gst_element_post_message (GST_ELEMENT_CAST (psink),
>         gst_message_new_request_state (GST_OBJECT_CAST (psink),
>             GST_STATE_PLAYING));
>   } else if (!strcmp (name, PA_STREAM_EVENT_FORMAT_LOST)) {
>     GstEvent *renego;
> 
>     if (g_atomic_int_get (&psink->format_lost)) {
>       /* Duplicate event before we're done reconfiguring, discard */
>       return;
>     }
> 
>     GST_DEBUG_OBJECT (psink, "got FORMAT LOST");
>     g_atomic_int_set (&psink->format_lost, 1);
>     psink->format_lost_time = g_ascii_strtoull (pa_proplist_gets (pl,
>             "stream-time"), NULL, 0) * 1000;
> 
>     g_free (psink->device);
>     psink->device = g_strdup (pa_proplist_gets (pl, "device"));
> 
>     /* FIXME: send reconfigure event instead and let decodebin/playbin
>      * handle that. Also take care of ac3 alignment */
>     renego = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM,
>         gst_structure_new_empty ("pulse-format-lost"));
> 
> #if 0
>     if (g_str_equal (gst_structure_get_name (st), "audio/x-eac3")) {
>       GstStructure *event_st = gst_structure_new ("ac3parse-set-alignment",
>           "alignment", G_TYPE_STRING, pbin->dbin ? "frame" : "iec61937",
> NULL);
> 
>       if (!gst_pad_push_event (pbin->sinkpad,
>               gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, event_st)))
>         GST_WARNING_OBJECT (pbin->sinkpad, "Could not update alignment");
>     }
> #endif
> 
>     if (!gst_pad_push_event (GST_BASE_SINK (psink)->sinkpad, renego)) {
>       /* Nobody handled the format change - emit an error */
>       GST_ELEMENT_ERROR (psink, STREAM, FORMAT, ("Sink format changed"),
>           ("Sink format changed"));
>     }
>   } else {
>     GST_DEBUG_OBJECT (psink, "got unknown event %s", name);
>   }
> }
> 
> 
> This request (highlited part) needs to communicated to my upper level QT
> application.
> 
> QT communicates with GSTREAMER through "PHONON - GSTREAMER BACKEND"..
> 
>  I am exactly not sure how the message posted in the function
> "gst_pulsering_stream_event_cb" in program pulsesink.c reaches the
> phonon-gstreamer backend and proceeds then on.
> 
> In short, how to find which function catches the bus message. 
> 
> I had tried to look at PHONON source code.. I could deduce to this position
> only..
> 
> I feel that function "MediaObject::handleBusMessage(const Message &message)"
> is called. Can anybody tell whether this correct or a way to validate how
> this can be verified ??

This is probably not the best place to ask about issues with Phonon and
its GStreamer backend, you probably better ask the developers of that.

However when shortly looking at the code I don't see it handling the
request-state message at all. This would need to be implemented. As
Phonon is a very high-level abstraction of a media playback API, I would
expect it to handle that internally without the application having to
worry about that.

-- 
Sebastian Dröge <sebastian at centricular.com>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131202/63788c3a/attachment-0001.pgp>


More information about the gstreamer-devel mailing list