Commit 4d12c66c authored by Laurent Aimar's avatar Laurent Aimar
Browse files

* all : added streaming support for crappy ms video codec into TS.

 - Only vlc is able to read such TS.
 - I use stream id 0xa0 and descriptor 0xa0, I hope there aren't used.
 - DivX1/2/3, wmv1/2, h/i263 should be supported, others could be
   quickly added.
 - Please test.
parent 5733e86e
......@@ -2,7 +2,7 @@
* system.h: MPEG demultiplexing.
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: system.h,v 1.5 2003/02/08 19:10:21 massiot Exp $
* $Id: system.h,v 1.6 2003/02/23 18:07:30 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -67,6 +67,8 @@
#define DVDB_SPU_ES 0x92
#define LPCMB_AUDIO_ES 0x93
#define MSCODEC_VIDEO_ES 0xa0
/****************************************************************************
* psi_callback_t
****************************************************************************
......
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.18 2003/02/20 01:52:46 sigmunau Exp $
* $Id: ts.c,v 1.19 2003/02/23 18:07:30 fenrir Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -1360,7 +1360,11 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
p_new_es->i_cat = AUDIO_ES;
p_new_es->i_stream_id = 0xfa;
break;
case MSCODEC_VIDEO_ES:
p_new_es->i_fourcc = VLC_FOURCC(0,0,0,0); // fixed later
p_new_es->i_cat = VIDEO_ES;
p_new_es->i_stream_id = 0xa0;
break;
default:
p_new_es->i_fourcc = 0;
p_new_es->i_cat = UNKNOWN_ES;
......@@ -1517,6 +1521,50 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
}
}
else if( p_es->i_type == MSCODEC_VIDEO_ES )
{
/* crapy ms codec stream, search private descriptor */
dvbpsi_descriptor_t *p_dr = p_es->p_first_descriptor;
es_ts_data_t *p_es_demux =
(es_ts_data_t*)p_new_es->p_demux_data;
while( p_dr && ( p_dr->i_tag != 0xa0 ) )
p_dr = p_dr->p_next;
if( p_dr && p_dr->i_length >= 8 )
{
int i_size;
int i_bih_size;
BITMAPINFOHEADER *p_bih;
p_new_es->i_fourcc = ( p_dr->p_data[0] << 24 )| ( p_dr->p_data[1] << 16 )|
( p_dr->p_data[2] << 8 )| ( p_dr->p_data[3] );
i_bih_size = ( ( p_dr->p_data[8] << 8)|( p_dr->p_data[9] ) );
i_size = sizeof( BITMAPINFOHEADER ) + i_bih_size;
p_new_es->p_bitmapinfoheader = (void*)p_bih = malloc( i_size );
p_bih->biSize = i_size;
p_bih->biWidth = ( p_dr->p_data[4] << 8 )|p_dr->p_data[5];
p_bih->biHeight = ( p_dr->p_data[6] << 8 )|p_dr->p_data[7];
p_bih->biPlanes = 1;
p_bih->biBitCount = 0;
p_bih->biCompression = 0;
p_bih->biSizeImage = 0;
p_bih->biXPelsPerMeter = 0;
p_bih->biYPelsPerMeter = 0;
p_bih->biClrUsed = 0;
p_bih->biClrImportant = 0;
memcpy( &p_bih[1],
&p_dr->p_data[10],
i_bih_size );
}
else
{
msg_Warn( p_input, "private ms-codec stream without bih private sl_descriptor" );
p_new_es->i_fourcc = 0;
p_new_es->i_cat = UNKNOWN_ES;
}
}
if( ( p_new_es->i_cat == AUDIO_ES )
|| (p_new_es->i_cat == SPU_ES ) )
......
......@@ -2,7 +2,7 @@
* ts.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ts.c,v 1.8 2003/02/16 14:10:44 fenrir Exp $
* $Id: ts.c,v 1.9 2003/02/23 18:07:30 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -72,6 +72,10 @@ typedef struct ts_stream_s
int i_stream_id;
int i_continuity_counter;
/* to be used for carriege of DIV3 */
vlc_fourcc_t i_bih_codec;
int i_bih_width, i_bih_height;
/* Specific to mpeg4 in mpeg2ts */
int i_es_id;
int i_sl_predefined;
......@@ -235,11 +239,36 @@ static int AddStream( sout_instance_t *p_sout, sout_input_t *p_input )
p_stream->i_es_id = p_stream->i_pid;
p_stream->i_sl_predefined = 0x01; // NULL SL header
break;
/* XXX dirty dirty but somebody want that : using crapy MS-codec XXX */
/* I didn't want to do that :P */
case VLC_FOURCC( 'W', 'M', 'V', '2' ):
case VLC_FOURCC( 'H', '2', '6', '3' ):
case VLC_FOURCC( 'I', '2', '6', '3' ):
case VLC_FOURCC( 'W', 'M', 'V', '1' ):
case VLC_FOURCC( 'D', 'I', 'V', '3' ):
case VLC_FOURCC( 'D', 'I', 'V', '2' ):
case VLC_FOURCC( 'D', 'I', 'V', '1' ):
p_stream->i_stream_type = 0xa0; // private
p_stream->i_stream_id = 0xa0; // beurk
break;
default:
return( -1 );
}
p_mux->i_video_bound++;
p_bih = (BITMAPINFOHEADER*)p_input->input_format.p_format;
if( p_bih )
{
p_stream->i_bih_codec = p_input->input_format.i_fourcc;
p_stream->i_bih_width = p_bih->biWidth;
p_stream->i_bih_height = p_bih->biHeight;
}
else
{
p_stream->i_bih_codec = 0x0;
p_stream->i_bih_width = 0;
p_stream->i_bih_height = 0;
}
if( p_bih && p_bih->biSize > sizeof( BITMAPINFOHEADER ) )
{
p_stream->i_decoder_specific_info_len =
......@@ -996,6 +1025,30 @@ static int GetPMT( sout_instance_t *p_sout,
bits.i_data,
bits.p_data );
}
else if( p_stream->i_stream_id == 0xa0 )
{
uint8_t data[512];
bits_buffer_t bits;
/* private DIV3 descripor */
bits_initwrite( &bits, 512, data );
bits_write( &bits, 32, p_stream->i_bih_codec );
bits_write( &bits, 16, p_stream->i_bih_width );
bits_write( &bits, 16, p_stream->i_bih_height );
bits_write( &bits, 16, p_stream->i_decoder_specific_info_len );
if( p_stream->i_decoder_specific_info_len > 0 )
{
int i;
for( i = 0; i < p_stream->i_decoder_specific_info_len; i++ )
{
bits_write( &bits, 8, p_stream->p_decoder_specific_info[i] );
}
}
dvbpsi_PMTESAddDescriptor( p_es,
0xa0, // private
bits.i_data,
bits.p_data );
}
}
p_section = dvbpsi_GenPMTSections( &pmt );
......
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