[FFmpeg-devel] [PATCH+RFC] AVFrame for audio
Michael Niedermayer
michaelni
Sun Jul 11 15:20:42 CEST 2010
On Sun, Jul 11, 2010 at 05:22:45PM +1000, Peter Ross wrote:
[...]
> @@ -942,6 +949,7 @@ typedef struct AVPanScan{
> #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
> #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
> #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
> +#define FF_BUFFER_TYPE_SIMPLE 16 ///< data[0] elements have been allocated using av_malloc()
>
>
> #define FF_I_TYPE 1 ///< Intra
this is not ideal, some decoders can benefit from having allocated memory
prior to data[0][0], thats mostly for filters that filter based on previous
samples.
FF_BUFFER_TYPE_INTERNAL should do as indication that av_malloc was used
i suspect
> @@ -2672,6 +2680,13 @@ typedef struct AVCodecContext {
> float crf_max;
>
> int log_level_offset;
> +
> + /**
> + * Called at the beginning of each audio frame to get a buffer for it.
> + * - encoding: unused
> + * - decoding: Set by libavcodec, user can override.
> + */
> + int (*reget_audio_buffer)(struct AVCodecContext *c, AVFrame *frame, int nb_samples);
a bit tersely documented
return code, nb_samples, initial allocation vs reallocation
how and who frees it
[...]
> @@ -470,7 +484,7 @@ AVCodec name ## _decoder = { \
> sizeof(PCMDecode), \
> pcm_decode_init, \
> NULL, \
> - NULL, \
> + pcm_decode_close, \
> pcm_decode_frame, \
> .sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
> .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index c3d701c..f52baad 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -353,6 +353,12 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
> assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
> assert(s->internal_buffer_count);
>
> + if (pic->type == FF_BUFFER_TYPE_SIMPLE) {
thats not looking good
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- 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/20100711/08ca884b/attachment.pgp>
More information about the ffmpeg-devel
mailing list