Skip to content

Commit

Permalink
ffpmeg 5.1 compat, remove access to private member -- #11
Browse files Browse the repository at this point in the history
  • Loading branch information
x42 committed Sep 2, 2022
1 parent a3f85c5 commit d35bc4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 11 additions & 0 deletions libharvid/ffcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,16 @@ register_codecs_compat ()
#endif
}

static inline void
maybe_avcodec_flush_buffers(AVCodecContext *avctx)
{
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 26, 100)
if (avctx->codec->flush) {
avcodec_flush_buffers(avctx);
}
#else
avcodec_flush_buffers(avctx);
#endif
}

#endif /* FFCOMPAT_H */
8 changes: 2 additions & 6 deletions libharvid/ffdecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,7 @@ static int my_seek_frame (ffst *ff, AVPacket *packet, int64_t framenumber) {

if (ff->avprev < 0 || ff->avprev >= timestamp || ((ff->avprev + 32 * ff->tpf) < timestamp)) {
rv = av_seek_frame(ff->pFormatCtx, ff->videoStream, timestamp, AVSEEK_FLAG_BACKWARD) ;
if (ff->pCodecCtx->codec->flush) {
avcodec_flush_buffers(ff->pCodecCtx);
}
maybe_avcodec_flush_buffers (ff->pCodecCtx);
}

ff->avprev = -1;
Expand Down Expand Up @@ -683,9 +681,7 @@ static int my_seek_frame (ffst *ff, AVPacket *packet, int64_t framenumber) {
fprintf(stdout, " PTS mismatch want: %"PRId64" got: %"PRId64" -> re-seek\n", timestamp, pts);
// re-seek - make a guess, since we don't know the keyframe interval
rv = av_seek_frame(ff->pFormatCtx, ff->videoStream, MAX(0, timestamp - ff->tpf * 25), AVSEEK_FLAG_BACKWARD) ;
if (ff->pCodecCtx->codec->flush) {
avcodec_flush_buffers(ff->pCodecCtx);
}
maybe_avcodec_flush_buffers (ff->pCodecCtx);
if (rv < 0) {
return -3;
}
Expand Down

0 comments on commit d35bc4e

Please sign in to comment.