[MOVED FROM GST-P-FARSIGHT] using the unlock method of basesrc

20070913212145-4f0f6-0e438a681bf1651c0cc0d8fa3269aed3f1668b6b.gz
This commit is contained in:
Youness Alaoui 2007-09-13 21:21:45 +00:00 committed by Edward Hervey
parent 1b38cedd80
commit 7c7d210fd0

View file

@ -253,6 +253,7 @@ static void gst_dtmf_src_add_stop_event (GstDTMFSrc *dtmfsrc);
static void gst_dtmf_src_get_times (GstBaseSrc * basesrc, static void gst_dtmf_src_get_times (GstBaseSrc * basesrc,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end); GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_dtmf_src_unlock (GstBaseSrc *src);
static void static void
@ -294,6 +295,8 @@ gst_dtmf_src_class_init (GstDTMFSrcClass * klass)
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_dtmf_src_change_state); GST_DEBUG_FUNCPTR (gst_dtmf_src_change_state);
gstbasesrc_class->unlock =
GST_DEBUG_FUNCPTR (gst_dtmf_src_unlock);
gstbasesrc_class->event = gstbasesrc_class->event =
GST_DEBUG_FUNCPTR (gst_dtmf_src_handle_event); GST_DEBUG_FUNCPTR (gst_dtmf_src_handle_event);
@ -301,6 +304,7 @@ gst_dtmf_src_class_init (GstDTMFSrcClass * klass)
GST_DEBUG_FUNCPTR (gst_dtmf_src_get_times); GST_DEBUG_FUNCPTR (gst_dtmf_src_get_times);
gstbasesrc_class->create = gstbasesrc_class->create =
GST_DEBUG_FUNCPTR (gst_dtmf_src_create); GST_DEBUG_FUNCPTR (gst_dtmf_src_create);
} }
@ -724,6 +728,19 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
} }
static gboolean
gst_dtmf_src_unlock (GstBaseSrc *src) {
GstDTMFSrc *dtmfsrc = GST_DTMF_SRC (src);
GstDTMFSrcEvent *event = NULL;
GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK even on PAUSED_TO_READY change");
event = g_malloc (sizeof(GstDTMFSrcEvent));
event->event_type = DTMF_EVENT_TYPE_PAUSE_TASK;
g_async_queue_push (dtmfsrc->event_queue, event);
return TRUE;
}
static GstStateChangeReturn static GstStateChangeReturn
gst_dtmf_src_change_state (GstElement * element, GstStateChange transition) gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
{ {
@ -756,13 +773,17 @@ gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_DEBUG_OBJECT (dtmfsrc, "PLAYING TO PAUSED");
if (dtmfsrc->last_event) { if (dtmfsrc->last_event) {
GST_DEBUG_OBJECT (dtmfsrc, "Stopping current event");
/* Don't forget to release the stream lock */ /* Don't forget to release the stream lock */
gst_dtmf_src_set_stream_lock (dtmfsrc, FALSE); gst_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
g_free (dtmfsrc->last_event); g_free (dtmfsrc->last_event);
dtmfsrc->last_event = NULL; dtmfsrc->last_event = NULL;
} }
GST_DEBUG_OBJECT (dtmfsrc, "Flushing event queue");
/* Flushing the event queue */ /* Flushing the event queue */
event = g_async_queue_try_pop (dtmfsrc->event_queue); event = g_async_queue_try_pop (dtmfsrc->event_queue);
@ -774,13 +795,6 @@ gst_dtmf_src_change_state (GstElement * element, GstStateChange transition)
/* Indicate that we don't do PRE_ROLL */ /* Indicate that we don't do PRE_ROLL */
no_preroll = TRUE; no_preroll = TRUE;
break; break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK even on PAUSED_TO_READY change");
event = g_malloc (sizeof(GstDTMFSrcEvent));
event->event_type = DTMF_EVENT_TYPE_PAUSE_TASK;
g_async_queue_push (dtmfsrc->event_queue, event);
event = NULL;
default: default:
break; break;
} }