From 75013fc5eed08d7d27907ed401a7d6e7967c752e Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Sun, 25 Apr 2004 17:02:49 +0000 Subject: [PATCH] * modules/stream_out/transcode.c: if aenc/venc is specified, force the encoder. * modules/codec/vorbis.c,flac.c,theora.c,speex.c: use encoder if forced. --- include/vlc_codec.h | 8 ++++++-- modules/codec/flac.c | 9 ++++++--- modules/codec/speex.c | 4 +++- modules/codec/theora.c | 4 +++- modules/codec/vorbis.c | 5 ++++- modules/stream_out/transcode.c | 4 ++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/include/vlc_codec.h b/include/vlc_codec.h index 5224a1bdd8..7302ce2f1c 100644 --- a/include/vlc_codec.h +++ b/include/vlc_codec.h @@ -100,6 +100,7 @@ struct encoder_t /* Module properties */ module_t * p_module; encoder_sys_t * p_sys; + vlc_bool_t b_force; block_t * ( * pf_header )( encoder_t * ); block_t * ( * pf_encode_video )( encoder_t *, picture_t * ); @@ -111,8 +112,11 @@ struct encoder_t /* Properties of the output of the encoder */ es_format_t fmt_out; - /* Number of threads to use during encoding */ - int i_threads; + /* Common encoder options */ + int i_threads; /* Number of threads to use during encoding */ + int i_iframes; /* One I frame per i_iframes */ + int i_bframes; /* One B frame per i_bframes */ + int i_tolerance; /* Bitrate tolerance */ /* Encoder config */ sout_cfg_t *p_cfg; diff --git a/modules/codec/flac.c b/modules/codec/flac.c index 1b31aabb7d..3e5b940596 100644 --- a/modules/codec/flac.c +++ b/modules/codec/flac.c @@ -2,9 +2,9 @@ * flac.c: flac decoder/packetizer/encoder module making use of libflac ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: flac.c,v 1.9 2004/02/25 17:48:52 fenrir Exp $ + * $Id$ * - * Authors: Gildas Bazin + * Authors: Gildas Bazin * Sigmund Augdal * * This program is free software; you can redistribute it and/or modify @@ -1060,7 +1060,8 @@ static int OpenEncoder( vlc_object_t *p_this ) encoder_t *p_enc = (encoder_t *)p_this; encoder_sys_t *p_sys; - if( p_enc->fmt_out.i_codec != VLC_FOURCC('f','l','a','c') ) + if( p_enc->fmt_out.i_codec != VLC_FOURCC('f','l','a','c') && + !p_enc->b_force ) { return VLC_EGENERIC; } @@ -1073,6 +1074,8 @@ static int OpenEncoder( vlc_object_t *p_this ) } p_enc->p_sys = p_sys; p_enc->pf_encode_audio = Encode; + p_enc->fmt_out.i_codec = VLC_FOURCC('f','l','a','c'); + p_sys->i_headers = 0; p_sys->p_buffer = 0; p_sys->i_buffer = 0; diff --git a/modules/codec/speex.c b/modules/codec/speex.c index f201863c45..4161dced1f 100755 --- a/modules/codec/speex.c +++ b/modules/codec/speex.c @@ -552,7 +552,8 @@ static int OpenEncoder( vlc_object_t *p_this ) SpeexMode *p_speex_mode = &speex_nb_mode; int i_quality; - if( p_enc->fmt_out.i_codec != VLC_FOURCC('s','p','x',' ') ) + if( p_enc->fmt_out.i_codec != VLC_FOURCC('s','p','x',' ') && + !p_enc->b_force ) { return VLC_EGENERIC; } @@ -567,6 +568,7 @@ static int OpenEncoder( vlc_object_t *p_this ) p_enc->pf_header = Headers; p_enc->pf_encode_audio = Encode; p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE; + p_enc->fmt_out.i_codec = VLC_FOURCC('s','p','x',' '); speex_init_header( &p_sys->header, p_enc->fmt_in.audio.i_rate, 1, p_speex_mode ); diff --git a/modules/codec/theora.c b/modules/codec/theora.c index 2e578cb7a6..eaceea47b1 100644 --- a/modules/codec/theora.c +++ b/modules/codec/theora.c @@ -441,7 +441,8 @@ static int OpenEncoder( vlc_object_t *p_this ) encoder_t *p_enc = (encoder_t *)p_this; encoder_sys_t *p_sys = p_enc->p_sys; - if( p_enc->fmt_out.i_codec != VLC_FOURCC('t','h','e','o') ) + if( p_enc->fmt_out.i_codec != VLC_FOURCC('t','h','e','o') && + !p_enc->b_force ) { return VLC_EGENERIC; } @@ -466,6 +467,7 @@ static int OpenEncoder( vlc_object_t *p_this ) p_enc->pf_header = Headers; p_enc->pf_encode_video = Encode; p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0'); + p_enc->fmt_out.i_codec = VLC_FOURCC('t','h','e','o'); #define frame_x_offset 0 #define frame_y_offset 0 diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c index 976ac38c49..3633d08cf9 100644 --- a/modules/codec/vorbis.c +++ b/modules/codec/vorbis.c @@ -26,6 +26,7 @@ *****************************************************************************/ #include #include +#include #include @@ -558,7 +559,8 @@ static int OpenEncoder( vlc_object_t *p_this ) encoder_t *p_enc = (encoder_t *)p_this; encoder_sys_t *p_sys; - if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') ) + if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') && + !p_enc->b_force ) { return VLC_EGENERIC; } @@ -574,6 +576,7 @@ static int OpenEncoder( vlc_object_t *p_this ) p_enc->pf_header = Headers; p_enc->pf_encode_audio = Encode; p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2'); + p_enc->fmt_out.i_codec = VLC_FOURCC('v','o','r','b'); /* Initialize vorbis encoder */ vorbis_info_init( &p_sys->vi ); diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index 63f80967c0..a718f9006a 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -837,6 +837,8 @@ static int transcode_audio_ffmpeg_new( sout_stream_t *p_stream, id->p_encoder->fmt_out.i_bitrate = id->f_dst.i_bitrate; id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg; + if( p_stream->p_sys->psz_aenc && + *p_stream->p_sys->psz_aenc ) id->p_encoder->b_force = VLC_TRUE; /* Attach object to parent so object variables inheritance works */ vlc_object_attach( id->p_encoder, p_stream ); @@ -1308,6 +1310,8 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, id->p_vresample = NULL; id->p_encoder->p_cfg = p_sys->p_video_cfg; + if( p_stream->p_sys->psz_venc && + *p_stream->p_sys->psz_venc ) id->p_encoder->b_force = VLC_TRUE; /* Attach object to parent so object variables inheritance works */ vlc_object_attach( id->p_encoder, p_stream ); -- 2.39.2