Changeset 4dec9682f6b5b0b6ed2d5187f4652cb680f39000

Show
Ignore:
Timestamp:
13/04/03 22:00:21 (5 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1050264021 +0000
git-parent:

[1bab4d1788d1f39537eebc09a5aec491c5064640]

git-author:
Laurent Aimar <fenrir@videolan.org> 1050264021 +0000
Message:
  • 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 :)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • configure.ac.in

    rf3bcd92 r4dec968  
    335335AC_CHECK_LIB(m,pow, 
    336336  LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm" 
     337  LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lm" 
    337338  LDFLAGS_imdct="${LDFLAGS_imdct} -lm" 
    338339  LDFLAGS_imdct3dn="${LDFLAGS_imdct3dn} -lm" 
     
    10181019  PLUGINS="${PLUGINS} packetizer_copy" 
    10191020 
    1020   PLUGINS="${PLUGINS} vout_encoder" 
     1021  PLUGINS="${PLUGINS} stream_out_dummy stream_out_standard stream_out_es" 
     1022  PLUGINS="${PLUGINS} stream_out_duplicate stream_out_display" 
    10211023 
    10221024    dnl Ogg/ogm 
     
    15111513    CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg" 
    15121514    LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib" 
     1515 
     1516    CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${with_ffmpeg}/include/ffmpeg" 
     1517    LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${with_ffmpeg}/lib" 
     1518 
    15131519  fi 
    15141520 
     
    15391545      dnl  Use a custom libffmpeg 
    15401546      AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a) 
    1541       BUILTINS="${BUILTINS} ffmpeg
     1547      BUILTINS="${BUILTINS} ffmpeg stream_out_transcode
    15421548      LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec" 
    15431549      CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec" 
     1550 
     1551      LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${real_ffmpeg_tree}/libavcodec -lavcodec" 
     1552      CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${real_ffmpeg_tree}/libavcodec" 
     1553 
    15441554    else 
    15451555      dnl  The given libavcodec wasn't built 
     
    15511561    LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}" 
    15521562    AC_CHECK_LIB(avcodec, avcodec_init, [ 
    1553       BUILTINS="${BUILTINS} ffmpeg" 
    1554       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ], 
     1563      BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" 
     1564      LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec"  
     1565      LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lavcodec" ], 
    15551566      [ AC_MSG_ERROR([Cannot find libavcodec library...]) ]) 
    15561567    LDFLAGS="${LDFLAGS_save}" 
  • include/input_ext-intf.h

    r607b74b r4dec968  
    55 ***************************************************************************** 
    66 * Copyright (C) 1999, 2000 VideoLAN 
    7  * $Id: input_ext-intf.h,v 1.87 2003/03/24 17:15:29 gbazin Exp $ 
     7 * $Id: input_ext-intf.h,v 1.88 2003/04/13 20:00:20 fenrir Exp $ 
    88 * 
    99 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    7272    count_t                 c_packets;                 /* total packets read */ 
    7373    count_t                 c_invalid_packets;       /* invalid packets read */ 
     74 
     75    /* XXX hack: to force a decoder instead of mode based on sout */ 
     76    vlc_bool_t              b_force_decoder; 
    7477}; 
    7578 
  • include/stream_output.h

    r949a4ce r4dec968  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: stream_output.h,v 1.9 2003/03/11 19:02:30 fenrir Exp $ 
     5 * $Id: stream_output.h,v 1.10 2003/04/13 20:00:20 fenrir Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    5858}; 
    5959 
    60 struct sout_packet_format_t 
    61 { 
    62     int             i_cat;      // AUDIO_ES, VIDEO_ES, SPU_ES 
     60struct sout_format_t 
     61{ 
     62    int             i_cat; 
    6363    vlc_fourcc_t    i_fourcc; 
    6464 
    65     void            *p_format;  // WAVEFORMATEX or BITMAPINFOHEADER 
     65    /* audio */ 
     66    int             i_sample_rate; 
     67    int             i_channels; 
     68    int             i_block_align; 
     69 
     70    /* video */ 
     71    int             i_width; 
     72    int             i_height; 
     73 
     74    int             i_bitrate; 
     75    int             i_extra_data; 
     76    uint8_t         *p_extra_data; 
     77 
    6678}; 
    6779 
     
    7688}; 
    7789 
     90typedef struct sout_stream_id_t  sout_stream_id_t; 
     91 
    7892/* for mux */ 
    7993struct sout_input_t 
    8094{ 
    81 //    vlc_mutex_t             lock; 
    82  
    83     sout_instance_t         *p_sout; 
    84  
    85     sout_packet_format_t    input_format; 
    86     sout_fifo_t             *p_fifo; 
    87  
    88     void                    *p_sys; 
    89 }; 
    90  
    91 /* for packetizr */ 
     95    sout_instance_t *p_sout; 
     96 
     97    sout_format_t   *p_fmt; 
     98    sout_fifo_t     *p_fifo; 
     99 
     100    void            *p_sys; 
     101}; 
     102 
     103/* for packetizer */ 
    92104struct sout_packetizer_input_t 
    93105{ 
    94106 
    95     sout_instance_t         *p_sout; 
    96     sout_packet_format_t    input_format; 
    97  
    98 //    vlc_mutex_t             lock; 
    99     int                     i_nb_inputs; 
    100     sout_input_t            **pp_inputs; 
    101  
    102     int                     i_nb_mux;   // not really used, just usefull with TAB_* 
    103     sout_mux_t              **pp_mux; 
    104  
    105 }; 
     107    sout_instance_t     *p_sout; 
     108 
     109    sout_format_t       *p_fmt; 
     110 
     111    sout_stream_id_t    *id; 
     112}; 
     113 
    106114 
    107115#define SOUT_METHOD_NONE        0x00 
     
    109117#define SOUT_METHOD_NETWORK     0x20 
    110118 
     119typedef struct sout_access_out_sys_t   sout_access_out_sys_t; 
    111120struct sout_access_out_t 
    112121{ 
     
    181190}; 
    182191 
     192 
     193 
     194struct sout_cfg_t 
     195{ 
     196    sout_cfg_t  *p_next; 
     197 
     198    char        *psz_name; 
     199    char        *psz_value; 
     200}; 
     201 
     202typedef struct sout_stream_sys_t sout_stream_sys_t; 
     203struct sout_stream_t 
     204{ 
     205    VLC_COMMON_MEMBERS 
     206 
     207    module_t                *p_module; 
     208    sout_instance_t         *p_sout; 
     209 
     210    char                    *psz_name; 
     211    sout_cfg_t              *p_cfg; 
     212    char                    *psz_next; 
     213 
     214    /* add, remove a stream */ 
     215    sout_stream_id_t *      (*pf_add) ( sout_stream_t *, sout_format_t * ); 
     216    int                     (*pf_del) ( sout_stream_t *, sout_stream_id_t * ); 
     217 
     218    /* manage a packet */ 
     219    int                     (*pf_send)( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* ); 
     220 
     221    /* private */ 
     222    sout_stream_sys_t       *p_sys; 
     223}; 
     224 
    183225typedef struct sout_instance_sys_t sout_instance_sys_t; 
    184226struct sout_instance_t 
     
    186228    VLC_COMMON_MEMBERS 
    187229 
    188     /* complete sout string like udp/ts:239.255.12.42#file/ps://essai.ps */ 
    189230    char * psz_sout; 
    190  
    191     /* here are stored the parsed psz_sout */ 
    192     int                     i_nb_dest; 
    193     char                    **ppsz_dest; 
     231    char * psz_chain; 
    194232 
    195233    /* muxer data */ 
    196234    int                     i_preheader;    /* max over all muxer */ 
    197235 
    198     int                     i_nb_mux; 
    199     sout_mux_t              **pp_mux; 
    200  
    201     /* here are all packetizer inputs accepted by at least one muxer */ 
    202236    vlc_mutex_t             lock; 
    203     int                     i_nb_inputs; 
    204     sout_packetizer_input_t **pp_inputs; 
     237    sout_stream_t           *p_stream; 
    205238 
    206239    /* sout private */ 
     
    208241}; 
    209242 
    210  
    211  
    212  
     243/* some macro */ 
     244#define TAB_APPEND( count, tab, p )             \ 
     245    if( (count) > 0 )                           \ 
     246    {                                           \ 
     247        (tab) = realloc( (tab), sizeof( void ** ) * ( (count) + 1 ) ); \ 
     248    }                                           \ 
     249    else                                        \ 
     250    {                                           \ 
     251        (tab) = malloc( sizeof( void ** ) );    \ 
     252    }                                           \ 
     253    (void**)(tab)[(count)] = (void*)(p);        \ 
     254    (count)++ 
     255 
     256#define TAB_FIND( count, tab, p, index )        \ 
     257    {                                           \ 
     258        int _i_;                                \ 
     259        (index) = -1;                           \ 
     260        for( _i_ = 0; _i_ < (count); _i_++ )    \ 
     261        {                                       \ 
     262            if((void**)(tab)[_i_]==(void*)(p))  \ 
     263            {                                   \ 
     264                (index) = _i_;                  \ 
     265                break;                          \ 
     266            }                                   \ 
     267        }                                       \ 
     268    } 
     269 
     270#define TAB_REMOVE( count, tab, p )             \ 
     271    {                                           \ 
     272        int i_index;                            \ 
     273        TAB_FIND( count, tab, p, i_index );     \ 
     274        if( i_index >= 0 )                      \ 
     275        {                                       \ 
     276            if( count > 1 )                     \ 
     277            {                                   \ 
     278                memmove( ((void**)tab + i_index),    \ 
     279                         ((void**)tab + i_index+1),  \ 
     280                         ( (count) - i_index - 1 ) * sizeof( void* ) );\ 
     281            }                                   \ 
     282            else                                \ 
     283            {                                   \ 
     284                free( tab );                    \ 
     285                (tab) = NULL;                   \ 
     286            }                                   \ 
     287            (count)--;                          \ 
     288        }                                       \ 
     289    } 
     290 
     291static inline sout_cfg_t *sout_cfg_find( sout_cfg_t *p_cfg, char *psz_name ) 
     292
     293    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) ) 
     294    { 
     295        p_cfg = p_cfg->p_next; 
     296    } 
     297 
     298    return p_cfg; 
     299
     300 
     301static inline char *sout_cfg_find_value( sout_cfg_t *p_cfg, char *psz_name ) 
     302
     303    while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) ) 
     304    { 
     305        p_cfg = p_cfg->p_next; 
     306    } 
     307 
     308    if( p_cfg && p_cfg->psz_value ) 
     309    { 
     310        return( p_cfg->psz_value ); 
     311    } 
     312 
     313    return NULL; 
     314
    213315/***************************************************************************** 
    214316 * Prototypes 
     
    228330 
    229331#define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b ) 
    230 VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew,       ( vlc_object_t *, sout_packet_format_t * ) ); 
     332VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew,       ( vlc_object_t *, sout_format_t * ) ); 
    231333VLC_EXPORT( int,            sout_InputDelete,      ( sout_packetizer_input_t * ) ); 
    232334VLC_EXPORT( int,            sout_InputSendBuffer,  ( sout_packetizer_input_t *, sout_buffer_t* ) ); 
     
    244346VLC_EXPORT( int,                 sout_AccessOutWrite,  ( sout_access_out_t *, sout_buffer_t * ) ); 
    245347 
     348VLC_EXPORT( sout_mux_t *,       sout_MuxNew,          ( sout_instance_t*, char *, sout_access_out_t * ) ); 
     349VLC_EXPORT( sout_input_t *,     sout_MuxAddStream,    ( sout_mux_t *, sout_format_t * ) ); 
     350VLC_EXPORT( void,               sout_MuxDeleteStream, ( sout_mux_t *, sout_input_t * ) ); 
     351VLC_EXPORT( void,               sout_MuxDelete,       ( sout_mux_t * ) ); 
     352VLC_EXPORT( void,               sout_MuxSendBuffer, ( sout_mux_t *, sout_input_t  *, sout_buffer_t * ) ); 
     353 
     354VLC_EXPORT( char *,             sout_cfg_parser, ( char **, sout_cfg_t **, char * ) ); 
     355VLC_EXPORT( sout_stream_t *,    sout_stream_new, ( sout_instance_t *, char *psz_chain ) ); 
     356VLC_EXPORT( void,               sout_stream_delete, ( sout_stream_t *p_stream ) ); 
     357 
  • include/vlc_common.h

    r2b013d3 r4dec968  
    44 ***************************************************************************** 
    55 * Copyright (C) 1998, 1999, 2000 VideoLAN 
    6  * $Id: vlc_common.h,v 1.59 2003/03/17 18:02:11 sam Exp $ 
     6 * $Id: vlc_common.h,v 1.60 2003/04/13 20:00:20 fenrir Exp $ 
    77 * 
    88 * Authors: Samuel Hocevar <sam@via.ecp.fr> 
     
    250250typedef struct sout_packetizer_input_t sout_packetizer_input_t; 
    251251typedef struct sout_buffer_t sout_buffer_t; 
    252 typedef struct sout_packet_format_t sout_packet_format_t; 
    253252typedef struct sout_access_out_t sout_access_out_t; 
    254253typedef struct sout_mux_t sout_mux_t; 
    255 typedef struct sout_access_out_sys_t sout_access_out_sys_t; 
    256  
     254typedef struct sout_stream_t    sout_stream_t; 
     255typedef struct sout_cfg_t       sout_cfg_t; 
     256typedef struct sout_format_t    sout_format_t; 
    257257/* Decoders */ 
    258258typedef struct decoder_fifo_t decoder_fifo_t; 
  • modules/Makefile.am

    ra64501f r4dec968  
    6363    mux/mpeg/Modules.am \ 
    6464    packetizer/Modules.am \ 
     65    stream_out/Modules.am \ 
    6566    video_chroma/Modules.am \ 
    6667    video_filter/Modules.am \ 
  • modules/mux/avi.c

    r8c1b605 r4dec968  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: avi.c,v 1.11 2003/03/31 03:46:11 fenrir Exp $ 
     5 * $Id: avi.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    232232                    (uint64_t)p_stream->i_duration; 
    233233        } 
    234         msg_Err( p_mux, "stream[%d] duration:%lld totalsize:%lld frames:%d fps:%f kb/s:%d", 
    235                  i_stream, 
    236                  (int64_t)p_stream->i_duration / (int64_t)1000000, 
    237                  p_stream->i_totalsize, 
    238                  p_stream->i_frames, 
    239                  p_stream->f_fps, p_stream->i_bitrate/1024 ); 
     234        msg_Info( p_mux, "stream[%d] duration:%lld totalsize:%lld frames:%d fps:%f kb/s:%d", 
     235                  i_stream, 
     236                  (int64_t)p_stream->i_duration / (int64_t)1000000, 
     237                  p_stream->i_totalsize, 
     238                  p_stream->i_frames, 
     239                  p_stream->f_fps, p_stream->i_bitrate/1024 ); 
    240240    } 
    241241 
     
    267267        return( -1 ); 
    268268    } 
    269     if( p_input->input_format.p_format == NULL ) 
    270     { 
    271         msg_Err( p_mux, "stream descriptor missing" ); 
    272         return( -1 ); 
    273     } 
    274269 
    275270    msg_Dbg( p_mux, "adding input" ); 
     
    279274    p_stream = &p_sys->stream[p_sys->i_streams]; 
    280275 
    281     switch( p_input->input_format.i_cat ) 
     276    switch( p_input->p_fmt->i_cat ) 
    282277    { 
    283278        case AUDIO_ES: 
    284             { 
    285                 WAVEFORMATEX *p_wf = 
    286                     (WAVEFORMATEX*)p_input->input_format.p_format; 
    287  
    288                 p_stream->i_cat = AUDIO_ES; 
    289                 p_stream->fcc[0] = '0' + p_sys->i_streams / 10; 
    290                 p_stream->fcc[1] = '0' + p_sys->i_streams % 10; 
    291                 p_stream->fcc[2] = 'w'; 
    292                 p_stream->fcc[3] = 'b'; 
    293  
    294                 p_stream->p_bih = NULL; 
    295                 p_stream->p_wf  = malloc( sizeof( WAVEFORMATEX ) + p_wf->cbSize ); 
    296                 memcpy( p_stream->p_wf, 
    297                         p_wf, 
    298                         sizeof( WAVEFORMATEX ) + p_wf->cbSize); 
    299             } 
     279            p_stream->i_cat = AUDIO_ES; 
     280            p_stream->fcc[0] = '0' + p_sys->i_streams / 10; 
     281            p_stream->fcc[1] = '0' + p_sys->i_streams % 10; 
     282            p_stream->fcc[2] = 'w'; 
     283            p_stream->fcc[3] = 'b'; 
     284 
     285            p_stream->p_bih = NULL; 
     286 
     287            p_stream->p_wf  = malloc( sizeof( WAVEFORMATEX ) + p_input->p_fmt->i_extra_data ); 
     288#define p_wf p_stream->p_wf 
     289            p_wf->cbSize = p_input->p_fmt->i_extra_data; 
     290            if( p_wf->cbSize > 0 ) 
     291            { 
     292                memcpy( &p_wf[1], 
     293                        p_input->p_fmt->p_extra_data, 
     294                        p_input->p_fmt->i_extra_data ); 
     295            } 
     296            p_wf->nChannels      = p_input->p_fmt->i_channels; 
     297            p_wf->nSamplesPerSec = p_input->p_fmt->i_sample_rate; 
     298            p_wf->nBlockAlign    = p_input->p_fmt->i_block_align; 
     299            p_wf->nAvgBytesPerSec= p_input->p_fmt->i_bitrate / 8; 
     300            p_wf->wBitsPerSample = 0; 
     301 
     302            switch( p_input->p_fmt->i_fourcc ) 
     303            { 
     304                case VLC_FOURCC( 'a', '5', '2', ' ' ): 
     305                    p_wf->wFormatTag = WAVE_FORMAT_A52; 
     306                    break; 
     307                case VLC_FOURCC( 'm', 'p', 'g', 'a' ): 
     308                    p_wf->wFormatTag = WAVE_FORMAT_MPEGLAYER3; 
     309                    break; 
     310                case VLC_FOURCC( 'w', 'm', 'a', '1' ): 
     311                    p_wf->wFormatTag = WAVE_FORMAT_WMA1; 
     312                    break; 
     313                case VLC_FOURCC( 'w', 'm', 'a', '2' ): 
     314                    p_wf->wFormatTag = WAVE_FORMAT_WMA2; 
     315                    break; 
     316                case VLC_FOURCC( 'w', 'm', 'a', '3' ): 
     317                    p_wf->wFormatTag = WAVE_FORMAT_WMA3; 
     318                    break; 
     319                default: 
     320                    return VLC_EGENERIC; 
     321            } 
     322#undef p_wf 
    300323            break; 
    301324        case VIDEO_ES: 
    302             { 
    303                 BITMAPINFOHEADER *p_bih = 
    304                     (BITMAPINFOHEADER*)p_input->input_format.p_format;; 
    305  
    306                 p_stream->i_cat = VIDEO_ES; 
    307                 p_stream->fcc[0] = '0' + p_sys->i_streams / 10; 
    308                 p_stream->fcc[1] = '0' + p_sys->i_streams % 10; 
    309                 p_stream->fcc[2] = 'd'; 
    310                 p_stream->fcc[3] = 'c'; 
    311                 if( p_sys->i_stream_video < 0 ) 
    312                 { 
    313                     p_sys->i_stream_video = p_sys->i_streams; 
    314                 } 
    315                 p_stream->p_wf  = NULL; 
    316                 p_stream->p_bih = malloc( p_bih->biSize ); 
    317                 memcpy( p_stream->p_bih, 
    318                         p_bih, 
    319                         p_bih->biSize ); 
    320             } 
     325            p_stream->i_cat = VIDEO_ES; 
     326            p_stream->fcc[0] = '0' + p_sys->i_streams / 10; 
     327            p_stream->fcc[1] = '0' + p_sys->i_streams % 10; 
     328            p_stream->fcc[2] = 'd'; 
     329            p_stream->fcc[3] = 'c'; 
     330            if( p_sys->i_stream_video < 0 ) 
     331            { 
     332                p_sys->i_stream_video = p_sys->i_streams; 
     333            } 
     334            p_stream->p_wf  = NULL; 
     335            p_stream->p_bih = malloc( sizeof( BITMAPINFOHEADER ) + p_input->p_fmt->i_extra_data ); 
     336#define p_bih p_stream->p_bih 
     337            p_bih->biSize  = sizeof( BITMAPINFOHEADER ) + p_input->p_fmt->i_extra_data; 
     338            if( p_input->p_fmt->i_extra_data > 0 ) 
     339            { 
     340                memcpy( &p_bih[1], 
     341                        p_input->p_fmt->p_extra_data, 
     342                        p_input->p_fmt->i_extra_data ); 
     343            } 
     344            p_bih->biWidth = p_input->p_fmt->i_width; 
     345            p_bih->biHeight= p_input->p_fmt->i_height; 
     346            p_bih->biPlanes= 1; 
     347            p_bih->biBitCount       = 24; 
     348            p_bih->biSizeImage      = 0; 
     349            p_bih->biXPelsPerMeter  = 0; 
     350            p_bih->biYPelsPerMeter  = 0; 
     351            p_bih->biClrUsed        = 0; 
     352            p_bih->biClrImportant   = 0; 
     353            switch( p_input->p_fmt->i_fourcc ) 
     354            { 
     355                case VLC_FOURCC( 'm', 'p', '4', 'v' ): 
     356                    p_bih->biCompression = VLC_FOURCC( 'X', 'V', 'I', 'D' ); 
     357                    break; 
     358                default: 
     359                    p_bih->biCompression = p_input->p_fmt->i_fourcc; 
     360                    break; 
     361            } 
     362#undef p_bih 
    321363            break; 
    322364        default: 
    323             return( -1 ); 
     365            return( VLC_EGENERIC ); 
    324366    } 
    325367    p_stream->i_totalsize = 0; 
     
    334376 
    335377    p_sys->i_streams++; 
    336     return( 0 ); 
     378    return( VLC_SUCCESS ); 
    337379} 
    338380 
     
    432474            } 
    433475 
     476            p_sys->i_movi_size += p_data->i_size; 
    434477            sout_AccessOutWrite( p_mux->p_access, p_data ); 
    435             p_sys->i_movi_size += p_data->i_size; 
    436478 
    437479            i_count--; 
     
    650692                { 
    651693                    i_scale = i_samplesize; 
    652                     i_rate = i_scale * p_stream->i_bitrate / 8; 
     694                    i_rate = /*i_scale **/ p_stream->i_bitrate / 8; 
    653695                } 
    654696                else 
  • modules/mux/mpeg/ps.c

    r949a4ce r4dec968  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: ps.c,v 1.11 2003/03/11 19:02:30 fenrir Exp $ 
     5 * $Id: ps.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    175175    p_input->p_sys = (void*)p_stream = malloc( sizeof( ps_stream_t ) ); 
    176176    p_stream->i_ok = 0; 
    177     switch( p_input->input_format.i_cat ) 
     177    switch( p_input->p_fmt->i_cat ) 
    178178    { 
    179179        case VIDEO_ES: 
    180180 
    181             switch( p_input->input_format.i_fourcc ) 
     181            switch( p_input->p_fmt->i_fourcc ) 
    182182            { 
    183183                case VLC_FOURCC( 'm', 'p', 'g', 'v' ): 
     
    191191            break; 
    192192        case AUDIO_ES: 
    193             switch( p_input->input_format.i_fourcc ) 
     193            switch( p_input->p_fmt->i_fourcc ) 
    194194            { 
    195195                case VLC_FOURCC( 'a', '5', '2', ' ' ): 
  • modules/mux/mpeg/ts.c

    r949a4ce r4dec968  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: ts.c,v 1.15 2003/03/11 19:02:30 fenrir Exp $ 
     5 * $Id: ts.c,v 1.16 2003/04/13 20:00:21 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    224224    sout_mux_sys_t      *p_sys = p_mux->p_sys; 
    225225    ts_stream_t         *p_stream; 
    226     BITMAPINFOHEADER    *p_bih; 
    227     WAVEFORMATEX        *p_wf; 
    228226 
    229227    msg_Dbg( p_mux, "adding input" ); 
     
    237235    p_stream->i_continuity_counter = 0; 
    238236 
    239     switch( p_input->input_format.i_cat ) 
     237    switch( p_input->p_fmt->i_cat ) 
    240238    { 
    241239        case VIDEO_ES: 
    242             switch( p_input->input_format.i_fourcc ) 
     240            switch( p_input->p_fmt->i_fourcc ) 
    243241            { 
    244242                case VLC_FOURCC( 'm', 'p','g', 'v' ): 
     
    270268            } 
    271269            p_sys->i_video_bound++; 
    272             p_bih = (BITMAPINFOHEADER*)p_input->input_format.p_format; 
    273             if( p_bih ) 
    274             { 
    275                 p_stream->i_bih_codec = p_input->input_format.i_fourcc; 
    276                 p_stream->i_bih_width = p_bih->biWidth; 
    277                 p_stream->i_bih_height = p_bih->biHeight; 
    278             } 
    279             else 
    280             { 
    281                 p_stream->i_bih_codec = 0x0; 
    282                 p_stream->i_bih_width = 0; 
    283                 p_stream->i_bih_height = 0; 
    284             } 
    285  
    286             if( p_bih && p_bih->biSize > sizeof( BITMAPINFOHEADER ) ) 
    287             { 
    288                 p_stream->i_decoder_specific_info_len = 
    289                     p_bih->biSize - sizeof( BITMAPINFOHEADER ); 
     270 
     271            p_stream->i_bih_codec  = p_input->p_fmt->i_fourcc; 
     272            p_stream->i_bih_width  = p_input->p_fmt->i_width; 
     273            p_stream->i_bih_height = p_input->p_fmt->i_height; 
     274 
     275            p_stream->i_decoder_specific_info_len = p_input->p_fmt->i_extra_data; 
     276            if( p_stream->i_decoder_specific_info_len > 0 ) 
     277            { 
    290278                p_stream->p_decoder_specific_info = 
    291279                    malloc( p_stream->i_decoder_specific_info_len ); 
    292280                memcpy( p_stream->p_decoder_specific_info, 
    293                         &p_bih[1]
    294                         p_stream->i_decoder_specific_info_len ); 
     281                        p_input->p_fmt->p_extra_data
     282                        p_input->p_fmt->i_extra_data ); 
    295283            } 
    296284            else 
    297285            { 
    298286                p_stream->p_decoder_specific_info = NULL; 
    299                 p_stream->i_decoder_specific_info_len = 0; 
    300287            } 
    301288            break; 
     289 
    302290        case AUDIO_ES: 
    303             switch( p_input->input_format.i_fourcc ) 
     291            switch( p_input->p_fmt->i_fourcc ) 
    304292            { 
    305293                case VLC_FOURCC( 'a', '5','2', ' ' ): 
     
    325313            } 
    326314            p_sys->i_audio_bound++; 
    327             p_wf = (WAVEFORMATEX*)p_input->input_format.p_format; 
    328             if( p_wf && p_wf->cbSize > 0 ) 
    329             { 
    330                 p_stream->i_decoder_specific_info_len = p_wf->cbSize; 
     315 
     316            p_stream->i_decoder_specific_info_len = p_input->p_fmt->i_extra_data; 
     317            if( p_stream->i_decoder_specific_info_len > 0 ) 
     318            { 
    331319                p_stream->p_decoder_specific_info = 
    332320                    malloc( p_stream->i_decoder_specific_info_len ); 
    333321                memcpy( p_stream->p_decoder_specific_info, 
    334                         &p_wf[1]
    335                         p_stream->i_decoder_specific_info_len ); 
     322                        p_input->p_fmt->p_extra_data
     323                        p_input->p_fmt->i_extra_data ); 
    336324            } 
    337325            else 
    338326            { 
    339327                p_stream->p_decoder_specific_info = NULL; 
    340                 p_stream->i_decoder_specific_info_len = 0; 
    341328            } 
    342329            break; 
  • modules/mux/ogg.c

    r8c1b605 r4dec968  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: ogg.c,v 1.4 2003/03/31 03:46:11 fenrir Exp $ 
     5 * $Id: ogg.c,v 1.5 2003/04/13 20:00:21 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    210210    ogg_stream_t        *p_stream; 
    211211 
    212     BITMAPINFOHEADER    *p_bih; 
    213     WAVEFORMATEX        *p_wf; 
    214  
    215212    msg_Dbg( p_mux, "adding input" ); 
    216213    p_input->p_sys = (void*)p_stream = malloc( sizeof( ogg_stream_t ) ); 
    217214 
    218     p_stream->i_cat       = p_input->input_format.i_cat; 
    219     p_stream->i_fourcc    = p_input->input_format.i_fourcc; 
     215    p_stream->i_cat       = p_input->p_fmt->i_cat; 
     216    p_stream->i_fourcc    = p_input->p_fmt->i_fourcc; 
    220217    p_stream->i_packet_no = 0; 
    221218 
    222219    p_stream->header.i_packet_type = PACKET_TYPE_HEADER; 
    223     switch( p_input->input_format.i_cat ) 
     220    switch( p_input->p_fmt->i_cat ) 
    224221    { 
    225222        case VIDEO_ES: 
    226             p_bih = (BITMAPINFOHEADER*)p_input->input_format.p_format; 
    227             switch( p_input->input_format.i_fourcc ) 
     223            switch( p_input->p_fmt->i_fourcc ) 
    228224            { 
    229225                case VLC_FOURCC( 'm', 'p','4', 'v' ): 
     
    232228                            "video    ", 
    233229                            8 ); 
    234                     if( p_input->input_format.i_fourcc == VLC_FOURCC( 'm', 'p','4', 'v' ) ) 
     230                    if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'm', 'p','4', 'v' ) ) 
    235231                    { 
    236232                        memcpy( p_stream->header.sub_type, "XVID", 4 ); 
    237233                    } 
    238                     else if( p_input->input_format.i_fourcc == VLC_FOURCC( 'D', 'I','V', '3' ) ) 
     234                    else if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'D', 'I','V', '3' ) ) 
    239235                    { 
    240236                        memcpy( p_stream->header.sub_type, "DIV3", 4 ); 
     
    247243                    SetDWLE( &p_stream->header.i_buffer_size, 1024*1024 ); 
    248244                    SetWLE( &p_stream->header.i_bits_per_sample, 0 ); 
    249                     if( p_bih ) 
    250                     { 
    251                         SetDWLE( &p_stream->header.header.video.i_width, p_bih->biWidth ); 
    252                         SetDWLE( &p_stream->header.header.video.i_height, p_bih->biHeight ); 
    253                     } 
    254                     else 
    255                     { 
    256                         SetDWLE( &p_stream->header.header.video.i_width,  0 ); 
    257                         SetDWLE( &p_stream->header.header.video.i_height, 0 ); 
    258                     } 
     245                    SetDWLE( &p_stream->header.header.video.i_width,  p_input->p_fmt->i_width ); 
     246                    SetDWLE( &p_stream->header.header.video.i_height, p_input->p_fmt->i_height ); 
    259247                    break; 
    260248                default: 
     
    264252            break; 
    265253        case AUDIO_ES: 
    266             p_wf = (WAVEFORMATEX*)p_input->input_format.p_format; 
    267             switch( p_input->input_format.i_fourcc ) 
     254            switch( p_input->p_fmt->i_fourcc ) 
    268255            { 
    269256                case VLC_FOURCC( 'm', 'p','g', 'a' ): 
     
    272259                            "audio    ", 
    273260                            8 ); 
    274                     if( p_input->input_format.i_fourcc == VLC_FOURCC( 'm', 'p','g', 'a' ) ) 
     261                    if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'm', 'p','g', 'a' ) ) 
    275262                    { 
    276263                        memcpy( p_stream->header.sub_type, "55  ", 4 ); 
    277264                    } 
    278                     else if( p_input->input_format.i_fourcc == VLC_FOURCC( 'a', '5','2', ' ' ) ) 
     265                    else if( p_input->p_fmt->i_fourcc == VLC_FOURCC( 'a', '5','2', ' ' ) ) 
    279266                    { 
    280267                        memcpy( p_stream->header.sub_type, "2000", 4 ); 
     
    284271                    SetDWLE( &p_stream->header.i_default_len, 0 );      /* ??? */ 
    285272                    SetDWLE( &p_stream->header.i_buffer_size, 30*1024 ); 
    286                     if( p_wf ) 
    287                     { 
    288                         SetQWLE( &p_stream->header.i_samples_per_unit, p_wf->nSamplesPerSec ); 
    289                         SetWLE( &p_stream->header.i_bits_per_sample, p_wf->wBitsPerSample ); 
    290                         SetDWLE( &p_stream->header.header.audio.i_channels, p_wf->nChannels ); 
    291                         SetDWLE( &p_stream->header.header.audio.i_block_align, p_wf->nBlockAlign ); 
    292                         SetDWLE( &p_stream->header.header.audio.i_avgbytespersec, p_wf->nAvgBytesPerSec ); 
    293                     } 
    294                     else 
    295                     { 
    296                         /* perhaps it's better to fail */ 
    297                         SetQWLE( &p_stream->header.i_samples_per_unit, 44100 ); 
    298                         SetWLE( &p_stream->header.i_bits_per_sample, 0 ); 
    299                         SetDWLE( &p_stream->header.header.audio.i_channels, 2 ); 
    300                         SetDWLE( &p_stream->header.header.audio.i_block_align, 0 ); 
    301                         SetDWLE( &p_stream->header.header.audio.i_avgbytespersec, 0 ); 
    302                     } 
     273                    SetQWLE( &p_stream->header.i_samples_per_unit, p_input->p_fmt->i_sample_rate ); 
     274                    SetWLE( &p_stream->header.i_bits_per_sample, 0 ); 
     275                    SetDWLE( &p_stream->header.header.audio.i_channels, p_input->p_fmt->i_channels ); 
     276                    SetDWLE( &p_stream->header.header.audio.i_block_align, p_input->p_fmt->i_block_align ); 
     277                    SetDWLE( &p_stream->header.header.audio.i_avgbytespersec, 0 ); 
    303278                    break; 
    304279                case VLC_FOURCC( 'v', 'o', 'r', 'b' ): 
  • modules/packetizer/a52.c

    r8c1b605