+2005-04-01 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
+ (gst_ffmpegdec_open), (gst_ffmpegdec_frame),
+ (gst_ffmpegdec_handle_event):
+ Implement keyframe syncing.
+
2005-03-14 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
gint channels, samplerate;
} audio;
} format;
+ gboolean waiting_for_key;
guint64 next_ts;
/* parsing */
ffmpegdec->pcache = NULL;
ffmpegdec->par = NULL;
ffmpegdec->opened = FALSE;
+ ffmpegdec->waiting_for_key = FALSE;
ffmpegdec->hurry_up = ffmpegdec->lowres = 0;
GST_FLAG_SET (ffmpegdec, GST_ELEMENT_EVENT_AWARE);
default:
break;
}
+ ffmpegdec->waiting_for_key = TRUE;
ffmpegdec->next_ts = 0;
return TRUE;
GST_DEBUG_OBJECT (ffmpegdec,
"Decode video: len=%d, have_data=%d", len, have_data);
- if (len >= 0 && have_data > 0) {
+ if (ffmpegdec->waiting_for_key &&
+ ffmpegdec->picture->pict_type != FF_I_TYPE) {
+ have_data = 0;
+ } else if (len >= 0 && have_data > 0) {
/* libavcodec constantly crashes on stupid buffer allocation
* errors inside. This drives me crazy, so we let it allocate
* it's own buffers and copy to our own buffer afterwards... */
gint fsize = gst_ffmpeg_avpicture_get_size (ffmpegdec->context->pix_fmt,
ffmpegdec->context->width, ffmpegdec->context->height);
+ ffmpegdec->waiting_for_key = FALSE;
outbuf = gst_buffer_new_and_alloc (fsize);
/* original ffmpeg code does not handle odd sizes correctly.
}
if (ffmpegdec->opened) {
avcodec_flush_buffers (ffmpegdec->context);
+ ffmpegdec->waiting_for_key = TRUE;
}
/* fall-through */
}