]> git.sesse.net Git - vlc/commitdiff
* modules/mux/avi.c, modules/mux/ogg.c: use SetDWLE() from vlc_common.h.
authorGildas Bazin <gbazin@videolan.org>
Fri, 6 Feb 2004 23:43:32 +0000 (23:43 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 6 Feb 2004 23:43:32 +0000 (23:43 +0000)
* src/input/input.c: fixed memleak.
* modules/demux/ogg.c: fixed another timing bug.

modules/demux/ogg.c
modules/mux/avi.c
modules/mux/ogg.c
src/input/input.c

index d1f90dfec68c2b7cd72910de8414664fc7570bbb..fa6b25167e5036fe3ac3f1267c9d342fa54dac0f 100644 (file)
@@ -2,7 +2,7 @@
  * ogg.c : ogg stream demux module for vlc
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: ogg.c,v 1.53 2004/01/25 20:05:28 hartman Exp $
+ * $Id: ogg.c,v 1.54 2004/02/06 23:43:32 gbazin Exp $
  *
  * Author: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -256,7 +256,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
     block_t *p_block;
     vlc_bool_t b_selected;
     int i_header_len = 0;
-    mtime_t i_pts;
+    mtime_t i_pts = 0;
 
     /* Sanity check */
     if( !p_oggpacket->bytes )
@@ -409,44 +409,43 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
             input_ClockManageRef( p_input,
                                   p_input->stream.p_selected_program,
                                   p_stream->i_pcr );
-        }
-
-        /* The granulepos is the end date of the sample */
-        i_pts = ( p_stream->i_pcr < 0 ) ? 0 :
-            input_ClockGetTS( p_input, p_input->stream.p_selected_program,
-                              p_stream->i_pcr );
 
-        /* Convert the granulepos into the next pcr */
-        Ogg_UpdatePCR( p_stream, p_oggpacket );
+            /* The granulepos is the end date of the sample */
+            i_pts =  input_ClockGetTS( p_input,
+                                       p_input->stream.p_selected_program,
+                                       p_stream->i_pcr );
+        }
     }
-    else
-    {
-        /* Convert the granulepos into the current pcr */
-        Ogg_UpdatePCR( p_stream, p_oggpacket );
 
-        if( p_stream->i_pcr >= 0 )
-        {
-            /* This is for streams where the granulepos of the header packets
-             * doesn't match these of the data packets (eg. ogg web radios). */
-            if( p_stream->i_previous_pcr == 0 &&
-                p_stream->i_pcr  > 3 * DEFAULT_PTS_DELAY * 9/100 )
-                p_input->stream.p_selected_program->i_synchro_state =
-                    SYNCHRO_REINIT;
+    /* Convert the granulepos into the next pcr */
+    Ogg_UpdatePCR( p_stream, p_oggpacket );
 
-            p_stream->i_previous_pcr = p_stream->i_pcr;
+    if( p_stream->i_pcr >= 0 )
+    {
+        /* This is for streams where the granulepos of the header packets
+         * doesn't match these of the data packets (eg. ogg web radios). */
+        if( p_stream->i_previous_pcr == 0 &&
+            p_stream->i_pcr  > 3 * DEFAULT_PTS_DELAY * 9/100 )
+            p_input->stream.p_selected_program->i_synchro_state =
+                SYNCHRO_REINIT;
+
+        /* Call the pace control */
+        if( p_input->stream.p_selected_program->i_synchro_state ==
+            SYNCHRO_REINIT )
+          input_ClockManageRef( p_input, p_input->stream.p_selected_program,
+                                p_stream->i_pcr );
+    }
 
-            /* Call the pace control */
-            if( p_input->stream.p_selected_program->i_synchro_state ==
-                SYNCHRO_REINIT )
-            input_ClockManageRef( p_input,
-                                  p_input->stream.p_selected_program,
-                                  p_stream->i_pcr );
-        }
+    if( !p_stream->fmt.i_codec == VLC_FOURCC( 'v','o','r','b' ) &&
+        !p_stream->fmt.i_codec == VLC_FOURCC( 's','p','x',' ' ) &&
+        !p_stream->fmt.i_codec == VLC_FOURCC( 'f','l','a','c' ) &&
+        p_stream->i_pcr >= 0 )
+    {
+        p_stream->i_previous_pcr = p_stream->i_pcr;
 
         /* The granulepos is the start date of the sample */
-        i_pts = ( p_stream->i_pcr < 0 ) ? 0 :
-            input_ClockGetTS( p_input, p_input->stream.p_selected_program,
-                              p_stream->i_pcr );
+        i_pts = input_ClockGetTS( p_input, p_input->stream.p_selected_program,
+                                  p_stream->i_pcr );
     }
 
     if( !b_selected )
@@ -1078,7 +1077,8 @@ static int Ogg_BeginningOfStream( input_thread_t *p_input, demux_sys_t *p_ogg)
         p_input->stream.i_mux_rate += (p_stream->fmt.i_bitrate / ( 8 * 50 ));
         vlc_mutex_unlock( &p_input->stream.stream_lock );
 
-        p_stream->i_pcr  = p_stream->i_previous_pcr = -1;
+        p_stream->i_pcr = p_stream->i_previous_pcr =
+            p_stream->i_interpolated_pcr = -1;
         p_stream->b_reinit = 0;
 #undef p_stream
     }
