[FFmpeg-devel] [PATCH 1/9] lavfi: support unknown channel layouts.

Michael Niedermayer michaelni at gmx.at
Thu Dec 27 00:40:22 CET 2012


On Wed, Dec 26, 2012 at 06:28:12PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/audio.c         |    2 +-
>  libavfilter/avcodec.c       |    6 ++--
>  libavfilter/avfiltergraph.c |   73 ++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.c       |   80 ++++++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.h       |   24 +++++++++++++
>  5 files changed, 164 insertions(+), 21 deletions(-)
> 
> diff --git a/libavfilter/audio.c b/libavfilter/audio.c
> index 3564896..25c8756 100644
> --- a/libavfilter/audio.c
> +++ b/libavfilter/audio.c
> @@ -44,7 +44,7 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
>      AVFilterBufferRef *samplesref = NULL;
>      uint8_t **data;
>      int planar      = av_sample_fmt_is_planar(link->format);
> -    int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
> +    int nb_channels = link->channels;
>      int planes      = planar ? nb_channels : 1;
>      int linesize;
>      int full_perms = AV_PERM_READ | AV_PERM_WRITE | AV_PERM_PRESERVE |
> diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
> index 2533bd8..2074bfc 100644
> --- a/libavfilter/avcodec.c
> +++ b/libavfilter/avcodec.c
> @@ -94,9 +94,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
>  {
>      AVFilterBufferRef *samplesref;
>      int64_t layout = av_frame_get_channel_layout(frame);
> -
> -    if(av_frame_get_channels(frame) > 8) // libavfilter does not suport more than 8 channels FIXME, remove once libavfilter is fixed
> -        return NULL;

> +    int64_t fake_layout = layout ? layout : (int64_t)1 << av_frame_get_channels(frame);

this looks odd
2 channles == layout 4

about the patch overall, i leave review to others

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- 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/20121227/0eb8285e/attachment.asc>


More information about the ffmpeg-devel mailing list