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

Reynaldo H. Verdejo Pinochet reynaldo at opendot.cl
Tue Dec 13 05:48:31 CET 2005


On Mon, Dec 12, 2005 at 11:39:25PM -0300, Reynaldo H. Verdejo Pinochet wrote:
> 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.
> > 
> 
> Ok, hope everyone interested had time to react.
> 
> Option 5, propossed by Oded seems to be the winner* followed
> close by '1' (force -o) attached is a slightly modified version
> of the patch. Will commit tomorrow morning.
> 
> Best regards
> 
>    Reynaldo

Wait.. this has a bad gotcha, mencoder -of mpeg with no
explicit -o will fire the warning, mencoder will complain
for something he did wrong, choosing test.avi. 

solution: mix this with the force -o option. see patch below

Best regards

   Reynaldo
   
-------------- next part --------------
? cscope.out
? lala.avi
? lala.mpg
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 04:46:14 -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,27 @@
  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);
+	int i, n = 0;
+	for (i = 0; out_filename[i]; i++)
+		if (out_filename[i] == '.') n = i + 1;
+	if (out_file_format == MUXER_TYPE_AVI) {
+		if (strcmp(out_filename + n, "avi") &&
+			strcmp(out_filename + n, "AVI"))
+			mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
+	}
+	if (out_file_format == MUXER_TYPE_MPEG) {
+		if (strcmp(out_filename + n, "mpg") &&
+			strcmp(out_filename + n, "mpeg") &&
+			strcmp(out_filename + n, "vob") &&
+			strcmp(out_filename + n, "MPG") &&
+			strcmp(out_filename + n, "MPEG") &&
+			strcmp(out_filename + n, "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 04:46:20 -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 "Output filename (-o) is now mandatory\n"
 #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/ee8e2186/attachment.pgp>


More information about the MPlayer-dev-eng mailing list