changeset 3357:1fa5d7dda911

libmp3lame optional
author arpi
date Thu, 06 Dec 2001 22:27:09 +0000
parents 2ef511fe1f57
children 4c97a945398c
files cfg-mencoder.h mencoder.c
diffstat 2 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mencoder.h	Thu Dec 06 22:26:41 2001 +0000
+++ b/cfg-mencoder.h	Thu Dec 06 22:27:09 2001 +0000
@@ -28,10 +28,12 @@
 	{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 @@
 	{"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 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 @@
 	{"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"
--- a/mencoder.c	Thu Dec 06 22:26:41 2001 +0000
+++ b/mencoder.c	Thu Dec 06 22:27:09 2001 +0000
@@ -41,7 +41,9 @@
 #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 @@
 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 @@
 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_RESULT enc_result;
 void* enc_handle=NULL;
 
+#ifdef HAVE_MP3LAME
 lame_global_flags *lame;
+#endif
 
 float audio_preload=0.5;
 
@@ -602,9 +613,9 @@
     break;
 }
 
-#if 1
 if(sh_audio)
 switch(mux_a->codec){
+#ifdef HAVE_MP3LAME
 case ACODEC_VBRMP3:
 
 lame=lame_init();
@@ -627,9 +638,10 @@
     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 @@
 	    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 @@
 		  mux_a->buffer_len+=len;
 		}
 		break;
+#endif
 	    }
 	}
 	if(len<=0) break; // EOF?
@@ -856,7 +870,8 @@
 
 } // 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 @@
     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);