Commit d170ec7c authored by Laurent Aimar's avatar Laurent Aimar

* pes.c, ps.c: a52 stream should now work.

 * ts.c: added support for libdvbpsi (like ts demux, two modules are
generated : mux_ts and mux_ts_dvbpsi), fix crc generation for pat/pmt
without libdvbpsi. More works to add mpeg4 support (now I generate IOD
and SL descriptor).
parent 1c332603
......@@ -9,4 +9,9 @@ SOURCES_mux_ts = modules/mux/mpeg/ts.c \
modules/mux/mpeg/bits.h \
$(NULL)
SOURCES_mux_ts_dvbpsi = modules/mux/mpeg/ts.c \
modules/mux/mpeg/pes.c \
modules/mux/mpeg/pes.h \
modules/mux/mpeg/bits.h \
$(NULL)
......@@ -2,7 +2,7 @@
* bits.h
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: bits.h,v 1.2 2002/12/17 21:58:03 fenrir Exp $
* $Id: bits.h,v 1.3 2003/01/08 10:34:58 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -76,13 +76,17 @@ static inline void bits_write( bits_buffer_t *p_buffer,
{
p_buffer->p_data[p_buffer->i_data] |= p_buffer->i_mask;
}
else
{
p_buffer->p_data[p_buffer->i_data] &= ~p_buffer->i_mask;
}
p_buffer->i_mask >>= 1;
if( p_buffer->i_mask == 0 )
{
p_buffer->i_data++;
if( p_buffer->i_data < p_buffer->i_size )
{
p_buffer->p_data[p_buffer->i_data] = 0;
// p_buffer->p_data[p_buffer->i_data] = 0;
p_buffer->i_mask = 0x80;
}
}
......
......@@ -2,7 +2,7 @@
* pes.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: pes.c,v 1.2 2002/12/15 23:39:41 fenrir Exp $
* $Id: pes.c,v 1.3 2003/01/08 10:34:58 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -58,6 +58,19 @@ int E_( EStoPES )( sout_instance_t *p_sout,
uint8_t *p_data;
int i_size;
int i_private_id;
/* HACK for private stream 1 in ps */
if( ( i_stream_id&0xff00 ) == 0xbd00 )
{
i_private_id = i_stream_id & 0xff;
i_stream_id = PES_PRIVATE_STREAM_1;
}
else
{
i_private_id = -1;
}
i_pts = p_es->i_pts * 9 / 100; // 90000 units clock
i_dts = p_es->i_dts * 9 / 100; // 90000 units clock
......@@ -120,15 +133,29 @@ int E_( EStoPES )( sout_instance_t *p_sout,
if( b_mpeg2 )
{
int i_pts_dts;
int i_extra;
if( i_stream_id == PES_PRIVATE_STREAM_1 )
{
i_extra = 1;
if( ( i_private_id&0xf0 ) == 0x80 )
{
i_extra += 3;
}
}
else
{
i_extra = 0;
}
if( i_dts > 0 )
{
bits_write( &bits, 16, i_copy + 13 );
bits_write( &bits, 16, i_copy + i_extra+ 13 );
i_pts_dts = 0x03;
}
else
{
bits_write( &bits, 16, i_copy + 8 );
bits_write( &bits, 16, i_copy + i_extra + 8 );
i_pts_dts = 0x02;
}
......@@ -187,6 +214,14 @@ int E_( EStoPES )( sout_instance_t *p_sout,
/* and then pes data */
bits_align( &bits );
if( i_stream_id == PES_PRIVATE_STREAM_1 && i_private_id != -1 )
{
bits_write( &bits, 8, i_private_id );
if( ( i_private_id&0xf0 ) == 0x80 )
{
bits_write( &bits, 24, 0 ); // ac3
}
}
break;
}
......
......@@ -2,7 +2,7 @@
* pes.h
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: pes.h,v 1.2 2002/12/15 23:39:41 fenrir Exp $
* $Id: pes.h,v 1.3 2003/01/08 10:34:58 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -24,6 +24,7 @@
#define PES_PROGRAM_STREAM_MAP 0xbc
#define PES_PRIVATE_STREAM_1 0xbd
#define PES_PADDING 0xbe
#define PES_PRIVATE_STREAM_2 0xbf
#define PES_ECM 0xb0
......
......@@ -2,7 +2,7 @@
* ps.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ps.c,v 1.3 2002/12/18 14:17:11 sam Exp $
* $Id: ps.c,v 1.4 2003/01/08 10:34:58 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -166,22 +166,35 @@ static int AddStream( sout_instance_t *p_sout, sout_input_t *p_input )
switch( p_input->input_format.i_cat )
{
case VIDEO_ES:
p_stream->i_stream_id = p_mux->i_stream_id_mpgv;
p_mux->i_stream_id_mpgv++;
p_mux->i_video_bound++;
break;
case AUDIO_ES:
if( p_input->input_format.i_fourcc == VLC_FOURCC( 'a', '5', '2', ' ' ) )
switch( p_input->input_format.i_fourcc )
{
p_stream->i_stream_id = p_mux->i_stream_id_a52;
p_mux->i_stream_id_a52++;
case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
p_stream->i_stream_id = p_mux->i_stream_id_mpgv;
p_mux->i_stream_id_mpgv++;
p_mux->i_video_bound++;
break;
default:
return( -1 );
}
else
break;
case AUDIO_ES:
switch( p_input->input_format.i_fourcc )
{
p_stream->i_stream_id = p_mux->i_stream_id_mpga;
p_mux->i_stream_id_mpga++;
case VLC_FOURCC( 'a', '5', '2', ' ' ):
case VLC_FOURCC( 'a', '5', '2', 'b' ):
p_stream->i_stream_id = p_mux->i_stream_id_a52 | ( 0xbd << 8 );
p_mux->i_stream_id_a52++;
p_mux->i_audio_bound++;
break;
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_stream->i_stream_id = p_mux->i_stream_id_mpga;
p_mux->i_stream_id_mpga++;
p_mux->i_audio_bound++;
break;
default:
return( -1 );
}
p_mux->i_audio_bound++;
break;
default:
return( -1 );
......
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