Gnash  0.8.11dev
ffmpegHeaders.h
Go to the documentation of this file.
1 // ffmpegHeaders.h - hide braindamage required to support ffmpeg includes in a single file
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef GNASH_MEDIA_FFMPEG_HEADERS_H
21 #define GNASH_MEDIA_FFMPEG_HEADERS_H
22 
23 #ifdef HAVE_CONFIG_H
24 #include "gnashconfig.h"
25 #endif
26 
28 #ifndef __STDC_CONSTANT_MACROS
29 # define __STDC_CONSTANT_MACROS
30 #endif
31 
32 // This is for compatibility with braindamaged versions of ffmpeg
33 #if !defined INT64_C
34 #if defined __WORDSIZE && __WORDSIZE == 64
35 #define INT64_C(c) c ## L
36 #else
37 #define INT64_C(c) c ## LL
38 #endif
39 #endif
40 
41 #define MAX_AUDIO_FRAME_SIZE 192000
42 
43 #ifdef HAVE_FFMPEG_AVCODEC_H
44 extern "C" {
45 # include <ffmpeg/avcodec.h>
46 }
47 #endif
48 
49 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
50 extern "C" {
51 # include <libavcodec/avcodec.h>
52 }
53 #endif
54 
55 #ifdef HAVE_FFMPEG_AVFORMAT_H
56 extern "C" {
57 #include <ffmpeg/avformat.h>
58 }
59 #endif
60 
61 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
62 extern "C" {
63 #include <libavformat/avformat.h>
64 }
65 #endif
66 
67 
68 #ifdef HAVE_SWSCALE_H
69 extern "C" {
70 #include <swscale.h>
71 }
72 #endif
73 
74 #ifdef HAVE_FFMPEG_SWSCALE_H
75 extern "C" {
76 #include <ffmpeg/swscale.h>
77 }
78 #define HAVE_SWSCALE_H 1
79 #endif
80 
81 #ifdef HAVE_LIBSWSCALE_SWSCALE_H
82 extern "C" {
83 #include <libswscale/swscale.h>
84 }
85 #define HAVE_SWSCALE_H 1
86 #endif
87 
88 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,94,1)
89 #define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
90 #define AV_SAMPLE_FMT_U8 SAMPLE_FMT_U8
91 #define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
92 #define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
93 #define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
94 #define AV_SAMPLE_FMT_DBL SAMPLE_FMT_DBL
95 
96 #define AVSampleFormat SampleFormat
97 #endif
98 
99 // till Debian libav 10~beta1
100 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,34,1)
101 #define AV_CODEC_ID_AAC CODEC_ID_AAC
102 #define AV_CODEC_ID_ADPCM_SWF CODEC_ID_ADPCM_SWF
103 #define AV_CODEC_ID_FLASHSV CODEC_ID_FLASHSV
104 #define AV_CODEC_ID_FLV1 CODEC_ID_FLV1
105 #define AV_CODEC_ID_H264 CODEC_ID_H264
106 #define AV_CODEC_ID_MP3 CODEC_ID_MP3
107 #define AV_CODEC_ID_NELLYMOSER CODEC_ID_NELLYMOSER
108 #define AV_CODEC_ID_NONE CODEC_ID_NONE
109 #define AV_CODEC_ID_PCM_S8 CODEC_ID_PCM_S8
110 #define AV_CODEC_ID_PCM_S16LE CODEC_ID_PCM_S16LE
111 #define AV_CODEC_ID_PCM_U16LE CODEC_ID_PCM_U16LE
112 #define AV_CODEC_ID_VP6A CODEC_ID_VP6A
113 #define AV_CODEC_ID_VP6F CODEC_ID_VP6F
114 
115 #define avg_frame_rate r_frame_rate
116 #define FRAMEALLOC avcodec_alloc_frame
117 struct FrameDeleter
118 {
119  void operator()(AVFrame* frame)
120  {
121  av_free(frame);
122  }
123 };
124 #else
125 #define FRAMEALLOC av_frame_alloc
127 {
128  void operator()(AVFrame* frame)
129  {
130  av_frame_free(&frame);
131  }
132 };
133 #endif
134 
135 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,18,102)
136 #define CODECID AVCodecID
137 #else
138 #define CODECID CodecID
139 #endif
140 
141 #ifdef HAVE_SWRESAMPLE_H
142 extern "C" {
143 #include <swresample.h>
144 }
145 #endif
146 
147 #ifdef HAVE_FFMPEG_SWRESAMPLE_H
148 extern "C" {
149 #include <ffmpeg/swresample.h>
150 }
151 #define HAVE_SWRESAMPLE_H 1
152 #endif
153 
154 #ifdef HAVE_LIBSWRESAMPLE_SWRESAMPLE_H
155 extern "C" {
156 #include <libswresample/swresample.h>
157 }
158 #define HAVE_SWRESAMPLE_H 1
159 #endif
160 
161 #ifdef HAVE_AVRESAMPLE_H
162 extern "C" {
163 #include <avresample.h>
164 }
165 #endif
166 
167 #ifdef HAVE_LIBAV_AVRESAMPLE_H
168 extern "C" {
169 #include <libav/avresample.h>
170 }
171 #define HAVE_AVRESAMPLE_H 1
172 #endif
173 
174 #ifdef HAVE_LIBAVRESAMPLE_AVRESAMPLE_H
175 extern "C" {
176 #include <libavresample/avresample.h>
177 }
178 #define HAVE_AVRESAMPLE_H 1
179 #endif
180 
181 #ifdef HAVE_LIBAVUTIL_OPT_H
182 extern "C" {
183 #include <libavutil/opt.h>
184 }
185 #endif
186 
187 #endif // GNASH_MEDIA_FFMPEG_HEADERS_H
void operator()(AVFrame *frame)
Definition: ffmpegHeaders.h:128
Definition: ffmpegHeaders.h:126