void-packages/srcpkgs/bomi/patches/ffmpeg4.patch
Johannes Brechtmann b5347b978b bomi: add patch for ffmpeg-4.0.1.
[ci skip]
2018-07-01 19:30:17 +02:00

195 lines
8.5 KiB
Diff

source: https://github.com/d-s-x/bomi/commit/c1473b38bf92e9ac858fd58588a9d45fe717edfa
diff --git a/src/bomi/video/ffmpegfilters.hpp b/src/bomi/video/ffmpegfilters.hpp
index 77b1df41c5..5365525c48 100644
--- src/bomi/video/ffmpegfilters.hpp
+++ src/bomi/video/ffmpegfilters.hpp
@@ -6,7 +6,7 @@
extern "C" {
#include <video/mp_image_pool.h>
#include <video/img_format.h>
-#include <libavfilter/avfiltergraph.h>
+#include <libavfilter/avfilter.h>
#include <libpostproc/postprocess.h>
}
#include "enum/deintmethod.hpp"
diff --git a/src/mpv/audio/out/ao_lavc.c b/src/mpv/audio/out/ao_lavc.c
index b322982566..d1991e1d37 100644
--- src/mpv/audio/out/ao_lavc.c
+++ src/mpv/audio/out/ao_lavc.c
@@ -156,8 +156,8 @@ static int init(struct ao *ao)
ac->buffer_size =
ac->aframesize * ac->sample_size * ao->channels.num * 2 + 200;
}
- if (ac->buffer_size < FF_MIN_BUFFER_SIZE)
- ac->buffer_size = FF_MIN_BUFFER_SIZE;
+ if (ac->buffer_size < AV_INPUT_BUFFER_MIN_SIZE)
+ ac->buffer_size = AV_INPUT_BUFFER_MIN_SIZE;
ac->buffer = talloc_size(ac, ac->buffer_size);
// enough frames for at least 0.25 seconds
diff --git a/src/mpv/common/av_common.c b/src/mpv/common/av_common.c
index 05c694702d..fb6206bc01 100644
--- src/mpv/common/av_common.c
+++ src/mpv/common/av_common.c
@@ -36,7 +36,7 @@ int mp_lavc_set_extradata(AVCodecContext *avctx, void *ptr, int size)
if (size) {
av_free(avctx->extradata);
avctx->extradata_size = 0;
- avctx->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ avctx->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return -1;
avctx->extradata_size = size;
@@ -67,7 +67,7 @@ void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st)
avctx->channel_layout = st->channel_layout;
avctx->bits_per_coded_sample = st->bits_per_coded_sample;
// Required in FFmpeg 2.5.x / Libav 11, deprecated afterwards.
- avctx->stream_codec_tag = st->stream_codec_tag;
+ avctx->codec_tag = st->codec_tag;
}
// We merely pass-through our PTS/DTS as an int64_t; libavcodec won't use it.
diff --git a/src/mpv/common/encode_lavc.c b/src/mpv/common/encode_lavc.c
index 2a01bee380..9c97c97a88 100644
--- src/mpv/common/encode_lavc.c
+++ src/mpv/common/encode_lavc.c
@@ -476,7 +476,7 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx,
if (!(*bytebuf = stream_open(buf, ctx->global))) {
MP_WARN(ctx, "%s: could not open '%s', "
"disabling 2-pass encoding at pass 2\n", prefix, buf);
- stream->codec->flags &= ~CODEC_FLAG_PASS2;
+ stream->codec->flags &= ~AV_CODEC_FLAG_PASS2;
set_to_avdictionary(ctx, dictp, "flags", "-pass2");
} else {
struct bstr content = stream_read_complete(*bytebuf, NULL,
@@ -680,7 +680,7 @@ int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream)
MP_INFO(ctx, "Opening video encoder: %s [%s]\n",
ctx->vc->long_name, ctx->vc->name);
- if (ctx->vc->capabilities & CODEC_CAP_EXPERIMENTAL) {
+ if (ctx->vc->capabilities & AV_CODEC_CAP_EXPERIMENTAL) {
stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
MP_WARN(ctx, "\n\n"
" ********************************************\n"
@@ -715,7 +715,7 @@ int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream)
MP_INFO(ctx, "Opening audio encoder: %s [%s]\n",
ctx->ac->long_name, ctx->ac->name);
- if (ctx->ac->capabilities & CODEC_CAP_EXPERIMENTAL) {
+ if (ctx->ac->capabilities & AV_CODEC_CAP_EXPERIMENTAL) {
stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
MP_WARN(ctx, "\n\n"
" ********************************************\n"
diff --git a/src/mpv/demux/demux_lavf.c b/src/mpv/demux/demux_lavf.c
index 943fb1d8af..6f438249ad 100644
--- src/mpv/demux/demux_lavf.c
+++ src/mpv/demux/demux_lavf.c
@@ -318,7 +318,7 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
// Disable file-extension matching with normal checks
.filename = check <= DEMUX_CHECK_REQUEST ? priv->filename : "",
.buf_size = 0,
- .buf = av_mallocz(PROBE_BUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE),
+ .buf = av_mallocz(PROBE_BUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE),
};
if (!avpd.buf)
return -1;
diff --git a/src/mpv/demux/packet.c b/src/mpv/demux/packet.c
index 22b111b0ce..62cd90ef7e 100644
--- src/mpv/demux/packet.c
+++ src/mpv/demux/packet.c
@@ -92,7 +92,7 @@ void demux_packet_shorten(struct demux_packet *dp, size_t len)
{
assert(len <= dp->len);
dp->len = len;
- memset(dp->buffer + dp->len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ memset(dp->buffer + dp->len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
void free_demux_packet(struct demux_packet *dp)
diff --git a/src/mpv/video/decode/vd_lavc.c b/src/mpv/video/decode/vd_lavc.c
index ffd56350b6..2589faf4ec 100644
--- src/mpv/video/decode/vd_lavc.c
+++ src/mpv/video/decode/vd_lavc.c
@@ -377,15 +377,15 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
mp_set_avcodec_threads(vd->log, avctx, lavc_param->threads);
}
- avctx->flags |= lavc_param->bitexact ? CODEC_FLAG_BITEXACT : 0;
- avctx->flags2 |= lavc_param->fast ? CODEC_FLAG2_FAST : 0;
+ avctx->flags |= lavc_param->bitexact ? AV_CODEC_FLAG_BITEXACT : 0;
+ avctx->flags2 |= lavc_param->fast ? AV_CODEC_FLAG2_FAST : 0;
if (lavc_param->show_all) {
-#ifdef CODEC_FLAG2_SHOW_ALL
- avctx->flags2 |= CODEC_FLAG2_SHOW_ALL; // ffmpeg only?
+#ifdef AV_CODEC_FLAG2_SHOW_ALL
+ avctx->flags2 |= AV_CODEC_FLAG2_SHOW_ALL; // ffmpeg only?
#endif
-#ifdef CODEC_FLAG_OUTPUT_CORRUPT
- avctx->flags |= CODEC_FLAG_OUTPUT_CORRUPT; // added with Libav 10
+#ifdef AV_CODEC_FLAG_OUTPUT_CORRUPT
+ avctx->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT; // added with Libav 10
#endif
}
diff --git a/src/mpv/video/out/vo_lavc.c b/src/mpv/video/out/vo_lavc.c
index 3a6903b7fd..895e0952a5 100644
--- src/mpv/video/out/vo_lavc.c
+++ src/mpv/video/out/vo_lavc.c
@@ -166,8 +166,8 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
goto error;
vc->buffer_size = 6 * width * height + 200;
- if (vc->buffer_size < FF_MIN_BUFFER_SIZE)
- vc->buffer_size = FF_MIN_BUFFER_SIZE;
+ if (vc->buffer_size < AV_INPUT_BUFFER_MIN_SIZE)
+ vc->buffer_size = AV_INPUT_BUFFER_MIN_SIZE;
if (vc->buffer_size < sizeof(AVPicture))
vc->buffer_size = sizeof(AVPicture);
@@ -253,30 +253,19 @@ static void write_packet(struct vo *vo, int size, AVPacket *packet)
static int encode_video(struct vo *vo, AVFrame *frame, AVPacket *packet)
{
struct priv *vc = vo->priv;
- if (encode_lavc_oformat_flags(vo->encode_lavc_ctx) & AVFMT_RAWPICTURE) {
- if (!frame)
- return 0;
- memcpy(vc->buffer, frame, sizeof(AVPicture));
- MP_DBG(vo, "got pts %f\n",
- frame->pts * (double) vc->stream->codec->time_base.num /
- (double) vc->stream->codec->time_base.den);
- packet->size = sizeof(AVPicture);
- return packet->size;
- } else {
- int got_packet = 0;
- int status = avcodec_encode_video2(vc->stream->codec, packet,
- frame, &got_packet);
- int size = (status < 0) ? status : got_packet ? packet->size : 0;
-
- if (frame)
- MP_DBG(vo, "got pts %f; out size: %d\n",
- frame->pts * (double) vc->stream->codec->time_base.num /
- (double) vc->stream->codec->time_base.den, size);
-
- if (got_packet)
- encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
- return size;
- }
+ int got_packet = 0;
+ int status = avcodec_encode_video2(vc->stream->codec, packet,
+ frame, &got_packet);
+ int size = (status < 0) ? status : got_packet ? packet->size : 0;
+
+ if (frame)
+ MP_DBG(vo, "got pts %f; out size: %d\n",
+ frame->pts * (double) vc->stream->codec->time_base.num /
+ (double) vc->stream->codec->time_base.den, size);
+
+ if (got_packet)
+ encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
+ return size;
}
static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)