1 /*****************************************************************************
2 * avcodec.h: decoder and encoder using libavcodec
3 *****************************************************************************
4 * Copyright (C) 2001-2013 VLC authors and VideoLAN
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef AVCOMMON_COMPAT_H
26 #define AVCOMMON_COMPAT_H 1
28 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
29 #include <libavcodec/avcodec.h>
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 ) ) )
39 # if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 52, 0))
41 #include <libavutil/mem.h>
43 static inline void avcodec_free_context( AVCodecContext **ctx )
48 av_free( (*ctx)->extradata );
54 #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
56 #ifdef HAVE_LIBAVUTIL_AVUTIL_H
57 # include <libavutil/avutil.h>
59 /* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
60 * a is the major version
61 * b and c the minor and micro versions of libav
62 * d and e the minor and micro versions of FFmpeg */
63 #define LIBAVUTIL_VERSION_CHECK( a, b, c, d, e ) \
64 ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
65 (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
67 #if !LIBAVUTIL_VERSION_CHECK( 52, 11, 0, 32, 100 )
68 # define AV_PIX_FMT_FLAG_HWACCEL PIX_FMT_HWACCEL
71 #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
73 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
74 # include <libavformat/avformat.h>
76 #define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \
77 ( (LIBAVFORMAT_VERSION_MICRO < 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
78 (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )