2005-10-27 Wim Taymans <wim@fluendo.com>
+ * ext/theora/theoradec.c: (theora_dec_src_query),
+ (theora_dec_sink_event):
+ * ext/theora/theoraenc.c: (theora_enc_sink_event),
+ (theora_enc_change_state):
+ * ext/vorbis/vorbisenc.c: (gst_vorbisenc_init),
+ (gst_vorbisenc_sink_event), (gst_vorbisenc_change_state):
+ Take proper locks when handling events.
+
+2005-10-27 Wim Taymans <wim@fluendo.com>
+
* gst/adder/gstadder.c: (gst_adder_query), (gst_adder_collected),
(gst_adder_change_state):
Fix timestamps and fix deadlock when stopping the collectpads.
{
GstTheoraEnc *enc;
ogg_packet op;
+ gboolean res;
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
+ GST_STREAM_LOCK (pad);
/* push last packet with eos flag */
while (theora_encode_packetout (&enc->state, 1, &op)) {
GstClockTime out_time =
theora_granule_time (&enc->state, op.granulepos) * GST_SECOND;
+
theora_push_packet (enc, &op, out_time, GST_SECOND / enc->fps);
}
+ res = gst_pad_push_event (enc->srcpad, event);
+ GST_STREAM_UNLOCK (pad);
+ break;
default:
- return gst_pad_event_default (pad, event);
+ res = gst_pad_push_event (enc->srcpad, event);
}
+ return res;
}
static GstFlowReturn
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_STREAM_LOCK (enc->sinkpad);
theora_clear (&enc->state);
theora_comment_clear (&enc->comment);
theora_info_clear (&enc->info);
- GST_STREAM_UNLOCK (enc->sinkpad);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;
vorbisenc->quality_set = FALSE;
vorbisenc->last_message = NULL;
- vorbisenc->setup = FALSE;
- vorbisenc->header_sent = FALSE;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
+ GST_STREAM_LOCK (pad);
/* Tell the library we're at end of stream so that it can handle
* the last frame and mark end of stream in the output properly */
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
gst_vorbisenc_clear (vorbisenc);
- res = gst_pad_event_default (pad, event);
+ res = gst_pad_push_event (vorbisenc->srcpad, event);
+ GST_STREAM_UNLOCK (pad);
break;
case GST_EVENT_TAG:
+ GST_STREAM_LOCK (pad);
if (vorbisenc->tags) {
GstTagList *list;
} else {
g_assert_not_reached ();
}
- res = gst_pad_event_default (pad, event);
+ res = gst_pad_push_event (vorbisenc->srcpad, event);
+ GST_STREAM_UNLOCK (pad);
break;
default:
- res = gst_pad_event_default (pad, event);
+ res = gst_pad_push_event (vorbisenc->srcpad, event);
break;
}
return res;
vorbisenc->tags = gst_tag_list_new ();
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
+ vorbisenc->setup = FALSE;
+ vorbisenc->header_sent = FALSE;
+ break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+ break;
default:
break;
}
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_vorbisenc_clear (vorbisenc);
+ vorbis_block_clear (&vorbisenc->vb);
+ vorbis_dsp_clear (&vorbisenc->vd);
+ vorbis_info_clear (&vorbisenc->vi);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
gst_tag_list_free (vorbisenc->tags);