On Wed, 1 Aug 2012 20:39:36 +0100, Kieran Kunhya <kier...@ob-encoder.com> wrote: > > + /* the codec gives us the frame size, in samples, > > + * we calculate the size of the samples buffer in bytes */ > > + buffer_size = av_samples_get_buffer_size(NULL, c->channels, > > c->frame_size, > > + c->sample_fmt, 0); > > + samples = av_malloc(buffer_size); > > + if (!samples) { > > + fprintf(stderr, "could not allocate %d bytes for samples buffer\n", > > + buffer_size); > > + exit(1); > > + } > > + /* setup the data pointers in the AVFrame */ > > + ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, > > + (const uint8_t*)samples, buffer_size, > > 0); > > + if (ret < 0) { > > + fprintf(stderr, "could not setup audio frame\n"); > > + exit(1); > > + } > > Is this hunk not the same as av_samples_alloc?
In this case it is, but it wouldn't be for nontrivial extended_data, i.e. for planar audio with > 8 channels. Since this is an example, I think we should be more generic than necessary. note to self and Justin: we still need a function for freeing an AVFrame. -- Anton Khirnov _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel