diff -r db17a60b9b42 -r f9330272e09d gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Fri Mar 23 15:08:55 2007 +0000 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Mon Apr 02 16:02:03 2007 +0100 @@ -280,6 +280,7 @@ static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv); static void gst_nuv_demux_send_eos (GstNuvDemux * nuv); static void gst_nuv_demux_create_seek_index (GstNuvDemux * nuv); +static void gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h); #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) @@ -1051,6 +1052,24 @@ } +static void +gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h) +{ + if ((h->i_type == 'V') && (h->i_keyframe == 0)) { + GSList *lst = g_slist_last (nuv->priv->index); + if (lst != NULL) { + frame_index_data *d = (frame_index_data *) lst->data; + if (d->timecode < h->i_timecode) { + frame_index_data *f = g_new0 (frame_index_data, 1); + f->offset = nuv->priv->offset - 12; + f->timecode = h->i_timecode * GST_MSECOND; + nuv->priv->index = g_slist_append (nuv->priv->index, f); + } + } + } +} + + static GstFlowReturn gst_nuv_demux_play (GstPad * pad) { @@ -1114,6 +1133,7 @@ if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) { goto pause; } + gst_nuv_demux_store_keyframe (nuv, &nuv->priv->fh); break; case GST_NUV_DEMUX_MOVI: