1 --- ffms2-2.20/configure.ac~ 2016-03-22 18:01:21.000000000 +0100
2 +++ ffms2-2.20/configure.ac 2016-03-22 18:02:57.590572584 +0100
4 avcodec_register_all();
6 #ifdef FFMS_USE_FFMPEG_COMPAT
7 - int bogus = CODEC_ID_G2M;
8 + int bogus = AV_CODEC_ID_G2M;
11 ]])], [eval $1=yes], [eval $1=no])
12 --- ffms2-2.20/src/core/videosource.h~ 2014-06-20 17:09:10.000000000 +0200
13 +++ ffms2-2.20/src/core/videosource.h 2016-03-22 18:04:27.388385707 +0100
18 - PixelFormat LastFramePixelFormat;
19 + AVPixelFormat LastFramePixelFormat;
23 - std::vector<PixelFormat> TargetPixelFormats;
24 + std::vector<AVPixelFormat> TargetPixelFormats;
27 - PixelFormat OutputFormat;
28 + AVPixelFormat OutputFormat;
29 AVColorRange OutputColorRange;
30 AVColorSpace OutputColorSpace;
32 bool InputFormatOverridden;
33 - PixelFormat InputFormat;
34 + AVPixelFormat InputFormat;
35 AVColorRange InputColorRange;
36 AVColorSpace InputColorSpace;
39 virtual FFMS_Frame *GetFrame(int n) = 0;
40 void GetFrameCheck(int n);
41 FFMS_Frame *GetFrameByTime(double Time);
42 - void SetOutputFormat(const PixelFormat *TargetFormats, int Width, int Height, int Resizer);
43 + void SetOutputFormat(const AVPixelFormat *TargetFormats, int Width, int Height, int Resizer);
44 void ResetOutputFormat();
45 - void SetInputFormat(int ColorSpace, int ColorRange, PixelFormat Format);
46 + void SetInputFormat(int ColorSpace, int ColorRange, AVPixelFormat Format);
47 void ResetInputFormat();
50 --- ffms2-2.20/src/core/videosource.cpp~ 2014-06-20 17:09:10.000000000 +0200
51 +++ ffms2-2.20/src/core/videosource.cpp 2016-03-22 18:05:31.439198279 +0100
53 if (LastFrameWidth != CodecContext->width || LastFrameHeight != CodecContext->height || LastFramePixelFormat != CodecContext->pix_fmt) {
54 if (TargetHeight > 0 && TargetWidth > 0 && !TargetPixelFormats.empty()) {
55 if (!InputFormatOverridden) {
56 - InputFormat = PIX_FMT_NONE;
57 + InputFormat = AV_PIX_FMT_NONE;
58 InputColorSpace = AVCOL_SPC_UNSPECIFIED;
59 InputColorRange = AVCOL_RANGE_UNSPECIFIED;
65 - LastFramePixelFormat = PIX_FMT_NONE;
66 + LastFramePixelFormat = AV_PIX_FMT_NONE;
72 - OutputFormat = PIX_FMT_NONE;
73 + OutputFormat = AV_PIX_FMT_NONE;
74 OutputColorSpace = AVCOL_SPC_UNSPECIFIED;
75 OutputColorRange = AVCOL_RANGE_UNSPECIFIED;
77 InputFormatOverridden = false;
78 - InputFormat = PIX_FMT_NONE;
79 + InputFormat = AV_PIX_FMT_NONE;
80 InputColorSpace = AVCOL_SPC_UNSPECIFIED;
81 InputColorRange = AVCOL_RANGE_UNSPECIFIED;
84 LastDecodedFrame = av_frame_alloc();
86 // Dummy allocations so the unallocated case doesn't have to be handled later
87 - avpicture_alloc(&SWSFrame, PIX_FMT_GRAY8, 16, 16);
88 + avpicture_alloc(&SWSFrame, AV_PIX_FMT_GRAY8, 16, 16);
93 return GetFrame(Frame);
96 -static AVColorRange handle_jpeg(PixelFormat *format) {
97 +static AVColorRange handle_jpeg(AVPixelFormat *format) {
99 - case PIX_FMT_YUVJ420P: *format = PIX_FMT_YUV420P; return AVCOL_RANGE_JPEG;
100 - case PIX_FMT_YUVJ422P: *format = PIX_FMT_YUV422P; return AVCOL_RANGE_JPEG;
101 - case PIX_FMT_YUVJ444P: *format = PIX_FMT_YUV444P; return AVCOL_RANGE_JPEG;
102 - case PIX_FMT_YUVJ440P: *format = PIX_FMT_YUV440P; return AVCOL_RANGE_JPEG;
103 + case AV_PIX_FMT_YUVJ420P: *format = AV_PIX_FMT_YUV420P; return AVCOL_RANGE_JPEG;
104 + case AV_PIX_FMT_YUVJ422P: *format = AV_PIX_FMT_YUV422P; return AVCOL_RANGE_JPEG;
105 + case AV_PIX_FMT_YUVJ444P: *format = AV_PIX_FMT_YUV444P; return AVCOL_RANGE_JPEG;
106 + case AV_PIX_FMT_YUVJ440P: *format = AV_PIX_FMT_YUV440P; return AVCOL_RANGE_JPEG;
107 default: return AVCOL_RANGE_UNSPECIFIED;
111 -void FFMS_VideoSource::SetOutputFormat(const PixelFormat *TargetFormats, int Width, int Height, int Resizer) {
112 +void FFMS_VideoSource::SetOutputFormat(const AVPixelFormat *TargetFormats, int Width, int Height, int Resizer) {
114 TargetHeight = Height;
115 TargetResizer = Resizer;
116 TargetPixelFormats.clear();
117 - while (*TargetFormats != PIX_FMT_NONE)
118 + while (*TargetFormats != AV_PIX_FMT_NONE)
119 TargetPixelFormats.push_back(*TargetFormats++);
120 - OutputFormat = PIX_FMT_NONE;
121 + OutputFormat = AV_PIX_FMT_NONE;
123 ReAdjustOutputFormat();
124 OutputFrame(DecodeFrame);
127 -void FFMS_VideoSource::SetInputFormat(int ColorSpace, int ColorRange, PixelFormat Format) {
128 +void FFMS_VideoSource::SetInputFormat(int ColorSpace, int ColorRange, AVPixelFormat Format) {
129 InputFormatOverridden = true;
131 - if (Format != PIX_FMT_NONE)
132 + if (Format != AV_PIX_FMT_NONE)
133 InputFormat = Format;
134 if (ColorRange != AVCOL_RANGE_UNSPECIFIED)
135 InputColorRange = (AVColorRange)ColorRange;
139 void FFMS_VideoSource::DetectInputFormat() {
140 - if (InputFormat == PIX_FMT_NONE)
141 + if (InputFormat == AV_PIX_FMT_NONE)
142 InputFormat = CodecContext->pix_fmt;
144 AVColorRange RangeFromFormat = handle_jpeg(&InputFormat);
148 OutputFormat = FindBestPixelFormat(TargetPixelFormats, InputFormat);
149 - if (OutputFormat == PIX_FMT_NONE) {
150 + if (OutputFormat == AV_PIX_FMT_NONE) {
152 throw FFMS_Exception(FFMS_ERROR_SCALING, FFMS_ERROR_INVALID_ARGUMENT,
153 "No suitable output format found");
156 TargetPixelFormats.clear();
158 - OutputFormat = PIX_FMT_NONE;
159 + OutputFormat = AV_PIX_FMT_NONE;
160 OutputColorSpace = AVCOL_SPC_UNSPECIFIED;
161 OutputColorRange = AVCOL_RANGE_UNSPECIFIED;
165 void FFMS_VideoSource::ResetInputFormat() {
166 InputFormatOverridden = false;
167 - InputFormat = PIX_FMT_NONE;
168 + InputFormat = AV_PIX_FMT_NONE;
169 InputColorSpace = AVCOL_SPC_UNSPECIFIED;
170 InputColorRange = AVCOL_RANGE_UNSPECIFIED;
173 VP.ColorSpace = CodecContext->colorspace;
174 VP.ColorRange = CodecContext->color_range;
175 // these pixfmt's are deprecated but still used
176 - if (CodecContext->pix_fmt == PIX_FMT_YUVJ420P ||
177 - CodecContext->pix_fmt == PIX_FMT_YUVJ422P ||
178 - CodecContext->pix_fmt == PIX_FMT_YUVJ444P
179 + if (CodecContext->pix_fmt == AV_PIX_FMT_YUVJ420P ||
180 + CodecContext->pix_fmt == AV_PIX_FMT_YUVJ422P ||
181 + CodecContext->pix_fmt == AV_PIX_FMT_YUVJ444P
183 VP.ColorRange = AVCOL_RANGE_JPEG;
185 --- ffms2-2.20/src/core/videoutils.h~ 2014-06-20 17:09:10.000000000 +0200
186 +++ ffms2-2.20/src/core/videoutils.h 2016-03-22 18:06:41.360081076 +0100
189 // swscale and pp-related functions
190 int64_t GetSWSCPUFlags();
191 -SwsContext *GetSwsContext(int SrcW, int SrcH, PixelFormat SrcFormat, int SrcColorSpace, int SrcColorRange, int DstW, int DstH, PixelFormat DstFormat, int DstColorSpace, int DstColorRange, int64_t Flags);
192 +SwsContext *GetSwsContext(int SrcW, int SrcH, AVPixelFormat SrcFormat, int SrcColorSpace, int SrcColorRange, int DstW, int DstH, AVPixelFormat DstFormat, int DstColorSpace, int DstColorRange, int64_t Flags);
193 AVColorSpace GetAssumedColorSpace(int Width, int Height);
195 // timebase-related functions
197 void CorrectTimebase(FFMS_VideoProperties *VP, FFMS_TrackTimeBase *TTimebase);
199 // our implementation of avcodec_find_best_pix_fmt()
200 -PixelFormat FindBestPixelFormat(const std::vector<PixelFormat> &Dsts, PixelFormat Src);
201 +AVPixelFormat FindBestPixelFormat(const std::vector<AVPixelFormat> &Dsts, AVPixelFormat Src);
203 void RegisterCustomParsers();
204 --- ffms2-2.20/src/core/videoutils.cpp~ 2014-06-20 17:09:10.000000000 +0200
205 +++ ffms2-2.20/src/core/videoutils.cpp 2016-03-22 18:07:35.707431208 +0100
207 #include <libavutil/opt.h>
210 -SwsContext *GetSwsContext(int SrcW, int SrcH, PixelFormat SrcFormat, int SrcColorSpace, int SrcColorRange, int DstW, int DstH, PixelFormat DstFormat, int DstColorSpace, int DstColorRange, int64_t Flags) {
211 +SwsContext *GetSwsContext(int SrcW, int SrcH, AVPixelFormat SrcFormat, int SrcColorSpace, int SrcColorRange, int DstW, int DstH, AVPixelFormat DstFormat, int DstColorSpace, int DstColorRange, int64_t Flags) {
212 Flags |= SWS_FULL_CHR_H_INT | SWS_FULL_CHR_H_INP | SWS_ACCURATE_RND | SWS_BITEXACT;
213 SwsContext *Context = sws_alloc_context();
214 if (!Context) return 0;
219 -static BCSType GuessCSType(PixelFormat p) {
220 +static BCSType GuessCSType(AVPixelFormat p) {
221 // guessing the colorspace type from the name is kinda hackish but libav doesn't export this kind of metadata
222 - if (av_pix_fmt_desc_get(p)->flags & PIX_FMT_HWACCEL)
224 const char *n = av_get_pix_fmt_name(p);
225 if (strstr(n, "gray") || strstr(n, "mono") || strstr(n, "y400a"))
230 struct LossAttributes {
231 - PixelFormat Format;
232 + AVPixelFormat Format;
233 int ChromaUndersampling;
234 int ChromaOversampling;
240 -static LossAttributes CalculateLoss(PixelFormat Dst, PixelFormat Src) {
241 +static LossAttributes CalculateLoss(AVPixelFormat Dst, AVPixelFormat Src) {
242 const AVPixFmtDescriptor &SrcDesc = *av_pix_fmt_desc_get(Src);
243 const AVPixFmtDescriptor &DstDesc = *av_pix_fmt_desc_get(Dst);
244 BCSType SrcCS = GuessCSType(Src);
245 @@ -182,15 +182,15 @@
249 -PixelFormat FindBestPixelFormat(const std::vector<PixelFormat> &Dsts, PixelFormat Src) {
250 +AVPixelFormat FindBestPixelFormat(const std::vector<AVPixelFormat> &Dsts, AVPixelFormat Src) {
251 // some trivial special cases to make sure there's as little conversion as possible
253 - return PIX_FMT_NONE;
254 + return AV_PIX_FMT_NONE;
255 if (Dsts.size() == 1)
258 // is the input in the output?
259 - std::vector<PixelFormat>::const_iterator i = std::find(Dsts.begin(), Dsts.end(), Src);
260 + std::vector<AVPixelFormat>::const_iterator i = std::find(Dsts.begin(), Dsts.end(), Src);
264 --- ffms2-2.20/src/core/ffms.cpp~ 2014-06-20 17:09:10.000000000 +0200
265 +++ ffms2-2.20/src/core/ffms.cpp 2016-03-22 18:08:09.401187196 +0100
267 FFMS_API(int) FFMS_SetOutputFormatV2(FFMS_VideoSource *V, const int *TargetFormats, int Width, int Height, int Resizer, FFMS_ErrorInfo *ErrorInfo) {
268 ClearErrorInfo(ErrorInfo);
270 - V->SetOutputFormat(reinterpret_cast<const PixelFormat *>(TargetFormats), Width, Height, Resizer);
271 + V->SetOutputFormat(reinterpret_cast<const AVPixelFormat *>(TargetFormats), Width, Height, Resizer);
272 } catch (FFMS_Exception &e) {
273 return e.CopyOut(ErrorInfo);
276 FFMS_API(int) FFMS_SetInputFormatV(FFMS_VideoSource *V, int ColorSpace, int ColorRange, int Format, FFMS_ErrorInfo *ErrorInfo) {
277 ClearErrorInfo(ErrorInfo);
279 - V->SetInputFormat(ColorSpace, ColorRange, static_cast<PixelFormat>(Format));
280 + V->SetInputFormat(ColorSpace, ColorRange, static_cast<AVPixelFormat>(Format));
281 } catch (FFMS_Exception &e) {
282 return e.CopyOut(ErrorInfo);
284 --- ffms2-2.20/src/vapoursynth/vapoursource.cpp~ 2014-06-20 17:09:10.000000000 +0200
285 +++ ffms2-2.20/src/vapoursynth/vapoursource.cpp 2016-03-22 18:19:10.716042796 +0100
288 static int GetNumPixFmts() {
290 - while (av_get_pix_fmt_name((PixelFormat)n))
291 + while (av_get_pix_fmt_name((AVPixelFormat)n))
296 static int GetColorFamily(const AVPixFmtDescriptor &desc) {
297 if (desc.nb_components == 1)
299 - else if (desc.flags & PIX_FMT_RGB)
300 + else if (desc.flags & AV_PIX_FMT_FLAG_RGB)
305 && desc.log2_chroma_h == f->subSamplingH)
308 - return PIX_FMT_NONE;
309 + return AV_PIX_FMT_NONE;
311 int colorfamily = cmYUV;
312 if (av_pix_fmt_desc_get((AVPixelFormat) id)->nb_components == 1)
313 @@ -239,12 +239,12 @@
314 for (int i = 0; i < npixfmt; i++)
315 if (IsRealPlanar(*av_pix_fmt_desc_get((AVPixelFormat) i)))
316 TargetFormats.push_back(i);
317 - TargetFormats.push_back(PIX_FMT_NONE);
318 + TargetFormats.push_back(AV_PIX_FMT_NONE);
320 - int TargetPixelFormat = PIX_FMT_NONE;
321 + int TargetPixelFormat = AV_PIX_FMT_NONE;
322 if (ConvertToFormat != pfNone) {
323 TargetPixelFormat = formatConversion(ConvertToFormat, true, core, vsapi);
324 - if (TargetPixelFormat == PIX_FMT_NONE)
325 + if (TargetPixelFormat == AV_PIX_FMT_NONE)
326 throw std::runtime_error(std::string("Source: Invalid output colorspace specified"));
328 TargetFormats.clear();