Changeset e3c6886780a9759aaabea7c138a3fc49fd040628

Show
Ignore:
Timestamp:
25/04/04 18:35:39 (5 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1082910939 +0000
git-parent:

[a6d67949e98b25f010d0fff2c318f07eb544466f]

git-author:
Gildas Bazin <gbazin@videolan.org> 1082910939 +0000
Message:

* modules/stream_out/transcode.c:

+ new options to allow forcing an encoder and passing options to it.

(aenc=foo{optionbar=bar,etc...},venc=foo{optionbar=bar,etc...} where foo is the encoder plugin name).

+ got rid of aopts/vopts which is not needed anymore ;)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/stream_out/transcode.c

    r3ef2227 re3c6886  
    4949 * Module descriptor 
    5050 *****************************************************************************/ 
     51#define VENC_TEXT N_("Video encoder") 
     52#define VENC_LONGTEXT N_( \ 
     53    "Allows you to specify the video encoder to use and its associated " \ 
     54    "options." ) 
    5155#define VCODEC_TEXT N_("Destination video codec") 
    5256#define VCODEC_LONGTEXT N_( \ 
    53     "Allows you to pecify the destination video codec used for the streaming "
    54     "output." ) 
     57    "Allows you to specify the destination video codec used for the "
     58    "streaming output." ) 
    5559#define VB_TEXT N_("Video bitrate") 
    5660#define VB_LONGTEXT N_( \ 
     
    8387    "Allows you to specify the right coordinate for the video cropping." ) 
    8488 
     89#define AENC_TEXT N_("Audio encoder") 
     90#define AENC_LONGTEXT N_( \ 
     91    "Allows you to specify the audio encoder to use and its associated " \ 
     92    "options." ) 
    8593#define ACODEC_TEXT N_("Destination audio codec") 
    8694#define ACODEC_LONGTEXT N_( \ 
     
    115123    set_callbacks( Open, Close ); 
    116124 
     125    add_string( SOUT_CFG_PREFIX "venc", NULL, NULL, VENC_TEXT, 
     126                VENC_LONGTEXT, VLC_FALSE ); 
    117127    add_string( SOUT_CFG_PREFIX "vcodec", NULL, NULL, VCODEC_TEXT, 
    118128                VCODEC_LONGTEXT, VLC_FALSE ); 
     
    137147                 CROPRIGHT_LONGTEXT, VLC_TRUE ); 
    138148 
     149    add_string( SOUT_CFG_PREFIX "aenc", NULL, NULL, AENC_TEXT, 
     150                AENC_LONGTEXT, VLC_FALSE ); 
    139151    add_string( SOUT_CFG_PREFIX "acodec", NULL, NULL, ACODEC_TEXT, 
    140152                ACODEC_LONGTEXT, VLC_FALSE ); 
     
    150162vlc_module_end(); 
    151163 
     164static const char *ppsz_sout_options[] = { 
     165    "venc", "vcodec", "vb", "croptop", "cropbottom", "cropleft", "cropright", 
     166    "scale", "width", "height", "deinterlace", "threads", 
     167    "aenc", "acodec", "ab", "samplerate", "channels", NULL 
     168}; 
     169 
    152170/***************************************************************************** 
    153171 * Exported prototypes 
     
    180198}; 
    181199 
    182 static const char *ppsz_sout_options[] = { 
    183     "vcodec", "vb", "croptop", "cropbottom", "cropleft", "cropright", 
    184     "scale", "width", "height", "deinterlace", "threads", 
    185     "acodec", "ab", "samplerate", "channels", NULL 
    186 }; 
    187  
    188200#define PICTURE_RING_SIZE 64 
    189201 
     
    201213 
    202214    vlc_fourcc_t    i_acodec;   /* codec audio (0 if not transcode) */ 
     215    char            *psz_aenc; 
    203216    sout_cfg_t      *p_audio_cfg; 
    204217    int             i_sample_rate; 
     
    207220 
    208221    vlc_fourcc_t    i_vcodec;   /*    "   video  " "   "      " */ 
     222    char            *psz_venc; 
    209223    sout_cfg_t      *p_video_cfg; 
    210224    int             i_vbitrate; 
     
    235249    sout_stream_sys_t *p_sys; 
    236250    vlc_value_t       val; 
    237     char              *psz_opts; 
    238251 
    239252    p_sys = vlc_object_create( p_this, sizeof( sout_stream_sys_t ) ); 
     
    250263    p_sys->i_output_pts = 0; 
    251264 
    252     psz_opts = sout_cfg_find_value( p_stream->p_cfg, "aopts" ); 
    253     p_sys->p_audio_cfg = NULL; 
    254     if( psz_opts && *psz_opts ) 
    255     { 
    256         char *psz_name, *psz_next, *psz_tmp; 
    257         asprintf( &psz_tmp, "aopts%s", psz_opts ); 
    258         psz_next = sout_cfg_parser( &psz_name, &p_sys->p_audio_cfg, psz_tmp ); 
    259         if( psz_next ) free( psz_next ); 
    260         free( psz_tmp ); 
    261     } 
    262  
    263     psz_opts = sout_cfg_find_value( p_stream->p_cfg, "vopts" ); 
    264     p_sys->p_video_cfg = NULL; 
    265     if( psz_opts && *psz_opts ) 
    266     { 
    267         char *psz_name, *psz_next, *psz_tmp; 
    268         asprintf( &psz_tmp, "vopts%s", psz_opts ); 
    269         psz_next = sout_cfg_parser( &psz_name, &p_sys->p_video_cfg, psz_tmp ); 
    270         if( psz_next ) free( psz_next ); 
    271         free( psz_tmp ); 
    272     } 
    273  
    274265    sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, 
    275266                   p_stream->p_cfg ); 
    276267 
    277268    /* Audio transcoding parameters */ 
     269    var_Get( p_stream, SOUT_CFG_PREFIX "aenc", &val ); 
     270    p_sys->psz_aenc = NULL; 
     271    p_sys->p_audio_cfg = NULL; 
     272    if( val.psz_string && *val.psz_string ) 
     273    { 
     274        char *psz_next; 
     275        psz_next = sout_cfg_parser( &p_sys->psz_aenc, &p_sys->p_audio_cfg, 
     276                    val.psz_string ); 
     277        if( psz_next ) free( psz_next ); 
     278    } 
     279    if( val.psz_string ) free( val.psz_string ); 
     280 
    278281    var_Get( p_stream, SOUT_CFG_PREFIX "acodec", &val ); 
    279282    p_sys->i_acodec = 0; 
     
    304307 
    305308    /* Video transcoding parameters */ 
     309    var_Get( p_stream, SOUT_CFG_PREFIX "venc", &val ); 
     310    p_sys->psz_venc = NULL; 
     311    p_sys->p_video_cfg = NULL; 
     312    if( val.psz_string && *val.psz_string ) 
     313    { 
     314        char *psz_next; 
     315        psz_next = sout_cfg_parser( &p_sys->psz_venc, &p_sys->p_video_cfg, 
     316                    val.psz_string ); 
     317        if( psz_next ) free( psz_next ); 
     318    } 
     319    if( val.psz_string ) free( val.psz_string ); 
     320 
    306321    var_Get( p_stream, SOUT_CFG_PREFIX "vcodec", &val ); 
    307322    p_sys->i_vcodec = 0; 
     
    382397        p_sys->p_audio_cfg = p_next; 
    383398    } 
     399    if( p_sys->psz_aenc ) free( p_sys->psz_aenc ); 
    384400 
    385401    while( p_sys->p_video_cfg != NULL ) 
     
    395411        p_sys->p_video_cfg = p_next; 
    396412    } 
     413    if( p_sys->psz_venc ) free( p_sys->psz_venc ); 
    397414 
    398415    vlc_object_destroy( p_sys ); 
     
    521538    else 
    522539    { 
    523         msg_Dbg( p_stream, "not transcoding a stream (fcc=`%4.4s')", (char*)&p_fmt->i_codec ); 
     540        msg_Dbg( p_stream, "not transcoding a stream (fcc=`%4.4s')", 
     541                 (char*)&p_fmt->i_codec ); 
    524542        id->id = p_sys->p_out->pf_add( p_sys->p_out, p_fmt ); 
    525543        id->b_transcode = VLC_FALSE; 
     
    800818 
    801819    /* Sanity check for audio channels */ 
    802     id->f_dst.audio.i_channels = __MIN( id->f_dst.audio.i_channels, id->f_src.audio.i_channels ); 
     820    id->f_dst.audio.i_channels = 
     821        __MIN( id->f_dst.audio.i_channels, id->f_src.audio.i_channels ); 
    803822 
    804823    /* find encoder */ 
     
    824843 
    825844    id->p_encoder->p_module = 
    826         module_Need( id->p_encoder, "encoder", NULL, 0 ); 
     845        module_Need( id->p_encoder, "encoder", 
     846                     p_stream->p_sys->psz_aenc, VLC_TRUE ); 
    827847    if( !id->p_encoder->p_module ) 
    828848    { 
     849        vlc_object_detach( id->p_encoder ); 
    829850        vlc_object_destroy( id->p_encoder ); 
    830851        msg_Err( p_stream, "cannot open encoder" ); 
     
    12931314 
    12941315    id->p_encoder->p_module = 
    1295         module_Need( id->p_encoder, "encoder", NULL, 0 ); 
     1316        module_Need( id->p_encoder, "encoder", p_sys->psz_venc, VLC_TRUE ); 
    12961317 
    12971318    if( !id->p_encoder->p_module ) 
    12981319    { 
     1320        vlc_object_detach( id->p_encoder ); 
    12991321        vlc_object_destroy( id->p_encoder ); 
    13001322        msg_Err( p_stream, "cannot find encoder" ); 
     
    14971519 
    14981520            id->p_encoder->p_module = 
    1499                 module_Need( id->p_encoder, "encoder", NULL, 0 ); 
     1521                module_Need( id->p_encoder, "encoder", 
     1522                             p_sys->psz_venc, VLC_TRUE ); 
    15001523            if( !id->p_encoder->p_module ) 
    15011524            {