Python Forum
Can't work out parameter format for LibVLC functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't work out parameter format for LibVLC functions
#1
I just need help understanding how to provide the right variable types, by referring to the Python API for LibVLC.

I'm using the vlc.py Python wrapper, and I can't work out what format the parameters need to be in when calling "libvlc_video_set_aspect_ratio".

vlc.libvlc_video_set_aspect_ratio(player, "16:9")
Gives the error;
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

vlc.libvlc_video_set_aspect_ratio(player, c_char_p('16:9'))
Gives the error;
"builtins.TypeError: bytes or integer address expected instead of str instance"

Here is the documentation for libvlc_video_set_aspect_ratio:
def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): 
    '''Set new video aspect ratio. 
    @param p_mi: the media player. 
    @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. 
    ''' 
    f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ 
        _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, 
                    None, MediaPlayer, ctypes.c_char_p) 
    return f(p_mi, psz_aspect) 
Reply


Messages In This Thread
Can't work out parameter format for LibVLC functions - by Domarius - Apr-28-2019, 07:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [ERROR] ParamValidationError: Parameter validation failed: Invalid type for parameter gdbengo 3 11,232 Dec-26-2022, 08:48 AM
Last Post: ibreeden
  main libvlc error: stale plugins cache: schascheck 2 7,767 Dec-27-2020, 05:24 PM
Last Post: schascheck
  User functions don't work: Baldev10 7 3,202 Aug-18-2020, 08:34 PM
Last Post: deanhystad
  I writte 5 functions (def) but on 6 don't work. Someone can help me? perrud 2 2,824 Feb-03-2018, 10:20 AM
Last Post: perrud

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020