Skip to content

Commit

Permalink
ppb_video_decoder: use AV_ prefixed macros
Browse files Browse the repository at this point in the history
Looks like newer FFmpeg versions have droped old definitions.
  • Loading branch information
i-rinat committed Dec 26, 2017
1 parent f557edc commit 934aa9c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmake/ffmpeg-compat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ MACRO_C_SOURCE_CHECK(cfg_av_pix_fmt_vdpau.c HAVE_AV_PIX_FMT_VDPAU)
MACRO_C_SOURCE_CHECK(cfg_avcodecid.c HAVE_AVCodecID)
MACRO_C_SOURCE_CHECK(cfg_avcodeccontext_get_buffer2.c HAVE_AVCodecContext_get_buffer2)
MACRO_C_SOURCE_CHECK(cfg_AVVDPAUContext.c HAVE_AVVDPAUContext)
MACRO_C_SOURCE_CHECK(cfg_avcodecflags.c HAVE_AV_CODEC_FLAGS)

MACRO_SYMBOL_CHECK(av_frame_alloc "libavcodec/avcodec.h" HAVE_av_frame_alloc)
MACRO_SYMBOL_CHECK(av_frame_free "libavcodec/avcodec.h" HAVE_av_frame_free)
Expand Down
4 changes: 4 additions & 0 deletions cmake/ffmpeg-compat/cfg_avcodecflags.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <libavcodec/avcodec.h>
int main(void) {
return AV_CODEC_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED;
}
1 change: 1 addition & 0 deletions cmake/ffmpeg-compat/ffmpeg_compat.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
#define HAVE_av_frame_free (@HAVE_av_frame_free@)
#define HAVE_avcodec_free_context (@HAVE_avcodec_free_context@)
#define HAVE_AVVDPAUContext (@HAVE_AVVDPAUContext@)
#define HAVE_AV_CODEC_FLAGS (@HAVE_AV_CODEC_FLAGS@)
11 changes: 8 additions & 3 deletions src/ppb_video_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
#define AV_CODEC_ID_H264 CODEC_ID_H264
#endif // !HAVE_AVCodecID

#if !HAVE_AV_CODEC_FLAGS
#define AV_CODEC_CAP_TRUNCATED CODEC_CAP_TRUNCATED
#define AV_CODEC_FLAG_TRUNCATED CODEC_FLAG_TRUNCATED
#endif // !HAVE_AV_CODEC_FLAGS

enum hwdec_api_e {
HWDEC_NONE = 0,
HWDEC_VAAPI,
Expand Down Expand Up @@ -620,9 +625,9 @@ initialize_decoder(struct pp_video_decoder_s *vd)
goto err;
}

if (vd->avcodec->capabilities & CODEC_CAP_TRUNCATED) {
trace_info("%s, codec have CODEC_CAP_TRUNCATED\n", __func__);
vd->avctx->flags |= CODEC_FLAG_TRUNCATED;
if (vd->avcodec->capabilities & AV_CODEC_CAP_TRUNCATED) {
trace_info("%s, codec have AV_CODEC_CAP_TRUNCATED\n", __func__);
vd->avctx->flags |= AV_CODEC_FLAG_TRUNCATED;
}

vd->avctx->opaque = vd;
Expand Down

0 comments on commit 934aa9c

Please sign in to comment.