X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Ftwolame.c;h=9ff2dbe669bc242981e840b5428351ecaab0fef4;hb=e91b6fac50039e215c5d587e1aeca79d4b2dd9f5;hp=9a737de0ee49c1a4f6b6e364bc333727fb452d88;hpb=ffc45b9454e212908669d2370f5e5bf1da8d8c9e;p=vlc diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c index 9a737de0ee..9ff2dbe669 100644 --- a/modules/codec/twolame.c +++ b/modules/codec/twolame.c @@ -19,16 +19,21 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include #include @@ -49,43 +54,43 @@ static block_t *Encode ( encoder_t *, aout_buffer_t * ); #define ENC_QUALITY_TEXT N_("Encoding quality") #define ENC_QUALITY_LONGTEXT N_( \ - "Allows you to specify a quality between 0.0 (high) and 50.0 (low), " \ + "Force a specific encoding quality between 0.0 (high) and 50.0 (low), " \ "instead of specifying a particular bitrate. " \ "This will produce a VBR stream." ) #define ENC_MODE_TEXT N_("Stereo mode") -#define ENC_MODE_LONGTEXT N_( "Select how stereo streams will be handled" ) +#define ENC_MODE_LONGTEXT N_( "Handling mode for stereo streams" ) #define ENC_VBR_TEXT N_("VBR mode") #define ENC_VBR_LONGTEXT N_( \ - "By default the encoding is CBR." ) + "Use Variable BitRate. Default is to use Constant BitRate (CBR)." ) #define ENC_PSY_TEXT N_("Psycho-acoustic model") #define ENC_PSY_LONGTEXT N_( \ "Integer from -1 (no model) to 4." ) -static int pi_stereo_values[] = { 0, 1, 2 }; -static char *ppsz_stereo_descriptions[] = +static const int pi_stereo_values[] = { 0, 1, 2 }; +static const char *const ppsz_stereo_descriptions[] = { N_("Stereo"), N_("Dual mono"), N_("Joint stereo") }; vlc_module_begin(); set_shortname( "Twolame"); - set_description( _("Libtwolame audio encoder") ); + set_description( N_("Libtwolame audio encoder") ); set_capability( "encoder", 50 ); set_callbacks( OpenEncoder, CloseEncoder ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_ACODEC ); add_float( ENC_CFG_PREFIX "quality", 0.0, NULL, ENC_QUALITY_TEXT, - ENC_QUALITY_LONGTEXT, VLC_FALSE ); + ENC_QUALITY_LONGTEXT, false ); add_integer( ENC_CFG_PREFIX "mode", 0, NULL, ENC_MODE_TEXT, - ENC_MODE_LONGTEXT, VLC_FALSE ); + ENC_MODE_LONGTEXT, false ); change_integer_list( pi_stereo_values, ppsz_stereo_descriptions, 0 ); add_bool( ENC_CFG_PREFIX "vbr", 0, NULL, ENC_VBR_TEXT, - ENC_VBR_LONGTEXT, VLC_FALSE ); + ENC_VBR_LONGTEXT, false ); add_integer( ENC_CFG_PREFIX "psy", 3, NULL, ENC_PSY_TEXT, - ENC_PSY_LONGTEXT, VLC_FALSE ); + ENC_PSY_LONGTEXT, false ); vlc_module_end(); -static const char *ppsz_enc_options[] = { +static const char *const ppsz_enc_options[] = { "quality", "mode", "vbr", "psy", NULL }; @@ -155,17 +160,14 @@ static int OpenEncoder( vlc_object_t *p_this ) /* Allocate the memory needed to store the decoder's structure */ if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) - { - msg_Err( p_enc, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; p_enc->p_sys = p_sys; p_enc->pf_encode_audio = Encode; p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE; p_enc->fmt_out.i_codec = VLC_FOURCC('m','p','g','a'); - sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); + config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); p_sys->p_twolame = twolame_init(); @@ -285,8 +287,7 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf ) p_sys->p_out_buffer, MAX_CODED_FRAME_SIZE ); p_sys->i_nb_samples = 0; p_block = block_New( p_enc, i_used ); - p_enc->p_vlc->pf_memcpy( p_block->p_buffer, p_sys->p_out_buffer, - i_used ); + vlc_memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used ); p_block->i_length = (mtime_t)1000000 * (mtime_t)MPEG_FRAME_SIZE / (mtime_t)p_enc->fmt_out.audio.i_rate; p_block->i_dts = p_block->i_pts = p_sys->i_pts;