index f3657ee77b960e4d813384c1e14c1d6ff777057b..d86b688aa4e02defb6298ce7396eafaca2681386 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: avi.c,v 1.17 2003/12/22 02:24:53 sam Exp $
+ * $Id: avi.c,v 1.18 2004/02/06 23:43:32 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -127,15 +127,6 @@ static void SetFCC( uint8_t *p, char *fcc )
     memcpy( p, fcc, 4 );
 }
 
-static void SetDWLE( uint8_t *p, uint32_t i_dw )
-{
-    p[3] = ( i_dw >> 24 )&0xff;
-    p[2] = ( i_dw >> 16 )&0xff;
-    p[1] = ( i_dw >>  8 )&0xff;
-    p[0] = ( i_dw       )&0xff;
-}
-
-
 /*****************************************************************************
  * Open:
  *****************************************************************************/
index b995f4c84690ffd8699b62828ed2446cc94e0c9f..567b77955f5b6d4117474c3312948191a0a64ec4 100644 (file)
@@ -2,7 +2,7 @@
  * ogg.c: ogg muxer module for vlc
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ogg.c,v 1.27 2003/12/14 18:44:50 gbazin Exp $
+ * $Id: ogg.c,v 1.28 2004/02/06 23:43:32 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -126,30 +126,6 @@ typedef struct
 
 } oggds_header_t;
 
-/* Helper writer functions */
-
-#define SetWLE( p, v ) _SetWLE( (uint8_t*)p, v)
-static void _SetWLE( uint8_t *p, uint16_t i_dw )
-{
-    p[1] = ( i_dw >>  8 )&0xff;
-    p[0] = ( i_dw       )&0xff;
-}
-
-#define SetDWLE( p, v ) _SetDWLE( (uint8_t*)p, v)
-static void _SetDWLE( uint8_t *p, uint32_t i_dw )
-{
-    p[3] = ( i_dw >> 24 )&0xff;
-    p[2] = ( i_dw >> 16 )&0xff;
-    p[1] = ( i_dw >>  8 )&0xff;
-    p[0] = ( i_dw       )&0xff;
-}
-#define SetQWLE( p, v ) _SetQWLE( (uint8_t*)p, v)
-static void _SetQWLE( uint8_t *p, uint64_t i_qw )
-{
-    SetDWLE( p,   i_qw&0xffffffff );
-    SetDWLE( p+4, ( i_qw >> 32)&0xffffffff );
-}
-
 /*
  * TODO  move this function to src/stream_output.c (used by nearly all muxers)
  */
index 5ed55e02c6dc5b9e726567bf6b35fa31e5805ccb..7889d441f192c7172da92adfda2a67315fddcece 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2004 VideoLAN
- * $Id: input.c,v 1.286 2004/02/02 12:58:29 fenrir Exp $
+ * $Id: input.c,v 1.287 2004/02/06 23:43:32 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -685,6 +685,7 @@ static int InitThread( input_thread_t * p_input )
         {
             free( p_input->psz_dupsource );
         }
+        input_EsOutDelete( p_input->p_es_out );
         return VLC_EGENERIC;
     }
 
@@ -722,6 +723,7 @@ static int InitThread( input_thread_t * p_input )
                 {
                     free( p_input->psz_dupsource );
                 }
+                input_EsOutDelete( p_input->p_es_out );
                 return VLC_EGENERIC;
             }
         }
@@ -746,6 +748,7 @@ static int InitThread( input_thread_t * p_input )
         {
             free( p_input->psz_dupsource );
         }
+        input_EsOutDelete( p_input->p_es_out );
         return VLC_EGENERIC;
     }
 
@@ -772,6 +775,7 @@ static int InitThread( input_thread_t * p_input )
         {
             free( p_input->psz_dupsource );
         }
+        input_EsOutDelete( p_input->p_es_out );
         return VLC_EGENERIC;
     }