Commit 4dec9682 authored by Laurent Aimar's avatar Laurent Aimar

* all: new sout scheme. Now a chain of module are created that can

modify/apply on all streams, --sout has the same behavour expect when
starting with a '#'.

 With a starting '#' you can specify a chain of modules, it's still
unstable but a lot more powerfull.
 You have access to duplicate(that duplicate all stream), transcode
(using only ffmpeg), standard/std and es (that apply muxers and access),
and display. You could chain them with ':' and specify options with
{option1=value,option2=value[,...]}.

ex: * to stream and see the stream to udp/ts:ip
 --sout '#duplicate{dst=display,dst=std{access=udp,mux=ts,url=ip}}'
    * to transcode,see and stream
 --sout '#transcode{acodec=mpga}:duplicate{dst=display,dst=std{access=udp,mux=ts,url=ip}}'

 Without a starting '#', the url is converted into '#std{acces=,mux=,url}'
Test and report bugs :)
parent 1bab4d17
......@@ -334,6 +334,7 @@ AC_CHECK_LIB(m,cos,
LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
AC_CHECK_LIB(m,pow,
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lm"
LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
LDFLAGS_imdct3dn="${LDFLAGS_imdct3dn} -lm"
LDFLAGS_imdctsse="${LDFLAGS_imdctsse} -lm"
......@@ -1017,7 +1018,8 @@ then
PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
PLUGINS="${PLUGINS} packetizer_copy"
PLUGINS="${PLUGINS} vout_encoder"
PLUGINS="${PLUGINS} stream_out_dummy stream_out_standard stream_out_es"
PLUGINS="${PLUGINS} stream_out_duplicate stream_out_display"
dnl Ogg/ogm
AC_CHECK_HEADERS(ogg/ogg.h, [
......@@ -1510,6 +1512,10 @@ then
then
CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib"
CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${with_ffmpeg}/include/ffmpeg"
LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${with_ffmpeg}/lib"
fi
dnl Add postprocessing modules
......@@ -1538,9 +1544,13 @@ then
then
dnl Use a custom libffmpeg
AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
BUILTINS="${BUILTINS} ffmpeg"
BUILTINS="${BUILTINS} ffmpeg stream_out_transcode"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${real_ffmpeg_tree}/libavcodec"
else
dnl The given libavcodec wasn't built
AC_MSG_RESULT(no)
......@@ -1550,8 +1560,9 @@ then
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
AC_CHECK_LIB(avcodec, avcodec_init, [
BUILTINS="${BUILTINS} ffmpeg"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ],
BUILTINS="${BUILTINS} ffmpeg stream_out_transcode"
LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec"
LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lavcodec" ],
[ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
LDFLAGS="${LDFLAGS_save}"
CPPFLAGS="${CPPFLAGS_save}"
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.87 2003/03/24 17:15:29 gbazin Exp $
* $Id: input_ext-intf.h,v 1.88 2003/04/13 20:00:20 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -71,6 +71,9 @@ struct es_descriptor_t
count_t c_packets; /* total packets read */
count_t c_invalid_packets; /* invalid packets read */
/* XXX hack: to force a decoder instead of mode based on sout */
vlc_bool_t b_force_decoder;
};
/* Special PID values - note that the PID is only on 13 bits, and that values
......
......@@ -2,7 +2,7 @@
* stream_output.h : stream output module
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: stream_output.h,v 1.9 2003/03/11 19:02:30 fenrir Exp $
* $Id: stream_output.h,v 1.10 2003/04/13 20:00:20 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -57,12 +57,24 @@ struct sout_buffer_t
struct sout_buffer_t *p_next;
};
struct sout_packet_format_t
struct sout_format_t
{
int i_cat; // AUDIO_ES, VIDEO_ES, SPU_ES
int i_cat;
vlc_fourcc_t i_fourcc;
void *p_format; // WAVEFORMATEX or BITMAPINFOHEADER
/* audio */
int i_sample_rate;
int i_channels;
int i_block_align;
/* video */
int i_width;
int i_height;
int i_bitrate;
int i_extra_data;
uint8_t *p_extra_data;
};
struct sout_fifo_t
......@@ -75,39 +87,36 @@ struct sout_fifo_t
sout_buffer_t **pp_last;
};
typedef struct sout_stream_id_t sout_stream_id_t;
/* for mux */
struct sout_input_t
{
// vlc_mutex_t lock;
sout_instance_t *p_sout;
sout_instance_t *p_sout;
sout_packet_format_t input_format;
sout_fifo_t *p_fifo;
sout_format_t *p_fmt;
sout_fifo_t *p_fifo;
void *p_sys;
void *p_sys;
};
/* for packetizr */
/* for packetizer */
struct sout_packetizer_input_t
{
sout_instance_t *p_sout;
sout_packet_format_t input_format;
// vlc_mutex_t lock;
int i_nb_inputs;
sout_input_t **pp_inputs;
sout_instance_t *p_sout;
int i_nb_mux; // not really used, just usefull with TAB_*
sout_mux_t **pp_mux;
sout_format_t *p_fmt;
sout_stream_id_t *id;
};
#define SOUT_METHOD_NONE 0x00
#define SOUT_METHOD_FILE 0x10
#define SOUT_METHOD_NETWORK 0x20
typedef struct sout_access_out_sys_t sout_access_out_sys_t;
struct sout_access_out_t
{
VLC_COMMON_MEMBERS
......@@ -180,36 +189,129 @@ struct sout_mux_t
mtime_t i_add_stream_start;
};
struct sout_cfg_t
{
sout_cfg_t *p_next;
char *psz_name;
char *psz_value;
};
typedef struct sout_stream_sys_t sout_stream_sys_t;
struct sout_stream_t
{
VLC_COMMON_MEMBERS
module_t *p_module;
sout_instance_t *p_sout;
char *psz_name;
sout_cfg_t *p_cfg;
char *psz_next;
/* add, remove a stream */
sout_stream_id_t * (*pf_add) ( sout_stream_t *, sout_format_t * );
int (*pf_del) ( sout_stream_t *, sout_stream_id_t * );
/* manage a packet */
int (*pf_send)( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* );
/* private */
sout_stream_sys_t *p_sys;
};
typedef struct sout_instance_sys_t sout_instance_sys_t;
struct sout_instance_t
{
VLC_COMMON_MEMBERS
/* complete sout string like udp/ts:239.255.12.42#file/ps://essai.ps */
char * psz_sout;
/* here are stored the parsed psz_sout */
int i_nb_dest;
char **ppsz_dest;
char * psz_chain;
/* muxer data */
int i_preheader; /* max over all muxer */
int i_nb_mux;
sout_mux_t **pp_mux;
/* here are all packetizer inputs accepted by at least one muxer */
vlc_mutex_t lock;
int i_nb_inputs;
sout_packetizer_input_t **pp_inputs;
sout_stream_t *p_stream;
/* sout private */
sout_instance_sys_t *p_sys;
};
/* some macro */
#define TAB_APPEND( count, tab, p ) \
if( (count) > 0 ) \
{ \
(tab) = realloc( (tab), sizeof( void ** ) * ( (count) + 1 ) ); \
} \
else \
{ \
(tab) = malloc( sizeof( void ** ) ); \
} \
(void**)(tab)[(count)] = (void*)(p); \
(count)++
#define TAB_FIND( count, tab, p, index ) \
{ \
int _i_; \
(index) = -1; \
for( _i_ = 0; _i_ < (count); _i_++ ) \
{ \
if((void**)(tab)[_i_]==(void*)(p)) \
{ \
(index) = _i_; \
break; \
} \
} \
}
#define TAB_REMOVE( count, tab, p ) \
{ \
int i_index; \
TAB_FIND( count, tab, p, i_index ); \
if( i_index >= 0 ) \
{ \
if( count > 1 ) \
{ \
memmove( ((void**)tab + i_index), \
((void**)tab + i_index+1), \
( (count) - i_index - 1 ) * sizeof( void* ) );\
} \
else \
{ \
free( tab ); \
(tab) = NULL; \
} \
(count)--; \
} \
}
static inline sout_cfg_t *sout_cfg_find( sout_cfg_t *p_cfg, char *psz_name )
{
while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
{
p_cfg = p_cfg->p_next;
}
return p_cfg;
}
static inline char *sout_cfg_find_value( sout_cfg_t *p_cfg, char *psz_name )
{
while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
{
p_cfg = p_cfg->p_next;
}
if( p_cfg && p_cfg->psz_value )
{
return( p_cfg->psz_value );
}
return NULL;
}
/*****************************************************************************
* Prototypes
*****************************************************************************/
......@@ -227,7 +329,7 @@ VLC_EXPORT( sout_buffer_t *, sout_FifoShow, ( sout_fifo_t * ) );
#define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b )
VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew, ( vlc_object_t *, sout_packet_format_t * ) );
VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew, ( vlc_object_t *, sout_format_t * ) );
VLC_EXPORT( int, sout_InputDelete, ( sout_packetizer_input_t * ) );
VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t *, sout_buffer_t* ) );
......@@ -243,3 +345,13 @@ VLC_EXPORT( void, sout_AccessOutDelete, ( sout_access_out_t * ) )
VLC_EXPORT( int, sout_AccessOutSeek, ( sout_access_out_t *, off_t ) );
VLC_EXPORT( int, sout_AccessOutWrite, ( sout_access_out_t *, sout_buffer_t * ) );
VLC_EXPORT( sout_mux_t *, sout_MuxNew, ( sout_instance_t*, char *, sout_access_out_t * ) );
VLC_EXPORT( sout_input_t *, sout_MuxAddStream, ( sout_mux_t *, sout_format_t * ) );
VLC_EXPORT( void, sout_MuxDeleteStream, ( sout_mux_t *, sout_input_t * ) );
VLC_EXPORT( void, sout_MuxDelete, ( sout_mux_t * ) );
VLC_EXPORT( void, sout_MuxSendBuffer, ( sout_mux_t *, sout_input_t *, sout_buffer_t * ) );
VLC_EXPORT( char *, sout_cfg_parser, ( char **, sout_cfg_t **, char * ) );
VLC_EXPORT( sout_stream_t *, sout_stream_new, ( sout_instance_t *, char *psz_chain ) );
VLC_EXPORT( void, sout_stream_delete, ( sout_stream_t *p_stream ) );
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.59 2003/03/17 18:02:11 sam Exp $
* $Id: vlc_common.h,v 1.60 2003/04/13 20:00:20 fenrir Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -249,11 +249,11 @@ typedef struct sout_fifo_t sout_fifo_t;
typedef struct sout_input_t sout_input_t;
typedef struct sout_packetizer_input_t sout_packetizer_input_t;
typedef struct sout_buffer_t sout_buffer_t;
typedef struct sout_packet_format_t sout_packet_format_t;
typedef struct sout_access_out_t sout_access_out_t;
typedef struct sout_mux_t sout_mux_t;
typedef struct sout_access_out_sys_t sout_access_out_sys_t;
typedef struct sout_stream_t sout_stream_t;
typedef struct sout_cfg_t sout_cfg_t;
typedef struct sout_format_t sout_format_t;
/* Decoders */
typedef struct decoder_fifo_t decoder_fifo_t;
......
......@@ -62,6 +62,7 @@ EXTRA_DIST = \
mux/Modules.am \
mux/mpeg/Modules.am \
packetizer/Modules.am \
stream_out/Modules.am \
video_chroma/Modules.am \
video_filter/Modules.am \
video_filter/deinterlace/Modules.am \
......
......@@ -2,7 +2,7 @@
* avi.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: avi.c,v 1.11 2003/03/31 03:46:11 fenrir Exp $
* $Id: avi.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -231,12 +231,12 @@ static void Close( vlc_object_t * p_this )
(uint64_t)p_stream->i_totalsize /
(uint64_t)p_stream->i_duration;
}
msg_Err( p_mux, "stream[%d] duration:%lld totalsize:%lld frames:%d fps:%f kb/s:%d",
i_stream,
(int64_t)p_stream->i_duration / (int64_t)1000000,
p_stream->i_totalsize,
p_stream->i_frames,
p_stream->f_fps, p_stream->i_bitrate/1024 );
msg_Info( p_mux, "stream[%d] duration:%lld totalsize:%lld frames:%d fps:%f kb/s:%d",
i_stream,
(int64_t)p_stream->i_duration / (int64_t)1000000,
p_stream->i_totalsize,
p_stream->i_frames,
p_stream->f_fps, p_stream->i_bitrate/1024 );
}
p_hdr = avi_HeaderCreateRIFF( p_mux );
......@@ -266,11 +266,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
msg_Err( p_mux, "too many streams" );
return( -1 );
}
if( p_input->input_format.p_format == NULL )
{
msg_Err( p_mux, "stream descriptor missing" );
return( -1 );
}
msg_Dbg( p_mux, "adding input" );
p_input->p_sys = malloc( sizeof( int ) );
......@@ -278,49 +273,96 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
*((int*)p_input->p_sys) = p_sys->i_streams;
p_stream = &p_sys->stream[p_sys->i_streams];
switch( p_input->input_format.i_cat )
switch( p_input->p_fmt->i_cat )
{
case AUDIO_ES:
p_stream->i_cat = AUDIO_ES;
p_stream->fcc[0] = '0' + p_sys->i_streams / 10;
p_stream->fcc[1] = '0' + p_sys->i_streams % 10;
p_stream->fcc[2] = 'w';
p_stream->fcc[3] = 'b';
p_stream->p_bih = NULL;
p_stream->p_wf = malloc( sizeof( WAVEFORMATEX ) + p_input->p_fmt->i_extra_data );
#define p_wf p_stream->p_wf
p_wf->cbSize = p_input->p_fmt->i_extra_data;
if( p_wf->cbSize > 0 )
{
memcpy( &p_wf[1],
p_input->p_fmt->p_extra_data,
p_input->p_fmt->i_extra_data );
}
p_wf->nChannels = p_input->p_fmt->i_channels;
p_wf->nSamplesPerSec = p_input->p_fmt->i_sample_rate;
p_wf->nBlockAlign = p_input->p_fmt->i_block_align;
p_wf->nAvgBytesPerSec= p_input->p_fmt->i_bitrate / 8;
p_wf->wBitsPerSample = 0;
switch( p_input->p_fmt->i_fourcc )
{
WAVEFORMATEX *p_wf =
(WAVEFORMATEX*)p_input->input_format.p_format;
p_stream->i_cat = AUDIO_ES;
p_stream->fcc[0] = '0' + p_sys->i_streams / 10;
p_stream->fcc[1] = '0' + p_sys->i_streams % 10;
p_stream->fcc[2] = 'w';
p_stream->fcc[3] = 'b';
p_stream->p_bih = NULL;
p_stream->p_wf = malloc( sizeof( WAVEFORMATEX ) + p_wf->cbSize );
memcpy( p_stream->p_wf,
p_wf,
sizeof( WAVEFORMATEX ) + p_wf->cbSize);
case VLC_FOURCC( 'a', '5', '2', ' ' ):
p_wf->wFormatTag = WAVE_FORMAT_A52;
break;
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_wf->wFormatTag = WAVE_FORMAT_MPEGLAYER3;
break;
case VLC_FOURCC( 'w', 'm', 'a', '1' ):
p_wf->wFormatTag = WAVE_FORMAT_WMA1;
break;
case VLC_FOURCC( 'w', 'm', 'a', '2' ):
p_wf->wFormatTag = WAVE_FORMAT_WMA2;
break;
case VLC_FOURCC( 'w', 'm', 'a', '3' ):
p_wf->wFormatTag = WAVE_FORMAT_WMA3;
break;
default:
return VLC_EGENERIC;
}
#undef p_wf
break;
case VIDEO_ES:
p_stream->i_cat = VIDEO_ES;
p_stream->fcc[0] = '0' + p_sys->i_streams / 10;
p_stream->fcc[1] = '0' + p_sys->i_streams % 10;
p_stream->fcc[2] = 'd';
p_stream->fcc[3] = 'c';
if( p_sys->i_stream_video < 0 )
{
BITMAPINFOHEADER *p_bih =
(BITMAPINFOHEADER*)p_input->input_format.p_format;;
p_stream->i_cat = VIDEO_ES;
p_stream->fcc[0] = '0' + p_sys->i_streams / 10;
p_stream->fcc[1] = '0' + p_sys->i_streams % 10;
p_stream->fcc[2] = 'd';
p_stream->fcc[3] = 'c';
if( p_sys->i_stream_video < 0 )
{
p_sys->i_stream_video = p_sys->i_streams;
}
p_stream->p_wf = NULL;
p_stream->p_bih = malloc( p_bih->biSize );
memcpy( p_stream->p_bih,
p_bih,
p_bih->biSize );
p_sys->i_stream_video = p_sys->i_streams;
}
p_stream->p_wf = NULL;
p_stream->p_bih = malloc( sizeof( BITMAPINFOHEADER ) + p_input->p_fmt->i_extra_data );
#define p_bih p_stream->p_bih
p_bih->biSize = sizeof( BITMAPINFOHEADER ) + p_input->p_fmt->i_extra_data;
if( p_input->p_fmt->i_extra_data > 0 )
{
memcpy( &p_bih[1],
p_input->p_fmt->p_extra_data,
p_input->p_fmt->i_extra_data );
}
p_bih->biWidth = p_input->p_fmt->i_width;
p_bih->biHeight= p_input->p_fmt->i_height;
p_bih->biPlanes= 1;
p_bih->biBitCount = 24;
p_bih->biSizeImage = 0;
p_bih->biXPelsPerMeter = 0;
p_bih->biYPelsPerMeter = 0;
p_bih->biClrUsed = 0;
p_bih->biClrImportant = 0;
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'm', 'p', '4', 'v' ):
p_bih->biCompression = VLC_FOURCC( 'X', 'V', 'I', 'D' );
break;
default:
p_bih->biCompression = p_input->p_fmt->i_fourcc;
break;
}
#undef p_bih
break;
default:
return( -1 );
return( VLC_EGENERIC );
}
p_stream->i_totalsize = 0;
p_stream->i_frames = 0;
......@@ -333,7 +375,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_sys->i_streams++;
return( 0 );
return( VLC_SUCCESS );
}
static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
......@@ -431,8 +473,8 @@ static int Mux ( sout_mux_t *p_mux )
p_data->i_size += 1;
}
sout_AccessOutWrite( p_mux->p_access, p_data );
p_sys->i_movi_size += p_data->i_size;
sout_AccessOutWrite( p_mux->p_access, p_data );
i_count--;
}
......@@ -649,7 +691,7 @@ static int avi_HeaderAdd_strh( sout_mux_t *p_mux,
if( i_samplesize > 1 )
{
i_scale = i_samplesize;
i_rate = i_scale * p_stream->i_bitrate / 8;
i_rate = /*i_scale **/ p_stream->i_bitrate / 8;
}
else
{
......
......@@ -2,7 +2,7 @@
* ps.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ps.c,v 1.11 2003/03/11 19:02:30 fenrir Exp $
* $Id: ps.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -174,11 +174,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
msg_Dbg( p_mux, "adding input" );
p_input->p_sys = (void*)p_stream = malloc( sizeof( ps_stream_t ) );
p_stream->i_ok = 0;
switch( p_input->input_format.i_cat )
switch( p_input->p_fmt->i_cat )
{
case VIDEO_ES:
switch( p_input->input_format.i_fourcc )
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
p_stream->i_stream_id = p_sys->i_stream_id_mpgv;
......@@ -190,7 +190,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
break;
case AUDIO_ES:
switch( p_input->input_format.i_fourcc )
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'a', '5', '2', ' ' ):
case VLC_FOURCC( 'a', '5', '2', 'b' ):
......
......@@ -2,7 +2,7 @@
* ts.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ts.c,v 1.15 2003/03/11 19:02:30 fenrir Exp $
* $Id: ts.c,v 1.16 2003/04/13 20:00:21 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -223,8 +223,6 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
{
sout_mux_sys_t *p_sys = p_mux->p_sys;
ts_stream_t *p_stream;
BITMAPINFOHEADER *p_bih;
WAVEFORMATEX *p_wf;
msg_Dbg( p_mux, "adding input" );
p_input->p_sys = (void*)p_stream = malloc( sizeof( ts_stream_t ) );
......@@ -236,10 +234,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
p_stream->i_continuity_counter = 0;
switch( p_input->input_format.i_cat )
switch( p_input->p_fmt->i_cat )
{
case VIDEO_ES:
switch( p_input->input_format.i_fourcc )
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'm', 'p','g', 'v' ):
p_stream->i_stream_type = 0x02;
......@@ -269,38 +267,28 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
return( -1 );
}
p_sys->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_bih_codec = p_input->p_fmt->i_fourcc;
p_stream->i_bih_width = p_input->p_fmt->i_width;
p_stream->i_bih_height = p_input->p_fmt->i_height;
p_stream->i_decoder_specific_info_len = p_input->p_fmt->i_extra_data;
if( p_stream->i_decoder_specific_info_len > 0 )
{
p_stream->i_decoder_specific_info_len =
p_bih->biSize - sizeof( BITMAPINFOHEADER );
p_stream->p_decoder_specific_info =
malloc( p_stream->i_decoder_specific_info_len );
memcpy( p_stream->p_decoder_specific_info,
&p_bih[1],
p_stream->i_decoder_specific_info_len );
p_input->p_fmt->p_extra_data,
p_input->p_fmt->i_extra_data );
}
else
{
p_stream->p_decoder_specific_info = NULL;
p_stream->i_decoder_specific_info_len = 0;
}
break;
case AUDIO_ES:
switch( p_input->input_format.i_fourcc )
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'a', '5','2', ' ' ):
case VLC_FOURCC( 'a', '5','2', 'b' ):
......@@ -324,20 +312,19 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
return( -1 );
}
p_sys->i_audio_bound++;
p_wf = (WAVEFORMATEX*)p_input->input_format.p_format;
if( p_wf && p_wf->cbSize > 0 )
p_stream->i_decoder_specific_info_len = p_input->p_fmt->i_extra_data;
if( p_stream->i_decoder_specific_info_len > 0 )
{
p_stream->i_decoder_specific_info_len = p_wf->cbSize;
p_stream->p_decoder_specific_info =
malloc( p_stream->i_decoder_specific_info_len );
memcpy( p_stream->p_decoder_specific_info,
&p_wf[1],
p_stream->i_decoder_specific_info_len );
p_input->p_fmt->p_extra_data,
p_input->p_fmt->i_extra_data );
}
else
{
p_stream->p_decoder_specific_info = NULL;
p_stream->i_decoder_specific_info_len = 0;
}
break;
default:
......
......@@ -2,7 +2,7 @@
* ogg.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ogg.c,v 1.4 2003/03/31 03:46:11 fenrir Exp $
* $Id: ogg.c,v 1.5 2003/04/13 20:00:21 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -209,33 +209,29 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
sout_mux_sys_t *p_sys = p_mux->p_sys;
ogg_stream_t *p_stream;
BITMAPINFOHEADER *p_bih;
WAVEFORMATEX *p_wf;
msg_Dbg( p_mux, "adding input" );
p_input->p_sys = (void*)p_stream = malloc( sizeof( ogg_stream_t ) );
p_stream->i_cat = p_input->input_format.i_cat;
p_stream->i_fourcc = p_input->input_format.i_fourcc;
p_stream->i_cat = p_input->p_fmt->i_cat;
p_stream->i_fourcc = p_input->p_fmt->i_fourcc;
p_stream->i_packet_no = 0;
p_stream->header.i_packet_type = PACKET_TYPE_HEADER;
switch( p_input->input_format.i_cat )
switch( p_input->p_fmt->i_cat )
{
case VIDEO_ES:
p_bih = (BITMAPINFOHEADER*)p_input->input_format.p_format;
switch( p_input->input_format.i_fourcc )
switch( p_input->p_fmt->i_fourcc )
{
case VLC_FOURCC( 'm', 'p','4', 'v' ):
case VLC_FOURCC( 'D', 'I','V', '3' ):
memcpy( p_stream->header.stream_type,
"video ",
8 );
if( p_input->input_format.i_fourcc == VLC_FOURCC( 'm', 'p','4', 'v' ) )
if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'm', 'p','4', 'v' ) )
{
memcpy( p_stream->header.sub_type, "XVID", 4 );
}
else if( p_input->input_format.i_fourcc == VLC_FOURCC( 'D', 'I','V', '3' ) )
else if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'D', 'I','V', '3' ) )
{
memcpy( p_stream->header.sub_type, "DIV3", 4 );
}
......@@ -246,16 +242,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )