[FFmpeg-devel] [PATCH] IFF stereo support

Michael Niedermayer michaelni
Fri May 2 19:49:23 CEST 2008


On Fri, May 02, 2008 at 09:49:17PM +0530, Jai Menon wrote:
> On Friday 02 May 2008 6:56:49 pm Jai Menon wrote:
> > Hi,
> >
> > I have a few patches in my local tree which add support for IFF animations.
> > These have been split up to make reviewing easier, As a start, I'm
> > attaching a patch which adds support for interleaved stereo samples.
> Sorry, wrong version of the patch.......Here is the correct one
> Hope i didn't waste your time :-)

[...]
> Index: libavformat/iff.c
> ===================================================================
> --- libavformat/iff.c	(revision 13030)
> +++ libavformat/iff.c	(working copy)
> @@ -60,6 +60,19 @@
>      uint32_t  audio_frame_count;
>  } IffDemuxContext;
>  
> +
> +void interleave_stereo(uint8_t *src, uint8_t *dest, int size)

static void interleave_stereo
and const uint8_t *src


> +{
> +    int index = size = size>>1;
> +
> +    while(size >= 0) {
> +        *dest++ = *src;
> +        *dest++ = *(src+index);
> +        src++;
> +        size--;
> +    }

while(dest < end) ...
would avoid the size--


> +}
> +
>  static int iff_probe(AVProbeData *p)
>  {
>      const uint8_t *d = p->buf;
> @@ -152,8 +165,21 @@
>  
>      if(iff->sent_bytes > iff->body_size)
>          return AVERROR(EIO);
> -    ret = av_get_packet(pb, pkt, PACKET_SIZE);
>  
> +    if(s->streams[0]->codec->channels == 2) {
> +        uint8_t sample_buffer[PACKET_SIZE];
> +
> +        ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
> +        if(av_new_packet(pkt, PACKET_SIZE) < 0) {
> +            av_log(s, AV_LOG_ERROR, "iff: cannot allocate packet \n");
> +            return AVERROR(ENOMEM);
> +        }
> +        interleave_stereo(sample_buffer, pkt->data, PACKET_SIZE);
> +    }
> +    else {
> +        ret = av_get_packet(pb, pkt, PACKET_SIZE);
> +    }

What about 8SVX_FIB/EXP 2 channel files? This looks like it is just
correct for 8bit PCM.

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20080502/c714fa6f/attachment.pgp>



More information about the ffmpeg-devel mailing list