Changeset e3c6886780a9759aaabea7c138a3fc49fd040628
- 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
| r3ef2227 |
re3c6886 |
|
| 49 | 49 | * Module descriptor |
|---|
| 50 | 50 | *****************************************************************************/ |
|---|
| | 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." ) |
|---|
| 51 | 55 | #define VCODEC_TEXT N_("Destination video codec") |
|---|
| 52 | 56 | #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." ) |
|---|
| 55 | 59 | #define VB_TEXT N_("Video bitrate") |
|---|
| 56 | 60 | #define VB_LONGTEXT N_( \ |
|---|
| … | … | |
| 83 | 87 | "Allows you to specify the right coordinate for the video cropping." ) |
|---|
| 84 | 88 | |
|---|
| | 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." ) |
|---|
| 85 | 93 | #define ACODEC_TEXT N_("Destination audio codec") |
|---|
| 86 | 94 | #define ACODEC_LONGTEXT N_( \ |
|---|
| … | … | |
| 115 | 123 | set_callbacks( Open, Close ); |
|---|
| 116 | 124 | |
|---|
| | 125 | add_string( SOUT_CFG_PREFIX "venc", NULL, NULL, VENC_TEXT, |
|---|
| | 126 | VENC_LONGTEXT, VLC_FALSE ); |
|---|
| 117 | 127 | add_string( SOUT_CFG_PREFIX "vcodec", NULL, NULL, VCODEC_TEXT, |
|---|
| 118 | 128 | VCODEC_LONGTEXT, VLC_FALSE ); |
|---|
| … | … | |
| 137 | 147 | CROPRIGHT_LONGTEXT, VLC_TRUE ); |
|---|
| 138 | 148 | |
|---|
| | 149 | add_string( SOUT_CFG_PREFIX "aenc", NULL, NULL, AENC_TEXT, |
|---|
| | 150 | AENC_LONGTEXT, VLC_FALSE ); |
|---|
| 139 | 151 | add_string( SOUT_CFG_PREFIX "acodec", NULL, NULL, ACODEC_TEXT, |
|---|
| 140 | 152 | ACODEC_LONGTEXT, VLC_FALSE ); |
|---|
| … | … | |
| 150 | 162 | vlc_module_end(); |
|---|
| 151 | 163 | |
|---|
| | 164 | static 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 | |
|---|
| 152 | 170 | /***************************************************************************** |
|---|
| 153 | 171 | * Exported prototypes |
|---|
| … | … | |
| 180 | 198 | }; |
|---|
| 181 | 199 | |
|---|
| 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 | | |
|---|
| 188 | 200 | #define PICTURE_RING_SIZE 64 |
|---|
| 189 | 201 | |
|---|
| … | … | |
| 201 | 213 | |
|---|
| 202 | 214 | vlc_fourcc_t i_acodec; /* codec audio (0 if not transcode) */ |
|---|
| | 215 | char *psz_aenc; |
|---|
| 203 | 216 | sout_cfg_t *p_audio_cfg; |
|---|
| 204 | 217 | int i_sample_rate; |
|---|
| … | … | |
| 207 | 220 | |
|---|
| 208 | 221 | vlc_fourcc_t i_vcodec; /* " video " " " " */ |
|---|
| | 222 | char *psz_venc; |
|---|
| 209 | 223 | sout_cfg_t *p_video_cfg; |
|---|
| 210 | 224 | int i_vbitrate; |
|---|
| … | … | |
| 235 | 249 | sout_stream_sys_t *p_sys; |
|---|
| 236 | 250 | vlc_value_t val; |
|---|
| 237 | | char *psz_opts; |
|---|
| 238 | 251 | |
|---|
| 239 | 252 | p_sys = vlc_object_create( p_this, sizeof( sout_stream_sys_t ) ); |
|---|
| … | … | |
| 250 | 263 | p_sys->i_output_pts = 0; |
|---|
| 251 | 264 | |
|---|
| 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 | | |
|---|
| 274 | 265 | sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, |
|---|
| 275 | 266 | p_stream->p_cfg ); |
|---|
| 276 | 267 | |
|---|
| 277 | 268 | /* 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 | |
|---|
| 278 | 281 | var_Get( p_stream, SOUT_CFG_PREFIX "acodec", &val ); |
|---|
| 279 | 282 | p_sys->i_acodec = 0; |
|---|
| … | … | |
| 304 | 307 | |
|---|
| 305 | 308 | /* 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 | |
|---|
| 306 | 321 | var_Get( p_stream, SOUT_CFG_PREFIX "vcodec", &val ); |
|---|
| 307 | 322 | p_sys->i_vcodec = 0; |
|---|
| … | … | |
| 382 | 397 | p_sys->p_audio_cfg = p_next; |
|---|
| 383 | 398 | } |
|---|
| | 399 | if( p_sys->psz_aenc ) free( p_sys->psz_aenc ); |
|---|
| 384 | 400 | |
|---|
| 385 | 401 | while( p_sys->p_video_cfg != NULL ) |
|---|
| … | … | |
| 395 | 411 | p_sys->p_video_cfg = p_next; |
|---|
| 396 | 412 | } |
|---|
| | 413 | if( p_sys->psz_venc ) free( p_sys->psz_venc ); |
|---|
| 397 | 414 | |
|---|
| 398 | 415 | vlc_object_destroy( p_sys ); |
|---|
| … | … | |
| 521 | 538 | else |
|---|
| 522 | 539 | { |
|---|
| 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 ); |
|---|
| 524 | 542 | id->id = p_sys->p_out->pf_add( p_sys->p_out, p_fmt ); |
|---|
| 525 | 543 | id->b_transcode = VLC_FALSE; |
|---|
| … | … | |
| 800 | 818 | |
|---|
| 801 | 819 | /* 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 ); |
|---|
| 803 | 822 | |
|---|
| 804 | 823 | /* find encoder */ |
|---|
| … | … | |
| 824 | 843 | |
|---|
| 825 | 844 | 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 ); |
|---|
| 827 | 847 | if( !id->p_encoder->p_module ) |
|---|
| 828 | 848 | { |
|---|
| | 849 | vlc_object_detach( id->p_encoder ); |
|---|
| 829 | 850 | vlc_object_destroy( id->p_encoder ); |
|---|
| 830 | 851 | msg_Err( p_stream, "cannot open encoder" ); |
|---|
| … | … | |
| 1293 | 1314 | |
|---|
| 1294 | 1315 | 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 ); |
|---|
| 1296 | 1317 | |
|---|
| 1297 | 1318 | if( !id->p_encoder->p_module ) |
|---|
| 1298 | 1319 | { |
|---|
| | 1320 | vlc_object_detach( id->p_encoder ); |
|---|
| 1299 | 1321 | vlc_object_destroy( id->p_encoder ); |
|---|
| 1300 | 1322 | msg_Err( p_stream, "cannot find encoder" ); |
|---|
| … | … | |
| 1497 | 1519 | |
|---|
| 1498 | 1520 | 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 ); |
|---|
| 1500 | 1523 | if( !id->p_encoder->p_module ) |
|---|
| 1501 | 1524 | { |
|---|