[MPlayer-dev-eng] missing check on mencoder leads to video only files without warning/error

Reynaldo H. Verdejo Pinochet reynaldo at opendot.cl
Mon Feb 21 19:44:42 CET 2005


a check should be done against lame_init_params to ensure proper audio
encoding, we cant just *trust* options to be ok, try with -oac mp3lame 
-lameopts cbr:br=16 for an example.

The imcluded patch does the needed check and makes mencoder bail
with an error when lame_init_params returns -1 (error, see lame.h).

will wait for comments till midnight.

Reynaldo

-------------- next part --------------
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.262
diff -a -u -r1.262 mencoder.c
--- mencoder.c	12 Feb 2005 15:11:02 -0000	1.262
+++ mencoder.c	21 Feb 2005 18:35:09 -0000
@@ -1106,7 +1106,10 @@
   lame_presets_set(lame,lame_param_fast, (lame_param_vbr==0), lame_param_preset);
 }
 #endif
-lame_init_params(lame);
+if(lame_init_params(lame) == -1){
+    mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameCantInit); 
+    mencoder_exit(1,NULL);
+}
 if(verbose>0){
     lame_print_config(lame);
     lame_print_internals(lame);
-------------- next part --------------
Index: help/help_mp-es.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-es.h,v
retrieving revision 1.48
diff -a -u -r1.48 help_mp-es.h
--- help/help_mp-es.h	11 Nov 2004 02:22:16 -0000	1.48
+++ help/help_mp-es.h	21 Feb 2005 18:36:00 -0000
@@ -308,6 +308,9 @@
 "mw-us => 40kbps/mono        voice => 56kbps/mono\n"\
 "fm/radio/tape => 112kbps    hifi => 160kbps\n"\
 "cd => 192kbps               studio => 256kbps"
+#define MSGTR_LameCantInit "No se pudo setear las opciones de Lame, revise el"\
+" bitrate/samplerate, algunos bitrates muy bajos (<32) necesitan una tasa de"\
+" muestreo m?s baja (ej. -srate 8000). Si todo falla, pruebe con un preset."
 #define MSGTR_ConfigfileError "error en archivo de configuraci?n"
 #define MSGTR_ErrorParsingCommandLine "error en parametros de la l?nea de comando"
 #define MSGTR_VideoStreamRequired "?El flujo de video es obligatorio!\n"
-------------- next part --------------
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.158
diff -a -u -r1.158 help_mp-en.h
--- help/help_mp-en.h	12 Feb 2005 16:05:11 -0000	1.158
+++ help/help_mp-en.h	21 Feb 2005 18:35:40 -0000
@@ -337,6 +337,9 @@
 "mw-us => 40kbps/mono        voice => 56kbps/mono\n"\
 "fm/radio/tape => 112kbps    hifi => 160kbps\n"\
 "cd => 192kbps               studio => 256kbps"
+#define MSGTR_LameCantInit "can't set Lame options, check bitrate/samplerate,"\
+" some very low bitrates (<32) need lower samplerates (i.e. -srate 8000). "\
+"if everything else fails, try a preset."
 #define MSGTR_ConfigfileError "configfile error"
 #define MSGTR_ErrorParsingCommandLine "error parsing cmdline"
 #define MSGTR_VideoStreamRequired "Video stream is mandatory!\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050221/f613cc2a/attachment.pgp>


More information about the MPlayer-dev-eng mailing list