[MPlayer-dev-eng] [SURVEY] change mencoder's default ofilename extension?

Oded Shimon ods15 at ods15.dyndns.org
Wed Dec 14 07:29:32 CET 2005


On Tue, Dec 13, 2005 at 06:01:14PM -0300, Reynaldo H. Verdejo Pinochet wrote:
> @@ -170,7 +170,7 @@
>  unsigned int vobsub_out_index=0;
>  char *vobsub_out_id=NULL;
>  
> -char* out_filename="test.avi";
> +char* out_filename="";
>  
>  char *force_fourcc=NULL;
>  int force_audiofmttag=-1;
> @@ -465,6 +465,31 @@
>   filelist = m_config_parse_me_command_line(mconfig, argc, argv);
>   if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine);
>  
> +	if (!strlen(out_filename)) mencoder_exit(1,MSGTR_MissingOutputFilename);
>
> [...]

You still haven't done the NULL thing i told, out_filename needs to be 
NULL on init, and you need to check for it being non null, not strlen.

Here's a fixed patch.

- ods15
-------------- next part --------------
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.326
diff -a -u -r1.326 mencoder.c
--- mencoder.c	7 Dec 2005 10:07:27 -0000	1.326
+++ mencoder.c	13 Dec 2005 20:57:23 -0000
@@ -170,7 +170,7 @@
 unsigned int vobsub_out_index=0;
 char *vobsub_out_id=NULL;
 
-char* out_filename="test.avi";
+char* out_filename=NULL;
 
 char *force_fourcc=NULL;
 int force_audiofmttag=-1;
@@ -465,6 +465,31 @@
  filelist = m_config_parse_me_command_line(mconfig, argc, argv);
  if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine);
 
+{
+	char *extension;
+	
+	if (!out_filename) mencoder_exit(1,MSGTR_MissingOutputFilename);
+	extension=strrchr(out_filename,'.');
+	if (extension != NULL && strlen(extension) > 1)
+	{
+		extension++;
+		
+		if (out_file_format == MUXER_TYPE_AVI)
+		{
+			if (strcasecmp(extension,"avi"))
+				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
+		}
+		else if (out_file_format == MUXER_TYPE_MPEG)
+		{
+			if (strcasecmp(extension,"mpg") &&
+				strcasecmp(extension,"mpeg") &&
+				strcasecmp(extension,"vob")) 
+				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG);
+		}
+	}
+}				
+
+
 if (frameno_filename) {
   stream2=open_stream(frameno_filename,0,&i);
   if(stream2){
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.211
diff -a -u -r1.211 help_mp-en.h
--- help/help_mp-en.h	13 Dec 2005 01:43:54 -0000	1.211
+++ help/help_mp-en.h	13 Dec 2005 20:57:29 -0000
@@ -238,6 +238,9 @@
 #define MSGTR_NoVideoEncoderSelected "\nNo video encoder (-ovc) selected. Select one (see -ovc help).\n"
 #define MSGTR_CannotOpenOutputFile "Cannot open output file '%s'.\n"
 #define MSGTR_EncoderOpenFailed "Failed to open the encoder.\n"
+#define MSGTR_MencoderWrongFormatAVI "\nWARNING: OUTPUT FILE FORMAT IS _AVI_. see -of help.\n"
+#define MSGTR_MencoderWrongFormatMPG "\nWARNING: OUTPUT FILE FORMAT IS _MPEG_. see -of help.\n"
+#define MSGTR_MissingOutputFilename "No output file specified, please see the -o option"
 #define MSGTR_ForcingOutputFourcc "Forcing output fourcc to %x [%.4s]\n"
 #define MSGTR_ForcingOutputAudiofmtTag "Forcing output audio format tag to 0x%x\n"
 #define MSGTR_DuplicateFrames "\n%d duplicate frame(s)!\n"


More information about the MPlayer-dev-eng mailing list