From cc0da016f802e698ba4bc34997139ae62c935bb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 3 Jul 2009 04:41:05 -0400 Subject: [PATCH] audiosrc: Add stream-status messages See #587695 --- gst-libs/gst/audio/gstaudiosrc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c index 4541b9d..e5e0713 100644 --- a/gst-libs/gst/audio/gstaudiosrc.c +++ b/gst-libs/gst/audio/gstaudiosrc.c @@ -199,6 +199,8 @@ audioringbuffer_thread_func (GstRingBuffer * buf) GstAudioSrcClass *csrc; GstAudioRingBuffer *abuf = GST_AUDIORING_BUFFER (buf); ReadFunc readfunc; + GstMessage *message; + GValue val = { 0 }; src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf)); csrc = GST_AUDIO_SRC_GET_CLASS (src); @@ -209,6 +211,14 @@ audioringbuffer_thread_func (GstRingBuffer * buf) if (readfunc == NULL) goto no_function; + g_value_init (&val, G_TYPE_POINTER); + g_value_set_pointer (&val, src->thread); + message = gst_message_new_stream_status (GST_OBJECT_CAST (buf), + GST_STREAM_STATUS_TYPE_ENTER, GST_ELEMENT_CAST (src)); + gst_message_set_stream_status_object (message, &val); + GST_DEBUG_OBJECT (src, "posting ENTER stream status"); + gst_element_post_message (GST_ELEMENT_CAST (src), message); + while (TRUE) { gint left, len; guint8 *readptr; @@ -251,6 +261,7 @@ audioringbuffer_thread_func (GstRingBuffer * buf) } /* Will never be reached */ + g_assert_not_reached (); return; /* ERROR */ @@ -263,6 +274,11 @@ stop_running: { GST_OBJECT_UNLOCK (abuf); GST_DEBUG ("stop running, exit thread"); + message = gst_message_new_stream_status (GST_OBJECT_CAST (buf), + GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (src)); + gst_message_set_stream_status_object (message, &val); + GST_DEBUG_OBJECT (src, "posting LEAVE stream status"); + gst_element_post_message (GST_ELEMENT_CAST (src), message); return; } } -- 2.7.4