Wohlstand / libADLMIDI

A Software MIDI Synthesizer library with OPL3 (YMF262) emulator
GNU Lesser General Public License v3.0
174 stars 17 forks source link

Plugin for VLC Media player #38

Closed Wohlstand closed 9 months ago

Wohlstand commented 6 years ago

This plugin must allows to play MIDI files through libADLMIDI by using of VLC Media Player.

The working example is stored in utils/vlc_plugin folder. Buildable on Linux with libvlccore-dev and libvlc-dev packages. Possibly on other platforms which is not tested.

Wohlstand commented 6 years ago

CMake build of VLC plugin has been fixed! Thanks for the help to Rémi Denis-Courmont on VideoLAN forums: https://forum.videolan.org/viewtopic.php?f=2&t=143829

freq-mod commented 6 years ago

Attempt to build plugin under Windows 7 x64 results in: vlc

Linux Mint works 100% fine.

Wohlstand commented 6 years ago

Yeah, I never tested the plugin on Windows, and also, it supports VLC 2.2.2 version only yet, and I will need to add support for latest version by macros.

Wohlstand commented 6 years ago

Okay, on the official forum one of developers have pointed me libvlc_version.h header which will help me to make a codec be compatible with both legacy and moder versions of VLC. However, for now, I will need to install more fresh VLC build than my in-system to port current stuff into it.

freq-mod commented 6 years ago

OK WTF: (building plugin under Ubuntu 18.04 running inside virtualbox) vlc

Wohlstand commented 6 years ago

Which version of VLC? At me was VLC 2.2.2 and the newer VLC has different API I must to support to fix this

freq-mod commented 6 years ago

Aw shiiit, it's 3.0.1 :(

Wohlstand commented 6 years ago

At me is a second thing that is built from source VLC 3 I wasn't tested. For now I working on a fix for some, and I'll also try to port to it

Wohlstand commented 6 years ago

