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

Tobias Diedrich ranma at tdiedrich.de
Thu Jun 30 02:21:05 CEST 2005


Giacomo Comes wrote on Mon, 17 Jan 2005:
> I have found that -oac copy produces incorrect results
> in some particular cases.
> 
> Here is a simple way to test the bug;
> take a dvd with LPCM audio and do:
> 
> mencoder dvd://1 -ovc frameno -oac copy -aid 160 -frames 500 -o file.avi
> 
> Now play file.avi: mplayer file.avi
> 
> You will get only loud noise.

I propose fixing this by refusing audio streamcopy if
sh_audio->format does not fit into mux_a->wf->wFormatTag, patch
attached.

-- 
Tobias						PGP: http://9ac7e0bc.uguu.de
-------------- next part --------------
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 00:13:42 -0000
@@ -857,6 +857,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_CPLAYER,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: 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 00:13:43 -0000
@@ -366,6 +366,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'.\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 00:13:43 -0000
@@ -360,6 +360,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.\n"
 
 // cfg-mencoder.h:
 


More information about the MPlayer-dev-eng mailing list