From a123c6be4c9c8baa0165bd37b37e34eb34efe2e5 Mon Sep 17 00:00:00 2001 From: ranma Date: Sat, 2 Jul 2005 19:00:13 +0000 Subject: 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 --- mencoder.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mencoder.c') 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); -- cgit v1.2.3