Just now I have added support for VLC 3! @papiezak , please pull fresh stuff and try again! :wink: (I have used this file as example to compare: https://github.com/videolan/vlc/blob/master/modules/codec/fluidsynth.c as originally my codec is directly basing of FluidSynth's plugin)

Wohlstand commented 6 years ago

Gotta to backport my changes to OPNMIDI

Wohlstand commented 6 years ago

it was built without of UI, but even that it now successfully plays music from a console by my plugins! :wink: So, feel free to test arround plugin again, also try to test it on Windows too...

freq-mod commented 6 years ago

OK, let me check...

EDIT: Removing "@" tokens from libvlc_version.h gives EXACTLY the same errors as my first attempts to build plugin under Win 7

Wohlstand commented 6 years ago

How to install: Just put the "libadlmidi_plugin.so" (or SymLink to it) into /usr/lib/vlc/plugins/codec/"

About of win build: I'll need to test this out by myself, this still look weird...

freq-mod commented 6 years ago

On Ubuntu 18.04 (and most likely in an upcoming Linux Mint 19) it goes to /usr/lib/x86_64-linux-gnu/vlc/plugins/codec. That's why I had slight problems

freq-mod commented 6 years ago

Drums on at least this particular XG midi are broken at one point. (time position around 00:46) Example: badxg.zip

Wohlstand commented 6 years ago

@papiezak , I have tried this file, and it seems works fine. What do you think is wrong? Try out super-fresh version. I have tested in both VLC and built-in MIDI player.

freq-mod commented 6 years ago

Yeah, sorry my bad, it was a very stupid bug in my DMXOPL mod bank. But is it okay if I don't see any public codec settings except (custom) bank selection and amount of chips? Your main post says it's done already :suspect:

Wohlstand commented 6 years ago

You right, damn, forgot to add them, gonna to add them on a quick hand... P.S. Is VLC plugin now buildable on Windows? (Did you tested build recently?)

freq-mod commented 6 years ago

last time i used windows (a week ago) it wasnt :disappointed: but I will check, give me some time...

Wohlstand commented 6 years ago

_2018-06-25_15-10-17 Now setup is this

Wohlstand commented 6 years ago

Similar for OPNMIDI: _2018-06-25_15-30-19

freq-mod commented 6 years ago

aaand here goes nothing: vlc win 10

OK am I doing something wrong?

Wohlstand commented 6 years ago

Did you even installed VLC SDK? (or build it from sources)

Wohlstand commented 6 years ago

Or maybe need to append more search paths here? https://github.com/Wohlstand/libADLMIDI/blob/ccfb31ab7cd966aeddb106f7a1c3efec6834dccc/cmake/FindLIBVLC.cmake#L35-L44

freq-mod commented 6 years ago

vlc take 2

Wohlstand commented 6 years ago

Oh, one thing you need, you need to use MinGW-w64, you need to compile complete VLC from sources. And yeah, as I looked VLC docs, VLC no more supports vanilla MinGW (32-bit only) toolchains.

freq-mod commented 6 years ago

I didn't compile VLC or its SDK from sources. SDK files, devel headers, import libraries come with official 7-zip package.

Wohlstand commented 6 years ago

Anyway, try to use MinGW-w64 toolchain instead of vanilla. I have tried to find their pre-built SDK package, but found nothing, can you link me that? I wanna try to build the things by myself...

freq-mod commented 6 years ago

Grab it then - https://get.videolan.org/vlc/3.0.3/win32/vlc-3.0.3-win32.7z Speaking of plugin - vlc take 3

everything is installed correctly, findLIBVLC.cmake is modified appropriately ( I think), libvlccore is taken from that package and it's the result.

Wohlstand commented 6 years ago

Seems you are trying to link x86_64 with X86_32, carefully check the archirecture of toolchain and the package (try to use 64-bit MinGW-w64 and 64-bit VLC), or be sure you have 32-bit MinGW-w64 toolchain.

freq-mod commented 6 years ago

Yeah, getting closer and closer vlc take 4

freq-mod commented 6 years ago

To sum up: CMake produces objects.a, which contains libadlmidi.c.obj that stops compilation, crying about "undefined references to vlc_module_name". I can't even open it, and objects.a is simply not there while building under linux.

Wohlstand commented 6 years ago

Okay, just for a test, Try to use autotools build, but before install ADLMIDI library into system first. If it will work, then I have some to change in the build code...

Wohlstand commented 6 years ago

It's possibly I need to try review actual pkgconfig on Windows, it's possibly I forgot to link some important libraries...

freq-mod commented 6 years ago

On Windows I can't get past: ./configure: line 16932: syntax error near unexpected token 'vlc,' ./configure: line 16932: PKG_CHECK_MODULES(vlc, vlc-plugin >= 2.0)'

vlc sdk installed as previously, I even downloaded mingw-w64-x86_64-vlc package, still nothing. On Linux autotools build works fine.

Wohlstand commented 6 years ago

Okay, a bit later I'll give you some test of CMake script you can try out...

freq-mod commented 6 years ago

Yeah, post it here, I can try out

freq-mod commented 5 years ago

Looks like 4cf3a53 fixed Windows build, I just compiled OPNMIDI vlc plugin, just I need to check out if it works...

freq-mod commented 5 years ago

... and looks like it doesn't. Sure, it compiles just fine, but VLC doesn't see/load it when placed in vlc/plugins/codec/. Maybe I'm doing sth wrong, though I doubt it at this point

Wohlstand commented 5 years ago

What vlc --list command is showing?

Wohlstand commented 5 years ago

One note: if it's some Windows-specific MIDI plugin to play MIDI files via MIDI-Out, you need to rename it (for example, into .dll-off) and restart VLC.

freq-mod commented 5 years ago

What vlc --list command is showing?

https://pastebin.com/ys8nbYx3 - there is no mention of any OPN/OPL/MIDI codec, fluidsynth was disabled by me

Wohlstand commented 5 years ago

Looks like for Windows I need something different than this: https://forum.videolan.org/viewtopic.php?f=2&t=143829 to let built plugin be visible by VLC... Until this thread, Linux build was also invisible to VLC until missing macros was defined...

jpcima commented 5 years ago

I don't have the setup to build this but maybe post the compiled dll so I can try analyzing this.

Wohlstand commented 5 years ago

Together with built ADLMIDI/OPNMIDI DLL plugin, also please send any random DLL that is working on VLC.

freq-mod commented 5 years ago

as you wish - codecs.zip

jpcima commented 5 years ago

They're mixed architectures, look. I think you have built the wrong target.

libadlmidi_plugin.dll:    PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows
libfluidsynth_plugin.dll: PE32+ executable (DLL) (console) x86-64, for MS Windows
libopnmidi_plugin.dll:    PE32 executable (DLL) (console) Intel 80386 (stripped to external PDB), for MS Windows
Wohlstand commented 5 years ago

Ha-ha :fox_face: :rofl: So easy! I have though it was something worse, like missing macros... Try with 32-bit VLC build, or rebuild with MinGW-w64 for 64-bit arch...

Wohlstand commented 5 years ago

So, let's for case of AppVeyor CI deploy the VLC plugins? (when we will take them working)

freq-mod commented 5 years ago

damn i'm ashamed of myself 🤦‍♂️ how could I forgot i want to force 64 bit vlc to read 32-bit plugins.. or not. interesting, still it's invisible to win32 vlc... i'm lost at this point