[FFmpeg-soc] [soc]: r5067 - spdif/spdif.c
Bartlomiej Wolowiec
bartek.wolowiec at gmail.com
Fri Aug 14 14:06:31 CEST 2009
Friday 14 August 2009 07:45:38 Diego Biurrun napisał(a):
> On Thu, Aug 13, 2009 at 10:51:07PM +0200, Bartlomiej Wolowiec wrote:
> > Thursday 13 August 2009 12:05:10 Reimar Döffinger napisał(a):
> > > On Thu, Aug 13, 2009 at 11:10:21AM +0200, bwolowiec wrote:
> > > > --- spdif/spdif.c Thu Aug 13 10:28:04 2009 (r5066)
> > > > +++ spdif/spdif.c Thu Aug 13 11:10:21 2009 (r5067)
> > > > @@ -237,13 +256,13 @@ static int spdif_write_packet(struct AVF
> > > > #if HAVE_BIGENDIAN
> > > > put_buffer(s->pb, pkt->data, pkt->size & ~1);
> > > > #else
> > > > - {
> > > > - //XXX swab... ?
> > > > - uint16_t *data = (uint16_t *) pkt->data;
> > > > - int i;
> > > > - for (i = 0; i < pkt->size >> 1; i++)
> > > > - put_be16(s->pb, data[i]);
> > > > + if (ctx->buffer_size < pkt->size) {
> > > > + av_fast_malloc(&ctx->buffer, &ctx->buffer_size, pkt->size +
> > > > FF_INPUT_BUFFER_PADDING_SIZE); + if (!ctx->buffer)
> > > > + return AVERROR(ENOMEM);
> > > > }
> > > > + swab(pkt->data, ctx->buffer, pkt->size & ~1);
> > > > + put_buffer(s->pb, ctx->buffer, pkt->size & ~1);
> > > > #endif
> > >
> > > Btw. using
> > > if (HAVE_BIGENDIAN) {
> > > ...
> > > } else {
> > > }
> > >
> > > will ensure that compilation of both paths is checked on all builds,
> > > and unless someone compiles with -O0 results in the same code.
> >
> > so why in other places in FFmpeg there are #if ? any pros of this ?
>
> Where would that be?
hmm... I've just tried grep HAVE_BIGENDIAN libavcodec/*.c ...
--
Bartlomiej Wolowiec
More information about the FFmpeg-soc
mailing list