]> git.sesse.net Git - vlc/blobdiff - modules/demux/au.c
vlc_aout.h: fix typo
[vlc] / modules / demux / au.c
index bccf2ea6cf3ec532df464bef1121d7a835513eb3..19f8752247aff174d04aa55f40698cd84711cf7f 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * au.c : au file input module for vlc
  *****************************************************************************
- * Copyright (C) 2001-2007 the VideoLAN team
+ * Copyright (C) 2001-2007 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -132,7 +132,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
-    p_sys->i_time = 1;
+    p_sys->i_time = 0;
     p_sys->i_header_size = GetDWBE( &hdr[0] );
 
     /* skip extra header data */
@@ -261,6 +261,13 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    if( p_sys->fmt.audio.i_rate == 0 )
+    {
+        msg_Err( p_demux, "invalid samplerate: 0" );
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
+
     /* add the es */
     p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt );
 
@@ -293,7 +300,7 @@ static int Demux( demux_t *p_demux )
     block_t     *p_block;
 
     /* set PCR */
-    es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_time );
+    es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_time );
 
     if( ( p_block = stream_Block( p_demux->s, p_sys->i_frame_size ) ) == NULL )
     {
@@ -302,7 +309,7 @@ static int Demux( demux_t *p_demux )
     }
 
     p_block->i_dts =
-    p_block->i_pts = p_sys->i_time;
+    p_block->i_pts = VLC_TS_0 + p_sys->i_time;
 
     es_out_Send( p_demux->out, p_sys->es, p_block );