Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in [OUT] parameters handling #287

Open
oaubert opened this issue Nov 5, 2024 · 5 comments
Open

Regression in [OUT] parameters handling #287

oaubert opened this issue Nov 5, 2024 · 5 comments

Comments

@oaubert
Copy link
Owner

oaubert commented Nov 5, 2024

The libvlc_log_get_context is improperly wrapped in the latest bindings version: parameters marked as [OUT] are not properly parsed as such, as indicated by the generate.py -dc output, as well as the generated code. The current version
https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L7305 states that the parameter signature is ( (1,), (1,), (1,), (2,), ), (3 in-parameters, 1 out parameter) while the previous version of the bindings (before the tree-sitter change) correctly gets ((1,), (2,), (2,), (2,),) :

def libvlc_log_get_context(ctx):

This is a regression, which also happens to other functions (e.g. libvlc_media_tracks_get, libvlc_media_slaves_get...) but sometimes is correct (e.g. libvlc_video_get_size, libvlc_video_get_cursor).

@jc-kynesim
Copy link

Is there a workaround or fix for this? I've got a small test framework that relies on libvlc_log_get_context to scrape debug info from some vlc modules that I've written. My python C binding knowledge is very limited so please assume I know nothing as far as that goes.
Thanks

@oaubert
Copy link
Owner Author

oaubert commented Feb 14, 2025

There is a manual workaround for now, by monkey-patching the vlc function after loading the vlc module

    """Gets log message debug infos (patched).
    """
   f = _Cfunctions.get('libvlc_log_get_context', None) or \
        _Cfunction('libvlc_log_get_context', ((1,), (2,), (2,), (2,),), None,
                    None, Log_ptr, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint))
    return f(ctx, module, file)

vlc.libvlc_log_get_context =  libvlc_log_get_context

(waiting for some time to dedicate for properly fixing this, or some contribution for it)

@oaubert
Copy link
Owner Author

oaubert commented Feb 15, 2025

@yanns1 could maybe have some ideas about it.

@jc-kynesim
Copy link

I can't help with a proper fix (sorry), but your workaround is great. Thanks.

@yanns1
Copy link
Contributor

yanns1 commented Feb 18, 2025

See #289.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants