[svn r445] bug fix trunk
authorrenatofilho
Fri Mar 23 13:56:18 2007 +0000 (2007-03-23)
branchtrunk
changeset 4401a9af071ab1f
parent 439 ee220ab67ffd
child 441 f310d1d086b5
[svn r445] bug fix
gst-plugins-nuvdemux/INSTALL
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
     1.1 --- a/gst-plugins-nuvdemux/INSTALL	Fri Mar 23 13:52:12 2007 +0000
     1.2 +++ b/gst-plugins-nuvdemux/INSTALL	Fri Mar 23 13:56:18 2007 +0000
     1.3 @@ -1,13 +1,16 @@
     1.4 -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
     1.5 -Foundation, Inc.
     1.6 +Installation Instructions
     1.7 +*************************
     1.8  
     1.9 -   This file is free documentation; the Free Software Foundation gives
    1.10 +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
    1.11 +Software Foundation, Inc.
    1.12 +
    1.13 +This file is free documentation; the Free Software Foundation gives
    1.14  unlimited permission to copy, distribute and modify it.
    1.15  
    1.16  Basic Installation
    1.17  ==================
    1.18  
    1.19 -   These are generic installation instructions.
    1.20 +These are generic installation instructions.
    1.21  
    1.22     The `configure' shell script attempts to guess correct values for
    1.23  various system-dependent variables used during compilation.  It uses
    1.24 @@ -67,9 +70,9 @@
    1.25  Compilers and Options
    1.26  =====================
    1.27  
    1.28 -   Some systems require unusual options for compilation or linking that
    1.29 -the `configure' script does not know about.  Run `./configure --help'
    1.30 -for details on some of the pertinent environment variables.
    1.31 +Some systems require unusual options for compilation or linking that the
    1.32 +`configure' script does not know about.  Run `./configure --help' for
    1.33 +details on some of the pertinent environment variables.
    1.34  
    1.35     You can give `configure' initial values for configuration parameters
    1.36  by setting variables in the command line or in the environment.  Here
    1.37 @@ -82,7 +85,7 @@
    1.38  Compiling For Multiple Architectures
    1.39  ====================================
    1.40  
    1.41 -   You can compile the package for more than one kind of computer at the
    1.42 +You can compile the package for more than one kind of computer at the
    1.43  same time, by placing the object files for each architecture in their
    1.44  own directory.  To do this, you must use a version of `make' that
    1.45  supports the `VPATH' variable, such as GNU `make'.  `cd' to the
    1.46 @@ -99,19 +102,19 @@
    1.47  Installation Names
    1.48  ==================
    1.49  
    1.50 -   By default, `make install' will install the package's files in
    1.51 -`/usr/local/bin', `/usr/local/man', etc.  You can specify an
    1.52 -installation prefix other than `/usr/local' by giving `configure' the
    1.53 -option `--prefix=PATH'.
    1.54 +By default, `make install' installs the package's commands under
    1.55 +`/usr/local/bin', include files under `/usr/local/include', etc.  You
    1.56 +can specify an installation prefix other than `/usr/local' by giving
    1.57 +`configure' the option `--prefix=PREFIX'.
    1.58  
    1.59     You can specify separate installation prefixes for
    1.60  architecture-specific files and architecture-independent files.  If you
    1.61 -give `configure' the option `--exec-prefix=PATH', the package will use
    1.62 -PATH as the prefix for installing programs and libraries.
    1.63 -Documentation and other data files will still use the regular prefix.
    1.64 +pass the option `--exec-prefix=PREFIX' to `configure', the package uses
    1.65 +PREFIX as the prefix for installing programs and libraries.
    1.66 +Documentation and other data files still use the regular prefix.
    1.67  
    1.68     In addition, if you use an unusual directory layout you can give
    1.69 -options like `--bindir=PATH' to specify different values for particular
    1.70 +options like `--bindir=DIR' to specify different values for particular
    1.71  kinds of files.  Run `configure --help' for a list of the directories
    1.72  you can set and what kinds of files go in them.
    1.73  
    1.74 @@ -122,7 +125,7 @@
    1.75  Optional Features
    1.76  =================
    1.77  
    1.78 -   Some packages pay attention to `--enable-FEATURE' options to
    1.79 +Some packages pay attention to `--enable-FEATURE' options to
    1.80  `configure', where FEATURE indicates an optional part of the package.
    1.81  They may also pay attention to `--with-PACKAGE' options, where PACKAGE
    1.82  is something like `gnu-as' or `x' (for the X Window System).  The
    1.83 @@ -137,11 +140,11 @@
    1.84  Specifying the System Type
    1.85  ==========================
    1.86  
    1.87 -   There may be some features `configure' cannot figure out
    1.88 -automatically, but needs to determine by the type of machine the package
    1.89 -will run on.  Usually, assuming the package is built to be run on the
    1.90 -_same_ architectures, `configure' can figure that out, but if it prints
    1.91 -a message saying it cannot guess the machine type, give it the
    1.92 +There may be some features `configure' cannot figure out automatically,
    1.93 +but needs to determine by the type of machine the package will run on.
    1.94 +Usually, assuming the package is built to be run on the _same_
    1.95 +architectures, `configure' can figure that out, but if it prints a
    1.96 +message saying it cannot guess the machine type, give it the
    1.97  `--build=TYPE' option.  TYPE can either be a short name for the system
    1.98  type, such as `sun4', or a canonical name which has the form:
    1.99  
   1.100 @@ -156,7 +159,7 @@
   1.101  need to know the machine type.
   1.102  
   1.103     If you are _building_ compiler tools for cross-compiling, you should
   1.104 -use the `--target=TYPE' option to select the type of system they will
   1.105 +use the option `--target=TYPE' to select the type of system they will
   1.106  produce code for.
   1.107  
   1.108     If you want to _use_ a cross compiler, that generates code for a
   1.109 @@ -167,9 +170,9 @@
   1.110  Sharing Defaults
   1.111  ================
   1.112  
   1.113 -   If you want to set default values for `configure' scripts to share,
   1.114 -you can create a site shell script called `config.site' that gives
   1.115 -default values for variables like `CC', `cache_file', and `prefix'.
   1.116 +If you want to set default values for `configure' scripts to share, you
   1.117 +can create a site shell script called `config.site' that gives default
   1.118 +values for variables like `CC', `cache_file', and `prefix'.
   1.119  `configure' looks for `PREFIX/share/config.site' if it exists, then
   1.120  `PREFIX/etc/config.site' if it exists.  Or, you can set the
   1.121  `CONFIG_SITE' environment variable to the location of the site script.
   1.122 @@ -178,7 +181,7 @@
   1.123  Defining Variables
   1.124  ==================
   1.125  
   1.126 -   Variables not defined in a site shell script can be set in the
   1.127 +Variables not defined in a site shell script can be set in the
   1.128  environment passed to `configure'.  However, some packages may run
   1.129  configure again during the build, and the customized values of these
   1.130  variables may be lost.  In order to avoid this problem, you should set
   1.131 @@ -186,14 +189,18 @@
   1.132  
   1.133       ./configure CC=/usr/local2/bin/gcc
   1.134  
   1.135 -will cause the specified gcc to be used as the C compiler (unless it is
   1.136 -overridden in the site shell script).
   1.137 +causes the specified `gcc' to be used as the C compiler (unless it is
   1.138 +overridden in the site shell script).  Here is a another example:
   1.139 +
   1.140 +     /bin/bash ./configure CONFIG_SHELL=/bin/bash
   1.141 +
   1.142 +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
   1.143 +configuration-related scripts to be executed by `/bin/bash'.
   1.144  
   1.145  `configure' Invocation
   1.146  ======================
   1.147  
   1.148 -   `configure' recognizes the following options to control how it
   1.149 -operates.
   1.150 +`configure' recognizes the following options to control how it operates.
   1.151  
   1.152  `--help'
   1.153  `-h'
     2.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 13:52:12 2007 +0000
     2.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Fri Mar 23 13:56:18 2007 +0000
     2.3 @@ -61,6 +61,7 @@
     2.4  GST_DEBUG_CATEGORY_STATIC (nuvdemux_debug);
     2.5  #define GST_CAT_DEFAULT nuvdemux_debug
     2.6  #define GST_FLOW_ERROR_NO_DATA  -101
     2.7 +#define GST_FLOW_ERROR_EOS	-102
     2.8  
     2.9  enum
    2.10  {
    2.11 @@ -146,9 +147,9 @@
    2.12  typedef struct
    2.13  {
    2.14      gint             i_version;
    2.15 -    guint32		     i_video_fcc;
    2.16 +    guint32	     i_video_fcc;
    2.17  
    2.18 -    guint32		     i_audio_fcc;
    2.19 +    guint32	     i_audio_fcc;
    2.20      gint             i_audio_sample_rate;
    2.21      gint             i_audio_bits_per_sample;
    2.22      gint             i_audio_channels;
    2.23 @@ -199,9 +200,10 @@
    2.24    GstPad        *src_audio_pad;
    2.25  
    2.26    /* Flow control */
    2.27 -  GstFlowReturn last_video_return;
    2.28 -  GstFlowReturn last_audio_return;
    2.29 -  gboolean      more_data;
    2.30 +  GstFlowReturn     last_video_return;
    2.31 +  GstFlowReturn     last_audio_return;
    2.32 +  gboolean          more_data;
    2.33 +  gboolean	    eos;
    2.34  
    2.35    /* NUV decoding state */
    2.36    GstNuvDemuxState  state;
    2.37 @@ -218,8 +220,8 @@
    2.38    gboolean          new_video_segment;
    2.39  
    2.40    /* Mpeg ExtraData */
    2.41 -  guint64       mpeg_data_size;
    2.42 -  GstBuffer     *mpeg_buffer;
    2.43 +  guint64           mpeg_data_size;
    2.44 +  GstBuffer         *mpeg_buffer;
    2.45  
    2.46    /* Headers */
    2.47    nuv_header h;
    2.48 @@ -1137,6 +1139,14 @@
    2.49  pause:
    2.50    GST_LOG_OBJECT (nuv, "pausing task, reason %s", gst_flow_get_name (res));
    2.51    gst_pad_pause_task (nuv->priv->sinkpad);
    2.52 +
    2.53 +  if (res == GST_FLOW_ERROR_EOS) {
    2.54 +    g_debug ("EOS EOS EOS EOS EOS EOS");
    2.55 +    gst_nuv_demux_send_eos (nuv);
    2.56 +    nuv->priv->eos = TRUE;
    2.57 +    res = GST_FLOW_OK;
    2.58 +  }
    2.59 +
    2.60    if (GST_FLOW_IS_FATAL (res)) {
    2.61      GST_ELEMENT_ERROR (nuv, STREAM, FAILED,
    2.62          (_("Internal data stream error.")),
    2.63 @@ -1178,8 +1188,7 @@
    2.64        /* got eos */
    2.65      } else if (ret == GST_FLOW_UNEXPECTED) {
    2.66        g_debug ("GOT EOS");
    2.67 -      //gst_nuv_demux_send_eos (nuv);
    2.68 -      return GST_FLOW_WRONG_STATE;
    2.69 +      return GST_FLOW_ERROR_EOS;
    2.70      }
    2.71    } else {
    2.72      if (gst_adapter_available (nuv->priv->adapter) < size) {
    2.73 @@ -1309,7 +1318,7 @@
    2.74    frame_index_data *entry;
    2.75    gint64 segment_start;
    2.76    gint64 segment_stop;
    2.77 -  //GstEvent *newsegment_event;
    2.78 +  GstEvent *newsegment_event;
    2.79  
    2.80  
    2.81    g_debug ("DEMUX SEEK");
    2.82 @@ -1359,10 +1368,8 @@
    2.83  
    2.84    if (cur == GST_CLOCK_TIME_NONE)
    2.85      cur = 0;
    2.86 -
    2.87 -
    2.88 -//  if (stop == GST_CLOCK_TIME_NONE)
    2.89 -//    stop = nuv->priv->duration_time;
    2.90 +  if (stop == GST_CLOCK_TIME_NONE)
    2.91 +    stop = nuv->priv->duration_time;
    2.92  
    2.93    if (cur_type == GST_SEEK_TYPE_SET)
    2.94      segment_start = cur;
    2.95 @@ -1378,8 +1385,8 @@
    2.96    else
    2.97      segment_stop = nuv->priv->segment_stop;
    2.98  
    2.99 -//  segment_start = CLAMP (segment_start, 0, nuv->priv->duration_bytes);
   2.100 -//  segment_stop = CLAMP (segment_stop, 0, nuv->priv->duration_bytes);
   2.101 +  segment_start = CLAMP (segment_start, 0, nuv->priv->duration_time);
   2.102 +  segment_stop = CLAMP (segment_stop, 0, nuv->priv->duration_time);
   2.103  
   2.104    entry = gst_nuv_demux_do_seek_index (nuv, segment_start,
   2.105        segment_stop, format);
   2.106 @@ -1390,7 +1397,6 @@
   2.107    }
   2.108  
   2.109    g_debug ("found frame at %lld", entry->offset);
   2.110 -  nuv->priv->offset = entry->offset;
   2.111  
   2.112    segment_start = entry->timecode;
   2.113  
   2.114 @@ -1399,23 +1405,21 @@
   2.115  
   2.116    GST_OBJECT_UNLOCK (nuv);
   2.117  
   2.118 -/*
   2.119 -  {
   2.120 -  GstMessage *msg;
   2.121 -  msg = gst_message_new_segment_start (GST_OBJECT (nuv), GST_FORMAT_TIME,
   2.122 -    nuv->priv->segment_start);
   2.123 +  if (!nuv->priv->eos) {
   2.124 +    GstMessage *msg;
   2.125 +    msg = gst_message_new_segment_start (GST_OBJECT (nuv), GST_FORMAT_TIME,
   2.126 +      nuv->priv->segment_start);
   2.127    
   2.128 -  gst_element_post_message (GST_ELEMENT (nuv), msg);
   2.129 +    gst_element_post_message (GST_ELEMENT (nuv), msg);
   2.130    }
   2.131 -*/
   2.132  
   2.133  
   2.134 -//  newsegment_event = gst_event_new_new_segment (FALSE, rate,
   2.135 -//    GST_FORMAT_TIME, segment_start, segment_stop, segment_start);
   2.136 +  g_debug ("NEW SEGMENT START %" G_GUINT64_FORMAT ", STOP %" G_GUINT64_FORMAT, segment_start, segment_stop);
   2.137 +  newsegment_event = gst_event_new_new_segment (FALSE, rate,
   2.138 +    GST_FORMAT_TIME, segment_start, segment_stop, segment_start);
   2.139  
   2.140  
   2.141    if (flush) {
   2.142 -    gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_stop ());
   2.143      if (nuv->priv->src_video_pad != NULL) {
   2.144        gst_pad_push_event (nuv->priv->src_video_pad, gst_event_new_flush_stop ());
   2.145      }
   2.146 @@ -1423,21 +1427,24 @@
   2.147      if (nuv->priv->src_audio_pad != NULL) {
   2.148        gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_new_flush_stop ());
   2.149      }
   2.150 +
   2.151 +    gst_pad_push_event (nuv->priv->sinkpad, gst_event_new_flush_stop ());
   2.152    }
   2.153  
   2.154 -/*
   2.155    
   2.156    if (nuv->priv->src_video_pad != NULL) {
   2.157 -    gst_pad_push_event (nuv->priv->src_video_pad, newsegment_event);
   2.158 +    gst_pad_push_event (nuv->priv->src_video_pad, gst_event_ref (newsegment_event));
   2.159    }
   2.160    if (nuv->priv->src_audio_pad != NULL) {
   2.161 -    gst_pad_push_event (nuv->priv->src_audio_pad, newsegment_event);
   2.162 +    gst_pad_push_event (nuv->priv->src_audio_pad, gst_event_ref (newsegment_event));
   2.163    } 
   2.164  
   2.165 -*/
   2.166 +  gst_event_unref (newsegment_event);
   2.167  
   2.168    g_debug ("STARTING TASK AGAIN");
   2.169    nuv->priv->state = GST_NUV_DEMUX_FRAME_HEADER;
   2.170 +  nuv->priv->offset = entry->offset;
   2.171 +
   2.172    gst_pad_start_task (nuv->priv->sinkpad, (GstTaskFunction) gst_nuv_demux_loop,
   2.173        nuv->priv->sinkpad);
   2.174