Commit a614010d authored by Gildas Bazin's avatar Gildas Bazin

* modules/mux/mpeg/ps.c: save pack and system headers for http streaming.

parent da7946c0
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* multiplexer module for vlc * multiplexer module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: ps.c,v 1.13 2003/07/15 13:12:00 gbazin Exp $ * $Id: ps.c,v 1.14 2003/07/15 16:07:33 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -238,7 +238,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -238,7 +238,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
return( VLC_SUCCESS ); return( VLC_SUCCESS );
} }
static int MuxWritePackHeader( sout_mux_t *p_mux, mtime_t i_dts ) static int MuxWritePackHeader( sout_mux_t *p_mux, sout_buffer_t **p_buf,
mtime_t i_dts )
{ {
sout_buffer_t *p_hdr; sout_buffer_t *p_hdr;
bits_buffer_t bits; bits_buffer_t bits;
...@@ -283,12 +284,12 @@ static int MuxWritePackHeader( sout_mux_t *p_mux, mtime_t i_dts ) ...@@ -283,12 +284,12 @@ static int MuxWritePackHeader( sout_mux_t *p_mux, mtime_t i_dts )
else else
p_hdr->i_size = 12; p_hdr->i_size = 12;
sout_AccessOutWrite( p_mux->p_access, p_hdr ); sout_BufferChain( p_buf, p_hdr );
return( 0 ); return( 0 );
} }
static int MuxWriteSystemHeader( sout_mux_t *p_mux ) static int MuxWriteSystemHeader( sout_mux_t *p_mux, sout_buffer_t **p_buf )
{ {
sout_mux_sys_t *p_sys = p_mux->p_sys; sout_mux_sys_t *p_sys = p_mux->p_sys;
sout_buffer_t *p_hdr; sout_buffer_t *p_hdr;
...@@ -339,7 +340,7 @@ static int MuxWriteSystemHeader( sout_mux_t *p_mux ) ...@@ -339,7 +340,7 @@ static int MuxWriteSystemHeader( sout_mux_t *p_mux )
} }
} }
sout_AccessOutWrite( p_mux->p_access, p_hdr ); sout_BufferChain( p_buf, p_hdr );
return( 0 ); return( 0 );
} }
...@@ -399,7 +400,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -399,7 +400,7 @@ static int Mux( sout_mux_t *p_mux )
sout_input_t *p_input; sout_input_t *p_input;
ps_stream_t *p_stream; ps_stream_t *p_stream;
sout_fifo_t *p_fifo; sout_fifo_t *p_fifo;
sout_buffer_t *p_data; sout_buffer_t *p_hdr = NULL, *p_data;
if( MuxGetStream( p_mux, &i_stream, &i_dts ) < 0 ) if( MuxGetStream( p_mux, &i_stream, &i_dts ) < 0 )
{ {
...@@ -412,18 +413,28 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -412,18 +413,28 @@ static int Mux( sout_mux_t *p_mux )
if( p_sys->i_pes_count % 30 == 0) if( p_sys->i_pes_count % 30 == 0)
{ {
MuxWritePackHeader( p_mux, i_dts ); MuxWritePackHeader( p_mux, &p_hdr, i_dts );
} }
if( p_sys->i_pes_count % 300 == 0 ) if( p_sys->i_pes_count % 300 == 0 )
{ {
MuxWriteSystemHeader( p_mux ); sout_buffer_t *p_buf;
MuxWriteSystemHeader( p_mux, &p_hdr );
/* For MPEG1 streaming, set HEADER flag */
for( p_buf = p_hdr; p_buf != NULL; p_buf = p_buf->p_next )
{
p_buf->i_flags |= SOUT_BUFFER_FLAGS_HEADER;
}
} }
p_data = sout_FifoGet( p_fifo ); p_data = sout_FifoGet( p_fifo );
E_( EStoPES )( p_mux->p_sout, &p_data, p_data, p_stream->i_stream_id, E_( EStoPES )( p_mux->p_sout, &p_data, p_data, p_stream->i_stream_id,
p_mux->p_sys->b_mpeg2 ); p_mux->p_sys->b_mpeg2 );
sout_AccessOutWrite( p_mux->p_access, p_data );
sout_BufferChain( &p_hdr, p_data );
sout_AccessOutWrite( p_mux->p_access, p_hdr );
p_sys->i_pes_count++; p_sys->i_pes_count++;
......
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