[FFmpeg-devel] [PATCH] extractplanes filter

Nicolas George nicolas.george at normalesup.org
Thu May 2 14:37:07 CEST 2013


Le duodi 12 floréal, an CCXXI, Paul B Mahol a écrit :
> Yes, I'm aware of that, either I could query for different formats if r/g/b are
> set, or leave it to user by renaming r/g/b/y/u/v to c0/c1.., or just
> return nothing
> if input does not have r/g/b.
> 
> I think I will pick first one.

I am not sure the first one is best: if the user request "r" from a yuv
input, it will silently insert a convert filter, while this is more likely a
user error.

I suggest something like that:

enum {
    PLANE_R = 0x01,
    PLANE_G = 0x02,
    PLANE_B = 0x04,
    PLANE_A = 0x08,
    PLANE_Y = 0x10,
    PLANE_U = 0x20,
    PLANE_V = 0x40,
};

plane_avail = (gray  ? PLANE_Y :
               rgb   ? PLANE_R | PLANE_G | PLANE_B :
                       PLANE_Y | PLANE_U | PLANE_V) |
              (alpha ? PLANE_A : 0);
if (plane_requested & ~plane_avail) {
    av_error(ctx, AV_LOG_ERROR, "Requested planes not available\n");
    return AVERROR(EINVAL);
}
plane_actual = (plane_requested & 0xF) | (plane_requested >> 4);

> So return AVERROR_EOF only if EOF happend for all outputs and
> otherwise just return 0?

Yes, exactly.

> greping shows its required.

Yes, indeed, and seeing it in your patch makes me think we should try to
make it unnecessary, but that is completely unrelated.

Regards,

-- 
  Nicolas George
-------------- 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/20130502/e6340a13/attachment.asc>


More information about the ffmpeg-devel mailing list