Commit 22cdb37f authored by Christophe Massiot's avatar Christophe Massiot

* modules/mux/mpeg/ts.c, modules/demux/ts.c: Fixed IOD descriptor

(patch courtesy of Nico Sabbi)
parent c47f3efc
...@@ -175,7 +175,7 @@ typedef struct ...@@ -175,7 +175,7 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t i_iod_label; uint8_t i_iod_label, i_iod_label_scope;
/* IOD */ /* IOD */
uint16_t i_od_id; uint16_t i_od_id;
...@@ -410,7 +410,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -410,7 +410,7 @@ static int Open( vlc_object_t *p_this )
/* Read config */ /* Read config */
var_Create( p_demux, "ts-es-id-pid", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_demux, "ts-es-id-pid", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_demux, "ts-es-id-pid", &val ); var_Get( p_demux, "ts-es-id-pid", &val );
p_sys->b_es_id_pid = val.b_bool, p_sys->b_es_id_pid = val.b_bool;
var_Create( p_demux, "ts-out", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_demux, "ts-out", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_demux, "ts-out", &val ); var_Get( p_demux, "ts-out", &val );
...@@ -1626,7 +1626,7 @@ static iod_descriptor_t *IODNew( int i_data, uint8_t *p_data ) ...@@ -1626,7 +1626,7 @@ static iod_descriptor_t *IODNew( int i_data, uint8_t *p_data )
iod_descriptor_t *p_iod; iod_descriptor_t *p_iod;
int i; int i;
int i_es_index; int i_es_index;
uint8_t i_flags; uint8_t i_flags, i_iod_tag, byte1, byte2, byte3;
vlc_bool_t b_url; vlc_bool_t b_url;
int i_iod_length; int i_iod_length;
...@@ -1645,14 +1645,28 @@ static iod_descriptor_t *IODNew( int i_data, uint8_t *p_data ) ...@@ -1645,14 +1645,28 @@ static iod_descriptor_t *IODNew( int i_data, uint8_t *p_data )
return p_iod; return p_iod;
} }
p_iod->i_iod_label = IODGetByte( &i_data, &p_data ); byte1 = IODGetByte( &i_data, &p_data );
byte2 = IODGetByte( &i_data, &p_data );
byte3 = IODGetByte( &i_data, &p_data );
if( byte2 == 0x02 ) //old vlc's buggy implementation of the IOD_descriptor
{
p_iod->i_iod_label_scope = 0x11;
p_iod->i_iod_label = byte1;
i_iod_tag = byte2;
}
else //correct implementation of the IOD_descriptor
{
p_iod->i_iod_label_scope = byte1;
p_iod->i_iod_label = byte2;
i_iod_tag = byte3;
}
fprintf( stderr, "\n* iod_label:%d", p_iod->i_iod_label ); fprintf( stderr, "\n* iod_label:%d", p_iod->i_iod_label );
fprintf( stderr, "\n* ===========" ); fprintf( stderr, "\n* ===========" );
fprintf( stderr, "\n* tag:0x%x", p_data[0] ); fprintf( stderr, "\n* tag:0x%x", i_iod_tag );
if( IODGetByte( &i_data, &p_data ) != 0x02 ) if( i_iod_tag != 0x02 )
{ {
fprintf( stderr, "\n ERR: tag != 0x02" ); fprintf( stderr, "\n ERR: tag %02x != 0x02", i_iod_tag );
return p_iod; return p_iod;
} }
...@@ -2112,6 +2126,9 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt ) ...@@ -2112,6 +2126,9 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
case 0x20: /* mpeg4 */ case 0x20: /* mpeg4 */
pid->es->fmt.i_codec = VLC_FOURCC('m','p','4','v'); pid->es->fmt.i_codec = VLC_FOURCC('m','p','4','v');
break; break;
case 0x21: /* h264 */
pid->es->fmt.i_codec = VLC_FOURCC('h','2','6','4');
break;
case 0x60: case 0x60:
case 0x61: case 0x61:
case 0x62: case 0x62:
......
...@@ -1790,6 +1790,8 @@ static void GetPMT( sout_mux_t *p_mux, ...@@ -1790,6 +1790,8 @@ static void GetPMT( sout_mux_t *p_mux,
memset( iod, 0, 4096 ); memset( iod, 0, 4096 );
bits_initwrite( &bits, 4096, iod ); bits_initwrite( &bits, 4096, iod );
// IOD_label_scope
bits_write( &bits, 8, 0x11 );
// IOD_label // IOD_label
bits_write( &bits, 8, 0x01 ); bits_write( &bits, 8, 0x01 );
// InitialObjectDescriptor // InitialObjectDescriptor
...@@ -1839,7 +1841,12 @@ static void GetPMT( sout_mux_t *p_mux, ...@@ -1839,7 +1841,12 @@ static void GetPMT( sout_mux_t *p_mux,
bits_write( &bits, 8, 0x20 ); // Visual 14496-2 bits_write( &bits, 8, 0x20 ); // Visual 14496-2
bits_write( &bits, 6, 0x04 ); // VisualStream bits_write( &bits, 6, 0x04 ); // VisualStream
} }
else if( p_stream->i_stream_type == 0x11 ) else if( p_stream->i_stream_type == 0x1b )
{
bits_write( &bits, 8, 0x21 ); // Visual 14496-2
bits_write( &bits, 6, 0x04 ); // VisualStream
}
else if( p_stream->i_stream_type == 0x11 || p_stream->i_stream_type == 0x0f )
{ {
bits_write( &bits, 8, 0x40 ); // Audio 14496-3 bits_write( &bits, 8, 0x40 ); // Audio 14496-3
bits_write( &bits, 6, 0x05 ); // AudioStream bits_write( &bits, 6, 0x05 ); // AudioStream
......
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