[FFmpeg-devel] [PATCH] Implement av_samples_fill_linesizes().
Michael Niedermayer
michaelni
Sat Jan 15 14:22:05 CET 2011
On Sat, Jan 15, 2011 at 02:26:38AM +0100, Stefano Sabatini wrote:
> ---
> libavcore/audioconvert.c | 20 ++++++++++++++++++++
> libavcore/audioconvert.h | 18 +++++++++++++++++-
> 2 files changed, 37 insertions(+), 1 deletions(-)
>
> diff --git a/libavcore/audioconvert.c b/libavcore/audioconvert.c
> index c720733..031c57f 100644
> --- a/libavcore/audioconvert.c
> +++ b/libavcore/audioconvert.c
> @@ -114,3 +114,23 @@ int av_get_channel_layout_nb_channels(int64_t channel_layout)
> x &= x-1; // unset lowest set bit
> return count;
> }
> +
> +int av_samples_fill_linesizes(int linesizes[8], enum AVSampleFormat sample_fmt,
> + int planar, int64_t channel_layout, int nb_channels)
> +{
> + int i, sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3;
> +
> + if (nb_channels <= 0) {
> + if (channel_layout > 0) {
> + nb_channels = av_get_channel_layout_nb_channels(channel_layout);
> + } else
> + /* not enough information for computing the linesizes */
> + return AVERROR(EINVAL);
> + }
> +
> + for (i = 0; i < nb_channels; i++)
> + linesizes[i] = planar ? sample_size : nb_channels * sample_size;
> + memset(&linesizes[nb_channels], 0, (8-nb_channels) * sizeof(linesizes[0]));
> +
> + return 0;
> +}
channel_layout should not be a input parameter to this function, it has nothing
to do with channel layout
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110115/5fd912f3/attachment.pgp>
More information about the ffmpeg-devel
mailing list