[FFmpeg-devel] [PATCH] fix swf playback with bad audio track

Aurelien Jacobs aurel
Sun Sep 16 17:31:53 CEST 2007


On Tue, 11 Sep 2007 14:04:40 +0200
Baptiste Coudurier <baptiste.coudurier at smartjog.com> wrote:

> Hi
> 
> Reimar D?ffinger wrote:
> > Hello,
> > On Tue, Sep 11, 2007 at 11:24:15AM +0200, Aurelien Jacobs wrote:
> >> On Tue, 11 Sep 2007 01:20:23 +0200
> >> Baptiste Coudurier <baptiste.coudurier at smartjog.com> wrote:
> >>> Aurelien Jacobs wrote:
> >>>> Right now, when the swf demuxer find an audio track with unrecognized
> >>>> samplerate, it simply return AVERROR(EIO). This prevent playing the
> >>>> video track.
> >>> It seems weird, samplerate should not be "unrecognized", Im curious, is
> >>> such a file available somewhere ?
> >> To be more precise, sample_rate_code has 2 significant bits. Values
> >> between 1 and 3 maps to samplerate 11025, 22050 and 44100. 
> >> sample_rate_code == 0 don't map to any samplerate (at least in current
> >> code).
> >> Here is a sample which has sample_rate_code = 0:
> >>   http://samples.mplayerhq.hu/SWF/962_fws.swf
> > 
> > I don't quite get why it should fail at all, mp3 and probably most
> > other audio codecs just don't need a sample rate from the container.
> > IMO just replace
> > 
> >>   if (!sample_rate_code)
> >>       return AVERROR(EIO);
> >>   ast->codec->sample_rate = 11025 << (sample_rate_code-1);
> > 
> > by
> > 
> >>   if (sample_rate_code)
> >>       ast->codec->sample_rate = 11025 << (sample_rate_code-1);
> > 
> > and change nothing else.
> > 
> 
> No, according to specs 0 is 5.5khz sample rate. Code must be fixed
> accordingly, and not failing.

OK. First attached patch does this.

> Now concerning the sample, it uses DEFINESOUND tag which is a block a
> sound data, ie all mp3 frames are in one block, so demuxer must
> interleave those frames with video frames. This is not supported atm.

Second attached patch implement support for DEFINESOUND.
Audio packetizing and interleaving is ugly, but at least it
works for the sample mentioned in this tread.

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swf_sample_rate.diff
Type: text/x-diff
Size: 720 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070916/cbf06e5f/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swf_definesound.diff
Type: text/x-diff
Size: 3240 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070916/cbf06e5f/attachment-0001.diff>



More information about the ffmpeg-devel mailing list