From bfeea8d61f8591f77a75a8c8a7a0c09c8681bda7 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 21 Nov 2003 15:32:09 +0000 Subject: [PATCH] * all: remove sout_format_t and use es_format_t instead. --- include/stream_output.h | 34 +---- include/vlc_common.h | 11 +- include/vlc_es.h | 10 +- modules/mux/asf.c | 64 ++++---- modules/mux/avi.c | 36 ++--- modules/mux/mp4.c | 66 ++++----- modules/mux/mpeg/ps.c | 8 +- modules/mux/mpeg/ts.c | 24 +-- modules/mux/ogg.c | 22 +-- modules/packetizer/mpegvideo.c | 22 +-- modules/stream_out/display.c | 38 ++--- modules/stream_out/dummy.c | 6 +- modules/stream_out/duplicate.c | 6 +- modules/stream_out/es.c | 12 +- modules/stream_out/gather.c | 26 ++-- modules/stream_out/rtp.c | 40 ++--- modules/stream_out/standard.c | 6 +- modules/stream_out/transcode.c | 180 +++++++++++------------ modules/stream_out/transrate/transrate.c | 12 +- src/input/input_dec.c | 26 +--- src/stream_output/stream_output.c | 12 +- 21 files changed, 315 insertions(+), 346 deletions(-) diff --git a/include/stream_output.h b/include/stream_output.h index b01779c5b5..b79dc1857b 100644 --- a/include/stream_output.h +++ b/include/stream_output.h @@ -2,7 +2,7 @@ * stream_output.h : stream output module ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: stream_output.h,v 1.15 2003/11/07 16:53:54 massiot Exp $ + * $Id: stream_output.h,v 1.16 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Christophe Massiot * Laurent Aimar @@ -27,6 +27,8 @@ * sout_instance_t: stream output thread descriptor *****************************************************************************/ +#include "vlc_es.h" + /* * i_allocated_size: size of allocated buffer * p_allocated_buffer: where data has been allocated @@ -65,26 +67,6 @@ struct sout_buffer_t struct sout_buffer_t *p_next; }; -struct sout_format_t -{ - int i_cat; - vlc_fourcc_t i_fourcc; - - /* 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 { vlc_mutex_t lock; /* fifo data lock */ @@ -102,7 +84,7 @@ struct sout_input_t { sout_instance_t *p_sout; - sout_format_t *p_fmt; + es_format_t *p_fmt; sout_fifo_t *p_fifo; void *p_sys; @@ -114,7 +96,7 @@ struct sout_packetizer_input_t sout_instance_t *p_sout; - sout_format_t *p_fmt; + es_format_t *p_fmt; sout_stream_id_t *id; }; @@ -225,7 +207,7 @@ struct sout_stream_t char *psz_next; /* add, remove a stream */ - sout_stream_id_t * (*pf_add) ( sout_stream_t *, sout_format_t * ); + sout_stream_id_t * (*pf_add) ( sout_stream_t *, es_format_t * ); int (*pf_del) ( sout_stream_t *, sout_stream_id_t * ); /* manage a packet */ @@ -296,7 +278,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_format_t * ) ); +VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew, ( vlc_object_t *, es_format_t * ) ); VLC_EXPORT( int, sout_InputDelete, ( sout_packetizer_input_t * ) ); VLC_EXPORT( int, sout_InputSendBuffer, ( sout_packetizer_input_t *, sout_buffer_t* ) ); @@ -313,7 +295,7 @@ VLC_EXPORT( int, sout_AccessOutSeek, ( sout_access_out_t *, of 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( sout_input_t *, sout_MuxAddStream, ( sout_mux_t *, es_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 * ) ); diff --git a/include/vlc_common.h b/include/vlc_common.h index db994d8711..50997146f3 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vlc_common.h,v 1.87 2003/11/21 00:38:01 gbazin Exp $ + * $Id: vlc_common.h,v 1.88 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -217,6 +217,12 @@ typedef struct pgrm_sys_t pgrm_sys_t; typedef struct stream_descriptor_t stream_descriptor_t; typedef struct stream_sys_t stream_sys_t; +/* Format */ +typedef struct audio_format_t audio_format_t; +typedef struct video_format_t video_format_t; +typedef struct subs_format_t subs_format_t; +typedef struct es_format_t es_format_t; + /* NInput */ typedef struct stream_t stream_t; typedef struct es_out_t es_out_t; @@ -230,7 +236,6 @@ typedef struct aout_sys_t aout_sys_t; typedef struct aout_fifo_t aout_fifo_t; typedef struct aout_input_t aout_input_t; typedef struct aout_buffer_t aout_buffer_t; -typedef struct audio_format_t audio_format_t; typedef audio_format_t audio_sample_format_t; typedef struct audio_date_t audio_date_t; typedef struct aout_filter_t aout_filter_t; @@ -239,7 +244,6 @@ typedef struct aout_filter_t aout_filter_t; typedef struct vout_thread_t vout_thread_t; typedef struct vout_sys_t vout_sys_t; typedef struct chroma_sys_t chroma_sys_t; -typedef struct video_format_t video_format_t; typedef video_format_t video_frame_format_t; typedef struct picture_t picture_t; typedef struct picture_sys_t picture_sys_t; @@ -260,7 +264,6 @@ typedef struct sout_access_out_t sout_access_out_t; typedef struct sout_mux_t sout_mux_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; /*typedef struct sap_session_t sap_session_t; typedef struct slp_session_t slp_session_t;*/ diff --git a/include/vlc_es.h b/include/vlc_es.h index 73cd4d29a7..83c69b069c 100644 --- a/include/vlc_es.h +++ b/include/vlc_es.h @@ -2,7 +2,7 @@ * vlc_es.h ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: vlc_es.h,v 1.1 2003/11/20 22:10:55 fenrir Exp $ + * $Id: vlc_es.h,v 1.2 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -83,16 +83,16 @@ struct video_format_t /** * Description of subs */ -typedef struct subs_format_t +struct subs_format_t { char *psz_encoding; -} subs_format_t; +}; /** * ES definition */ -typedef struct +struct es_format_t { int i_cat; vlc_fourcc_t i_codec; @@ -116,7 +116,7 @@ typedef struct int i_extra; void *p_extra; -} es_format_t; +}; static inline void es_format_Init( es_format_t *fmt, int i_cat, vlc_fourcc_t i_codec ) diff --git a/modules/mux/asf.c b/modules/mux/asf.c index bcb0c6c489..d70760e915 100644 --- a/modules/mux/asf.c +++ b/modules/mux/asf.c @@ -2,7 +2,7 @@ * asf.c ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: asf.c,v 1.7 2003/08/29 19:49:33 fenrir Exp $ + * $Id: asf.c,v 1.8 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -280,11 +280,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) { case AUDIO_ES: { - int i_blockalign = p_input->p_fmt->i_block_align; + int i_blockalign = p_input->p_fmt->audio.i_blockalign; int i_bitspersample = 0; int i_extra = 0; - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'a', '5', '2', ' ' ): tk->i_tag = WAVE_FORMAT_A52; @@ -320,25 +320,25 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) case VLC_FOURCC( 'u', '8', ' ', ' ' ): tk->psz_name = "Raw audio 8bits"; tk->i_tag = WAVE_FORMAT_PCM; - i_blockalign= p_input->p_fmt->i_channels; + i_blockalign= p_input->p_fmt->audio.i_channels; i_bitspersample = 8; break; case VLC_FOURCC( 's', '1', '6', 'l' ): tk->psz_name = "Raw audio 16bits"; tk->i_tag = WAVE_FORMAT_PCM; - i_blockalign= 2 * p_input->p_fmt->i_channels; + i_blockalign= 2 * p_input->p_fmt->audio.i_channels; i_bitspersample = 16; break; case VLC_FOURCC( 's', '2', '4', 'l' ): tk->psz_name = "Raw audio 24bits"; tk->i_tag = WAVE_FORMAT_PCM; - i_blockalign= 3 * p_input->p_fmt->i_channels; + i_blockalign= 3 * p_input->p_fmt->audio.i_channels; i_bitspersample = 24; break; case VLC_FOURCC( 's', '3', '2', 'l' ): tk->psz_name = "Raw audio 32bits"; tk->i_tag = WAVE_FORMAT_PCM; - i_blockalign= 4 * p_input->p_fmt->i_channels; + i_blockalign= 4 * p_input->p_fmt->audio.i_channels; i_bitspersample = 32; break; default: @@ -347,20 +347,20 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) tk->i_extra = sizeof( WAVEFORMATEX ) + - p_input->p_fmt->i_extra_data + i_extra; + p_input->p_fmt->i_extra + i_extra; tk->p_extra = malloc( tk->i_extra ); bo_init( &bo, tk->p_extra, tk->i_extra ); bo_addle_u16( &bo, tk->i_tag ); - bo_addle_u16( &bo, p_input->p_fmt->i_channels ); - bo_addle_u32( &bo, p_input->p_fmt->i_sample_rate ); + bo_addle_u16( &bo, p_input->p_fmt->audio.i_channels ); + bo_addle_u32( &bo, p_input->p_fmt->audio.i_rate ); bo_addle_u32( &bo, p_input->p_fmt->i_bitrate / 8 ); bo_addle_u16( &bo, i_blockalign ); bo_addle_u16( &bo, i_bitspersample ); - if( p_input->p_fmt->i_extra_data > 0 ) + if( p_input->p_fmt->i_extra > 0 ) { - bo_addle_u16( &bo, p_input->p_fmt->i_extra_data ); - bo_add_mem ( &bo, p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + bo_addle_u16( &bo, p_input->p_fmt->i_extra ); + bo_add_mem ( &bo, p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } else { @@ -379,7 +379,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) msg_Dbg( p_mux, "adding mp2 header" ); bo_addle_u16( &bo, 2 ); /* fwHeadLayer */ bo_addle_u32( &bo, p_input->p_fmt->i_bitrate ); - bo_addle_u16( &bo, p_input->p_fmt->i_channels == 2 ?1:8 ); + bo_addle_u16( &bo, p_input->p_fmt->audio.i_channels == 2 ?1:8 ); bo_addle_u16( &bo, 0 ); /* fwHeadModeExt */ bo_addle_u16( &bo, 1 ); /* wHeadEmphasis */ bo_addle_u16( &bo, 16 ); /* fwHeadFlags */ @@ -401,46 +401,46 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) case VIDEO_ES: { tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) + - p_input->p_fmt->i_extra_data; + p_input->p_fmt->i_extra; tk->p_extra = malloc( tk->i_extra ); bo_init( &bo, tk->p_extra, tk->i_extra ); - bo_addle_u32( &bo, p_input->p_fmt->i_width ); - bo_addle_u32( &bo, p_input->p_fmt->i_height ); + bo_addle_u32( &bo, p_input->p_fmt->video.i_width ); + bo_addle_u32( &bo, p_input->p_fmt->video.i_height ); bo_add_u8 ( &bo, 0x02 ); /* flags */ bo_addle_u16( &bo, sizeof( BITMAPINFOHEADER ) + - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->i_extra ); bo_addle_u32( &bo, sizeof( BITMAPINFOHEADER ) + - p_input->p_fmt->i_extra_data ); - bo_addle_u32( &bo, p_input->p_fmt->i_width ); - bo_addle_u32( &bo, p_input->p_fmt->i_height ); + p_input->p_fmt->i_extra ); + bo_addle_u32( &bo, p_input->p_fmt->video.i_width ); + bo_addle_u32( &bo, p_input->p_fmt->video.i_height ); bo_addle_u16( &bo, 1 ); bo_addle_u16( &bo, 24 ); - if( p_input->p_fmt->i_fourcc == VLC_FOURCC('m','p','4','v') ) + if( p_input->p_fmt->i_codec == VLC_FOURCC('m','p','4','v') ) { tk->psz_name = "MPEG-4 Video"; tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', 'S' ); } - else if( p_input->p_fmt->i_fourcc == VLC_FOURCC('D','I','V','3') ) + else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','3') ) { tk->psz_name = "MSMPEG-4 V3 Video"; tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', '3' ); } - else if( p_input->p_fmt->i_fourcc == VLC_FOURCC('D','I','V','2') ) + else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','2') ) { tk->psz_name = "MSMPEG-4 V2 Video"; tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', '2' ); } - else if( p_input->p_fmt->i_fourcc == VLC_FOURCC('D','I','V','1') ) + else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','1') ) { tk->psz_name = "MSMPEG-4 V1 Video"; tk->i_fourcc = VLC_FOURCC( 'M', 'P', 'G', '4' ); } - else if( p_input->p_fmt->i_fourcc == VLC_FOURCC('W','M','V','1') ) + else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','1') ) { tk->psz_name = "Windows Media Video 1"; tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '1' ); } - else if( p_input->p_fmt->i_fourcc == VLC_FOURCC('W','M','V','2') ) + else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','2') ) { tk->psz_name = "Windows Media Video 2"; tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '2' ); @@ -448,7 +448,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) else { tk->psz_name = "Unknow Video"; - tk->i_fourcc = p_input->p_fmt->i_fourcc; + tk->i_fourcc = p_input->p_fmt->i_codec; } bo_add_mem( &bo, (uint8_t*)&tk->i_fourcc, 4 ); bo_addle_u32( &bo, 0 ); @@ -456,10 +456,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) bo_addle_u32( &bo, 0 ); bo_addle_u32( &bo, 0 ); bo_addle_u32( &bo, 0 ); - if( p_input->p_fmt->i_extra_data > 0 ) + if( p_input->p_fmt->i_extra > 0 ) { - bo_add_mem ( &bo, p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + bo_add_mem ( &bo, p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } if( p_input->p_fmt->i_bitrate > 50000 ) diff --git a/modules/mux/avi.c b/modules/mux/avi.c index 5c863ca4b8..38c617add9 100644 --- a/modules/mux/avi.c +++ b/modules/mux/avi.c @@ -2,7 +2,7 @@ * avi.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: avi.c,v 1.15 2003/08/17 18:44:26 fenrir Exp $ + * $Id: avi.c,v 1.16 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -264,22 +264,22 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) p_stream->p_bih = NULL; p_stream->p_wf = malloc( sizeof( WAVEFORMATEX ) + - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->i_extra ); #define p_wf p_stream->p_wf - p_wf->cbSize = p_input->p_fmt->i_extra_data; + p_wf->cbSize = p_input->p_fmt->i_extra; if( p_wf->cbSize > 0 ) { memcpy( &p_wf[1], - p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } - 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->nChannels = p_input->p_fmt->audio.i_channels; + p_wf->nSamplesPerSec = p_input->p_fmt->audio.i_rate; + p_wf->nBlockAlign = p_input->p_fmt->audio.i_blockalign; p_wf->nAvgBytesPerSec= p_input->p_fmt->i_bitrate / 8; p_wf->wBitsPerSample = 0; - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'a', '5', '2', ' ' ): p_wf->wFormatTag = WAVE_FORMAT_A52; @@ -334,18 +334,18 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) } p_stream->p_wf = NULL; p_stream->p_bih = malloc( sizeof( BITMAPINFOHEADER ) + - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->i_extra ); #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 ) + p_input->p_fmt->i_extra; + if( p_input->p_fmt->i_extra > 0 ) { memcpy( &p_bih[1], - p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } - p_bih->biWidth = p_input->p_fmt->i_width; - p_bih->biHeight= p_input->p_fmt->i_height; + p_bih->biWidth = p_input->p_fmt->video.i_width; + p_bih->biHeight= p_input->p_fmt->video.i_height; p_bih->biPlanes= 1; p_bih->biBitCount = 24; p_bih->biSizeImage = 0; @@ -353,13 +353,13 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) p_bih->biYPelsPerMeter = 0; p_bih->biClrUsed = 0; p_bih->biClrImportant = 0; - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { 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; + p_bih->biCompression = p_input->p_fmt->i_codec; break; } #undef p_bih diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index 5006cfb426..a148998251 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -2,7 +2,7 @@ * mp4.c: mp4/mov muxer ***************************************************************************** * Copyright (C) 2001, 2002, 2003 VideoLAN - * $Id: mp4.c,v 1.6 2003/10/17 16:40:08 gbazin Exp $ + * $Id: mp4.c,v 1.7 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -73,7 +73,7 @@ typedef struct typedef struct { - sout_format_t *p_fmt; + es_format_t *p_fmt; int i_track_id; /* index */ @@ -209,10 +209,10 @@ static bo_t *GetESDS( mp4_stream_t *p_stream ) int i_object_type_indication; int i_decoder_specific_info_size; - if( p_stream->p_fmt->i_extra_data > 0 ) + if( p_stream->p_fmt->i_extra > 0 ) { i_decoder_specific_info_size = - GetDescrLength( p_stream->p_fmt->i_extra_data ); + GetDescrLength( p_stream->p_fmt->i_extra ); } else { @@ -231,7 +231,7 @@ static bo_t *GetESDS( mp4_stream_t *p_stream ) /* DecoderConfigDescr */ bo_add_descr( esds, 0x04, 13 + i_decoder_specific_info_size ); - switch( p_stream->p_fmt->i_fourcc ) + switch( p_stream->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', '4', 'v' ): i_object_type_indication = 0x20; @@ -246,7 +246,7 @@ static bo_t *GetESDS( mp4_stream_t *p_stream ) break; case VLC_FOURCC( 'm', 'p', 'g', 'a' ): i_object_type_indication = - p_stream->p_fmt->i_sample_rate < 32000 ? 0x69 : 0x6b; + p_stream->p_fmt->audio.i_rate < 32000 ? 0x69 : 0x6b; break; default: i_object_type_indication = 0x00; @@ -260,16 +260,16 @@ static bo_t *GetESDS( mp4_stream_t *p_stream ) bo_add_32be( esds, 0x7fffffff ); // maxBitrate bo_add_32be( esds, 0 ); // avgBitrate - if( p_stream->p_fmt->i_extra_data > 0 ) + if( p_stream->p_fmt->i_extra > 0 ) { int i; /* DecoderSpecificInfo */ - bo_add_descr( esds, 0x05, p_stream->p_fmt->i_extra_data ); + bo_add_descr( esds, 0x05, p_stream->p_fmt->i_extra ); - for( i = 0; i < p_stream->p_fmt->i_extra_data; i++ ) + for( i = 0; i < p_stream->p_fmt->i_extra; i++ ) { - bo_add_8( esds, p_stream->p_fmt->p_extra_data[i] ); + bo_add_8( esds, ((uint8_t*)p_stream->p_fmt->p_extra)[i] ); } } @@ -427,7 +427,7 @@ static void Close( vlc_object_t * p_this ) } if( p_stream->p_fmt->i_cat == AUDIO_ES ) { - i_timescale = p_stream->p_fmt->i_sample_rate; + i_timescale = p_stream->p_fmt->audio.i_rate; } else { @@ -480,8 +480,8 @@ static void Close( vlc_object_t * p_this ) } else { - bo_add_32be( tkhd, p_stream->p_fmt->i_width << 16 ); // width (presentation) - bo_add_32be( tkhd, p_stream->p_fmt->i_height << 16 ); // height(presentation) + bo_add_32be( tkhd, p_stream->p_fmt->video.i_width << 16 ); // width (presentation) + bo_add_32be( tkhd, p_stream->p_fmt->video.i_height << 16 ); // height(presentation) } box_fix( tkhd ); box_gather( trak, tkhd ); @@ -599,7 +599,7 @@ static void Close( vlc_object_t * p_this ) int i; vlc_bool_t b_mpeg4_hdr; - switch( p_stream->p_fmt->i_fourcc ) + switch( p_stream->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', '4', 'a' ): memcpy( fcc, "mp4a", 4 ); @@ -615,7 +615,7 @@ static void Close( vlc_object_t * p_this ) break; default: - memcpy( fcc, (char*)&p_stream->p_fmt->i_fourcc, 4 ); + memcpy( fcc, (char*)&p_stream->p_fmt->i_codec, 4 ); b_mpeg4_hdr = VLC_FALSE; break; } @@ -631,11 +631,11 @@ static void Close( vlc_object_t * p_this ) bo_add_16be( soun, 0 ); // version; bo_add_16be( soun, 0 ); // revision level (0) bo_add_32be( soun, 0 ); // vendor - bo_add_16be( soun, p_stream->p_fmt->i_channels ); // channel-count + bo_add_16be( soun, p_stream->p_fmt->audio.i_channels ); // channel-count bo_add_16be( soun, 16); // FIXME sample size bo_add_16be( soun, -2 ); // compression id bo_add_16be( soun, 0 ); // packet size (0) - bo_add_16be( soun, p_stream->p_fmt->i_sample_rate ); // sampleratehi + bo_add_16be( soun, p_stream->p_fmt->audio.i_rate ); // sampleratehi bo_add_16be( soun, 0 ); // sampleratelo /* add an ES Descriptor */ @@ -659,7 +659,7 @@ static void Close( vlc_object_t * p_this ) int i; vlc_bool_t b_mpeg4_hdr; - switch( p_stream->p_fmt->i_fourcc ) + switch( p_stream->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', '4', 'v' ): case VLC_FOURCC( 'm', 'p', 'g', 'v' ): @@ -673,7 +673,7 @@ static void Close( vlc_object_t * p_this ) break; default: - memcpy( fcc, (char*)&p_stream->p_fmt->i_fourcc, 4 ); + memcpy( fcc, (char*)&p_stream->p_fmt->i_codec, 4 ); b_mpeg4_hdr = VLC_FALSE; break; } @@ -692,8 +692,8 @@ static void Close( vlc_object_t * p_this ) bo_add_32be( vide, 0 ); // predefined; } - bo_add_16be( vide, p_stream->p_fmt->i_width ); // i_width - bo_add_16be( vide, p_stream->p_fmt->i_height ); // i_height + bo_add_16be( vide, p_stream->p_fmt->video.i_width ); // i_width + bo_add_16be( vide, p_stream->p_fmt->video.i_height ); // i_height bo_add_32be( vide, 0x00480000 ); // h 72dpi bo_add_32be( vide, 0x00480000 ); // v 72dpi @@ -916,9 +916,9 @@ static void Close( vlc_object_t * p_this ) p_stream = p_sys->pp_streams[i_trak]; - if( p_stream->p_fmt->p_extra_data ) + if( p_stream->p_fmt->p_extra ) { - free( p_stream->p_fmt->p_extra_data ); + free( p_stream->p_fmt->p_extra ); } free( p_stream->p_fmt ); free( p_stream->entry ); @@ -945,7 +945,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) sout_mux_sys_t *p_sys = p_mux->p_sys; mp4_stream_t *p_stream; - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', '4', 'a' ): case VLC_FOURCC( 'm', 'p', '4', 'v' ): @@ -956,20 +956,20 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) break; default: msg_Err( p_mux, "unsupported codec %4.4s in mp4", - (char*)&p_input->p_fmt->i_fourcc ); + (char*)&p_input->p_fmt->i_codec ); return VLC_EGENERIC; } p_stream = malloc( sizeof( mp4_stream_t ) ); - p_stream->p_fmt = malloc( sizeof( sout_format_t ) ); - memcpy( p_stream->p_fmt, p_input->p_fmt, sizeof( sout_format_t ) ); - if( p_stream->p_fmt->i_extra_data ) + p_stream->p_fmt = malloc( sizeof( es_format_t ) ); + memcpy( p_stream->p_fmt, p_input->p_fmt, sizeof( es_format_t ) ); + if( p_stream->p_fmt->i_extra ) { - p_stream->p_fmt->p_extra_data = - malloc( p_stream->p_fmt->i_extra_data ); - memcpy( p_stream->p_fmt->p_extra_data, - p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + p_stream->p_fmt->p_extra = + malloc( p_stream->p_fmt->i_extra ); + memcpy( p_stream->p_fmt->p_extra, + p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } p_stream->i_track_id = p_sys->i_nb_streams + 1; p_stream->i_entry_count = 0; diff --git a/modules/mux/mpeg/ps.c b/modules/mux/mpeg/ps.c index 6ebe0e3913..d08bcf15b1 100644 --- a/modules/mux/mpeg/ps.c +++ b/modules/mux/mpeg/ps.c @@ -3,7 +3,7 @@ * multiplexer module for vlc ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ps.c,v 1.15 2003/08/02 01:33:53 fenrir Exp $ + * $Id: ps.c,v 1.16 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -188,12 +188,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) sout_mux_sys_t *p_sys = p_mux->p_sys; ps_stream_t *p_stream; - msg_Dbg( p_mux, "adding input codec=%4.4s", (char*)&p_input->p_fmt->i_fourcc ); + msg_Dbg( p_mux, "adding input codec=%4.4s", (char*)&p_input->p_fmt->i_codec ); p_input->p_sys = (void*)p_stream = malloc( sizeof( ps_stream_t ) ); /* Init this new stream */ - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', 'g', 'v' ): p_stream->i_stream_id = StreamIdGet( p_sys->stream_id_mpgv, 0xe0, 0xef ); @@ -247,7 +247,7 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ps_stream_t *p_stream =(ps_stream_t*)p_input->p_sys; msg_Dbg( p_mux, "removing input" ); - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p', 'g', 'v' ): StreamIdRelease( p_sys->stream_id_mpgv, 0xe0, p_stream->i_stream_id); diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index a584b3891a..9aa77a26a5 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -2,7 +2,7 @@ * ts.c: MPEG-II TS Muxer ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ts.c,v 1.36 2003/11/20 18:26:44 fenrir Exp $ + * $Id: ts.c,v 1.37 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -411,7 +411,7 @@ 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; - msg_Dbg( p_mux, "adding input codec=%4.4s", (char*)&p_input->p_fmt->i_fourcc ); + msg_Dbg( p_mux, "adding input codec=%4.4s", (char*)&p_input->p_fmt->i_codec ); p_input->p_sys = (void*)p_stream = malloc( sizeof( ts_stream_t ) ); @@ -425,7 +425,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) switch( p_input->p_fmt->i_cat ) { case VIDEO_ES: - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p','g', 'v' ): /* TODO: do we need to check MPEG-I/II ? */ @@ -451,9 +451,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) case VLC_FOURCC( 'M', 'J', 'P', 'G' ): p_stream->i_stream_type = 0xa0; // private p_stream->i_stream_id = 0xa0; // beurk - 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_bih_codec = p_input->p_fmt->i_codec; + p_stream->i_bih_width = p_input->p_fmt->video.i_width; + p_stream->i_bih_height = p_input->p_fmt->video.i_height; break; default: free( p_stream ); @@ -463,10 +463,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) break; case AUDIO_ES: - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 'm', 'p','g', 'a' ): - p_stream->i_stream_type = p_input->p_fmt->i_sample_rate >= 32000 ? 0x03 : 0x04; + p_stream->i_stream_type = p_input->p_fmt->audio.i_rate >= 32000 ? 0x03 : 0x04; p_stream->i_stream_id = p_sys->i_stream_id_mpga; p_sys->i_stream_id_mpga++; break; @@ -488,7 +488,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) break; case SPU_ES: - switch( p_input->p_fmt->i_fourcc ) + switch( p_input->p_fmt->i_codec ) { case VLC_FOURCC( 's', 'p','u', ' ' ): p_stream->i_stream_type = 0x82; @@ -506,14 +506,14 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) } /* Copy extra data (VOL for MPEG-4 and extra BitMapInfoHeader for VFW */ - p_stream->i_decoder_specific_info = p_input->p_fmt->i_extra_data; + p_stream->i_decoder_specific_info = p_input->p_fmt->i_extra; if( p_stream->i_decoder_specific_info > 0 ) { p_stream->p_decoder_specific_info = malloc( p_stream->i_decoder_specific_info ); memcpy( p_stream->p_decoder_specific_info, - p_input->p_fmt->p_extra_data, - p_input->p_fmt->i_extra_data ); + p_input->p_fmt->p_extra, + p_input->p_fmt->i_extra ); } /* Init pes chain */ diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c index e4e9211e8a..3e84a6f615 100644 --- a/modules/mux/ogg.c +++ b/modules/mux/ogg.c @@ -2,7 +2,7 @@ * ogg.c: ogg muxer module for vlc ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ogg.c,v 1.20 2003/11/21 13:01:05 gbazin Exp $ + * $Id: ogg.c,v 1.21 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -339,7 +339,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) p_input->p_sys = (void *)p_stream = malloc( sizeof( ogg_stream_t ) ); p_stream->i_cat = p_input->p_fmt->i_cat; - p_stream->i_fourcc = p_input->p_fmt->i_fourcc; + p_stream->i_fourcc = p_input->p_fmt->i_codec; p_stream->i_serial_no = p_sys->i_next_serial_no++; p_stream->i_packet_no = 0; @@ -372,9 +372,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) SetDWLE( &p_stream->oggds_header.i_buffer_size, 1024*1024 ); SetWLE( &p_stream->oggds_header.i_bits_per_sample, 0 ); SetDWLE( &p_stream->oggds_header.header.video.i_width, - p_input->p_fmt->i_width ); + p_input->p_fmt->video.i_width ); SetDWLE( &p_stream->oggds_header.header.video.i_height, - p_input->p_fmt->i_height ); + p_input->p_fmt->video.i_height ); msg_Dbg( p_mux, "mp4v/div3 stream" ); break; @@ -408,12 +408,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) SetDWLE( &p_stream->oggds_header.i_default_len, 1 ); SetDWLE( &p_stream->oggds_header.i_buffer_size, 30*1024 ); SetQWLE( &p_stream->oggds_header.i_samples_per_unit, - p_input->p_fmt->i_sample_rate ); + p_input->p_fmt->audio.i_rate ); SetWLE( &p_stream->oggds_header.i_bits_per_sample, 0 ); SetDWLE( &p_stream->oggds_header.header.audio.i_channels, - p_input->p_fmt->i_channels ); + p_input->p_fmt->audio.i_channels ); SetDWLE( &p_stream->oggds_header.header.audio.i_block_align, - p_input->p_fmt->i_block_align ); + p_input->p_fmt->audio.i_blockalign ); SetDWLE( &p_stream->oggds_header.header.audio.i_avgbytespersec, 0); msg_Dbg( p_mux, "mpga/a52 stream" ); break; @@ -710,11 +710,11 @@ static sout_buffer_t *OggCreateHeader( sout_mux_t *p_mux, mtime_t i_dts ) /* Special case for mp4v */ if( p_stream->i_fourcc == VLC_FOURCC( 'm', 'p', '4', 'v' ) && - p_mux->pp_inputs[i]->p_fmt->i_extra_data ) + p_mux->pp_inputs[i]->p_fmt->i_extra ) { /* Send a packet with the VOL data */ - op.bytes = p_mux->pp_inputs[i]->p_fmt->i_extra_data; - op.packet = p_mux->pp_inputs[i]->p_fmt->p_extra_data; + op.bytes = p_mux->pp_inputs[i]->p_fmt->i_extra; + op.packet = p_mux->pp_inputs[i]->p_fmt->p_extra; op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; @@ -903,7 +903,7 @@ static int Mux( sout_mux_t *p_mux ) /* number of sample from begining + current packet */ op.granulepos = ( i_dts + p_data->i_length - p_sys->i_start_dts ) * - p_input->p_fmt->i_sample_rate / I64C(1000000); + p_input->p_fmt->audio.i_rate / I64C(1000000); } else { diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c index 97a1dd3a68..e15c29d3af 100644 --- a/modules/packetizer/mpegvideo.c +++ b/modules/packetizer/mpegvideo.c @@ -2,7 +2,7 @@ * mpegvideo.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: mpegvideo.c,v 1.20 2003/11/07 16:53:54 massiot Exp $ + * $Id: mpegvideo.c,v 1.21 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -59,7 +59,7 @@ typedef struct packetizer_s /* Output properties */ sout_packetizer_input_t *p_sout_input; - sout_format_t output_format; + es_format_t output_format; mtime_t i_interpolated_dts; mtime_t i_old_duration; @@ -173,12 +173,12 @@ static int InitThread( packetizer_t *p_pack ) { p_pack->output_format.i_cat = VIDEO_ES; - p_pack->output_format.i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'v'); - p_pack->output_format.i_width = 0; - p_pack->output_format.i_height = 0; + p_pack->output_format.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'v'); + p_pack->output_format.video.i_width = 0; + p_pack->output_format.video.i_height = 0; p_pack->output_format.i_bitrate= 0; - p_pack->output_format.i_extra_data = 0; - p_pack->output_format.p_extra_data = NULL; + p_pack->output_format.i_extra = 0; + p_pack->output_format.p_extra = NULL; p_pack->b_expect_discontinuity = 0; p_pack->p_sout_input = NULL; @@ -273,9 +273,9 @@ static void PacketizeThread( packetizer_t *p_pack ) GetChunk( &p_pack->bit_stream, p_temp, 4 ); i_pos += 4; /* horizontal_size_value */ - p_pack->output_format.i_width = ShowBits( &p_pack->bit_stream, 12 ); + p_pack->output_format.video.i_width = ShowBits( &p_pack->bit_stream, 12 ); /* vertical_size_value */ - p_pack->output_format.i_height= ShowBits( &p_pack->bit_stream, 24 ) & 0xFFF; + p_pack->output_format.video.i_height= ShowBits( &p_pack->bit_stream, 24 ) & 0xFFF; /* frame_rate_code */ i_frame_rate_code = ShowBits( &p_pack->bit_stream, 32 ) & 0xF; @@ -327,8 +327,8 @@ static void PacketizeThread( packetizer_t *p_pack ) msg_Warn( p_pack->p_fifo, "creating input (image size %dx%d, frame rate %.2f)", - p_pack->output_format.i_width, - p_pack->output_format.i_height, + p_pack->output_format.video.i_width, + p_pack->output_format.video.i_height, p_pack->d_frame_rate ); /* now we have informations to create the input */ diff --git a/modules/stream_out/display.c b/modules/stream_out/display.c index 5eb75ca810..9656e0048f 100644 --- a/modules/stream_out/display.c +++ b/modules/stream_out/display.c @@ -2,7 +2,7 @@ * display.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: display.c,v 1.6 2003/11/18 16:46:31 fenrir Exp $ + * $Id: display.c,v 1.7 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -39,7 +39,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -125,7 +125,7 @@ struct sout_stream_id_t }; -static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add ( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; @@ -155,37 +155,37 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f return NULL; } id->p_es->i_stream_id = 1; - id->p_es->i_fourcc = p_fmt->i_fourcc; + id->p_es->i_fourcc = p_fmt->i_codec; id->p_es->b_force_decoder = VLC_TRUE; switch( p_fmt->i_cat ) { case AUDIO_ES: id->p_es->p_bitmapinfoheader = NULL; id->p_es->p_waveformatex = - malloc( sizeof( WAVEFORMATEX ) + p_fmt->i_extra_data ); + malloc( sizeof( WAVEFORMATEX ) + p_fmt->i_extra ); #define p_wf ((WAVEFORMATEX*)id->p_es->p_waveformatex) p_wf->wFormatTag = WAVE_FORMAT_UNKNOWN; - p_wf->nChannels = p_fmt->i_channels; - p_wf->nSamplesPerSec = p_fmt->i_sample_rate; + p_wf->nChannels = p_fmt->audio.i_channels; + p_wf->nSamplesPerSec = p_fmt->audio.i_rate; p_wf->nAvgBytesPerSec= p_fmt->i_bitrate / 8; - p_wf->nBlockAlign = p_fmt->i_block_align; + p_wf->nBlockAlign = p_fmt->audio.i_blockalign; p_wf->wBitsPerSample = 0; - p_wf->cbSize = p_fmt->i_extra_data; - if( p_fmt->i_extra_data > 0 ) + p_wf->cbSize = p_fmt->i_extra; + if( p_fmt->i_extra > 0 ) { memcpy( &p_wf[1], - p_fmt->p_extra_data, - p_fmt->i_extra_data ); + p_fmt->p_extra, + p_fmt->i_extra ); } #undef p_wf break; case VIDEO_ES: id->p_es->p_waveformatex = NULL; - id->p_es->p_bitmapinfoheader = malloc( sizeof( BITMAPINFOHEADER ) + p_fmt->i_extra_data ); + id->p_es->p_bitmapinfoheader = malloc( sizeof( BITMAPINFOHEADER ) + p_fmt->i_extra ); #define p_bih ((BITMAPINFOHEADER*)id->p_es->p_bitmapinfoheader) - p_bih->biSize = sizeof( BITMAPINFOHEADER ) + p_fmt->i_extra_data; - p_bih->biWidth = p_fmt->i_width; - p_bih->biHeight = p_fmt->i_height; + p_bih->biSize = sizeof( BITMAPINFOHEADER ) + p_fmt->i_extra; + p_bih->biWidth = p_fmt->video.i_width; + p_bih->biHeight = p_fmt->video.i_height; p_bih->biPlanes = 0; p_bih->biBitCount = 0; p_bih->biCompression = 0; @@ -194,11 +194,11 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f p_bih->biYPelsPerMeter = 0; p_bih->biClrUsed = 0; p_bih->biClrImportant = 0; - if( p_fmt->i_extra_data > 0 ) + if( p_fmt->i_extra > 0 ) { memcpy( &p_bih[1], - p_fmt->p_extra_data, - p_fmt->i_extra_data ); + p_fmt->p_extra, + p_fmt->i_extra ); } #undef p_bih break; diff --git a/modules/stream_out/dummy.c b/modules/stream_out/dummy.c index 8b27502cbf..d61caf9ea8 100644 --- a/modules/stream_out/dummy.c +++ b/modules/stream_out/dummy.c @@ -2,7 +2,7 @@ * dummy.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: dummy.c,v 1.1 2003/04/13 20:00:21 fenrir Exp $ + * $Id: dummy.c,v 1.2 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -36,7 +36,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -82,7 +82,7 @@ struct sout_stream_id_t }; -static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add ( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_id_t *id; diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c index c253abbe6d..5e51b2ed68 100644 --- a/modules/stream_out/duplicate.c +++ b/modules/stream_out/duplicate.c @@ -2,7 +2,7 @@ * duplicate.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: duplicate.c,v 1.4 2003/09/21 11:48:58 gbazin Exp $ + * $Id: duplicate.c,v 1.5 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -36,7 +36,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -134,7 +134,7 @@ static void Close( vlc_object_t * p_this ) free( p_sys ); } -static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; diff --git a/modules/stream_out/es.c b/modules/stream_out/es.c index 08980ff3e3..0e29c89b6a 100644 --- a/modules/stream_out/es.c +++ b/modules/stream_out/es.c @@ -2,7 +2,7 @@ * es.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: es.c,v 1.3 2003/07/05 21:31:02 alexis Exp $ + * $Id: es.c,v 1.4 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -38,7 +38,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -186,7 +186,7 @@ static char * es_print_url( char *psz_fmt, vlc_fourcc_t i_fourcc, int i_count, c return( psz_url ); } -static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add ( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_instance_t *p_sout = p_stream->p_sout; @@ -230,11 +230,11 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f /* *** get url (%d expanded as a codec count, %c expanded as codec fcc ) *** */ if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_url_audio ) { - psz_url = es_print_url( p_sys->psz_url_audio, p_fmt->i_fourcc, p_sys->i_count_audio, psz_access, psz_mux ); + psz_url = es_print_url( p_sys->psz_url_audio, p_fmt->i_codec, p_sys->i_count_audio, psz_access, psz_mux ); } else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_url_video ) { - psz_url = es_print_url( p_sys->psz_url_video, p_fmt->i_fourcc, p_sys->i_count_video, psz_access, psz_mux ); + psz_url = es_print_url( p_sys->psz_url_video, p_fmt->i_codec, p_sys->i_count_video, psz_access, psz_mux ); } else { @@ -252,7 +252,7 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f i_count = p_sys->i_count; } - psz_url = es_print_url( p_sys->psz_url, p_fmt->i_fourcc, i_count, psz_access, psz_mux ); + psz_url = es_print_url( p_sys->psz_url, p_fmt->i_codec, i_count, psz_access, psz_mux ); } p_sys->i_count++; diff --git a/modules/stream_out/gather.c b/modules/stream_out/gather.c index 7aee39a67c..5898817e69 100644 --- a/modules/stream_out/gather.c +++ b/modules/stream_out/gather.c @@ -2,7 +2,7 @@ * gather.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: gather.c,v 1.1 2003/09/07 20:12:44 fenrir Exp $ + * $Id: gather.c,v 1.2 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -46,7 +46,7 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -54,7 +54,7 @@ struct sout_stream_id_t { vlc_bool_t b_used; - sout_format_t fmt; + es_format_t fmt; void *id; }; @@ -114,7 +114,7 @@ static void Close( vlc_object_t * p_this ) /***************************************************************************** * Add: *****************************************************************************/ -static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; @@ -126,14 +126,14 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) id = p_sys->id[i]; if( !id->b_used && id->fmt.i_cat == p_fmt->i_cat && - id->fmt.i_fourcc == p_fmt->i_fourcc && + id->fmt.i_codec == p_fmt->i_codec && ( ( id->fmt.i_cat == AUDIO_ES && - id->fmt.i_sample_rate == p_fmt->i_sample_rate && - id->fmt.i_channels == p_fmt->i_channels && - id->fmt.i_block_align == p_fmt->i_block_align ) || + id->fmt.audio.i_rate == p_fmt->audio.i_rate && + id->fmt.audio.i_channels == p_fmt->audio.i_channels && + id->fmt.audio.i_blockalign == p_fmt->audio.i_blockalign ) || ( id->fmt.i_cat == VIDEO_ES && - id->fmt.i_width == p_fmt->i_width && - id->fmt.i_height == p_fmt->i_height ) ) ) + id->fmt.video.i_width == p_fmt->video.i_width && + id->fmt.video.i_height == p_fmt->video.i_height ) ) ) { msg_Dbg( p_stream, "reusing already opened output" ); id->b_used = VLC_TRUE; @@ -158,9 +158,9 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) id = malloc( sizeof( sout_stream_id_t ) ); msg_Dbg( p_stream, "creating new output" ); - memcpy( &id->fmt, p_fmt, sizeof( sout_format_t ) ); - id->fmt.i_extra_data = 0; - id->fmt.p_extra_data = NULL; + memcpy( &id->fmt, p_fmt, sizeof( es_format_t ) ); + id->fmt.i_extra = 0; + id->fmt.p_extra = NULL; id->b_used = VLC_TRUE; id->id = p_sys->p_out->pf_add( p_sys->p_out, p_fmt ); if( id->id == NULL ) diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index fbd4dab530..46fdb3c4cf 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -2,7 +2,7 @@ * rtp.c ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: rtp.c,v 1.6 2003/11/07 18:32:24 fenrir Exp $ + * $Id: rtp.c,v 1.7 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -49,7 +49,7 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -456,7 +456,7 @@ static void sprintf_hexa( char *s, uint8_t *p_data, int i_data ) s[2*i_data] = '\0'; } -static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add ( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_instance_t *p_sout = p_stream->p_sout; sout_stream_sys_t *p_sys = p_stream->p_sys; @@ -509,14 +509,14 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f id->psz_destination = strdup( p_sys->psz_destination ); id->i_port = p_sys->i_port; - switch( p_fmt->i_fourcc ) + switch( p_fmt->i_codec ) { case VLC_FOURCC( 's', '1', '6', 'b' ): - if( p_fmt->i_channels == 1 && p_fmt->i_sample_rate == 44100 ) + if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 44100 ) { id->i_payload_type = 11; } - else if( p_fmt->i_channels == 2 && p_fmt->i_sample_rate == 44100 ) + else if( p_fmt->audio.i_channels == 2 && p_fmt->audio.i_rate == 44100 ) { id->i_payload_type = 10; } @@ -525,15 +525,15 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f id->i_payload_type = p_sys->i_payload_type++; } id->psz_rtpmap = malloc( strlen( "L16/*/*" ) + 20+1 ); - sprintf( id->psz_rtpmap, "L16/%d/%d", p_fmt->i_sample_rate, p_fmt->i_channels ); - id->i_clock_rate = p_fmt->i_sample_rate; + sprintf( id->psz_rtpmap, "L16/%d/%d", p_fmt->audio.i_rate, p_fmt->audio.i_channels ); + id->i_clock_rate = p_fmt->audio.i_rate; id->pf_packetize = rtp_packetize_l16; break; case VLC_FOURCC( 'u', '8', ' ', ' ' ): id->i_payload_type = p_sys->i_payload_type++; id->psz_rtpmap = malloc( strlen( "L8/*/*" ) + 20+1 ); - sprintf( id->psz_rtpmap, "L8/%d/%d", p_fmt->i_sample_rate, p_fmt->i_channels ); - id->i_clock_rate = p_fmt->i_sample_rate; + sprintf( id->psz_rtpmap, "L8/%d/%d", p_fmt->audio.i_rate, p_fmt->audio.i_channels ); + id->i_clock_rate = p_fmt->audio.i_rate; id->pf_packetize = rtp_packetize_l8; break; case VLC_FOURCC( 'm', 'p', 'g', 'a' ): @@ -556,16 +556,16 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f break; case VLC_FOURCC( 'm', 'p', '4', 'v' ): { - char hexa[2*p_fmt->i_extra_data +1]; + char hexa[2*p_fmt->i_extra +1]; id->i_payload_type = p_sys->i_payload_type++; id->i_clock_rate = 90000; id->psz_rtpmap = strdup( "MP4V-ES/90000" ); id->pf_packetize = rtp_packetize_split; - if( p_fmt->i_extra_data > 0 ) + if( p_fmt->i_extra > 0 ) { - id->psz_fmtp = malloc( 100 + 2 * p_fmt->i_extra_data ); - sprintf_hexa( hexa, p_fmt->p_extra_data, p_fmt->i_extra_data ); + id->psz_fmtp = malloc( 100 + 2 * p_fmt->i_extra ); + sprintf_hexa( hexa, p_fmt->p_extra, p_fmt->i_extra ); sprintf( id->psz_fmtp, "profile-level-id=3; config=%s", hexa ); } @@ -573,15 +573,15 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f } case VLC_FOURCC( 'm', 'p', '4', 'a' ): { - char hexa[2*p_fmt->i_extra_data +1]; + char hexa[2*p_fmt->i_extra +1]; id->i_payload_type = p_sys->i_payload_type++; - id->i_clock_rate = p_fmt->i_sample_rate; + id->i_clock_rate = p_fmt->audio.i_rate; id->psz_rtpmap = malloc( strlen( "mpeg4-generic/" ) + 12 ); - sprintf( id->psz_rtpmap, "mpeg4-generic/%d", p_fmt->i_sample_rate ); + sprintf( id->psz_rtpmap, "mpeg4-generic/%d", p_fmt->audio.i_rate ); id->pf_packetize = rtp_packetize_mp4a; - id->psz_fmtp = malloc( 200 + 2 * p_fmt->i_extra_data ); - sprintf_hexa( hexa, p_fmt->p_extra_data, p_fmt->i_extra_data ); + id->psz_fmtp = malloc( 200 + 2 * p_fmt->i_extra ); + sprintf_hexa( hexa, p_fmt->p_extra, p_fmt->i_extra ); sprintf( id->psz_fmtp, "streamtype=5; profile-level-id=15; mode=AAC-hbr; config=%s; " "SizeLength=13; IndexLength=3; IndexDeltaLength=3; Profile=1;", hexa ); @@ -589,7 +589,7 @@ static sout_stream_id_t * Add ( sout_stream_t *p_stream, sout_format_t *p_f } default: - msg_Err( p_stream, "cannot add this stream (unsupported codec:%4.4s)", (char*)&p_fmt->i_fourcc ); + msg_Err( p_stream, "cannot add this stream (unsupported codec:%4.4s)", (char*)&p_fmt->i_codec ); free( id ); return NULL; } diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c index 7dc8687072..84231e5891 100644 --- a/modules/stream_out/standard.c +++ b/modules/stream_out/standard.c @@ -2,7 +2,7 @@ * standard.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: standard.c,v 1.15 2003/09/13 17:44:13 fenrir Exp $ + * $Id: standard.c,v 1.16 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * @@ -40,7 +40,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -341,7 +341,7 @@ struct sout_stream_id_t }; -static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index d37c5c915b..89c1da9ed3 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -2,7 +2,7 @@ * transcode.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: transcode.c,v 1.51 2003/11/17 02:55:22 fenrir Exp $ + * $Id: transcode.c,v 1.52 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -47,7 +47,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); @@ -316,8 +316,8 @@ static void Close( vlc_object_t * p_this ) struct sout_stream_id_t { vlc_fourcc_t b_transcode; - sout_format_t f_src; /* only if transcoding */ - sout_format_t f_dst; /* " " " */ + es_format_t f_src; /* only if transcoding */ + es_format_t f_dst; /* " " " */ unsigned int i_inter_pixfmt; /* intermediary format when transcoding */ /* id of the out stream */ @@ -347,7 +347,7 @@ struct sout_stream_id_t }; -static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; @@ -361,21 +361,21 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) { msg_Dbg( p_stream, "creating audio transcoding from fcc=`%4.4s' to fcc=`%4.4s'", - (char*)&p_fmt->i_fourcc, + (char*)&p_fmt->i_codec, (char*)&p_sys->i_acodec ); /* src format */ - memcpy( &id->f_src, p_fmt, sizeof( sout_format_t ) ); + memcpy( &id->f_src, p_fmt, sizeof( es_format_t ) ); /* create dst format */ id->f_dst.i_cat = AUDIO_ES; - id->f_dst.i_fourcc = p_sys->i_acodec; - id->f_dst.i_sample_rate = p_sys->i_sample_rate > 0 ? p_sys->i_sample_rate : id->f_src.i_sample_rate; - id->f_dst.i_channels = p_sys->i_channels > 0 ? p_sys->i_channels : id->f_src.i_channels; + id->f_dst.i_codec = p_sys->i_acodec; + id->f_dst.audio.i_rate = p_sys->i_sample_rate > 0 ? p_sys->i_sample_rate : id->f_src.audio.i_rate; + id->f_dst.audio.i_channels = p_sys->i_channels > 0 ? p_sys->i_channels : id->f_src.audio.i_channels; id->f_dst.i_bitrate = p_sys->i_abitrate > 0 ? p_sys->i_abitrate : 64000; - id->f_dst.i_block_align = 0; - id->f_dst.i_extra_data = 0; - id->f_dst.p_extra_data = NULL; + id->f_dst.audio.i_blockalign = 0; + id->f_dst.i_extra = 0; + id->f_dst.p_extra = NULL; /* build decoder -> filter -> encoder */ if( transcode_audio_ffmpeg_new( p_stream, id ) ) @@ -399,19 +399,19 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) { msg_Dbg( p_stream, "creating video transcoding from fcc=`%4.4s' to fcc=`%4.4s'", - (char*)&p_fmt->i_fourcc, + (char*)&p_fmt->i_codec, (char*)&p_sys->i_vcodec ); - memcpy( &id->f_src, p_fmt, sizeof( sout_format_t ) ); + memcpy( &id->f_src, p_fmt, sizeof( es_format_t ) ); /* create dst format */ id->f_dst.i_cat = VIDEO_ES; - id->f_dst.i_fourcc = p_sys->i_vcodec; - id->f_dst.i_width = p_sys->i_width ; /* > 0 ? p_sys->i_width : id->f_src.i_width; */ - id->f_dst.i_height = p_sys->i_height; /* > 0 ? p_sys->i_height: id->f_src.i_height; */ + id->f_dst.i_codec = p_sys->i_vcodec; + id->f_dst.video.i_width = p_sys->i_width ; /* > 0 ? p_sys->i_width : id->f_src.i_width; */ + id->f_dst.video.i_height= p_sys->i_height; /* > 0 ? p_sys->i_height: id->f_src.i_height; */ id->f_dst.i_bitrate = p_sys->i_vbitrate > 0 ? p_sys->i_vbitrate : 800*1000; - id->f_dst.i_extra_data = 0; - id->f_dst.p_extra_data = NULL; + id->f_dst.i_extra = 0; + id->f_dst.p_extra = NULL; /* build decoder -> filter -> encoder */ if( transcode_video_ffmpeg_new( p_stream, id ) ) @@ -428,7 +428,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) } else { - msg_Dbg( p_stream, "not transcoding a stream (fcc=`%4.4s')", (char*)&p_fmt->i_fourcc ); + msg_Dbg( p_stream, "not transcoding a stream (fcc=`%4.4s')", (char*)&p_fmt->i_codec ); id->id = p_sys->p_out->pf_add( p_sys->p_out, p_fmt ); id->b_transcode = VLC_FALSE; @@ -636,23 +636,23 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, { int i_ff_codec; - if( id->f_src.i_fourcc == VLC_FOURCC('s','1','6','l') || - id->f_src.i_fourcc == VLC_FOURCC('s','1','6','b') || - id->f_src.i_fourcc == VLC_FOURCC('s','8',' ',' ') || - id->f_src.i_fourcc == VLC_FOURCC('u','8',' ',' ') ) + if( id->f_src.i_codec == VLC_FOURCC('s','1','6','l') || + id->f_src.i_codec == VLC_FOURCC('s','1','6','b') || + id->f_src.i_codec == VLC_FOURCC('s','8',' ',' ') || + id->f_src.i_codec == VLC_FOURCC('u','8',' ',' ') ) { id->ff_dec = NULL; id->ff_dec_c = avcodec_alloc_context(); - id->ff_dec_c->sample_rate = id->f_src.i_sample_rate; - id->ff_dec_c->channels = id->f_src.i_channels; - id->ff_dec_c->block_align = id->f_src.i_block_align; + id->ff_dec_c->sample_rate = id->f_src.audio.i_rate; + id->ff_dec_c->channels = id->f_src.audio.i_channels; + id->ff_dec_c->block_align = id->f_src.audio.i_blockalign; id->ff_dec_c->bit_rate = id->f_src.i_bitrate; } else { /* find decoder */ - i_ff_codec = get_ff_codec( id->f_src.i_fourcc ); + i_ff_codec = get_ff_codec( id->f_src.i_codec ); if( i_ff_codec == 0 ) { msg_Err( p_stream, "cannot find decoder id" ); @@ -667,13 +667,13 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, } id->ff_dec_c = avcodec_alloc_context(); - id->ff_dec_c->sample_rate = id->f_src.i_sample_rate; - id->ff_dec_c->channels = id->f_src.i_channels; - id->ff_dec_c->block_align = id->f_src.i_block_align; + id->ff_dec_c->sample_rate = id->f_src.audio.i_rate; + id->ff_dec_c->channels = id->f_src.audio.i_channels; + id->ff_dec_c->block_align = id->f_src.audio.i_blockalign; id->ff_dec_c->bit_rate = id->f_src.i_bitrate; - id->ff_dec_c->extradata_size = id->f_src.i_extra_data; - id->ff_dec_c->extradata = id->f_src.p_extra_data; + id->ff_dec_c->extradata_size = id->f_src.i_extra; + id->ff_dec_c->extradata = id->f_src.p_extra; if( avcodec_open( id->ff_dec_c, id->ff_dec ) ) { msg_Err( p_stream, "cannot open decoder" ); @@ -686,7 +686,7 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, id->p_buffer = malloc( id->i_buffer ); /* Sanity check for audio channels */ - id->f_dst.i_channels = __MIN( id->f_dst.i_channels, id->f_src.i_channels ); + id->f_dst.audio.i_channels = __MIN( id->f_dst.audio.i_channels, id->f_src.audio.i_channels ); /* find encoder */ id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER ); @@ -694,14 +694,14 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, /* Initialization of encoder format structures */ es_format_Init( &id->p_encoder->fmt_in, AUDIO_ES, AOUT_FMT_S16_NE ); id->p_encoder->fmt_in.audio.i_format = AOUT_FMT_S16_NE; - id->p_encoder->fmt_in.audio.i_rate = id->f_dst.i_sample_rate; + id->p_encoder->fmt_in.audio.i_rate = id->f_dst.audio.i_rate; id->p_encoder->fmt_in.audio.i_physical_channels = id->p_encoder->fmt_in.audio.i_original_channels = - pi_channels_maps[id->f_dst.i_channels]; - id->p_encoder->fmt_in.audio.i_channels = id->f_dst.i_channels; + pi_channels_maps[id->f_dst.audio.i_channels]; + id->p_encoder->fmt_in.audio.i_channels = id->f_dst.audio.i_channels; id->p_encoder->fmt_out = id->p_encoder->fmt_in; - id->p_encoder->fmt_out.i_codec = id->f_dst.i_fourcc; + id->p_encoder->fmt_out.i_codec = id->f_dst.i_codec; id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate; id->p_encoder->p_module = @@ -715,13 +715,13 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, id->b_enc_inited = VLC_FALSE; - id->f_dst.i_extra_data = id->p_encoder->fmt_out.i_extra; - id->f_dst.p_extra_data = id->p_encoder->fmt_out.p_extra; + id->f_dst.i_extra = id->p_encoder->fmt_out.i_extra; + id->f_dst.p_extra = id->p_encoder->fmt_out.p_extra; /* Hack for mp3 transcoding support */ - if( id->f_dst.i_fourcc == VLC_FOURCC( 'm','p','3',' ' ) ) + if( id->f_dst.i_codec == VLC_FOURCC( 'm','p','3',' ' ) ) { - id->f_dst.i_fourcc = VLC_FOURCC( 'm','p','g','a' ); + id->f_dst.i_codec = VLC_FOURCC( 'm','p','g','a' ); } return VLC_SUCCESS; @@ -784,14 +784,14 @@ static int transcode_audio_ffmpeg_process( sout_stream_t *p_stream, { int16_t *sout = (int16_t*)id->p_buffer; - if( id->f_src.i_fourcc == VLC_FOURCC( 's', '8', ' ', ' ' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'u', '8', ' ', ' ' ) ) + if( id->f_src.i_codec == VLC_FOURCC( 's', '8', ' ', ' ' ) || + id->f_src.i_codec == VLC_FOURCC( 'u', '8', ' ', ' ' ) ) { int8_t *sin = (int8_t*)p_buffer; int i_used = __MIN( id->i_buffer/2, i_buffer ); int i_samples = i_used; - if( id->f_src.i_fourcc == VLC_FOURCC( 's', '8', ' ', ' ' ) ) + if( id->f_src.i_codec == VLC_FOURCC( 's', '8', ' ', ' ' ) ) while( i_samples > 0 ) { *sout++ = ( *sin++ ) << 8; @@ -808,15 +808,15 @@ static int transcode_audio_ffmpeg_process( sout_stream_t *p_stream, p_buffer += i_used; id->i_buffer_pos = i_used * 2; } - else if( id->f_src.i_fourcc == VLC_FOURCC( 's', '1', '6', 'l' ) || - id->f_src.i_fourcc == VLC_FOURCC( 's', '1', '6', 'b' ) ) + else if( id->f_src.i_codec == VLC_FOURCC( 's', '1', '6', 'l' ) || + id->f_src.i_codec == VLC_FOURCC( 's', '1', '6', 'b' ) ) { int16_t *sin = (int16_t*)p_buffer; int i_used = __MIN( id->i_buffer, i_buffer ); int i_samples = i_used / 2; int b_invert_indianness; - if( id->f_src.i_fourcc == VLC_FOURCC( 's', '1', '6', 'l' ) ) + if( id->f_src.i_codec == VLC_FOURCC( 's', '1', '6', 'l' ) ) #ifdef WORDS_BIGENDIAN b_invert_indianness = 1; #else @@ -879,12 +879,12 @@ static int transcode_audio_ffmpeg_process( sout_stream_t *p_stream, aout_buf.p_buffer = id->p_buffer; aout_buf.i_nb_bytes = id->i_buffer_pos; - aout_buf.i_nb_samples = id->i_buffer_pos / 2 / id->f_src.i_channels; + aout_buf.i_nb_samples = id->i_buffer_pos / 2 / id->f_src.audio.i_channels; aout_buf.start_date = id->i_dts; aout_buf.end_date = id->i_dts; id->i_dts += ( I64C(1000000) * id->i_buffer_pos / 2 / - id->f_src.i_channels / id->f_src.i_sample_rate ); + id->f_src.audio.i_channels / id->f_src.audio.i_rate ); p_block = id->p_encoder->pf_encode_audio( id->p_encoder, &aout_buf ); while( p_block ) @@ -919,26 +919,26 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, int i_ff_codec; /* Open decoder */ - if( id->f_src.i_fourcc == VLC_FOURCC( 'I', '4', '2', '0' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'I', '4', '2', '2' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'I', '4', '4', '4' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'Y', 'U', 'Y', '2' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'R', 'V', '1', '5' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'R', 'V', '1', '6' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'R', 'V', '2', '4' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'R', 'V', '3', '2' ) || - id->f_src.i_fourcc == VLC_FOURCC( 'G', 'R', 'E', 'Y' ) ) + if( id->f_src.i_codec == VLC_FOURCC( 'I', '4', '2', '0' ) || + id->f_src.i_codec == VLC_FOURCC( 'I', '4', '2', '2' ) || + id->f_src.i_codec == VLC_FOURCC( 'I', '4', '4', '4' ) || + id->f_src.i_codec == VLC_FOURCC( 'Y', 'U', 'Y', '2' ) || + id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '5' ) || + id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '1', '6' ) || + id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '2', '4' ) || + id->f_src.i_codec == VLC_FOURCC( 'R', 'V', '3', '2' ) || + id->f_src.i_codec == VLC_FOURCC( 'G', 'R', 'E', 'Y' ) ) { id->ff_dec = NULL; id->ff_dec_c = avcodec_alloc_context(); - id->ff_dec_c->width = id->f_src.i_width; - id->ff_dec_c->height = id->f_src.i_height; - id->ff_dec_c->pix_fmt = get_ff_chroma( id->f_src.i_fourcc ); + id->ff_dec_c->width = id->f_src.video.i_width; + id->ff_dec_c->height = id->f_src.video.i_height; + id->ff_dec_c->pix_fmt = get_ff_chroma( id->f_src.i_codec ); } else { /* find decoder */ - i_ff_codec = get_ff_codec( id->f_src.i_fourcc ); + i_ff_codec = get_ff_codec( id->f_src.i_codec ); if( i_ff_codec == 0 ) { msg_Err( p_stream, "cannot find decoder" ); @@ -953,11 +953,11 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, } id->ff_dec_c = avcodec_alloc_context(); - id->ff_dec_c->width = id->f_src.i_width; - id->ff_dec_c->height = id->f_src.i_height; + id->ff_dec_c->width = id->f_src.video.i_width; + id->ff_dec_c->height = id->f_src.video.i_height; /* id->ff_dec_c->bit_rate = id->f_src.i_bitrate; */ - id->ff_dec_c->extradata_size= id->f_src.i_extra_data; - id->ff_dec_c->extradata = id->f_src.p_extra_data; + id->ff_dec_c->extradata_size= id->f_src.i_extra; + id->ff_dec_c->extradata = id->f_src.p_extra; id->ff_dec_c->workaround_bugs = FF_BUG_AUTODETECT; id->ff_dec_c->error_resilience= -1; id->ff_dec_c->get_buffer = transcode_video_ffmpeg_getframebuf; @@ -995,17 +995,17 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, es_format_Init( &id->p_encoder->fmt_in, id->f_src.i_cat, get_vlc_chroma(id->ff_dec_c->pix_fmt) ); - id->p_encoder->fmt_in.video.i_width = id->f_dst.i_width; - id->p_encoder->fmt_in.video.i_height = id->f_dst.i_height; + id->p_encoder->fmt_in.video.i_width = id->f_dst.video.i_width; + id->p_encoder->fmt_in.video.i_height = id->f_dst.video.i_height; if( id->p_encoder->fmt_in.video.i_width <= 0 ) { - id->p_encoder->fmt_in.video.i_width = id->f_dst.i_width = + id->p_encoder->fmt_in.video.i_width = id->f_dst.video.i_width = id->ff_dec_c->width - p_sys->i_crop_left - p_sys->i_crop_right; } if( id->p_encoder->fmt_in.video.i_height <= 0 ) { - id->p_encoder->fmt_in.video.i_height = id->f_dst.i_height = + id->p_encoder->fmt_in.video.i_height = id->f_dst.video.i_height = id->ff_dec_c->height - p_sys->i_crop_top - p_sys->i_crop_bottom; } @@ -1031,7 +1031,7 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, } id->p_encoder->fmt_out = id->p_encoder->fmt_in; - id->p_encoder->fmt_out.i_codec = id->f_dst.i_fourcc; + id->p_encoder->fmt_out.i_codec = id->f_dst.i_codec; id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate; id->p_encoder->i_vtolerance = p_sys->i_vtolerance; @@ -1179,14 +1179,14 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, if( id->p_encoder->fmt_in.video.i_width <= 0 ) { id->p_encoder->fmt_in.video.i_width = - id->p_encoder->fmt_out.video.i_width = id->f_dst.i_width = + id->p_encoder->fmt_out.video.i_width = id->f_dst.video.i_width = id->ff_dec_c->width - p_sys->i_crop_left - p_sys->i_crop_right; } if( id->p_encoder->fmt_in.video.i_height <= 0 ) { id->p_encoder->fmt_in.video.i_height = - id->p_encoder->fmt_out.video.i_height = id->f_dst.i_height = + id->p_encoder->fmt_out.video.i_height = id->f_dst.video.i_height = id->ff_dec_c->height - p_sys->i_crop_top - p_sys->i_crop_bottom; } @@ -1203,14 +1203,14 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, return VLC_EGENERIC; } - id->f_dst.i_extra_data = id->p_encoder->fmt_out.i_extra; - id->f_dst.p_extra_data = id->p_encoder->fmt_out.p_extra; + id->f_dst.i_extra = id->p_encoder->fmt_out.i_extra; + id->f_dst.p_extra = id->p_encoder->fmt_out.p_extra; /* Hack for mp2v/mp1v transcoding support */ - if( id->f_dst.i_fourcc == VLC_FOURCC( 'm','p','1','v' ) || - id->f_dst.i_fourcc == VLC_FOURCC( 'm','p','2','v' ) ) + if( id->f_dst.i_codec == VLC_FOURCC( 'm','p','1','v' ) || + id->f_dst.i_codec == VLC_FOURCC( 'm','p','2','v' ) ) { - id->f_dst.i_fourcc = VLC_FOURCC( 'm','p','g','v' ); + id->f_dst.i_codec = VLC_FOURCC( 'm','p','g','v' ); } if( !( id->id = @@ -1293,8 +1293,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, } /* convert size and crop */ - if( id->ff_dec_c->width != id->f_dst.i_width || - id->ff_dec_c->height != id->f_dst.i_height || + if( id->ff_dec_c->width != id->f_dst.video.i_width || + id->ff_dec_c->height != id->f_dst.video.i_height || p_sys->i_crop_top > 0 || p_sys->i_crop_bottom > 0 || p_sys->i_crop_left > 0 || p_sys->i_crop_right ) { @@ -1304,18 +1304,18 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, uint8_t *buf; id->p_ff_pic_tmp2 = avcodec_alloc_frame(); i_size = avpicture_get_size( id->i_inter_pixfmt, - id->f_dst.i_width, - id->f_dst.i_height ); + id->f_dst.video.i_width, + id->f_dst.video.i_height ); buf = malloc( i_size ); avpicture_fill( (AVPicture*)id->p_ff_pic_tmp2, buf, id->i_inter_pixfmt, - id->f_dst.i_width, id->f_dst.i_height ); + id->f_dst.video.i_width, id->f_dst.video.i_height ); id->p_vresample = - img_resample_full_init( id->f_dst.i_width, - id->f_dst.i_height, + img_resample_full_init( id->f_dst.video.i_width, + id->f_dst.video.i_height, id->ff_dec_c->width, id->ff_dec_c->height, p_stream->p_sys->i_crop_top, p_stream->p_sys->i_crop_bottom, @@ -1332,9 +1332,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, /* Encoding */ vout_InitPicture( VLC_OBJECT(p_stream), &pic, id->p_encoder->fmt_in.i_codec, - id->f_dst.i_width, id->f_dst.i_height, - id->f_dst.i_width * VOUT_ASPECT_FACTOR / - id->f_dst.i_height ); + id->f_dst.video.i_width, id->f_dst.video.i_height, + id->f_dst.video.i_width * VOUT_ASPECT_FACTOR / + id->f_dst.video.i_height ); for( i_plane = 0; i_plane < pic.i_planes; i_plane++ ) { diff --git a/modules/stream_out/transrate/transrate.c b/modules/stream_out/transrate/transrate.c index 9a59c65d8e..1121ca471a 100644 --- a/modules/stream_out/transrate/transrate.c +++ b/modules/stream_out/transrate/transrate.c @@ -6,7 +6,7 @@ * Copyright (C) 2003 Antoine Missout * Copyright (C) 2000-2003 Michel Lespinasse * Copyright (C) 1999-2000 Aaron Holtzman - * $Id: transrate.c,v 1.2 2003/11/12 18:13:31 fenrir Exp $ + * $Id: transrate.c,v 1.3 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Christophe Massiot * Laurent Aimar @@ -48,7 +48,7 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * ); +static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); static int Del ( sout_stream_t *, sout_stream_id_t * ); static int Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t * ); @@ -212,7 +212,7 @@ struct sout_stream_id_t }; -static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) +static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) { sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_id_t *id; @@ -221,11 +221,11 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) id->id = NULL; if( p_fmt->i_cat == VIDEO_ES - && p_fmt->i_fourcc == VLC_FOURCC('m', 'p', 'g', 'v') ) + && p_fmt->i_codec == VLC_FOURCC('m', 'p', 'g', 'v') ) { msg_Dbg( p_stream, "creating video transrating for fcc=`%4.4s'", - (char*)&p_fmt->i_fourcc ); + (char*)&p_fmt->i_codec ); id->p_current_buffer = NULL; id->p_next_gop = NULL; @@ -242,7 +242,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, sout_format_t *p_fmt ) } else { - msg_Dbg( p_stream, "not transrating a stream (fcc=`%4.4s')", (char*)&p_fmt->i_fourcc ); + msg_Dbg( p_stream, "not transrating a stream (fcc=`%4.4s')", (char*)&p_fmt->i_codec ); id->id = p_sys->p_out->pf_add( p_sys->p_out, p_fmt ); id->b_transrate = VLC_FALSE; diff --git a/src/input/input_dec.c b/src/input/input_dec.c index 2c8bdeac71..19e5ffd28f 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_dec.c,v 1.71 2003/11/18 22:48:46 fenrir Exp $ + * $Id: input_dec.c,v 1.72 2003/11/21 15:32:08 fenrir Exp $ * * Authors: Christophe Massiot * Gildas Bazin @@ -303,11 +303,11 @@ struct decoder_owner_sys_t vout_thread_t *p_vout; sout_packetizer_input_t *p_sout; - sout_format_t sout_format; /* Current format in use by the output */ video_format_t video; - audio_format_t audio; + audio_format_t audio; + es_format_t sout; }; /***************************************************************************** @@ -487,26 +487,10 @@ static int DecoderThread( decoder_t * p_dec ) { if( !p_dec->p_owner->p_sout ) { - sout_format_t *p_format = &p_dec->p_owner->sout_format; - - p_format->i_cat = p_dec->fmt_out.i_cat; - p_format->i_fourcc = p_dec->fmt_out.i_codec; - p_format->i_sample_rate = - p_dec->fmt_out.audio.i_rate; - p_format->i_channels = - p_dec->fmt_out.audio.i_channels; - p_format->i_block_align = - p_dec->fmt_out.audio.i_blockalign; - p_format->i_width = - p_dec->fmt_out.video.i_width; - p_format->i_height = - p_dec->fmt_out.video.i_height; - p_format->i_bitrate = p_dec->fmt_out.i_bitrate; - p_format->i_extra_data = p_dec->fmt_out.i_extra; - p_format->p_extra_data = p_dec->fmt_out.p_extra; + es_format_Copy( &p_dec->p_owner->sout, &p_dec->fmt_out ); p_dec->p_owner->p_sout = - sout_InputNew( p_dec, p_format ); + sout_InputNew( p_dec, &p_dec->p_owner->sout ); if( p_dec->p_owner->p_sout == NULL ) { diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c index fe745a1dfc..fb5d89c9e8 100644 --- a/src/stream_output/stream_output.c +++ b/src/stream_output/stream_output.c @@ -2,7 +2,7 @@ * stream_output.c : stream output module ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: stream_output.c,v 1.34 2003/09/07 22:43:17 fenrir Exp $ + * $Id: stream_output.c,v 1.35 2003/11/21 15:32:09 fenrir Exp $ * * Authors: Christophe Massiot * Laurent Aimar @@ -175,7 +175,7 @@ void sout_DeleteInstance( sout_instance_t * p_sout ) * Packetizer/Input *****************************************************************************/ sout_packetizer_input_t *__sout_InputNew( vlc_object_t *p_this, - sout_format_t *p_fmt ) + es_format_t *p_fmt ) { sout_instance_t *p_sout = NULL; sout_packetizer_input_t *p_input; @@ -195,7 +195,7 @@ sout_packetizer_input_t *__sout_InputNew( vlc_object_t *p_this, p_input->p_sout = p_sout; p_input->p_fmt = p_fmt; - if( p_fmt->i_fourcc == VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) + if( p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) { vlc_object_release( p_sout ); return p_input; @@ -225,7 +225,7 @@ int sout_InputDelete( sout_packetizer_input_t *p_input ) msg_Dbg( p_sout, "removing an input" ); - if( p_input->p_fmt->i_fourcc != VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) + if( p_input->p_fmt->i_codec != VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) { vlc_mutex_lock( &p_sout->lock ); p_sout->p_stream->pf_del( p_sout->p_stream, p_input->id ); @@ -243,7 +243,7 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input, sout_buffer_t *p_buf sout_instance_t *p_sout = p_input->p_sout; int i_ret; - if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) + if( p_input->p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) ) { sout_BufferDelete( p_input->p_sout, p_buffer ); return VLC_SUCCESS; @@ -423,7 +423,7 @@ void sout_MuxDelete ( sout_mux_t *p_mux ) } sout_input_t *sout_MuxAddStream( sout_mux_t *p_mux, - sout_format_t *p_fmt ) + es_format_t *p_fmt ) { sout_input_t *p_input; -- 2.39.2