ffmpeg-debug-qp icon indicating copy to clipboard operation
ffmpeg-debug-qp copied to clipboard

Does not work with ffmpeg v5

Open slhck opened this issue 3 years ago • 0 comments

Some APIs have been removed and the build fails:

cc -I/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include -Wall -g   -c -o ffmpeg_debug_qp.o ffmpeg_debug_qp.c
ffmpeg_debug_qp.c:35:8: error: must use 'struct' tag to refer to type 'AVCodecContext'
static AVCodecContext *video_dec_ctx = NULL;
       ^
       struct 
ffmpeg_debug_qp.c:67:34: error: incomplete definition of type 'struct AVCodecContext'
    int mb_width = (video_dec_ctx->width + 15) / 16;
                    ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:68:35: error: incomplete definition of type 'struct AVCodecContext'
    int mb_height = (video_dec_ctx->height + 15) / 16;
                     ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:75:15: error: implicit declaration of function 'avcodec_decode_video2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
              ^
ffmpeg_debug_qp.c:80:26: error: incomplete definition of type 'struct AVCodecContext'
        if (video_dec_ctx->width != width || video_dec_ctx->height != height ||
            ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:80:59: error: incomplete definition of type 'struct AVCodecContext'
        if (video_dec_ctx->width != width || video_dec_ctx->height != height ||
                                             ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:81:26: error: incomplete definition of type 'struct AVCodecContext'
            video_dec_ctx->pix_fmt != pix_fmt) {
            ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:90:34: error: incomplete definition of type 'struct AVCodecContext'
                    video_dec_ctx->width, video_dec_ctx->height,
                    ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:90:56: error: incomplete definition of type 'struct AVCodecContext'
                    video_dec_ctx->width, video_dec_ctx->height,
                                          ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:91:54: error: incomplete definition of type 'struct AVCodecContext'
                    av_get_pix_fmt_name(video_dec_ctx->pix_fmt));
                                        ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:99:17: error: implicit declaration of function 'av_frame_get_pkt_size' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                av_frame_get_pkt_size(frame));
                ^
ffmpeg_debug_qp.c:99:17: note: did you mean 'av_image_get_linesize'?
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavutil/imgutils.h:59:5: note: 'av_image_get_linesize' declared here
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
    ^
ffmpeg_debug_qp.c:118:31: error: must use 'struct' tag to refer to type 'AVCodecContext'
                              AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
                              ^
                              struct 
ffmpeg_debug_qp.c:136:13: warning: assigning to 'AVCodec *' (aka 'struct AVCodec *') from 'const AVCodec *' (aka 'const struct AVCodec *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        dec = avcodec_find_decoder(st->codecpar->codec_id);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ffmpeg_debug_qp.c:145:20: error: implicit declaration of function 'avcodec_alloc_context3' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        *dec_ctx = avcodec_alloc_context3(dec);
                   ^
ffmpeg_debug_qp.c:145:20: note: did you mean 'avio_alloc_context'?
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavformat/avio.h:409:14: note: 'avio_alloc_context' declared here
AVIOContext *avio_alloc_context(
             ^
ffmpeg_debug_qp.c:145:18: warning: incompatible integer to pointer conversion assigning to 'struct AVCodecContext *' from 'int' [-Wint-conversion]
        *dec_ctx = avcodec_alloc_context3(dec);
                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
ffmpeg_debug_qp.c:153:20: error: implicit declaration of function 'avcodec_parameters_to_context' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) {
                   ^
ffmpeg_debug_qp.c:153:20: note: did you mean 'avcodec_parameters_copy'?
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec_par.h:222:5: note: 'avcodec_parameters_copy' declared here
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
    ^
ffmpeg_debug_qp.c:162:20: error: implicit declaration of function 'avcodec_open2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
                   ^
ffmpeg_debug_qp.c:162:20: note: did you mean 'avio_open2'?
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavformat/avio.h:684:5: note: 'avio_open2' declared here
int avio_open2(AVIOContext **s, const char *url, int flags,
    ^
ffmpeg_debug_qp.c:203:5: error: implicit declaration of function 'av_register_all' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    av_register_all();
    ^
ffmpeg_debug_qp.c:223:22: error: incomplete definition of type 'struct AVCodecContext'
        video_dec_ctx->debug = debug_level;
        ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:225:22: error: incomplete definition of type 'struct AVCodecContext'
        video_dec_ctx->thread_count = 1;
        ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
ffmpeg_debug_qp.c:228:30: error: incomplete definition of type 'struct AVCodecContext'
        width = video_dec_ctx->width;
                ~~~~~~~~~~~~~^
/opt/homebrew/Cellar/ffmpeg/5.0.1_2/include/libavcodec/codec.h:195:8: note: forward declaration of 'struct AVCodecContext'
struct AVCodecContext;
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make: *** [ffmpeg_debug_qp.o] Error 1

slhck avatar Jun 30 '22 06:06 slhck