mirror of
https://github.com/mpv-player/mpv
synced 2025-01-13 00:06:25 +01:00
libmp3lame optional
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3358 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7246c564b0
commit
64d92d7732
@ -28,10 +28,12 @@ struct config divx4opts_conf[]={
|
||||
{NULL, NULL, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#ifdef HAVE_MP3LAME
|
||||
struct config lameopts_conf[]={
|
||||
{"q", &lame_param_quality, CONF_TYPE_INT, CONF_RANGE, 0, 9},
|
||||
{"vbr", &lame_param_vbr, CONF_TYPE_INT, CONF_RANGE, 0, vbr_max_indicator},
|
||||
{"cbr", &lame_param_vbr, CONF_TYPE_FLAG, 0, 0, 0},
|
||||
{"abr", &lame_param_vbr, CONF_TYPE_FLAG, 0, 0, vbr_abr},
|
||||
{"mode", &lame_param_mode, CONF_TYPE_INT, CONF_RANGE, 0, MAX_INDICATOR},
|
||||
{"padding", &lame_param_padding, CONF_TYPE_INT, CONF_RANGE, 0, PAD_MAX_INDICATOR},
|
||||
{"br", &lame_param_br, CONF_TYPE_INT, CONF_RANGE, 0, 1024},
|
||||
@ -39,6 +41,7 @@ struct config lameopts_conf[]={
|
||||
{"help", "TODO: lameopts help!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
|
||||
{NULL, NULL, 0, 0, 0, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct config ovc_conf[]={
|
||||
{"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, 0},
|
||||
@ -50,8 +53,13 @@ struct config ovc_conf[]={
|
||||
struct config oac_conf[]={
|
||||
{"copy", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, 0},
|
||||
{"pcm", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_PCM},
|
||||
#ifdef HAVE_MP3LAME
|
||||
{"mp3lame", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_VBRMP3},
|
||||
{"help", "\nAvailable codecs:\n copy\n pcm\n mp3lame\n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
|
||||
#else
|
||||
{"mp3lame", "MPlayer was compiled without libmp3lame support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
|
||||
{"help", "\nAvailable codecs:\n copy\n pcm\n\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
|
||||
#endif
|
||||
{NULL, NULL, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
@ -76,7 +84,9 @@ struct config conf[]={
|
||||
{"pass", &pass, CONF_TYPE_INT, CONF_RANGE,0,2},
|
||||
|
||||
{"divx4opts", divx4opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0},
|
||||
#ifdef HAVE_MP3LAME
|
||||
{"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0},
|
||||
#endif
|
||||
|
||||
#define MAIN_CONF
|
||||
#include "cfg-common.h"
|
||||
|
22
mencoder.c
22
mencoder.c
@ -41,7 +41,9 @@ static char* banner_text=
|
||||
#include <encore2.h>
|
||||
#include "divx4_vbr.h"
|
||||
|
||||
#ifdef HAVE_MP3LAME
|
||||
#include <lame/lame.h>
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "../postproc/swscale.h"
|
||||
@ -66,7 +68,12 @@ char *video_codec=NULL; // override video codec
|
||||
int audio_family=-1; // override audio codec family
|
||||
int video_family=-1; // override video codec family
|
||||
|
||||
#ifdef HAVE_MP3LAME
|
||||
int out_audio_codec=ACODEC_VBRMP3;
|
||||
#else
|
||||
int out_audio_codec=ACODEC_PCM;
|
||||
#endif
|
||||
|
||||
int out_video_codec=VCODEC_DIVX4;
|
||||
|
||||
// audio stream skip/resync functions requires only for seeking.
|
||||
@ -111,12 +118,14 @@ static int play_n_frames=-1;
|
||||
ENC_PARAM divx4_param;
|
||||
int divx4_crispness=100;
|
||||
|
||||
#ifdef HAVE_MP3LAME
|
||||
int lame_param_quality=0; // best
|
||||
int lame_param_vbr=vbr_default;
|
||||
int lame_param_mode=-1; // unset
|
||||
int lame_param_padding=-1; // unset
|
||||
int lame_param_br=-1; // unset
|
||||
int lame_param_ratio=-1; // unset
|
||||
#endif
|
||||
|
||||
static int scale_srcW=0;
|
||||
static int scale_srcH=0;
|
||||
@ -266,7 +275,9 @@ ENC_FRAME enc_frame;
|
||||
ENC_RESULT enc_result;
|
||||
void* enc_handle=NULL;
|
||||
|
||||
#ifdef HAVE_MP3LAME
|
||||
lame_global_flags *lame;
|
||||
#endif
|
||||
|
||||
float audio_preload=0.5;
|
||||
|
||||
@ -602,9 +613,9 @@ case VCODEC_DIVX4:
|
||||
break;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if(sh_audio)
|
||||
switch(mux_a->codec){
|
||||
#ifdef HAVE_MP3LAME
|
||||
case ACODEC_VBRMP3:
|
||||
|
||||
lame=lame_init();
|
||||
@ -627,9 +638,10 @@ if(verbose){
|
||||
lame_print_config(lame);
|
||||
lame_print_internals(lame);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
signal(SIGINT,exit_sighandler); // Interrupt from keyboard
|
||||
signal(SIGQUIT,exit_sighandler); // Quit from keyboard
|
||||
@ -674,6 +686,7 @@ if(sh_audio){
|
||||
case 0: // copy
|
||||
printf("not yet implemented!\n");
|
||||
break;
|
||||
#ifdef HAVE_MP3LAME
|
||||
case ACODEC_VBRMP3:
|
||||
while(mux_a->buffer_len<4){
|
||||
unsigned char tmp[2304];
|
||||
@ -700,6 +713,7 @@ if(sh_audio){
|
||||
mux_a->buffer_len+=len;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(len<=0) break; // EOF?
|
||||
@ -856,7 +870,8 @@ if(sh_audio){
|
||||
|
||||
} // while(!eof)
|
||||
|
||||
// fixup CBR audio header:
|
||||
#ifdef HAVE_MP3LAME
|
||||
// fixup CBR mp3 audio header:
|
||||
if(sh_audio && mux_a->codec==ACODEC_VBRMP3 && !lame_param_vbr){
|
||||
mux_a->h.dwSampleSize=1;
|
||||
mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec;
|
||||
@ -864,6 +879,7 @@ if(sh_audio && mux_a->codec==ACODEC_VBRMP3 && !lame_param_vbr){
|
||||
printf("\n\nCBR audio effective bitrate: %8.3f kbit/s (%d bytes/sec)\n",
|
||||
mux_a->h.dwRate*8.0f/1000.0f,mux_a->h.dwRate);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\nWriting AVI index...\n");
|
||||
aviwrite_write_index(muxer,muxer_f);
|
||||
|
Loading…
Reference in New Issue
Block a user