aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKeith Bowes <keithbowes@users.noreply.github.com>2022-02-17 16:46:17 -0500
committerSimon Ser <contact@emersion.fr>2022-02-21 15:51:17 +0100
commit35b3d67e5f0c12ae8d3174a268b0af73724ecc3e (patch)
treefbf424b087bfa920adca9ae9ce009d550d80fd74 /examples
parent252b2348bd62170d97c4e81fb2050f757b56d67e (diff)
Fixed compiling with FFmpeg 5.0
Diffstat (limited to 'examples')
-rw-r--r--examples/dmabuf-capture.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/dmabuf-capture.c b/examples/dmabuf-capture.c
index 4d05b78b..58bf6419 100644
--- a/examples/dmabuf-capture.c
+++ b/examples/dmabuf-capture.c
@@ -1,4 +1,5 @@
#define _POSIX_C_SOURCE 199309L
+#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/display.h>
#include <libavutil/hwcontext_drm.h>
@@ -619,12 +620,12 @@ static int init_encoding(struct capture_context *ctx) {
}
/* Find encoder */
- AVCodec *out_codec = avcodec_find_encoder_by_name(ctx->encoder_name);
+ const AVCodec *out_codec = avcodec_find_encoder_by_name(ctx->encoder_name);
if (!out_codec) {
av_log(ctx, AV_LOG_ERROR, "Codec not found (not compiled in lavc?)!\n");
return AVERROR(EINVAL);
}
- ctx->avf->oformat->video_codec = out_codec->id;
+ ctx->avf->oformat = av_guess_format(ctx->encoder_name, NULL, NULL);
ctx->is_software_encoder = !(out_codec->capabilities & AV_CODEC_CAP_HARDWARE);
ctx->avctx = avcodec_alloc_context3(out_codec);