# HG changeset patch # User renatofilho # Date 1175526123 -3600 # Node ID f9330272e09deceef092920f2912ec8433f8e6dc # Parent 2521ec986005354e907a6418276bff9438cf251f [svn r481] implemented dynamic index table diff -r 2521ec986005 -r f9330272e09d gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c Sun Apr 01 03:11:01 2007 +0100 +++ 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: