+2007-04-19 Michael Smith <msmith@fluendo.com>
+
+ * ext/theora/gsttheoraenc.h:
+ * ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
+ (theora_enc_sink_event), (theora_enc_change_state):
+ Track initialisation state; don't try to use encoder state if we're
+ not initialised (it'll segfault).
+
2007-04-18 Stefan Kost <ensonic@users.sf.net>
* tests/check/pipelines/.cvsignore:
enc->info.keyframe_frequency_force, enc->granule_shift);
theora_enc_reset (enc);
+ enc->initialised = TRUE;
gst_object_unref (enc);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- /* push last packet with eos flag */
- while (theora_encode_packetout (&enc->state, 1, &op)) {
- /* See comment in the chain function */
- GstClockTime next_time = theora_granule_time (&enc->state,
- granulepos_add (op.granulepos, 1, enc->granule_shift)) * GST_SECOND;
-
- theora_push_packet (enc, &op, enc->next_ts, next_time - enc->next_ts);
- enc->next_ts = next_time;
+ if (enc->initialised) {
+ /* push last packet with eos flag */
+ while (theora_encode_packetout (&enc->state, 1, &op)) {
+ /* See comment in the chain function */
+ GstClockTime next_time = theora_granule_time (&enc->state,
+ granulepos_add (op.granulepos, 1, enc->granule_shift)) *
+ GST_SECOND;
+
+ theora_push_packet (enc, &op, enc->next_ts, next_time - enc->next_ts);
+ enc->next_ts = next_time;
+ }
}
res = gst_pad_push_event (enc->srcpad, event);
break;
theora_info_clear (&enc->info);
theora_enc_clear (enc);
+ enc->initialised = FALSE;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;