[FFmpeg-devel] [PATCH] let the ffpcm set sample_fmt for wav audio streams

Michael Niedermayer michaelni
Thu Nov 26 21:31:16 CET 2009


On Thu, Nov 26, 2009 at 11:50:44PM +0530, Jai Menon wrote:
> On Thu, Nov 26, 2009 at 06:12:17PM +0100, Michael Niedermayer wrote:
> > On Thu, Nov 26, 2009 at 05:43:28PM +0530, Jai Menon wrote:
> > > Hi,
> > > 
> > > All the 24bit PCM WAV files I have show the wrong sample_fmt. Would it
> > > be okay if we let the decoder set correct sample_fmt instead of the
> > > default s16. Attached patch is more or less what I mean. Please tell
> > > me if I'm missing something, or if there is a better way to show
> > > correct stream info.
> > > Thanks.
> > > 
> > > -- 
> > > Jai Menon
> > 
> > >  riff.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > > f6e0cd818e7c167c93fe9e4baec767455af2bac3  sample_fmt_wav.patch
> > > Index: libavformat/riff.c
> > > ===================================================================
> > > --- libavformat/riff.c	(revision 20584)
> > > +++ libavformat/riff.c	(working copy)
> > > @@ -450,6 +450,8 @@
> > >      codec->sample_rate = get_le32(pb);
> > >      codec->bit_rate = get_le32(pb) * 8;
> > >      codec->block_align = get_le16(pb);
> > > +    codec->sample_fmt = SAMPLE_FMT_NONE;
> > 
> > you want to change
> > s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE
> > in avcodec_get_context_defaults2()
> > i suspect ...
> > dunno if that can just done or if it will need more changes but adding
> > =NONE hacks in lavf is not a good idea
> 
> Indeed, my bad. I really think the fixme is correct though and the
> decoder should do the right thing. I verified that make codectest
> passes (fulltest fails because lavftest reference needs to be updated,
> but thats a different issue). Patch attached. If something breaks
> later, I guess we can "fix" it by setting correct sample_fmt in that
> case.
> 
> -- 
> Jai Menon
> 

>  options.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 61477dd054d9537dcab8449e5aba8ee7fe8d3cd7  sample_fmt_fix.patch

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091126/b2e8ad96/attachment.pgp>



More information about the ffmpeg-devel mailing list