Mercurial > mplayer.hg
changeset 15888:da752f91c5f2
Check for WAVEFORMAT.wFormatTag overflows and allow user to override the tag with -fafmttag
author | ranma |
---|---|
date | Sat, 02 Jul 2005 19:00:13 +0000 |
parents | a03d9116fc25 |
children | efb8b8fa323e |
files | DOCS/man/de/mplayer.1 DOCS/man/en/mplayer.1 cfg-mencoder.h help/help_mp-de.h help/help_mp-en.h mencoder.c |
diffstat | 6 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/man/de/mplayer.1 Sat Jul 02 16:22:38 2005 +0000 +++ b/DOCS/man/de/mplayer.1 Sat Jul 02 19:00:13 2005 +0000 @@ -5785,6 +5785,18 @@ .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
--- a/DOCS/man/en/mplayer.1 Sat Jul 02 16:22:38 2005 +0000 +++ b/DOCS/man/en/mplayer.1 Sat Jul 02 19:00:13 2005 +0000 @@ -5583,6 +5583,18 @@ .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
--- a/cfg-mencoder.h Sat Jul 02 16:22:38 2005 +0000 +++ b/cfg-mencoder.h Sat Jul 02 19:00:13 2005 +0000 @@ -232,6 +232,8 @@ // 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},
--- a/help/help_mp-de.h Sat Jul 02 16:22:38 2005 +0000 +++ b/help/help_mp-de.h Sat Jul 02 19:00:13 2005 +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_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 @@ #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:
--- a/help/help_mp-en.h Sat Jul 02 16:22:38 2005 +0000 +++ b/help/help_mp-en.h Sat Jul 02 19:00:13 2005 +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_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 @@ #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:
--- a/mencoder.c Sat Jul 02 16:22:38 2005 +0000 +++ b/mencoder.c Sat Jul 02 19:00:13 2005 +0000 @@ -164,6 +164,7 @@ char* out_filename="test.avi"; char *force_fourcc=NULL; +int force_audiofmttag=-1; char* passtmpfile="divx2pass.log"; @@ -808,6 +809,15 @@ // ============= 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 @@ 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);