1 diff -ur gtatool-2.0.1.orig/src/conv-ffmpeg/media_object.cpp gtatool-2.0.1/src/conv-ffmpeg/media_object.cpp
2 --- gtatool-2.0.1.orig/src/conv-ffmpeg/media_object.cpp 2016-03-29 15:47:09.906503157 +0200
3 +++ gtatool-2.0.1/src/conv-ffmpeg/media_object.cpp 2016-03-29 15:54:14.410037508 +0200
5 video_frame_template.value_range = video_frame::u8_full;
6 video_frame_template.chroma_location = video_frame::center;
7 if (!_always_convert_to_bgra32
8 - && (video_codec_ctx->pix_fmt == PIX_FMT_YUV444P
9 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV444P10
10 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV422P
11 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV422P10
12 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV420P
13 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV420P10))
14 + && (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV444P
15 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV444P10
16 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV422P
17 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV422P10
18 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV420P
19 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV420P10))
21 - if (video_codec_ctx->pix_fmt == PIX_FMT_YUV444P
22 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV444P10)
23 + if (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV444P
24 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV444P10)
26 video_frame_template.layout = video_frame::yuv444p;
28 - else if (video_codec_ctx->pix_fmt == PIX_FMT_YUV422P
29 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV422P10)
30 + else if (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV422P
31 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV422P10)
33 video_frame_template.layout = video_frame::yuv422p;
37 video_frame_template.color_space = video_frame::yuv709;
39 - if (video_codec_ctx->pix_fmt == PIX_FMT_YUV444P10
40 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV422P10
41 - || video_codec_ctx->pix_fmt == PIX_FMT_YUV420P10)
42 + if (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV444P10
43 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV422P10
44 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUV420P10)
46 video_frame_template.value_range = video_frame::u10_mpeg;
47 if (video_codec_ctx->color_range == AVCOL_RANGE_JPEG)
51 else if (!_always_convert_to_bgra32
52 - && (video_codec_ctx->pix_fmt == PIX_FMT_YUVJ444P
53 - || video_codec_ctx->pix_fmt == PIX_FMT_YUVJ422P
54 - || video_codec_ctx->pix_fmt == PIX_FMT_YUVJ420P))
55 + && (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUVJ444P
56 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUVJ422P
57 + || video_codec_ctx->pix_fmt == AV_PIX_FMT_YUVJ420P))
59 - if (video_codec_ctx->pix_fmt == PIX_FMT_YUVJ444P)
60 + if (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUVJ444P)
62 video_frame_template.layout = video_frame::yuv444p;
64 - else if (video_codec_ctx->pix_fmt == PIX_FMT_YUVJ422P)
65 + else if (video_codec_ctx->pix_fmt == AV_PIX_FMT_YUVJ422P)
67 video_frame_template.layout = video_frame::yuv422p;
70 _ffmpeg->video_frames.push_back(av_frame_alloc());
71 _ffmpeg->video_buffered_frames.push_back(av_frame_alloc());
73 - enum PixelFormat frame_fmt = (_ffmpeg->video_frame_templates[j].layout == video_frame::bgra32
74 - ? PIX_FMT_BGRA : _ffmpeg->video_codec_ctxs[j]->pix_fmt);
75 + enum AVPixelFormat frame_fmt = (_ffmpeg->video_frame_templates[j].layout == video_frame::bgra32
76 + ? AV_PIX_FMT_BGRA : _ffmpeg->video_codec_ctxs[j]->pix_fmt);
77 int frame_bufsize = (avpicture_get_size(frame_fmt,
78 _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height));
79 _ffmpeg->video_buffers.push_back(static_cast<uint8_t *>(av_malloc(frame_bufsize)));
81 if (_ffmpeg->video_frame_templates[j].layout == video_frame::bgra32)
83 // Initialize things needed for software pixel format conversion
84 - int sws_bufsize = avpicture_get_size(PIX_FMT_BGRA,
85 + int sws_bufsize = avpicture_get_size(AV_PIX_FMT_BGRA,
86 _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height);
87 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1)
88 _ffmpeg->video_sws_frames.push_back(avcodec_alloc_frame());
90 throw exc(HERE + ": " + strerror(ENOMEM));
92 avpicture_fill(reinterpret_cast<AVPicture *>(_ffmpeg->video_sws_frames[j]), _ffmpeg->video_sws_buffers[j],
93 - PIX_FMT_BGRA, _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height);
94 + AV_PIX_FMT_BGRA, _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height);
95 // Call sws_getCachedContext(NULL, ...) instead of sws_getContext(...) just to avoid a deprecation warning.
96 _ffmpeg->video_sws_ctxs.push_back(sws_getCachedContext(NULL,
97 _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height, _ffmpeg->video_codec_ctxs[j]->pix_fmt,
98 - _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height, PIX_FMT_BGRA,
99 + _ffmpeg->video_codec_ctxs[j]->width, _ffmpeg->video_codec_ctxs[j]->height, AV_PIX_FMT_BGRA,
100 SWS_POINT, NULL, NULL, NULL));
101 if (!_ffmpeg->video_sws_ctxs[j])
103 @@ -1532,7 +1532,7 @@
104 // We need to buffer the data because FFmpeg will clubber it when decoding the next frame.
105 av_picture_copy(reinterpret_cast<AVPicture *>(_ffmpeg->video_buffered_frames[_video_stream]),
106 reinterpret_cast<AVPicture *>(_ffmpeg->video_frames[_video_stream]),
107 - static_cast<enum PixelFormat>(_ffmpeg->video_codec_ctxs[_video_stream]->pix_fmt),
108 + static_cast<enum AVPixelFormat>(_ffmpeg->video_codec_ctxs[_video_stream]->pix_fmt),
109 _ffmpeg->video_codec_ctxs[_video_stream]->width,
110 _ffmpeg->video_codec_ctxs[_video_stream]->height);
111 src_frame = _ffmpeg->video_buffered_frames[_video_stream];