[FFmpeg-devel] [PATCH] lavu, lavfi, lavd: do not hardcode AV_PIX_FMT_NB value when setting pixel format max value

Michael Niedermayer michaelni at gmx.at
Mon Dec 16 16:35:52 CET 2013


On Mon, Dec 16, 2013 at 04:23:51PM +0100, Stefano Sabatini wrote:
> The constant may change in libavutil but the library may be compiled
> against an older version, thus rejecting a value which is otherwise
> supported by the new libavutil.
> 
> INT_MAX is used here to denote the max allowed value for a pixel format.
> 
> The opt-test code is changed to provide a valid reference example.
> ---
>  libavdevice/dshow.c          | 2 +-
>  libavfilter/vf_mergeplanes.c | 2 +-
>  libavutil/opt.c              | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index 37efabe..2ef004e 100644
> --- a/libavdevice/dshow.c
> +++ b/libavdevice/dshow.c
> @@ -1059,7 +1059,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
>  #define DEC AV_OPT_FLAG_DECODING_PARAM
>  static const AVOption options[] = {
>      { "video_size", "set video size given a string such as 640x480 or hd720.", OFFSET(requested_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
> -    { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, AV_PIX_FMT_NB-1, DEC },
> +    { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, MAX_INT, DEC },

MAX_INT or INT_MAX ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- 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/20131216/b6a57513/attachment.asc>


More information about the ffmpeg-devel mailing list