Commit 79456652 authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi: store and propagate number of channels information in audio buffer properties

The channels field is required since the channel layout is not always
available.
parent 9d2a7c04
...@@ -15,6 +15,9 @@ libavutil: 2012-10-22 ...@@ -15,6 +15,9 @@ libavutil: 2012-10-22
API changes, most recent first: API changes, most recent first:
2012-11-13 - xxxxxxx - lavfi 3.23.100 - avfilter.h
Add channels field to AVFilterBufferRefAudioProps.
2012-11-02 - xxxxxxx - lavu 52.4.100 - opt.h 2012-11-02 - xxxxxxx - lavu 52.4.100 - opt.h
Add av_opt_get_key_value(). Add av_opt_get_key_value().
......
...@@ -85,12 +85,12 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) ...@@ -85,12 +85,12 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
av_log(ctx, AV_LOG_INFO, av_log(ctx, AV_LOG_INFO,
"n:%"PRIu64" pts:%s pts_time:%s pos:%"PRId64" " "n:%"PRIu64" pts:%s pts_time:%s pos:%"PRId64" "
"fmt:%s chlayout:%s rate:%d nb_samples:%d " "fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d "
"checksum:%08X ", "checksum:%08X ",
s->frame, s->frame,
av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base), av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base),
buf->pos, buf->pos,
av_get_sample_fmt_name(buf->format), chlayout_str, av_get_sample_fmt_name(buf->format), buf->audio->channels, chlayout_str,
buf->audio->sample_rate, buf->audio->nb_samples, buf->audio->sample_rate, buf->audio->nb_samples,
checksum); checksum);
......
...@@ -60,6 +60,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) ...@@ -60,6 +60,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
dst->audio->sample_rate = src->sample_rate; dst->audio->sample_rate = src->sample_rate;
dst->audio->channel_layout = src->channel_layout; dst->audio->channel_layout = src->channel_layout;
dst->audio->channels = src->channels;
if(src->channels != av_get_channel_layout_nb_channels(src->channel_layout)) { if(src->channels != av_get_channel_layout_nb_channels(src->channel_layout)) {
av_log(0, AV_LOG_ERROR, "libavfilter does not support this channel layout\n"); av_log(0, AV_LOG_ERROR, "libavfilter does not support this channel layout\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
...@@ -161,6 +162,7 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) ...@@ -161,6 +162,7 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
dst->nb_samples = src->audio->nb_samples; dst->nb_samples = src->audio->nb_samples;
av_frame_set_sample_rate (dst, src->audio->sample_rate); av_frame_set_sample_rate (dst, src->audio->sample_rate);
av_frame_set_channel_layout(dst, src->audio->channel_layout); av_frame_set_channel_layout(dst, src->audio->channel_layout);
av_frame_set_channels (dst, src->audio->channels);
break; break;
default: default:
return AVERROR(EINVAL); return AVERROR(EINVAL);
......
...@@ -117,6 +117,7 @@ typedef struct AVFilterBufferRefAudioProps { ...@@ -117,6 +117,7 @@ typedef struct AVFilterBufferRefAudioProps {
uint64_t channel_layout; ///< channel layout of audio buffer uint64_t channel_layout; ///< channel layout of audio buffer
int nb_samples; ///< number of audio samples per channel int nb_samples; ///< number of audio samples per channel
int sample_rate; ///< audio buffer sample rate int sample_rate; ///< audio buffer sample rate
int channels; ///< number of channels
} AVFilterBufferRefAudioProps; } AVFilterBufferRefAudioProps;
/** /**
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 22 #define LIBAVFILTER_VERSION_MINOR 23
#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment