[svn r481] implemented dynamic index table trunk
authorrenatofilho
Mon Apr 02 16:02:03 2007 +0100 (2007-04-02)
branchtrunk
changeset 476f9330272e09d
parent 475 2521ec986005
child 477 88bf59e8da5f
[svn r481] implemented dynamic index table
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Sun Apr 01 03:11:01 2007 +0100
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Apr 02 16:02:03 2007 +0100
     1.3 @@ -280,6 +280,7 @@
     1.4  static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
     1.5  static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
     1.6  static void gst_nuv_demux_create_seek_index (GstNuvDemux * nuv);
     1.7 +static void gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h);
     1.8  
     1.9  
    1.10  #if (GST_VERSION_MINOR == 10) && (GST_VERSION_MICRO < 6) 
    1.11 @@ -1051,6 +1052,24 @@
    1.12  }
    1.13  
    1.14  
    1.15 +static void 
    1.16 +gst_nuv_demux_store_keyframe (GstNuvDemux * nuv, nuv_frame_header *h)
    1.17 +{
    1.18 +   if ((h->i_type == 'V') && (h->i_keyframe == 0)) {
    1.19 +      GSList *lst = g_slist_last (nuv->priv->index);
    1.20 +      if (lst != NULL) {
    1.21 +          frame_index_data *d = (frame_index_data *) lst->data;
    1.22 +          if (d->timecode < h->i_timecode) {
    1.23 +              frame_index_data *f = g_new0 (frame_index_data, 1);
    1.24 +              f->offset = nuv->priv->offset - 12;
    1.25 +              f->timecode = h->i_timecode * GST_MSECOND;
    1.26 +              nuv->priv->index = g_slist_append (nuv->priv->index, f);
    1.27 +          }
    1.28 +      }
    1.29 +   }
    1.30 +}
    1.31 +
    1.32 +
    1.33  static GstFlowReturn
    1.34  gst_nuv_demux_play (GstPad * pad)
    1.35  {
    1.36 @@ -1114,6 +1133,7 @@
    1.37        if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
    1.38          goto pause;
    1.39        }
    1.40 +      gst_nuv_demux_store_keyframe (nuv, &nuv->priv->fh);
    1.41        break;
    1.42  
    1.43      case GST_NUV_DEMUX_MOVI: