summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-02 19:00:13 +0000
committerranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-02 19:00:13 +0000
commita123c6be4c9c8baa0165bd37b37e34eb34efe2e5 (patch)
treed16b7bacd7b4e27d518bda36dc9d952e2f1d5262
parentf47b576d49de8ad257d9c24131070b43b072dbd0 (diff)
downloadmpv-a123c6be4c9c8baa0165bd37b37e34eb34efe2e5.tar.bz2
mpv-a123c6be4c9c8baa0165bd37b37e34eb34efe2e5.tar.xz
Check for WAVEFORMAT.wFormatTag overflows and allow user to override the tag with -fafmttag
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15889 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/man/de/mplayer.112
-rw-r--r--DOCS/man/en/mplayer.112
-rw-r--r--cfg-mencoder.h2
-rw-r--r--help/help_mp-de.h2
-rw-r--r--help/help_mp-en.h2
-rw-r--r--mencoder.c14
6 files changed, 44 insertions, 0 deletions
diff --git a/DOCS/man/de/mplayer.1 b/DOCS/man/de/mplayer.1
index d9c603be02..d169b5f28e 100644
--- a/DOCS/man/de/mplayer.1
+++ b/DOCS/man/de/mplayer.1
@@ -5785,6 +5785,18 @@ Encodiere nur 100 MBytes.
.PD 1
.
.TP
+.B \-fafmttag <format>
+Hiermit kann die Audioformat-Kennzeichnung der Ausgabedatei überschrieben werden.
+.sp 1
+.I BEISPIEL:
+.PD 0
+.RSs
+.IPs "\-fafmttag 0x55"
+Setzt die Kennzeichnung der Ausgabedatei auf 0x55 (mp3).
+.RE
+.PD 1
+.
+.TP
.B \-ffourcc <fourcc>
Hiermit kann das FourCC-Feld der Ausgabedatei überschrieben werden.
.sp
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 109df83b34..94e3142c7a 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -5583,6 +5583,18 @@ Encode only 100 MBytes.
.PD 1
.
.TP
+.B \-fafmttag <format>
+Can be used to override the audio format tag of the output file.
+.sp 1
+.I EXAMPLE:
+.PD 0
+.RSs
+.IPs "\-fafmttag 0x55"
+Will have the output file contain 0x55 (mp3) as audio format tag.
+.RE
+.PD 1
+.
+.TP
.B \-ffourcc <fourcc>
Can be used to override the video fourcc of the output file.
.sp 1
diff --git a/cfg-mencoder.h b/cfg-mencoder.h
index 682635ee8f..c8779461b0 100644
--- a/cfg-mencoder.h
+++ b/cfg-mencoder.h
@@ -232,6 +232,8 @@ m_option_t mencoder_opts[]={
// output file format
{"of", of_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ // override audio format tag in output file
+ {"fafmttag", &force_audiofmttag, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL},
// override FOURCC in output file
{"ffourcc", &force_fourcc, CONF_TYPE_STRING, CONF_GLOBAL, 4, 4, NULL},
diff --git a/help/help_mp-de.h b/help/help_mp-de.h
index 5ba5320eb3..54c059cfaf 100644
--- a/help/help_mp-de.h
+++ b/help/help_mp-de.h
@@ -218,6 +218,7 @@ static char help_text[]=
#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_ForcingOutputAudiofmtTag "Erzwinge Audioformatkennzeichnung 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 @@ static char help_text[]=
#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%x ist nicht mit '-oac copy' kompatibel, versuche bitte stattdessen '-oac pcm' oder benutze '-fafmttag' um ein anderes Format zu erzwingen.\n"
// cfg-mencoder.h:
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index 2fa2fb58a9..74deb788c0 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -214,6 +214,7 @@ static char help_text[]=
#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_ForcingOutputAudiofmtTag "Forcing output audio format tag 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 @@ static char help_text[]=
#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%x is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.\n"
// cfg-mencoder.h:
diff --git a/mencoder.c b/mencoder.c
index f252ba2bbc..beed3a1e71 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -164,6 +164,7 @@ char *vobsub_out_id=NULL;
char* out_filename="test.avi";
char *force_fourcc=NULL;
+int force_audiofmttag=-1;
char* passtmpfile="divx2pass.log";
@@ -808,6 +809,15 @@ if(muxer->fix_stream_parameters)
// ============= AUDIO ===============
if(sh_audio){
+if (force_audiofmttag != -1) {
+ sh_audio->format = force_audiofmttag;
+ if (sh_audio->wf) {
+ sh_audio->wf->wFormatTag = sh_audio->format;
+ }
+ mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputAudiofmtTag,
+ force_audiofmttag);
+}
+
mux_a=muxer_new_stream(muxer,MUXER_TYPE_AUDIO);
mux_a->buffer_size=0x100000; //16384;
@@ -850,6 +860,10 @@ if(mux_a->codec != ACODEC_COPY) {
switch(mux_a->codec){
case ACODEC_COPY:
if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy);
+ if (sh_audio->format >= 0x10000) {
+ mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantCopyAudioFormat, sh_audio->format);
+ mencoder_exit(1,NULL);
+ }
if (sh_audio->wf){
mux_a->wf=malloc(sizeof(WAVEFORMATEX) + sh_audio->wf->cbSize);
memcpy(mux_a->wf, sh_audio->wf, sizeof(WAVEFORMATEX) + sh_audio->wf->cbSize);