summaryrefslogtreecommitdiff
path: root/libavfilter/audio.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-19 08:27:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-19 08:27:35 +0200
commit209cb8afe0092e66411d730b85139947cc706708 (patch)
tree6f70969604b0f7a2f2fb8d1f89f2e04cd6575f74 /libavfilter/audio.c
parent9ead06057acfcc43bcb99a63a7c58543007b2847 (diff)
parentc9c7bc4493bc72254cfb826941cdaf56c9b110d6 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavfi: switch ff_default_get_audio_buffer() to av_frame_get_buffer() Conflicts: libavfilter/audio.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/audio.c')
-rw-r--r--libavfilter/audio.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index 1075217fe0..315c273c28 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -42,43 +42,29 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
{
AVFrame *frame = av_frame_alloc();
int channels = link->channels;
- int buf_size, ret;
+ int ret;
av_assert0(channels == av_get_channel_layout_nb_channels(link->channel_layout) || !av_get_channel_layout_nb_channels(link->channel_layout));
if (!frame)
return NULL;
- buf_size = av_samples_get_buffer_size(NULL, channels, nb_samples,
- link->format, 0);
- if (buf_size < 0)
- goto fail;
-
- frame->buf[0] = av_buffer_alloc(buf_size);
- if (!frame->buf[0])
- goto fail;
-
- frame->nb_samples = nb_samples;
- ret = avcodec_fill_audio_frame(frame, channels, link->format,
- frame->buf[0]->data, buf_size, 0);
- if (ret < 0)
- goto fail;
-
- av_samples_set_silence(frame->extended_data, 0, nb_samples, channels,
- link->format);
-
frame->nb_samples = nb_samples;
frame->format = link->format;
av_frame_set_channels(frame, link->channels);
frame->channel_layout = link->channel_layout;
frame->sample_rate = link->sample_rate;
+ ret = av_frame_get_buffer(frame, 0);
+ if (ret < 0) {
+ av_frame_free(&frame);
+ return NULL;
+ }
- return frame;
+ av_samples_set_silence(frame->extended_data, 0, nb_samples, channels,
+ link->format);
-fail:
- av_buffer_unref(&frame->buf[0]);
- av_frame_free(&frame);
- return NULL;
+
+ return frame;
}
AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples)