assrender: Return WRONG_STATE from the subtitle chain when flushing

This commit is contained in:
Sebastian Dröge 2009-11-04 13:11:44 +01:00
parent e38fbc6795
commit 4c625bd569
2 changed files with 9 additions and 1 deletions

View file

@ -262,8 +262,10 @@ gst_assrender_change_state (GstElement * element, GstStateChange transition)
GstStateChangeReturn ret;
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
case GST_STATE_CHANGE_READY_TO_PAUSED:
render->subtitle_flushing = FALSE;
break;
case GST_STATE_CHANGE_NULL_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
default:
break;
@ -612,6 +614,9 @@ gst_assrender_chain_text (GstPad * pad, GstBuffer * buffer)
render = GST_ASSRENDER (GST_PAD_PARENT (pad));
if (render->subtitle_flushing)
return GST_FLOW_WRONG_STATE;
timestamp = GST_BUFFER_TIMESTAMP (buffer);
if (timestamp > render->video_segment.last_stop) {
@ -741,6 +746,7 @@ gst_assrender_event_text (GstPad * pad, GstEvent * event)
break;
}
case GST_EVENT_FLUSH_STOP:
render->subtitle_flushing = FALSE;
gst_event_unref (event);
ret = TRUE;
break;
@ -761,6 +767,7 @@ gst_assrender_event_text (GstPad * pad, GstEvent * event)
if (render->subtitle_pending)
gst_buffer_unref (render->subtitle_pending);
render->subtitle_pending = NULL;
render->subtitle_flushing = TRUE;
g_cond_signal (render->subtitle_cond);
g_mutex_unlock (render->subtitle_mutex);
gst_event_unref (event);

View file

@ -55,6 +55,7 @@ struct _Gstassrender
GMutex *subtitle_mutex;
GCond *subtitle_cond;
GstBuffer *subtitle_pending;
gboolean subtitle_flushing;
ASS_Library *ass_library;
ASS_Renderer *ass_renderer;