[MPlayer-dev-eng] [PATCH] add "resample=<rate>" -lameopts option

matthew green mrg at eterna.com.au
Mon Apr 7 14:10:52 CEST 2003


   
   Only parts of your patch seem to be a unified diff.  Please send a unified
   diff as explained in DOCS/tech/patches.txt.  Also you do not need to update
   the help files and documentation for languages you do not know.  Updating
   languages you know is very much appreciated.
   Thanks


here's an updated version.

thanks.


.mrg.



Index: cfg-mencoder.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
retrieving revision 1.66
diff -p -u -r1.66 cfg-mencoder.h
--- cfg-mencoder.h	3 Mar 2003 11:03:17 -0000	1.66
+++ cfg-mencoder.h	7 Apr 2003 12:19:38 -0000
@@ -32,6 +32,7 @@ struct config lameopts_conf[]={
 	{"br", &lame_param_br, CONF_TYPE_INT, CONF_RANGE, 0, 1024, NULL},
 	{"ratio", &lame_param_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
 	{"vol", &lame_param_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10, NULL},
+	{"resample", &lame_param_resample, CONF_TYPE_INT, CONF_RANGE, 0, 96000, NULL},
 #if HAVE_MP3LAME >= 392
 	{"fast", &lame_param_fast, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"preset", &lame_param_preset, CONF_TYPE_STRING, 0, 0, 0, NULL},
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.212
diff -p -u -r1.212 mencoder.c
--- mencoder.c	31 Mar 2003 17:32:46 -0000	1.212
+++ mencoder.c	7 Apr 2003 12:19:39 -0000
@@ -202,6 +202,7 @@ int lame_param_mode=-1; // unset
 int lame_param_padding=-1; // unset
 int lame_param_br=-1; // unset
 int lame_param_ratio=-1; // unset
+int lame_param_resample=-1; // unset
 float lame_param_scale=-1; // unset
 #if HAVE_MP3LAME >= 392
 int lame_param_fast=0; // unset
@@ -783,7 +784,7 @@ case ACODEC_VBRMP3:
     mux_a->wf->wFormatTag=0x55; // MP3
     mux_a->wf->nChannels= (lame_param_mode<0) ? sh_audio->channels :
 	((lame_param_mode==3) ? 1 : 2);
-    mux_a->wf->nSamplesPerSec=mux_a->h.dwRate;
+    mux_a->wf->nSamplesPerSec= (lame_param_resample>0) ?  lame_param_resample : mux_a->h.dwRate;
     mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME!
     mux_a->wf->nBlockAlign=(mux_a->h.dwRate<32000)?576:1152; // required for l3codeca.acm + WMP 6.4
     mux_a->wf->wBitsPerSample=0; //16;
@@ -846,6 +847,7 @@ if(lame_param_vbr){  // VBR:
 }
 if(lame_param_mode>=0) lame_set_mode(lame,lame_param_mode); // j-st
 if(lame_param_ratio>0) lame_set_compression_ratio(lame,lame_param_ratio);
+if(lame_param_resample>0) lame_set_out_samplerate(lame,lame_param_resample);
 if(lame_param_scale>0) {
     printf("Setting audio input gain to %f\n", lame_param_scale);
     lame_set_scale(lame,lame_param_scale);
Index: DOCS/en/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/en/mplayer.1,v
retrieving revision 1.367
diff -p -u -r1.367 mplayer.1
--- DOCS/en/mplayer.1	7 Apr 2003 00:33:13 -0000	1.367
+++ DOCS/en/mplayer.1	7 Apr 2003 12:19:41 -0000
@@ -2709,6 +2709,8 @@ insane: CBR encoding, highest preset qua
 <8-320>: ABR encoding at average given kbps bitrate.
 .br
 .REss
+.IPs resample=<samplerate>
+resample input to the given rate, in hz.
 .RE
 
 .I EXAMPLE:
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.96
diff -p -u -r1.96 help_mp-en.h
--- help/help_mp-en.h	29 Mar 2003 20:11:45 -0000	1.96
+++ help/help_mp-en.h	7 Apr 2003 12:19:42 -0000
@@ -236,7 +236,8 @@ static char help_text[]=
 "                 (200-240 kbps bitrate range)\n"\
 "                 insane:  CBR  encoding, highest preset quality\n"\
 "                 (320 kbps bitrate)\n"\
-"                 <8-320>: ABR encoding at average given kbps bitrate.\n\n"
+"                 <8-320>: ABR encoding at average given kbps bitrate.\n"\
+" resample=<rate> resample audio to rate hz.\n\n"
 
 // open.c, stream.c:
 #define MSGTR_CdDevNotfound "CD-ROM Device '%s' not found.\n"



More information about the MPlayer-dev-eng mailing list