mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
f47b576d49
commit
a123c6be4c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
14
mencoder.c
14
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);
|
||||
|
|
Loading…
Reference in New Issue