diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-02-01 12:34:23 +0100 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-06-06 10:12:49 +0200 |
commit | 95a0242642e8ee345f6545ea7f9b042989272729 (patch) | |
tree | d1a6b279f5613c46a1b676ca3ba71345f23eb365 /libavfilter/avfilter.c | |
parent | 0bc2cca12f671010eac171bc22049320a7cd61a3 (diff) | |
download | ffmpeg-95a0242642e8ee345f6545ea7f9b042989272729.tar.gz |
lavfi: prefer nb_samples over size in AVFilterBufferRefAudioProps
Remove AVFilterBufferRefAudioProps.size, and use nb_samples in
avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in
place of size.
This is required as the size in the audio buffer may be aligned, so it
may not contain a well defined number of samples.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index fae3c6c5f2..6d55350f7c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -305,10 +305,9 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) av_get_picture_type_char(ref->video->pict_type)); } if (ref->audio) { - av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", + av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d p:%d", ref->audio->channel_layout, ref->audio->nb_samples, - ref->audio->size, ref->audio->sample_rate, ref->audio->planar); } @@ -405,16 +404,16 @@ fail: } AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int nb_samples, int64_t channel_layout, int planar) { AVFilterBufferRef *ret = NULL; if (link->dstpad->get_audio_buffer) - ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout, planar); if (!ret) - ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, nb_samples, channel_layout, planar); if (ret) ret->type = AVMEDIA_TYPE_AUDIO; @@ -545,6 +544,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) { void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); AVFilterPad *dst = link->dstpad; + int i; FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1); @@ -561,14 +561,15 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms, samplesref->format, - samplesref->audio->size, + samplesref->audio->nb_samples, samplesref->audio->channel_layout, samplesref->audio->planar); link->cur_buf->pts = samplesref->pts; link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; /* Copy actual data into new samples buffer */ - memcpy(link->cur_buf->data[0], samplesref->data[0], samplesref->audio->size); + for (i = 0; samplesref->data[i]; i++) + memcpy(link->cur_buf->data[i], samplesref->data[i], samplesref->linesize[0]); avfilter_unref_buffer(samplesref); } else |