[FFmpeg-devel] avformat/mov : add support for read/write Adobe Alpha Udta

Michael Niedermayer michael at niedermayer.cc
Tue Mar 20 21:54:45 EET 2018


On Sun, Mar 11, 2018 at 01:43:16PM +0100, Martin Vignali wrote:
> > > +        av_log(c->fc, AV_LOG_ERROR,
> > > +               "unknown value for ALFA udta (%llu)\n", alpha_val);
> >
> > the %llu looks wrong for the type
> >
> >
> >
> New patch in attach replacing %llu with %"PRIu64
> 
> Martin

>  mov.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> f3a63c8a1a96c720a35b4905d484a0a1dbc1754c  0001-avformat-mov-add-support-for-Adobe-Alpha-metadata.patch
> From 7f64436a07a1ceb3fa56ddb8267c8c1b08e04617 Mon Sep 17 00:00:00 2001
> From: Martin Vignali <martin.vignali at gmail.com>
> Date: Sun, 11 Mar 2018 13:16:29 +0100
> Subject: [PATCH 1/3] avformat/mov : add support for Adobe Alpha metadata 
>  parsing
> 
> ---
>  libavformat/mov.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 51228f5df2..740f4d5faa 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -120,6 +120,29 @@ static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb,
>      return 0;
>  }
>  
> +/* Adobe Alpha metadata */
> +static int mov_metadata_alpha(MOVContext *c, AVIOContext *pb, unsigned len)
> +{
> +    uint64_t alpha_val;
> +    if (len != 10) {
> +        av_log(c->fc, AV_LOG_ERROR,
> +               "invalid size for ALFA udta (%u bytes left, need %d)\n", len, 10);
> +        return AVERROR_INVALIDDATA;
> +    }
> +    avio_rb16(pb);
> +    alpha_val = avio_rb64(pb);
> +
> +    if (alpha_val == 0) {
> +        return av_dict_set(&c->fc->metadata, "alpha", "straight", 0);
> +    } else if (alpha_val == 4294967297) {
> +        return av_dict_set(&c->fc->metadata, "alpha", "premult", 0);
> +    } else {
> +        av_log(c->fc, AV_LOG_ERROR,
> +               "unknown value for ALFA udta (%"PRIu64")\n", alpha_val);
> +        return AVERROR_INVALIDDATA;
> +    }
> +}

iam not objecting to this but i do not think that metadata is teh correct
place to ex/inport information about redefining the meaning of the alpha
channel

I think it should be handled similar to how other information about
pixel formats and colorspaces is handled

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180320/2747b39d/attachment.sig>


More information about the ffmpeg-devel mailing list