Commit 8f254588 authored by Franz Brausse's avatar Franz Brausse Committed by Øyvind "pippin" Kolås

operations/external/ff-save: ffmpeg-4.0 compat; fixes #795625

parent 1263d1e8
...@@ -88,6 +88,11 @@ property_int (me_subpel_quality, _("me-subpel-quality"), 0) ...@@ -88,6 +88,11 @@ property_int (me_subpel_quality, _("me-subpel-quality"), 0)
#include <libavutil/opt.h> #include <libavutil/opt.h>
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
/* remove if libavcodec_required_version is changed to > 56.41.100 */
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(56,41,100)
# define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
#endif
typedef struct typedef struct
{ {
gdouble frame; gdouble frame;
...@@ -290,7 +295,7 @@ add_audio_stream (GeglProperties *o, AVFormatContext * oc, int codec_id) ...@@ -290,7 +295,7 @@ add_audio_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
c->codec_type = AVMEDIA_TYPE_AUDIO; c->codec_type = AVMEDIA_TYPE_AUDIO;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER; c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
return st; return st;
} }
...@@ -699,7 +704,9 @@ open_video (GeglProperties *o, AVFormatContext * oc, AVStream * st) ...@@ -699,7 +704,9 @@ open_video (GeglProperties *o, AVFormatContext * oc, AVStream * st)
} }
p->video_outbuf = NULL; p->video_outbuf = NULL;
#if (LIBAVFORMAT_VERSION_MAJOR < 58) /* AVFMT_RAWPICTURE got removed from ffmpeg: "not used anymore" */
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
#endif
{ {
/* allocate output buffer, 1 mb / frame, might fail for some codecs on UHD - but works for now */ /* allocate output buffer, 1 mb / frame, might fail for some codecs on UHD - but works for now */
p->video_outbuf_size = 1024 * 1024; p->video_outbuf_size = 1024 * 1024;
...@@ -803,6 +810,7 @@ write_video_frame (GeglProperties *o, ...@@ -803,6 +810,7 @@ write_video_frame (GeglProperties *o,
picture_ptr = p->picture; picture_ptr = p->picture;
picture_ptr->pts = p->frame_count; picture_ptr->pts = p->frame_count;
#if (LIBAVFORMAT_VERSION_MAJOR < 58) /* AVFMT_RAWPICTURE got removed from ffmpeg: "not used anymore" */
if (oc->oformat->flags & AVFMT_RAWPICTURE) if (oc->oformat->flags & AVFMT_RAWPICTURE)
{ {
/* raw video case. The API will change slightly in the near /* raw video case. The API will change slightly in the near
...@@ -821,6 +829,7 @@ write_video_frame (GeglProperties *o, ...@@ -821,6 +829,7 @@ write_video_frame (GeglProperties *o,
ret = av_write_frame (oc, &pkt); ret = av_write_frame (oc, &pkt);
} }
else else
#endif
{ {
/* encode the image */ /* encode the image */
AVPacket pkt2; AVPacket pkt2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment