[MPlayer-dev-eng] Re: [PATCH] Re: mencoder -oac copy does not work all the times.

Tobias Diedrich ranma at tdiedrich.de
Thu Jun 30 16:37:52 CEST 2005


Rich Felker wrote:

> Agree. The patch can either make it a warning or an error, but it
> needs to add -ftwocc options (like -ffourcc) to force a new tag.. Then
> we can make new twocc's for storing random crappy audio formats in
> avi.. :)

Ok, how about this one?

-- 
Tobias						PGP: http://9ac7e0bc.uguu.de
-------------- next part --------------
Index: cfg-mencoder.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
retrieving revision 1.100
diff -u -r1.100 cfg-mencoder.h
--- cfg-mencoder.h	19 Jun 2005 09:12:42 -0000	1.100
+++ cfg-mencoder.h	30 Jun 2005 14:36:45 -0000
@@ -234,6 +234,7 @@
 
 	// override FOURCC in output file
 	{"ffourcc", &force_fourcc, CONF_TYPE_STRING, CONF_GLOBAL, 4, 4, NULL},
+	{"fafmt", &force_audiofmt, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL},
 
 	// override avi aspect autodetection
 	{"force-avi-aspect", &avi_aspect_override, CONF_TYPE_FLOAT, CONF_RANGE|CONF_GLOBAL, 0.2, 3.0, NULL},
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.290
diff -u -r1.290 mencoder.c
--- mencoder.c	27 Jun 2005 19:10:11 -0000	1.290
+++ mencoder.c	30 Jun 2005 14:36:46 -0000
@@ -164,6 +164,7 @@
 char* out_filename="test.avi";
 
 char *force_fourcc=NULL;
+int force_audiofmt=-1;
 
 char* passtmpfile="divx2pass.log";
 
@@ -808,6 +809,12 @@
 // ============= AUDIO ===============
 if(sh_audio){
 
+if (force_audiofmt != -1) {
+	sh_audio->format = force_audiofmt;
+	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputAudiofmt,
+	       force_audiofmt);
+}
+
 mux_a=muxer_new_stream(muxer,MUXER_TYPE_AUDIO);
 
 mux_a->buffer_size=0x100000; //16384;
@@ -857,6 +864,11 @@
     } else {
 	mux_a->wf = malloc(sizeof(WAVEFORMATEX));
 	mux_a->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize;
+	if (sh_audio->format >= 0x10000) {
+	    mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantCopyAudioFormat,
+	           sh_audio->format,sh_audio->codec->info);
+	    mencoder_exit(1,NULL);
+	}
 	mux_a->wf->wFormatTag = sh_audio->format;
 	mux_a->wf->nChannels = sh_audio->channels;
 	mux_a->wf->nSamplesPerSec = sh_audio->samplerate;
Index: DOCS/man/de/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/man/de/mplayer.1,v
retrieving revision 1.162
diff -u -r1.162 mplayer.1
--- DOCS/man/de/mplayer.1	20 Jun 2005 14:33:00 -0000	1.162
+++ DOCS/man/de/mplayer.1	30 Jun 2005 14:36:49 -0000
@@ -5797,6 +5797,18 @@
 .PD 1
 .
 .TP
+.B \-fafmt <format>
+Hiermit kann die Audioformat-Kennzeichnung der Ausgabedatei ?berschrieben werden.
+.sp 1
+.I BEISPIEL:
+.PD 0
+.RSs
+.IPs "\-fafmt 0x55"
+Setzt die Kennzeichnung der Ausgabedatei auf 0x55 (mp3).
+.RE
+.PD 1
+.
+.TP
 .B \-force-avi-aspect <0.2\-3.0>
 ?berschreibe den Aspekt, der im AVI-OpenDML-vprp-Header gespeichert ist.
 Dies kann benutzt werden, um den Aspekt mit '\-ovc copy' zu ?ndern.
