Commit 4ca92c14 authored by Gildas Bazin's avatar Gildas Bazin

* modules/mux/avi.c, modules/mux/ogg.c: use SetDWLE() from vlc_common.h.
* src/input/input.c: fixed memleak.
* modules/demux/ogg.c: fixed another timing bug.
parent 32e83f8a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ogg.c : ogg stream demux module for vlc * ogg.c : ogg stream demux module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * 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> * Author: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -256,7 +256,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input, ...@@ -256,7 +256,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
block_t *p_block; block_t *p_block;
vlc_bool_t b_selected; vlc_bool_t b_selected;
int i_header_len = 0; int i_header_len = 0;
mtime_t i_pts; mtime_t i_pts = 0;
/* Sanity check */ /* Sanity check */
if( !p_oggpacket->bytes ) if( !p_oggpacket->bytes )
...@@ -409,20 +409,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input, ...@@ -409,20 +409,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
input_ClockManageRef( p_input, input_ClockManageRef( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_stream->i_pcr ); p_stream->i_pcr );
}
/* The granulepos is the end date of the sample */ /* The granulepos is the end date of the sample */
i_pts = ( p_stream->i_pcr < 0 ) ? 0 : i_pts = input_ClockGetTS( p_input,
input_ClockGetTS( p_input, p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_stream->i_pcr ); p_stream->i_pcr );
}
}
/* Convert the granulepos into the next pcr */ /* Convert the granulepos into the next pcr */
Ogg_UpdatePCR( p_stream, p_oggpacket ); Ogg_UpdatePCR( p_stream, p_oggpacket );
}
else
{
/* Convert the granulepos into the current pcr */
Ogg_UpdatePCR( p_stream, p_oggpacket );
if( p_stream->i_pcr >= 0 ) if( p_stream->i_pcr >= 0 )
{ {
...@@ -433,19 +429,22 @@ static void Ogg_DecodePacket( input_thread_t *p_input, ...@@ -433,19 +429,22 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
p_input->stream.p_selected_program->i_synchro_state = p_input->stream.p_selected_program->i_synchro_state =
SYNCHRO_REINIT; SYNCHRO_REINIT;
p_stream->i_previous_pcr = p_stream->i_pcr;
/* Call the pace control */ /* Call the pace control */
if( p_input->stream.p_selected_program->i_synchro_state == if( p_input->stream.p_selected_program->i_synchro_state ==
SYNCHRO_REINIT ) SYNCHRO_REINIT )
input_ClockManageRef( p_input, input_ClockManageRef( p_input, p_input->stream.p_selected_program,
p_input->stream.p_selected_program,
p_stream->i_pcr ); 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 */ /* The granulepos is the start date of the sample */
i_pts = ( p_stream->i_pcr < 0 ) ? 0 : i_pts = input_ClockGetTS( p_input, p_input->stream.p_selected_program,
input_ClockGetTS( p_input, p_input->stream.p_selected_program,
p_stream->i_pcr ); p_stream->i_pcr );
} }
...@@ -1078,7 +1077,8 @@ static int Ogg_BeginningOfStream( input_thread_t *p_input, demux_sys_t *p_ogg) ...@@ -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 )); p_input->stream.i_mux_rate += (p_stream->fmt.i_bitrate / ( 8 * 50 ));
vlc_mutex_unlock( &p_input->stream.stream_lock ); 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; p_stream->b_reinit = 0;
#undef p_stream #undef p_stream
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c * avi.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -127,15 +127,6 @@ static void SetFCC( uint8_t *p, char *fcc ) ...@@ -127,15 +127,6 @@ static void SetFCC( uint8_t *p, char *fcc )
memcpy( p, fcc, 4 ); 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: * Open:
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ogg.c: ogg muxer module for vlc * ogg.c: ogg muxer module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -126,30 +126,6 @@ typedef struct ...@@ -126,30 +126,6 @@ typedef struct
} oggds_header_t; } 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) * TODO move this function to src/stream_output.c (used by nearly all muxers)
*/ */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2004 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -685,6 +685,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -685,6 +685,7 @@ static int InitThread( input_thread_t * p_input )
{ {
free( p_input->psz_dupsource ); free( p_input->psz_dupsource );
} }
input_EsOutDelete( p_input->p_es_out );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -722,6 +723,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -722,6 +723,7 @@ static int InitThread( input_thread_t * p_input )
{ {
free( p_input->psz_dupsource ); free( p_input->psz_dupsource );
} }
input_EsOutDelete( p_input->p_es_out );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
} }
...@@ -746,6 +748,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -746,6 +748,7 @@ static int InitThread( input_thread_t * p_input )
{ {
free( p_input->psz_dupsource ); free( p_input->psz_dupsource );
} }
input_EsOutDelete( p_input->p_es_out );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -772,6 +775,7 @@ static int InitThread( input_thread_t * p_input ) ...@@ -772,6 +775,7 @@ static int InitThread( input_thread_t * p_input )
{ {
free( p_input->psz_dupsource ); free( p_input->psz_dupsource );
} }
input_EsOutDelete( p_input->p_es_out );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment