Commit bff03e0b authored by Gildas Bazin's avatar Gildas Bazin

* modules/demux/ogg.c, modules/codec/vorbis.c: misc small fixes.
* modules/mux/ogg.c: support for inserting/removing elementary streams on the fly (really handy for the --sout-keep option). This will produce a chained Ogg bitstream.
parent f5012c55
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vorbis.c: vorbis decoder module making use of libvorbis. * vorbis.c: vorbis decoder module making use of libvorbis.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: vorbis.c,v 1.18 2003/09/24 23:45:06 gbazin Exp $ * $Id: vorbis.c,v 1.19 2003/09/28 16:50:05 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -293,7 +293,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block ) ...@@ -293,7 +293,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
if( p_sys->b_packetizer ) if( p_sys->b_packetizer )
{ {
i_ret = SendPacket( p_dec, &oggpacket ); i_ret = ProcessPacket( p_dec, &oggpacket, p_block->i_pts );
block_Release( p_block ); block_Release( p_block );
return i_ret; return i_ret;
} }
...@@ -319,7 +319,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block ) ...@@ -319,7 +319,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
if( p_sys->b_packetizer ) if( p_sys->b_packetizer )
{ {
i_ret = SendPacket( p_dec, &oggpacket ); i_ret = ProcessPacket( p_dec, &oggpacket, p_block->i_pts );
block_Release( p_block ); block_Release( p_block );
return i_ret; return i_ret;
} }
...@@ -352,7 +352,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block ) ...@@ -352,7 +352,7 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
if( p_sys->b_packetizer ) if( p_sys->b_packetizer )
{ {
i_ret = SendPacket( p_dec, &oggpacket ); i_ret = ProcessPacket( p_dec, &oggpacket, p_block->i_pts );
block_Release( p_block ); block_Release( p_block );
return i_ret; return i_ret;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc * ogg.c : ogg stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: ogg.c,v 1.36 2003/09/27 15:33:02 gbazin Exp $ * $Id: ogg.c,v 1.37 2003/09/28 16:50:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -210,8 +210,7 @@ static int Ogg_ElemStreamStart( input_thread_t *p_input, ...@@ -210,8 +210,7 @@ static int Ogg_ElemStreamStart( input_thread_t *p_input,
int i; int i;
for( i = 0; i < p_stream->i_packets_backup; i++ ) for( i = 0; i < p_stream->i_packets_backup; i++ )
{ {
/* Set correct starting date in the last header packet */ /* Set correct starting date in header packets */
if( i == p_stream->i_packets_backup -1 )
p_stream->p_packets_backup[i].granulepos = p_stream->p_packets_backup[i].granulepos =
p_stream->i_interpolated_pcr * p_stream->f_rate / 90000; p_stream->i_interpolated_pcr * p_stream->f_rate / 90000;
...@@ -375,8 +374,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input, ...@@ -375,8 +374,16 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
&p_stream->p_packets_backup[p_stream->i_packets_backup - 1]; &p_stream->p_packets_backup[p_stream->i_packets_backup - 1];
p_packet_backup->bytes = p_oggpacket->bytes; p_packet_backup->bytes = p_oggpacket->bytes;
if( p_stream->b_force_backup ) p_oggpacket->granulepos = -1;
p_packet_backup->granulepos = p_oggpacket->granulepos; p_packet_backup->granulepos = p_oggpacket->granulepos;
if( p_oggpacket->granulepos >= 0 )
{
/* Because of vorbis granulepos scheme we must set the pcr for the
* 1st header packet so it doesn't get discarded in the
* packetizer */
Ogg_UpdatePCR( p_stream, p_oggpacket );
}
p_packet_backup->packet = malloc( p_oggpacket->bytes ); p_packet_backup->packet = malloc( p_oggpacket->bytes );
if( !p_packet_backup->packet ) return; if( !p_packet_backup->packet ) return;
memcpy( p_packet_backup->packet, p_oggpacket->packet, memcpy( p_packet_backup->packet, p_oggpacket->packet,
...@@ -1524,7 +1531,7 @@ static int Demux( input_thread_t * p_input ) ...@@ -1524,7 +1531,7 @@ static int Demux( input_thread_t * p_input )
static int Control( input_thread_t *p_input, int i_query, va_list args ) static int Control( input_thread_t *p_input, int i_query, va_list args )
{ {
demux_sys_t *p_ogg = (demux_sys_t *)p_input->p_demux_data; demux_sys_t *p_ogg = (demux_sys_t *)p_input->p_demux_data;
int64_t i64, *pi64; int64_t *pi64;
switch( i_query ) switch( i_query )
{ {
......
This diff is collapsed.
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