So far I have already made several extensions based on following Lua functions:
'''var.add_callback( object, name, function, data )
var.del_callback( object, name, function, data )'''
I have just found out that they do not work in VLC2.1. They both disappeared also from global VLC Lua README.txt
This feature is able to add some dynamics in VLC Extensions. Subtitler (lite), Time and Previous frame work quite well. Sampler has some troubles to run properly in VLC2, but I hope that someone could help me to make it better.
I really have put all my effort in VLC Lua scripting to attract more scriptwriters that could create and share new scripts and ideas. I do not think that add_callback and del_callback are that bad that should be removed from Lua. Please, enable them again. I still hope that custom Lua scripting in VLC has a future. Please, please, ...
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
In my opinion, mwait() and msleep() should not be used by extensions anyway. They incite polling which is a bad and harmful programming practice. If you need to wait for events, then implement correct event handling.
Now how can I implement "correct event handling" wihout callbacks? No timers, no callbacks, ... My scripts cannot work in new VLC2.1
Is there anything else I could use instead of them in the scripts, that at least would be able to work automatically periodically within running extension?
Now how can I implement "correct event handling" without callbacks?
There will probably never be a one-size-fits-all answer to this generic programming question. There are a few useful patterns for event handling, one of them callbacks. Indeed, VLC relies mainly on callbacks.
However, most of VLC "events" are not exposed to Lua scripts, rather only to native C/C++ plugins. In many cases, Lua is inadequate, due to performance, locking or other constraints. In other cases, glue code would have to be written. For the record, the original VLC Lua hobbyist developer left the project a few years ago and never "finished" the Lua support.
No timers, no callbacks, ...
Timers are not a good pattern for events handling.
My scripts cannot work in new VLC2.1
At this point in time, I believe input events require native code, either plugin-specific or in the form of Lua glue code. I do not have a magic solution to offer.
They allow us to write interesting extensions. I would like to use my scripts based on them also in future versions of VLC. I would like to improve them and also I would like to write some more interesting scripts.
For example, already it is possible to add custom hotkeys in an extension. Mac OS X users can operate the extension without dialog box controls only using the hotkeys, so extensions can be made universally for Windows, Linux and OS X.
Please, keep the continuity of these 2 functions also in coming official VLC 2.1
Once it is there, then somebody with the right skills could see how it works and also could decide to fix it in the future.
For example, already it is possible to add custom hotkeys in an extension.
With the current design, the list of hotkey actions has to be hard-coded in the libvlccore run-time. Furthermore, Lua has no support for custom configuration items this far, due to limitations of the plugins cache.
So in fact, custom hotkeys are not currently possible, not for Lua scripts, and not even for external native plugins.
Please, keep the continuity of these 2 functions also in coming official VLC 2.1
"Please" get someone to post a sane patch on vlc-devel then.
I really need function "get movie time by hotkey" in my videoediting workflow… and several years I use these «time2clipboard» (modified) Lua scripts with hotkey-callbacks for this.
What is most adequate solution for this problem? Write a native plugin (OMG)? Or may be VLC 2.1 have these functions («time2clipboard») from the box?
Correct me if I'm wrong, but as far as I can see here, there's no easy (LUA) way to implement "Click to Play/Pause" functionality in 2.1 and so on.
Will this general video player function be implemented soon ? I couldn't find it on the roadmap...
Commit message for removing add_callback and del_callback in modules/lua/libs/variables.c found:
commit fe5df3d5b1bbe4918e0997c1f9875b2f1eab281aAuthor: Rémi Denis-Courmont <remi@remlab.net>Date: Mon Mar 26 17:38:49 2012 +0300 lua: remove add_callback and del_callback add_callback could not work correctly with the (lack of) Lua threading support. Fortunately, it was not in use. del_callback depends on add_callback.
Because 2.1 broke network access, I didn't notice that this functionality also disappeared. Now that 2.2 has fixed it, I was looking forward to being able to use my simple extension - which synchronizes playback status over the internet - on the latest VLC again. Too bad there is now no way to get notified when the playback position or status has changed, which I was doing by requesting a callback on "intf-event". (I am unsure whether the 'playing_changed' or 'meta_changed' functions are supposed to satisfy this use case, because they do not appear to actually work on OS X.)
I don't know enough about VLC internals to suggest a proper solution, but it is clear how much you care about extensions...
I did look at trying to add asynchronous notifications of playback changes (with a goal of adding MQTT support) but found the internals of VLC very difficult to work with, even for simple additions.
Adding back callbacks to Lua would make things substantially easier.
I don't know enough about VLC internals to suggest a proper solution, but it is clear how much you care about extensions...
Shocking news flash: Lua is mostly unmaintained. The guy that wrote the original VLC Lua plugin left without traces. The guy behind extensions pretty much left without even finishing what he promised. The guy who had effecitvely taken over maintaince of VLC Lua has not participated for a long time as well (I guess he is busy with his real life).
As you know, "nobody" is not good at "caring about" anything. If you actually care, then please do take over the maintainance and send patches, or hire someone else to do so. Otherwise I would argue that you do not care, and should not be surprised that none else does.
Replying to [comment:14 nicholas humfrey]:
Adding back callbacks to Lua would make things substantially easier.
As pointed out already earlier (at least in the linked mailing list discussion), even if Lua had working callbacks, the set of callback names and values changes with each version - sometimes even with minor/stable releases.
So while it would enable certain "features" in Lua, it would break extensions every so often. Not that much easier really.
Pierre Ynardchanged title from Lua Extensions, VLC2.1: var.add_callback( ), var.del_callback( ) do not work to Lua Extensions: bring back variable callback API
changed title from Lua Extensions, VLC2.1: var.add_callback( ), var.del_callback( ) do not work to Lua Extensions: bring back variable callback API