Index: DOCS/man/en/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
retrieving revision 1.1024
diff -u -r1.1024 mplayer.1
--- DOCS/man/en/mplayer.1	27 Jun 2005 10:33:50 -0000	1.1024
+++ DOCS/man/en/mplayer.1	30 Jun 2005 14:36:52 -0000
@@ -5595,6 +5595,18 @@
 .PD 1
 .
 .TP
+.B \-fafmt <format>
+Can be used to override the audio format tag of the output file.
+.sp 1
+.I EXAMPLE:
+.PD 0
+.RSs
+.IPs "\-fafmt 0x55"
+Will have the output file contain 0x55 (mp3) as audio format tag.
+.RE
+.PD 1
+.
+.TP
 .B \-force-avi-aspect <0.2\-3.0>
 Override the aspect stored in the AVI OpenDML vprp header.
 This can be used to change the aspect ratio with '\-ovc copy'.
Index: help/help_mp-de.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-de.h,v
retrieving revision 1.113
diff -u -r1.113 help_mp-de.h
--- help/help_mp-de.h	29 Jun 2005 23:28:36 -0000	1.113
+++ help/help_mp-de.h	30 Jun 2005 14:36:52 -0000
@@ -218,6 +218,7 @@
 #define MSGTR_CannotOpenOutputFile "Kann Ausgabedatei '%s' nicht ?ffnen.\n"
 #define MSGTR_EncoderOpenFailed "?ffnen des Encoders fehlgeschlagen.\n"
 #define MSGTR_ForcingOutputFourcc "Erzwinge Output-Fourcc %x  [%.4s].\n"
+#define MSGTR_ForcingOutputAudiofmt "Erzwinge Audioformat 0x%x in der Ausgabe.\n"
 #define MSGTR_WritingAVIHeader "Schreibe AVI-Header...\n"
 #define MSGTR_DuplicateFrames "\n%d doppelte(r) Frame(s)!\n"
 #define MSGTR_SkipFrame "\nFrame ?bersprungen!\n"
@@ -366,6 +367,7 @@
 #define MSGTR_LavcAudioCodecNotFound "Audio LAVC, konnte Encoder f?r Codec %s nicht finden.\n"
 #define MSGTR_CouldntAllocateLavcContext "Audio LAVC, konnte Kontext nicht zuordnen!\n"
 #define MSGTR_CouldntOpenCodec "Konnte Codec %s nicht ?ffnen, br=%d\n"
+#define MSGTR_CantCopyAudioFormat "Audioformat 0x%08x (%s) ist nicht mit '-oac copy' kompatibel, versuche bitte stattdessen '-oac pcm' oder benutze '-fafmt' um ein anderes Format zu erzwingen.\n"
 
 // cfg-mencoder.h:
 
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.171
diff -u -r1.171 help_mp-en.h
--- help/help_mp-en.h	19 Jun 2005 09:12:44 -0000	1.171
+++ help/help_mp-en.h	30 Jun 2005 14:36:53 -0000
@@ -214,6 +214,7 @@
 #define MSGTR_CannotOpenOutputFile "Cannot open output file '%s'.\n"
 #define MSGTR_EncoderOpenFailed "Failed to open the encoder.\n"
 #define MSGTR_ForcingOutputFourcc "Forcing output fourcc to %x [%.4s]\n"
+#define MSGTR_ForcingOutputAudiofmt "Forcing output audio format to 0x%x\n"
 #define MSGTR_WritingAVIHeader "Writing AVI header...\n"
 #define MSGTR_DuplicateFrames "\n%d duplicate frame(s)!\n"
 #define MSGTR_SkipFrame "\nSkipping frame!\n"
@@ -360,6 +361,7 @@
 #define MSGTR_LavcAudioCodecNotFound "Audio LAVC, couldn't find encoder for codec %s\n"
 #define MSGTR_CouldntAllocateLavcContext "Audio LAVC, couldn't allocate context!\n"
 #define MSGTR_CouldntOpenCodec "Couldn't open codec %s, br=%d\n"
+#define MSGTR_CantCopyAudioFormat "Audio format 0x%08x (%s) is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmt' to override it.\n"
 
 // cfg-mencoder.h:
 


More information about the MPlayer-dev-eng mailing list