[MPlayer-dev-eng] [SURVEY] change mencoder's default ofilename extension?
Reynaldo H. Verdejo Pinochet
reynaldo at opendot.cl
Thu Dec 15 00:49:27 CET 2005
On Wed, Dec 14, 2005 at 10:19:05AM +0100, Reimar at mplayerhq.hu wrote:
> Hi,
> > + extension=strrchr(out_filename,'.');
> > + if (extension != NULL && strlen(extension) > 1)
>
> I don't think the > 1 check is really necessary, though I do not mind
> it.
>
> > + if (out_file_format == MUXER_TYPE_AVI)
>
> Hmmm... would a switch/case work here? I'd say it would be easier to
> extend... Also, another idea would be adding a check_extension function
> to the muxers, maybe we could even support libavformat correctly with
> that *g* (but maybe not worth the effort)
>
> Greetings,
> Reimar Döffinger
Updated then.
Regards
Reynaldo
-------------- next part --------------
? cscope.out
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 14 Dec 2005 23:42:57 -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){
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.212
diff -a -u -r1.212 help_mp-en.h
--- help/help_mp-en.h 14 Dec 2005 19:35:25 -0000 1.212
+++ help/help_mp-en.h 14 Dec 2005 23:43:10 -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/20051214/3b9ba133/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list