Commit a36d6a8f authored by Laurent Aimar's avatar Laurent Aimar

* ts: use right stream_id for A52 (0xbd -> fix mplayer playback) and add a

  "registration descriptor" (-> fix xine playback) when using a52.
parent 747f24a1
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pes.c: PES packetizer used by the MPEG multiplexers * pes.c: PES packetizer used by the MPEG multiplexers
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: pes.c,v 1.9 2003/08/02 01:33:53 fenrir Exp $ * $Id: pes.c,v 1.10 2003/08/14 23:37:54 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>
...@@ -81,7 +81,8 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts, ...@@ -81,7 +81,8 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
/* For PES_PRIVATE_STREAM_1 there is an extra header after the /* For PES_PRIVATE_STREAM_1 there is an extra header after the
pes header */ pes header */
if( i_stream_id == PES_PRIVATE_STREAM_1 ) /* i_private_id != -1 because TS use 0xbd without private_id */
if( i_stream_id == PES_PRIVATE_STREAM_1 && i_private_id != -1 )
{ {
i_extra = 1; i_extra = 1;
if( ( i_private_id&0xf8 ) == 0x80 ) if( ( i_private_id&0xf8 ) == 0x80 )
...@@ -156,18 +157,18 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts, ...@@ -156,18 +157,18 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
bits_write( &bits, 1, 0x01 ); // marker bits_write( &bits, 1, 0x01 ); // marker
} }
} }
else /* MPEG1 */ else /* MPEG1 */
{ {
int i_pts_dts; int i_pts_dts;
if( i_pts >= 0 && i_dts >= 0 ) if( i_pts >= 0 && i_dts >= 0 )
{ {
bits_write( &bits, 16, i_es_size + 10 /* + stuffing */ ); bits_write( &bits, 16, i_es_size + 10 /* + stuffing */ );
i_pts_dts = 0x03; i_pts_dts = 0x03;
} }
else if( i_pts >= 0 ) else if( i_pts >= 0 )
{ {
bits_write( &bits, 16, i_es_size + 5 /* + stuffing */ ); bits_write( &bits, 16, i_es_size + 5 /* + stuffing */ );
i_pts_dts = 0x02; i_pts_dts = 0x02;
} }
else else
...@@ -202,12 +203,12 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts, ...@@ -202,12 +203,12 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
bits_write( &bits, 15, i_dts ); bits_write( &bits, 15, i_dts );
bits_write( &bits, 1, 0x01 ); // marker bits_write( &bits, 1, 0x01 ); // marker
} }
if( !i_pts_dts ) if( !i_pts_dts )
{ {
bits_write( &bits, 8, 0x0F ); bits_write( &bits, 8, 0x0F );
} }
} }
/* now should be stuffing */ /* now should be stuffing */
/* and then pes data */ /* and then pes data */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ts.c: MPEG-II TS Muxer * ts.c: MPEG-II TS Muxer
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: ts.c,v 1.27 2003/08/14 11:47:32 gbazin Exp $ * $Id: ts.c,v 1.28 2003/08/14 23:37:54 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>
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
* - check PCR frequency requirement * - check PCR frequency requirement
* - check PAT/PMT " " * - check PAT/PMT " "
* - check PCR/PCR "soft" * - check PCR/PCR "soft"
* - check if "registration" descriptor : "AC-3" should be a program
* descriptor or an es one. (xine want an es one)
* *
* - remove creation of PAT/PMT without dvbpsi * - remove creation of PAT/PMT without dvbpsi
* - ? * - ?
...@@ -173,7 +175,6 @@ struct sout_mux_sys_t ...@@ -173,7 +175,6 @@ struct sout_mux_sys_t
int i_stream_id_mpga; int i_stream_id_mpga;
int i_stream_id_mpgv; int i_stream_id_mpgv;
int i_stream_id_a52;
int i_audio_bound; int i_audio_bound;
int i_video_bound; int i_video_bound;
...@@ -241,7 +242,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -241,7 +242,6 @@ static int Open( vlc_object_t *p_this )
srand( (uint32_t)mdate() ); srand( (uint32_t)mdate() );
p_sys->i_stream_id_mpga = 0xc0; p_sys->i_stream_id_mpga = 0xc0;
p_sys->i_stream_id_a52 = 0x80;
p_sys->i_stream_id_mpgv = 0xe0; p_sys->i_stream_id_mpgv = 0xe0;
p_sys->i_audio_bound = 0; p_sys->i_audio_bound = 0;
...@@ -424,8 +424,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -424,8 +424,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
break; break;
case VLC_FOURCC( 'a', '5','2', ' ' ): case VLC_FOURCC( 'a', '5','2', ' ' ):
p_stream->i_stream_type = 0x81; p_stream->i_stream_type = 0x81;
p_stream->i_stream_id = p_sys->i_stream_id_a52; p_stream->i_stream_id = 0xbd;
p_sys->i_stream_id_a52++;
break; break;
case VLC_FOURCC( 'm', 'p','4', 'a' ): case VLC_FOURCC( 'm', 'p','4', 'a' ):
p_stream->i_stream_type = 0x11; p_stream->i_stream_type = 0x11;
...@@ -1294,6 +1293,11 @@ static void GetPMT( sout_mux_t *p_mux, ...@@ -1294,6 +1293,11 @@ static void GetPMT( sout_mux_t *p_mux,
bits_buffer_t bits; bits_buffer_t bits;
bits_buffer_t bits_fix_IOD; bits_buffer_t bits_fix_IOD;
/* Make valgrind happy : it works at byte level not bit one so
* bit_write confuse it (but DON'T CHANGE the way that bit_write is
* working (needed when fixing some bits) */
memset( iod, 0, 4096 );
bits_initwrite( &bits, 4096, iod ); bits_initwrite( &bits, 4096, iod );
// IOD_label // IOD_label
bits_write( &bits, 8, 0x01 ); bits_write( &bits, 8, 0x01 );
...@@ -1412,47 +1416,41 @@ static void GetPMT( sout_mux_t *p_mux, ...@@ -1412,47 +1416,41 @@ static void GetPMT( sout_mux_t *p_mux,
p_stream->i_pid ); p_stream->i_pid );
if( p_stream->i_stream_id == 0xfa || p_stream->i_stream_id == 0xfb ) if( p_stream->i_stream_id == 0xfa || p_stream->i_stream_id == 0xfb )
{ {
uint8_t data[512]; uint8_t es_id[2];
bits_buffer_t bits;
/* SL descriptor */ /* SL descriptor */
bits_initwrite( &bits, 512, data ); es_id[0] = (p_stream->i_es_id >> 8)&0xff;
bits_write( &bits, 16, p_stream->i_es_id ); es_id[1] = (p_stream->i_es_id)&0xff;
dvbpsi_PMTESAddDescriptor( p_es, 0x1f, 2, es_id );
dvbpsi_PMTESAddDescriptor( p_es,
0x1f,
bits.i_data,
bits.p_data );
} }
else if( p_stream->i_stream_id == 0xa0 ) else if( p_stream->i_stream_type == 0xa0 )
{ {
uint8_t data[512]; uint8_t data[512];
uint8_t fcc[4]; int i_extra = __MIN( p_stream->i_decoder_specific_info,
bits_buffer_t bits; 502 );
memcpy( fcc, &p_stream->i_bih_codec, 4 );
/* private DIV3 descripor */ /* private DIV3 descripor */
bits_initwrite( &bits, 512, data ); memcpy( &data[0], &p_stream->i_bih_codec, 4 );
bits_write( &bits, 8, fcc[0]); data[4] = ( p_stream->i_bih_width >> 8 )&&0xff;
bits_write( &bits, 8, fcc[1]); data[5] = ( p_stream->i_bih_width )&&0xff;
bits_write( &bits, 8, fcc[2]); data[6] = ( p_stream->i_bih_height>> 8 )&&0xff;
bits_write( &bits, 8, fcc[3]); data[7] = ( p_stream->i_bih_height )&&0xff;
bits_write( &bits, 16, p_stream->i_bih_width ); data[8] = ( i_extra >> 8 )&&0xff;
bits_write( &bits, 16, p_stream->i_bih_height ); data[9] = ( i_extra )&&0xff;
bits_write( &bits, 16, p_stream->i_decoder_specific_info ); if( i_extra > 0 )
if( p_stream->i_decoder_specific_info > 0 )
{ {
int i; memcpy( &data[10], p_stream->p_decoder_specific_info, i_extra );
for( i = 0; i < p_stream->i_decoder_specific_info; i++ )
{
bits_write( &bits, 8, p_stream->p_decoder_specific_info[i] );
}
} }
dvbpsi_PMTESAddDescriptor( p_es,
0xa0, // private /* 0xa0 is private */
bits.i_data, dvbpsi_PMTESAddDescriptor( p_es, 0xa0, i_extra + 10, data );
bits.p_data ); }
else if( p_stream->i_stream_type == 0x81 )
{
uint8_t format[4] = { 0x41, 0x43, 0x2d, 0x33 };
/* "registration" descriptor : "AC-3" */
dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, format );
} }
} }
......
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