[FFmpeg-devel] [PATCH+RFC] AVFrame for audio
Peter Ross
pross
Sat Sep 4 05:57:34 CEST 2010
On Thu, Sep 02, 2010 at 07:11:37PM -0400, Justin Ruggles wrote:
> Hi,
>
> Peter Ross wrote:
>
> > To prototype use of audio in AVFrame, I have modified the PCM encoder/decoder
> > and addded new public lavc functions.
> >
> > Existing SAMPLE_FMTs are mapping onto (AVFrame*)->data[0]. The obvious
> > next step is to support planar audio, and splitting FF_COMMON_FRAME into
> > common, audio- and video-specific parts.
> >
> > avctx->reget_audio_buffer() is implemened using a simple realloc. It
> > probably makes sense to reuse the video InternalBuffer stuff, but i'm not
> > sure.
>
> Any progress on this? I really like the idea.
Unfortunately not. If you or anyone else wants to run with this patch, please do.
> > +#if LIBAVCODEC_VERSION_MAJOR < 53
> > int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
> > const short *samples)
> > {
> > + AVFrame frame;
> > + avcodec_get_frame_defaults(&frame);
> > + frame.data[0] = (uint8_t*)samples;
> > + frame.nb_samples = buf_size / ( av_get_bits_per_sample(avctx->codec->id)/8 * avctx->channels);
> > + return avcodec_encode_audio2(avctx, buf, buf_size, &frame);
> > +}
> > +#endif
>
> Shouldn't the nb_samples calculation use av_get_bits_per_sample_format()
> instead? av_get_bits_per_sample() only works for pcm and adpcm codecs.
> Also, it should check for divide by zero.
Correct.
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100904/7fd3882e/attachment.pgp>
More information about the ffmpeg-devel
mailing list