Zren / bomi

bomi - a powerful and easy-to-use multimedia player
http://bomi-player.github.io
Other
1 stars 1 forks source link

mpv v0.24.0 #1

Open Zren opened 6 years ago

Zren commented 6 years ago

libswresample checks are hardcoded so the flag is no longer needed. Note that while this fixes compiling a build, there is currently a runtime segfault when loading a video.

Caused by: https://github.com/mpv-player/mpv/commit/cfda696580a994055e4532a273ce86c867ffdac4

Edit: This is probably because I haven't been properly building libmpv since v0.23.0.

There isn't a segfault if you load bomi without a video, but it will segfault when you open one after.

gdb build/bomi then type run [Enter] told me that the error was in VideoProcessor::open

I added #include "misc/log.hpp" and DECLARE_LOG_CONTEXT(VideoProcessor) to the top of videoprocessor.cpp, then littered the function with _Info("VideoProcessor::open");

The offending line is p->vp->d->vf = vf; which means p->vp is probably foobarred. There's some magical casting going on for p->vp.

auto VideoProcessor::open(vf_instance *vf) -> int
{
    _Info("VideoProcessor::open");
    auto p = reinterpret_cast<bomi_vf_priv*>(vf->priv);
    _Info("reinterpret_cast");
    p->vp = address_cast<VideoProcessor*>(p->address);
    _Info("address_cast");
    p->vp->d->vf = vf; // <= Segfault
    _Info("p->vp->d->vf");
    auto d = p->vp->d;
    _Info("p->vp->d");
    if (p->swdec_deint)
        d->deint_swdec = DeintOption::fromString(_L(p->swdec_deint));
    if (p->hwdec_deint)
        d->deint_hwdec = DeintOption::fromString(_L(p->hwdec_deint));
    _Info("hwdec_deint");

I had no idea what commit broke it. Normally I have a keyword to go on, but the history of vf.c and vf.h didn't reveal anything obvious. So I had to test every single commit between mpv 23 and 24.

I wrote a script ./test to run:

./checkoutmpv $1
./configure --prefix=/usr \
    && make -Winvalid-pch
testVideo="/home/chris/Videos/testvid.mp4"
build/bomi "$testVideo"

Then I ran cd src/mpv && git log --oneline > testall

I trimmed the testall file to only list the commits between 23 and 24. Then I reverse all lines (so it's chronological). I then converted each line into:

# ./test "bbdecb7" "hwdec: add a AVBufferRef(AVHWDeviceContext) field"
# ./test "6b00663" "vo_opengl: hwdec_cuda: export AVHWDeviceContext"
# ./test "3a85976" "cuda: fix AVHWFramesContext initialization"
# ./test "8a23892" "vo_opengl: hwdec_cuda: add yuv420p support"

# ./test "91fb707" "vf_lavfi: switch to AVBufferSrcParameters"

./test "1b1771f" "video: support filtering hardware frames via libavfilter"

./test "083e470" "manpage: add comment about --alpha being broken on X11/EGL/Mesa"
./test "fb6481e" "stream_bluray: use proper 0-based idx"
./test "64041f9" "cuda: fix 10 bit decoding"

Using binary search, I eventually found the offending commit that broke things.

Caused by: https://github.com/mpv-player/mpv/commit/1b1771f2a709269440ccbf2fdc27cc7f5bb7248a

video: support filtering hardware frames via libavfilter Requires a bunch of hacks:

^--- Yay...

After reading the commit, I realized I probably should have started testing with the 2 or 3 commits (and the commit that preceded them) that touched vf.c and vf.h. Oh well.

I'm not quite sure what to do here...

SolarAquarion commented 6 years ago

video/ffmpegfilters.hpp:9:10: fatal error: libavfilter/avfiltergraph.h: No such file or directory

include <libavfilter/avfiltergraph.h>

git removed avfiltergraph

Zren commented 6 years ago

?, The submodule src/mpv is at v0.24.0 right?

SolarAquarion commented 6 years ago

Yes, and mpv is up to 0.28

On Dec 28, 2017 2:13 PM, "Chris Holland" notifications@github.com wrote:

?, The submodule src/mpv is at v0.24.0 right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Zren/bomi/issues/1#issuecomment-354341463, or mute the thread https://github.com/notifications/unsubscribe-auth/AFD6iGOW64bfQeYtYbvy5trknTmsyoMlks5tE-g8gaJpZM4RMBk2 .

Zren commented 6 years ago

I know mpv just released 28, however I'm attempting to compile at mpv 22 and fix those errors.

Then compile against mpv 23 and fix it's errors.

Then compile against mpv 24... etc until I manage to reach the latest mpv 28.

This process lets me fix 2-3 errors at a time rather than 20-30 that jumping straight to v28 might give.

Right now it compiles against 23 and runs... "okayish" (I think I broke some of the hardware and audio acceleration). When I compile against mpv 24 though, while it does finish compiling okay, there's a runtime error when a video is loaded which will crash bomi. This is where I'm currently stuck.

I'm not even trying to fix errors for v28 until I fix this one.

SolarAquarion commented 6 years ago

so, why don't you change the configure to do static builds of ffmpeg as you creep up the line?

On Thu, Dec 28, 2017 at 2:22 PM, Chris Holland notifications@github.com wrote:

I know mpv just released 28, however I'm attempting to compile at mpv 22 and fix those errors.

Then compile against mpv 23 and fix it's errors.

Then compile against mpv 24... etc until I manage to reach the latest mpv 28.

This process lets me fix 2-3 errors at a time rather than 20-30 that jumping straight to v28 might give.

Right now it compiles against 23 and runs... "okayish" (I think I broke some of the hardware and audio acceleration). When I compile against mpv 24 though, there's a runtime error when a video is loaded, which will crash bomi. This is where I'm currently stuck.

I'm not even trying to fix errors for v28 until I fix this one.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Zren/bomi/issues/1#issuecomment-354342911, or mute the thread https://github.com/notifications/unsubscribe-auth/AFD6iMMnen7fenVV7k7ypG2SU1s1DBLOks5tE-qKgaJpZM4RMBk2 .

Zren commented 6 years ago

How will that help me compile against mpv 24, 25, 26, 27, 28?

It's possible that building later mpv releases won't work with my Ubuntu LTS version of ffmpeg version 2.8.11-0ubuntu0.16.04.1, but that's a worry for another day since I'm currently dealing with a runtime error caused by Bomi's code. Bomi is doing some crazy pointer casting where the segfault takes place.

It's caused by this commit https://github.com/mpv-player/mpv/commit/1b1771f2a709269440ccbf2fdc27cc7f5bb7248a since playing a video works fine when compiled against the mpv commit before it.

SolarAquarion commented 6 years ago

The filters are deprecated as far as I know

On Dec 28, 2017 3:16 PM, "Chris Holland" notifications@github.com wrote:

How will that help me compile against mpv 24, 25, 26, 27, 28?

It's possible that building later mpv releases won't work with my Ubuntu LTS version of ffmpeg version 2.8.11-0ubuntu0.16.04.1, but that's a worry for another day since I'm currently dealing with a runtime error caused by Bomi's code. Bomi is doing some crazy pointer casting where the segfault takes place.

It's caused by this commit mpv-player/mpv@1b1771f https://github.com/mpv-player/mpv/commit/1b1771f2a709269440ccbf2fdc27cc7f5bb7248a since playing a video works fine when compiled against the mpv commit before it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Zren/bomi/issues/1#issuecomment-354351824, or mute the thread https://github.com/notifications/unsubscribe-auth/AFD6iFUuWkvdjf243xzRPRk6WYXo7GqVks5tE_cjgaJpZM4RMBk2 .

SolarAquarion commented 6 years ago

what should i modify to make bomi build with these settings CFLAGS='-I/usr/include/ffmpeg2.8' \ LDFLAGS='-L/usr/lib/ffmpeg2.8' \ PKG_CONFIG_PATH='/usr/lib/ffmpeg2.8/pkgconfig'

SolarAquarion commented 6 years ago

Huh, mpv 24.0 does not support ffmpeg2.8 it needs 2.6

SolarAquarion commented 6 years ago

In file included from video/ffmpegfilters.hpp:7:0, from video/ffmpegfilters.cpp:1: ../mpv/video/mp_image_pool.h:12:69: error: expected ‘,’ or ‘...’ before ‘new’ void mp_image_pool_add(struct mp_image_pool pool, struct mp_image new); ^~~ In file included from ../mpv/video/mp_image.h:28:0, from video/mpimage.hpp:5, from video/ffmpegfilters.hpp:13, from video/ffmpegfilters.cpp:1: ../mpv/video/csputils.h:129:76: error: expected ‘,’ or ‘...’ before ‘new’ void mp_colorspace_merge(struct mp_colorspace orig, struct mp_colorspace new); ^~~ /usr/bin/g++ -c -include release/bomi -pipe -I/usr/include/ffmpeg2.8 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fvisibility=hidden -I/usr/include/chardet -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/alsa -D_REENTRANT -I/usr/include/samba-4.0 -Wno-non-template-friend -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DUSING_PCH -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_X11EXTRAS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_DBUS_LIB -DQT_CORE_LIB -I. -I../mpv -I../mpv/build -Ikiss_fft -isystem /usr/include/qt -isystem /usr/include/qt/QtQuick -isystem /usr/include/qt/QtSvg -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtX11Extras -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtQml -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtSql -isystem /usr/include/qt/QtXml -isystem /usr/include/qt/QtDBus -isystem /usr/include/qt/QtCore -Irelease -isystem /usr/include/libdrm -I. -I/usr/lib/qt/mkspecs/linux-g++ -o release/video/softwaredeinterlacer.o video/softwaredeinterlacer.cpp video/ffmpegfilters.cpp:12:13: warning: ‘mp_image null_mp_image(void, void ()(void))’ defined but not used [-Wunused-function] static auto null_mp_image(void arg, void(free)(void)) -> mp_image ^~~~~ make[2]: [Makefile.Release:3113: release/video/ffmpegfilters.o] Error 1 make[2]: Waiting for unfinished jobs.... In file included from ../mpv/video/mp_image.h:28:0, from video/mpimage.hpp:5, from video/videofilter.hpp:4, from video/softwaredeinterlacer.hpp:4, from video/softwaredeinterlacer.cpp:1: ../mpv/video/csputils.h:129:76: error: expected ‘,’ or ‘...’ before ‘new’ void mp_colorspace_merge(struct mp_colorspace orig, struct mp_colorspace new); ^~~ In file included from video/ffmpegfilters.hpp:7:0, from video/softwaredeinterlacer.cpp:3: ../mpv/video/mp_image_pool.h:12:69: error: expected ‘,’ or ‘...’ before ‘new’ void mp_image_pool_add(struct mp_image_pool pool, struct mp_image new); ^~~

Got this from using 2.8

SolarAquarion commented 6 years ago

ialog/aboutdialog.cpp:4:10: fatal error: ../mpv/build/version.h: No such file or directory

include "../mpv/build/version.h"

      ^~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. make[2]: [Makefile.Release:3591: release/dialog/aboutdialog.o] Error 1 make[2]: Waiting for unfinished jobs.... pref/prefdialog.cpp: In lambda function: pref/prefdialog.cpp:336:17: warning: this statement may fall through [-Wimplicit-fallthrough=] hide();


pref/prefdialog.cpp:337:9: note: here
         case BBox::Apply:
         ^~~~
pref/prefdialog.cpp:342:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
             hide();
             ~~~~^~
pref/prefdialog.cpp:343:9: note: here
         case BBox::Reset:
         ^~~~
make[2]: Leaving directory '/home/solaraquarion/build/bomi-git/src/bomi/src/bomi'
make[1]: *** [Makefile:40: release] Error 2
make[1]: Leaving directory '/home/solaraquarion/build/bomi-git/src/bomi/src/bomi'
make: *** [Makefile:40: build/build/bomi/bomi] Error 2

i patched that file now i get this
SolarAquarion commented 6 years ago

echo "#define VERSION 0.24" > build/version.h

i decided to this but i still get a build fail

Zren commented 6 years ago

Shit, you were right on the money. I totally missed this error at the end of mpv's ./waf configure $args

Unable to find development files for some of the required FFmpeg/Libav libraries. You need at least FFmpeg 3.2.2 or Libav 12. Aborting.

Looks like I can't compile mpv 23 and above with Ubuntu LTS. I'll either need to figure out how to build ffmpeg and link it somehow. It looks like download-ffmpeg downloads a tarball. build-ffmpeg will build it, but it also installs it which isn't desirable as I don't want it to possible break other apps.

Zren commented 6 years ago

I need to somehow edit the makefile to break when happens. Adding exit 1 to build-mpv.in didn't work.

SolarAquarion commented 6 years ago

You can statically link ffmpeg. But, you should go to the next Ubuntu lts above 16.04 especially if you're developing a moving target

On Dec 29, 2017 9:33 PM, "Chris Holland" notifications@github.com wrote:

I need to somehow edit the makefile to break when happens. Adding exit 1 to build-mpv.in didn't work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Zren/bomi/issues/1#issuecomment-354522815, or mute the thread https://github.com/notifications/unsubscribe-auth/AFD6iDsskLdKZcqpDzoaDnbfj92rA_Fqks5tFaD3gaJpZM4RMBk2 .

SolarAquarion commented 6 years ago

../video/vaapi.c: In function ‘va_initialize’: ../video/vaapi.c:192:5: error: too few arguments to function ‘vaSetErrorCallback’ vaSetErrorCallback(va_error_callback); ^~~~~~ In file included from ../video/vaapi.h:24:0, from ../video/vaapi.c:22: /usr/include/va/va.h:271:19: note: declared here VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void user_context); ^~~~~~ ../video/vaapi.c:193:5: error: too few arguments to function ‘vaSetInfoCallback’ vaSetInfoCallback(va_info_callback); ^~~~~ In file included from ../video/vaapi.h:24:0, from ../video/vaapi.c:22: /usr/include/va/va.h:277:19: note: declared here VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void user_context); ^~~~~

Waf: Leaving directory `/home/solaraquarion/build/bomi-git/src/bomi/src/mpv/build' Build failed

i created a ffmpeg3.2 and a 3.4 and i'm getting that