Skip to content

Commit

Permalink
Fix compilation on ubuntu noble with FFMPEG 6.0 (#21)
Browse files Browse the repository at this point in the history
Ubuntu noble ships with FFMPEG 6.0 where `AV_CODEC_CAP_TRUNCATED` is not defined. I based my work of off obsproject/obs-studio#8375

Co-authored-by: Michael Welter <DaWelter@users.noreply.github.com>
  • Loading branch information
arjo129 and DaWelter authored Jun 30, 2024
1 parent 23d9951 commit aa7742c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/h264decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ H264Decoder::H264Decoder()
if (!context)
throw H264InitFailure("cannot allocate context");

#if LIBAVCODEC_VERSION_MAJOR < 60
// Note: CODEC_CAP_TRUNCATED was prefixed with AV_...
if(codec->capabilities & AV_CODEC_CAP_TRUNCATED) {
context->flags |= AV_CODEC_FLAG_TRUNCATED;
}
}
#endif

int err = avcodec_open2(context, codec, nullptr);
if (err < 0)
Expand Down Expand Up @@ -169,4 +171,4 @@ int row_size(const AVFrame& f)
void disable_logging()
{
av_log_set_level(AV_LOG_QUIET);
}
}

0 comments on commit aa7742c

Please sign in to comment.