x42 / xjadeo

X JAck viDEo mOnitor: a tool that displays a video clip in sync with an external time source (jack-transport, LTC and MTC). Applications include: soundtrack composition/editing, video monitoring and -installations.
http://xjadeo.sf.net/
GNU General Public License v2.0
42 stars 7 forks source link

Unable to build against FFmpeg5.1 #51

Closed umlaeute closed 2 years ago

umlaeute commented 2 years ago

Similar to https://github.com/x42/harvid/issues/11, xjadeo also fails to build with FFmpeg-5.1 (see the harvid issue for details).

here's a more radical approach, that just unconditionally calls avcodec_flush_buffers() for all ffmpeg-versions:

--- xjadeo.orig/src/xjadeo/xjadeo.c
+++ xjadeo/src/xjadeo/xjadeo.c
@@ -575,9 +575,7 @@
            seek = av_seek_frame (pFormatCtx, videoStream, fidx[framenumber].seekpts, AVSEEK_FLAG_BACKWARD);
        }

-       if (pCodecCtx->codec->flush) {
-           avcodec_flush_buffers (pCodecCtx);
-       }
+       avcodec_flush_buffers (pCodecCtx);

        if (seek < 0) {
            if (!want_quiet)
@@ -915,9 +913,7 @@
            error |= 16;
            break;
        }
-       if (pCodecCtx->codec->flush) {
-           avcodec_flush_buffers (pCodecCtx);
-       }
+       avcodec_flush_buffers (pCodecCtx);

        int err = 0;
        int bailout = 100;
@@ -1053,9 +1049,7 @@
            printf("NOBYTE 2\n");
            break;
        }
-       if (pCodecCtx->codec->flush) {
-           avcodec_flush_buffers (pCodecCtx);
-       }
+       avcodec_flush_buffers (pCodecCtx);

        int64_t pts = AV_NOPTS_VALUE;
        while (!got_pic) {
@@ -1118,9 +1112,7 @@
        } else {
            av_seek_frame (pFormatCtx, videoStream, fidx[i].seekpts, AVSEEK_FLAG_BACKWARD);
        }
-       if (pCodecCtx->codec->flush) {
-           avcodec_flush_buffers (pCodecCtx);
-       }
+       avcodec_flush_buffers (pCodecCtx);
        while (!got_pic) {

            if (av_read_frame (pFormatCtx, &packet) < 0) {
@@ -1192,9 +1184,7 @@
    }

    av_seek_frame (pFormatCtx, videoStream, 0, AVSEEK_FLAG_BACKWARD);
-   if (pCodecCtx->codec->flush) {
-       avcodec_flush_buffers (pCodecCtx);
-   }
+   avcodec_flush_buffers (pCodecCtx);
    if (!error) {
        scan_complete = 1;
    }