Skip to content

Instantly share code, notes, and snippets.

@ilovezfs
Created April 27, 2018 05:52
Show Gist options
  • Save ilovezfs/565cf511b5caf83192f93d7c433420ec to your computer and use it in GitHub Desktop.
Save ilovezfs/565cf511b5caf83192f93d7c433420ec to your computer and use it in GitHub Desktop.
diff --git a/decoder_plugins/ffmpeg/ffmpeg.c b/decoder_plugins/ffmpeg/ffmpeg.c
index 93ac7e7..4ea635a 100644
--- a/decoder_plugins/ffmpeg/ffmpeg.c
+++ b/decoder_plugins/ffmpeg/ffmpeg.c
@@ -96,6 +96,16 @@ GCC_DIAG_ON(deprecated-declarations)
#include "files.h"
#include "lists.h"
+#ifndef AV_CODEC_CAP_DELAY
+# define AV_CODEC_CAP_DELAY CODEC_CAP_DELAY
+# define AV_CODEC_CAP_EXPERIMENTAL CODEC_CAP_EXPERIMENTAL
+# define AV_CODEC_CAP_TRUNCATED CODEC_CAP_TRUNCATED
+#endif
+
+#ifndef AV_CODEC_FLAG_TRUNCATED
+# define AV_CODEC_FLAG_TRUNCATED CODEC_FLAG_TRUNCATED
+#endif
+
/* Set SEEK_IN_DECODER to 1 if you'd prefer seeking to be delay until
* the next time ffmpeg_decode() is called. This will provide seeking
* in formats for which FFmpeg falsely reports seek errors, but could
@@ -1010,7 +1020,7 @@ static void *ffmpeg_open (const char *file)
* FFmpeg/LibAV in use. For some versions this will be caught in
* *_find_stream_info() above and misreported as an unfound codec
* parameters error. */
- if (data->codec->capabilities & CODEC_CAP_EXPERIMENTAL) {
+ if (data->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) {
decoder_error (&data->error, ERROR_FATAL, 0,
"The codec is experimental and may damage MOC: %s",
data->codec->name);
@@ -1019,8 +1029,8 @@ static void *ffmpeg_open (const char *file)
#endif
set_downmixing (data);
- if (data->codec->capabilities & CODEC_CAP_TRUNCATED)
- data->enc->flags |= CODEC_FLAG_TRUNCATED;
+ if (data->codec->capabilities & AV_CODEC_CAP_TRUNCATED)
+ data->enc->flags |= AV_CODEC_FLAG_TRUNCATED;
#ifdef HAVE_AVCODEC_OPEN2
if (avcodec_open2 (data->enc, data->codec, NULL) < 0)
@@ -1050,7 +1060,7 @@ static void *ffmpeg_open (const char *file)
data->sample_width = sfmt_Bps (data->fmt);
- if (data->codec->capabilities & CODEC_CAP_DELAY)
+ if (data->codec->capabilities & AV_CODEC_CAP_DELAY)
data->delay = true;
data->seek_broken = is_seek_broken (data);
data->timing_broken = is_timing_broken (data->ic);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment