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 \ ...@@ -9,4 +9,9 @@ SOURCES_mux_ts = modules/mux/mpeg/ts.c \
modules/mux/mpeg/bits.h \ modules/mux/mpeg/bits.h \
$(NULL) $(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 @@ ...@@ -2,7 +2,7 @@
* bits.h * bits.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -76,13 +76,17 @@ static inline void bits_write( bits_buffer_t *p_buffer, ...@@ -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; 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; p_buffer->i_mask >>= 1;
if( p_buffer->i_mask == 0 ) if( p_buffer->i_mask == 0 )
{ {
p_buffer->i_data++; p_buffer->i_data++;
if( p_buffer->i_data < p_buffer->i_size ) 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; p_buffer->i_mask = 0x80;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pes.c * pes.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -58,6 +58,19 @@ int E_( EStoPES )( sout_instance_t *p_sout, ...@@ -58,6 +58,19 @@ int E_( EStoPES )( sout_instance_t *p_sout,
uint8_t *p_data; uint8_t *p_data;
int i_size; 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_pts = p_es->i_pts * 9 / 100; // 90000 units clock
i_dts = p_es->i_dts * 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, ...@@ -120,15 +133,29 @@ int E_( EStoPES )( sout_instance_t *p_sout,
if( b_mpeg2 ) if( b_mpeg2 )
{ {
int i_pts_dts; 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 ) if( i_dts > 0 )
{ {
bits_write( &bits, 16, i_copy + 13 ); bits_write( &bits, 16, i_copy + i_extra+ 13 );
i_pts_dts = 0x03; i_pts_dts = 0x03;
} }
else else
{ {
bits_write( &bits, 16, i_copy + 8 ); bits_write( &bits, 16, i_copy + i_extra + 8 );
i_pts_dts = 0x02; i_pts_dts = 0x02;
} }
...@@ -187,6 +214,14 @@ int E_( EStoPES )( sout_instance_t *p_sout, ...@@ -187,6 +214,14 @@ int E_( EStoPES )( sout_instance_t *p_sout,
/* and then pes data */ /* and then pes data */
bits_align( &bits ); 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; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pes.h * pes.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define PES_PROGRAM_STREAM_MAP 0xbc #define PES_PROGRAM_STREAM_MAP 0xbc
#define PES_PRIVATE_STREAM_1 0xbd
#define PES_PADDING 0xbe #define PES_PADDING 0xbe
#define PES_PRIVATE_STREAM_2 0xbf #define PES_PRIVATE_STREAM_2 0xbf
#define PES_ECM 0xb0 #define PES_ECM 0xb0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ps.c * ps.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -166,26 +166,39 @@ static int AddStream( sout_instance_t *p_sout, sout_input_t *p_input ) ...@@ -166,26 +166,39 @@ static int AddStream( sout_instance_t *p_sout, sout_input_t *p_input )
switch( p_input->input_format.i_cat ) switch( p_input->input_format.i_cat )
{ {
case VIDEO_ES: case VIDEO_ES:
switch( p_input->input_format.i_fourcc )
{
case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
p_stream->i_stream_id = p_mux->i_stream_id_mpgv; p_stream->i_stream_id = p_mux->i_stream_id_mpgv;
p_mux->i_stream_id_mpgv++; p_mux->i_stream_id_mpgv++;
p_mux->i_video_bound++; p_mux->i_video_bound++;
break; break;
default:
return( -1 );
}
break;
case AUDIO_ES: 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; 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_stream_id_a52++;
} p_mux->i_audio_bound++;
else break;
{ case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_stream->i_stream_id = p_mux->i_stream_id_mpga; p_stream->i_stream_id = p_mux->i_stream_id_mpga;
p_mux->i_stream_id_mpga++; p_mux->i_stream_id_mpga++;
}
p_mux->i_audio_bound++; p_mux->i_audio_bound++;
break; break;
default: default:
return( -1 ); return( -1 );
} }
break;
default:
return( -1 );
}
p_stream->i_ok = 1; p_stream->i_ok = 1;
msg_Dbg( p_sout, "adding input stream_id:0x%x [OK]", p_stream->i_stream_id ); msg_Dbg( p_sout, "adding input stream_id:0x%x [OK]", p_stream->i_stream_id );
......
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