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

Reynaldo H. Verdejo Pinochet reynaldo at opendot.cl
Tue Dec 13 22:01:14 CET 2005


On Fri, Nov 25, 2005 at 08:43:02PM -0300, Reynaldo H. Verdejo Pinochet wrote:
> Default output filename of mencoder is always test.avi
> regardles of the muxer been used. Without trying to step
> on a 'extension are/arent meaningles' flame, think about
> windows user/progs that rely on filename extension to make
> 'open-with' asociations, icons disposal, etc. it may even
> be some apps that rely only on the extension for filetype
> identification.

Updated patch, force -o and test for some known wrong
combinations. tumbs up?

Best regards

   Reynaldo
-------------- 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="";
 
 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 (!strlen(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"
-------------- 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/20051213/38126f2d/attachment.pgp>


More information about the MPlayer-dev-eng mailing list