marlam / bino

3D video player with support for 180°/360° video and Virtual Reality
https://bino3d.org
GNU General Public License v3.0
45 stars 14 forks source link

Doesn't compile with ffmpeg 5.0 #12

Closed berolinux closed 2 years ago

berolinux commented 2 years ago

bino doesn't compile with the recently released ffmpeg 5.0. Some changes are trivial (remove av_register_all(), additional const-ness, ...), but some are problematic (removal of AVPicture).

media_object.cpp:348:5: error: use of undeclared identifier 'av_register_all'
    av_register_all();
    ^
media_object.cpp:796:19: error: assigning to 'AVInputFormat *' from 'const AVInputFormat *' discards qualifiers
        iformat = av_find_input_format("libdc1394");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media_object.cpp:799:19: error: assigning to 'AVInputFormat *' from 'const AVInputFormat *' discards qualifiers
        iformat = av_find_input_format("x11grab");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media_object.cpp:807:19: error: assigning to 'AVInputFormat *' from 'const AVInputFormat *' discards qualifiers
        iformat = av_find_input_format("video4linux2");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media_object.cpp:824:27: error: assigning to 'AVInputFormat *' from 'const AVInputFormat *' discards qualifiers
                iformat = av_find_input_format("mjpeg");
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media_object.cpp:886:70: error: no member named 'codec' in 'AVStream'
        AVCodecContext *codec_ctx = _ffmpeg->format_ctx->streams[i]->codec;
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
media_object.cpp:887:18: error: cannot initialize a variable of type 'AVCodec *' with an rvalue of type 'const AVCodec *'
        AVCodec *codec = (codec_ctx->codec_id == AV_CODEC_ID_TEXT
                 ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
media_object.cpp:940:13: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
            av_init_packet(&(_ffmpeg->video_packets[j]));
            ^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
media_object.cpp:951:34: error: use of undeclared identifier 'avpicture_get_size'
            int frame_bufsize = (avpicture_get_size(frame_fmt,
                                 ^
media_object.cpp:954:45: error: unknown type name 'AVPicture'
            avpicture_fill(reinterpret_cast<AVPicture *>(_ffmpeg->video_buffered_frames[j]), _ffmpeg->video_buffers[j],
                                            ^
media_object.cpp:954:13: error: use of undeclared identifier 'avpicture_fill'
            avpicture_fill(reinterpret_cast<AVPicture *>(_ffmpeg->video_buffered_frames[j]), _ffmpeg->video_buffers[j],
            ^
media_object.cpp:963:35: error: use of undeclared identifier 'avpicture_get_size'
                int sws_bufsize = avpicture_get_size(AV_PIX_FMT_BGRA,
                                  ^
media_object.cpp:975:49: error: unknown type name 'AVPicture'
                avpicture_fill(reinterpret_cast<AVPicture *>(_ffmpeg->video_sws_frames[j]), _ffmpeg->video_sws_buffers[j],
                                                ^
media_object.cpp:975:17: error: use of undeclared identifier 'avpicture_fill'
                avpicture_fill(reinterpret_cast<AVPicture *>(_ffmpeg->video_sws_frames[j]), _ffmpeg->video_sws_buffers[j],
                ^
media_object.cpp:1355:21: error: use of undeclared identifier 'av_dup_packet'; did you mean 'av_init_packet'?
                if (av_dup_packet(&packet) < 0)
                    ^~~~~~~~~~~~~
                    av_init_packet
/usr/include/libavcodec/packet.h:506:6: note: 'av_init_packet' declared here
void av_init_packet(AVPacket *pkt);
     ^
media_object.cpp:1355:21: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
                if (av_dup_packet(&packet) < 0)
                    ^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
media_object.cpp:1355:44: error: invalid operands to binary expression ('void' and 'int')
                if (av_dup_packet(&packet) < 0)
                    ~~~~~~~~~~~~~~~~~~~~~~ ^ ~
media_object.cpp:1384:25: error: use of undeclared identifier 'av_dup_packet'; did you mean 'av_init_packet'?
                    if (av_dup_packet(&packet) < 0)
                        ^~~~~~~~~~~~~
                        av_init_packet
/usr/include/libavcodec/packet.h:506:6: note: 'av_init_packet' declared here
void av_init_packet(AVPacket *pkt);
     ^
media_object.cpp:1384:25: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
                    if (av_dup_packet(&packet) < 0)
                        ^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
media_object.cpp:1384:48: error: invalid operands to binary expression ('void' and 'int')
                    if (av_dup_packet(&packet) < 0)
                        ~~~~~~~~~~~~~~~~~~~~~~ ^ ~
media_object.cpp:1414:25: error: use of undeclared identifier 'av_dup_packet'; did you mean 'av_init_packet'?
                    if (av_dup_packet(&packet) < 0)
                        ^~~~~~~~~~~~~
                        av_init_packet
/usr/include/libavcodec/packet.h:506:6: note: 'av_init_packet' declared here
void av_init_packet(AVPacket *pkt);
     ^
media_object.cpp:1414:25: warning: 'av_init_packet' is deprecated [-Wdeprecated-declarations]
                    if (av_dup_packet(&packet) < 0)
                        ^
/usr/include/libavcodec/packet.h:505:1: note: 'av_init_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
media_object.cpp:1414:48: error: invalid operands to binary expression ('void' and 'int')
                    if (av_dup_packet(&packet) < 0)
                        ~~~~~~~~~~~~~~~~~~~~~~ ^ ~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
marlam commented 2 years ago

Yes, the FFmpeg APIs changed again. And there is no porting guide again. And the few example code snippets that exist are all broken again. And the documentation is still entirely unusable - again. I am tired of this. I currently don't have the time to work on this; if I had that kind of time I would consider moving away from FFmpeg - far, far away.

For now, it would be ideal if somebody familiar with the new FFmpeg APIs fixes compilation. I currently cannot do it myself, and in the long run I need to think about alternatives.

gruenfron commented 2 years ago

Hello marlam,

only yesterday i discovered the bino project and wanted immediately to try it out. Since I am on Manjaro-Cinnamon (Arch based) there is an AUR package available, unfortunately compilation failed due to above reason...

Luckily there is an ffmpeg4.4 package available which seems to be required by java8-openjfx, opencascade, opencv and vlc .So with minor changes I could compile bino and run it:

https://aur.archlinux.org/packages/bino#comment-868926

However, thanks for bino! :smile:

marlam commented 2 years ago

Thanks for this info. For Bino to stay relevant, a large-scale modernization is necessary (update FFmpeg, drop GLEW, support OpenGL ES (or move from OpenGL to Vulkan), replace Equalizer, modernize Audio output, switch from autoconf to cmake, move to an "in-screen" GUI for better usability on more systems, and probably more). This may amount to a rewrite in large parts. At some point I'll have to bite the bullet and start that, but I cannot foresee when that will be possible.

marlam commented 2 years ago

The rewrite I mentioned in now underway. The next version of Bino will be based on Qt 6, including replacing FFmpeg with QtMultimedia. This will fix these problems. An initial version is already in the main git repository and ready for testing.