]> git.sesse.net Git - vlc/blob - modules/codec/avcodec/avcommon_compat.h
Upgrade requirements for libavcodec and libavutil
[vlc] / modules / codec / avcodec / avcommon_compat.h
1 /*****************************************************************************
2  * avcodec.h: decoder and encoder using libavcodec
3  *****************************************************************************
4  * Copyright (C) 2001-2013 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef AVCOMMON_COMPAT_H
26 #define AVCOMMON_COMPAT_H 1
27
28 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
29 #include <libavcodec/avcodec.h>
30
31 /* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
32  * a is the major version
33  * b and c the minor and micro versions of libav
34  * d and e the minor and micro versions of FFmpeg */
35 #define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \
36     ( (LIBAVCODEC_VERSION_MICRO <  100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
37       (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
38
39 #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
40
41 #ifdef HAVE_LIBAVUTIL_AVUTIL_H
42 # include <libavutil/avutil.h>
43
44 /* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
45  * a is the major version
46  * b and c the minor and micro versions of libav
47  * d and e the minor and micro versions of FFmpeg */
48 #define LIBAVUTIL_VERSION_CHECK( a, b, c, d, e ) \
49     ( (LIBAVUTIL_VERSION_MICRO <  100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
50       (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
51
52 #if !LIBAVUTIL_VERSION_CHECK( 52, 11, 0, 32, 100 )
53 #   define AV_PIX_FMT_FLAG_HWACCEL  PIX_FMT_HWACCEL
54 #endif
55
56 #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
57
58 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
59 # include <libavformat/avformat.h>
60
61 #define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \
62     ( (LIBAVFORMAT_VERSION_MICRO <  100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
63       (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
64
65 #endif
66
67 #endif