[FFmpeg-devel] [PATCH] lavfi: store and propagate number of channels information in audio buffer properties
Michael Niedermayer
michaelni at gmx.at
Tue Jul 31 01:13:14 CEST 2012
On Mon, Jul 30, 2012 at 04:11:56PM +0200, Stefano Sabatini wrote:
> The channels field is required since the channel layout is not always
> available.
> ---
> libavfilter/af_ashowinfo.c | 3 ++-
> libavfilter/avcodec.c | 2 ++
> libavfilter/avfilter.h | 1 +
> 3 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
> index 0d4bbb2..65f18f5 100644
> --- a/libavfilter/af_ashowinfo.c
> +++ b/libavfilter/af_ashowinfo.c
> @@ -66,12 +66,13 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
>
> av_log(ctx, AV_LOG_INFO,
> "n:%d pts:%s pts_time:%s pos:%"PRId64" "
> - "fmt:%s chlayout:%s nb_samples:%d rate:%d "
> + "fmt:%s channels:%d chlayout:%s nb_samples:%d rate:%d "
> "checksum:%08X plane_checksum[%08X",
> showinfo->frame,
> av_ts2str(samplesref->pts), av_ts2timestr(samplesref->pts, &inlink->time_base),
> samplesref->pos,
> av_get_sample_fmt_name(samplesref->format),
> + samplesref->audio->channels,
> chlayout_str,
> samplesref->audio->nb_samples,
> samplesref->audio->sample_rate,
> diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
> index f452303..8d61fbc 100644
> --- a/libavfilter/avcodec.c
> +++ b/libavfilter/avcodec.c
> @@ -46,6 +46,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
> case AVMEDIA_TYPE_AUDIO:
> dst->audio->sample_rate = src->sample_rate;
> dst->audio->channel_layout = src->channel_layout;
> + dst->audio->channels = src->channels;
> break;
> default:
> return AVERROR(EINVAL);
> @@ -137,6 +138,7 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
> dst->nb_samples = src->audio->nb_samples;
> av_frame_set_sample_rate (dst, src->audio->sample_rate);
> av_frame_set_channel_layout(dst, src->audio->channel_layout);
> + av_frame_set_channels (dst, src->audio->channels);
> break;
> default:
> return AVERROR(EINVAL);
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 91820dd..c9ef7db 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -110,6 +110,7 @@ typedef struct AVFilterBuffer {
> */
> typedef struct AVFilterBufferRefAudioProps {
> uint64_t channel_layout; ///< channel layout of audio buffer
> + int channels; ///< number of channels
> int nb_samples; ///< number of audio samples per channel
> int sample_rate; ///< audio buffer sample rate
> } AVFilterBufferRefAudioProps;
i think at the end of the struct is a safer
and minor should be bumped
otherwise LGTM
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120731/1cf6cec2/attachment.asc>
More information about the ffmpeg-devel
mailing list