changeset 17196:8e6cf7bbe18a

make -o mandatory and add a warning when the extension does not match the container format, patch by Reynaldo Pinochet
author wanderer
date Thu, 15 Dec 2005 17:57:18 +0000
parents 3b33f4c52324
children 0ab565f7ed60
files DOCS/man/en/mplayer.1 help/help_mp-en.h mencoder.c
diffstat 3 files changed, 37 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Thu Dec 15 17:54:29 2005 +0000
+++ b/DOCS/man/en/mplayer.1	Thu Dec 15 17:57:18 2005 +0000
@@ -490,6 +490,8 @@
 mf=type=png:fps=25
 # Eerie negative images are cool.
 vf=eq2=1.0:-0.8
+# I want MEncoder to ouput to this filename by default.
+o=encoded.avi
 .fi
 .PP
 You can also write file-specific configuration files.
@@ -6119,7 +6121,10 @@
 .
 .TP
 .B \-o <filename>
-Outputs to the given filename, instead of the default 'test.avi'.
+Outputs to the given filename.
+.br
+If you want a default output filename, you can put this option in the
+MEncoder config file.
 .
 .TP
 .B \-oac <codec name>
--- a/help/help_mp-en.h	Thu Dec 15 17:54:29 2005 +0000
+++ b/help/help_mp-en.h	Thu Dec 15 17:57:18 2005 +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"
--- a/mencoder.c	Thu Dec 15 17:54:29 2005 +0000
+++ b/mencoder.c	Thu Dec 15 17:57:18 2005 +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,33 @@
  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) > 3 && strlen(extension) < 6)
+	{
+		extension++;
+		
+		switch (out_file_format)
+		{
+			case MUXER_TYPE_AVI:
+			if (strcasecmp(extension,"avi"))
+				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
+			break;
+
+			case MUXER_TYPE_MPEG:
+			if (strcasecmp(extension,"mpg") &&
+				strcasecmp(extension,"mpeg") &&
+				strcasecmp(extension,"vob")) 
+				mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG);
+			break;
+		}
+	}
+}				
+
+
 if (frameno_filename) {
   stream2=open_stream(frameno_filename,0,&i);
   if(stream2){