|
51 | 51 | import logging
|
52 | 52 | logger = logging.getLogger(__name__)
|
53 | 53 |
|
54 |
| -__version__ = "4.0.0-dev-20729-g085d1ae71b121" |
55 |
| -__libvlc_version__ = "4.0.0-dev-20729-g085d1ae71b" |
56 |
| -__generator_version__ = "1.21" |
57 |
| -build_date = "Wed Nov 16 12:04:29 2022 4.0.0-dev-20729-g085d1ae71b" |
| 54 | +__version__ = "4.0.0122" |
| 55 | +__libvlc_version__ = "4.0.0" |
| 56 | +__generator_version__ = "1.22" |
| 57 | +build_date = "Wed Apr 19 17:27:22 2023 4.0.0" |
58 | 58 |
|
59 | 59 | # The libvlc doc states that filenames are expected to be in UTF8, do
|
60 | 60 | # not rely on sys.getfilesystemencoding() which will be confused,
|
@@ -732,12 +732,14 @@ class MediaParseFlag(_Enum):
|
732 | 732 | 0x2: 'fetch_local',
|
733 | 733 | 0x4: 'fetch_network',
|
734 | 734 | 0x8: 'do_interact',
|
| 735 | + 0x10: 'no_skip', |
735 | 736 | }
|
736 | 737 | MediaParseFlag.do_interact = MediaParseFlag(0x8)
|
737 | 738 | MediaParseFlag.fetch_local = MediaParseFlag(0x2)
|
738 | 739 | MediaParseFlag.fetch_network = MediaParseFlag(0x4)
|
739 | 740 | MediaParseFlag.local = MediaParseFlag(0x0)
|
740 | 741 | MediaParseFlag.network = MediaParseFlag(0x1)
|
| 742 | +MediaParseFlag.no_skip = MediaParseFlag(0x10) |
741 | 743 |
|
742 | 744 | class MediaParsedStatus(_Enum):
|
743 | 745 | '''Parse status used sent by libvlc_media_parse_request() or returned by
|
@@ -1015,23 +1017,43 @@ class VideoAdjustOption(_Enum):
|
1015 | 1017 | VideoAdjustOption.Hue = VideoAdjustOption(3)
|
1016 | 1018 | VideoAdjustOption.Saturation = VideoAdjustOption(4)
|
1017 | 1019 |
|
1018 |
| -class AudioOutputChannel(_Enum): |
1019 |
| - '''Audio channels. |
| 1020 | +class AudioOutputStereomode(_Enum): |
| 1021 | + '''Audio stereo modes. |
1020 | 1022 | '''
|
1021 | 1023 | _enum_names_ = {
|
1022 |
| - -1: 'Error', |
1023 |
| - 1: 'Stereo', |
1024 |
| - 2: 'RStereo', |
1025 |
| - 3: 'Left', |
1026 |
| - 4: 'Right', |
1027 |
| - 5: 'Dolbys', |
| 1024 | + 0: 'AudioStereoMode_Unset', |
| 1025 | + 1: 'AudioStereoMode_Stereo', |
| 1026 | + 2: 'AudioStereoMode_RStereo', |
| 1027 | + 3: 'AudioStereoMode_Left', |
| 1028 | + 4: 'AudioStereoMode_Right', |
| 1029 | + 5: 'AudioStereoMode_Dolbys', |
| 1030 | + 7: 'AudioStereoMode_Mono', |
1028 | 1031 | }
|
1029 |
| -AudioOutputChannel.Dolbys = AudioOutputChannel(5) |
1030 |
| -AudioOutputChannel.Error = AudioOutputChannel(-1) |
1031 |
| -AudioOutputChannel.Left = AudioOutputChannel(3) |
1032 |
| -AudioOutputChannel.RStereo = AudioOutputChannel(2) |
1033 |
| -AudioOutputChannel.Right = AudioOutputChannel(4) |
1034 |
| -AudioOutputChannel.Stereo = AudioOutputChannel(1) |
| 1032 | +AudioOutputStereomode.AudioStereoMode_Dolbys = AudioOutputStereomode(5) |
| 1033 | +AudioOutputStereomode.AudioStereoMode_Left = AudioOutputStereomode(3) |
| 1034 | +AudioOutputStereomode.AudioStereoMode_Mono = AudioOutputStereomode(7) |
| 1035 | +AudioOutputStereomode.AudioStereoMode_RStereo = AudioOutputStereomode(2) |
| 1036 | +AudioOutputStereomode.AudioStereoMode_Right = AudioOutputStereomode(4) |
| 1037 | +AudioOutputStereomode.AudioStereoMode_Stereo = AudioOutputStereomode(1) |
| 1038 | +AudioOutputStereomode.AudioStereoMode_Unset = AudioOutputStereomode(0) |
| 1039 | + |
| 1040 | +class AudioOutputMixmode(_Enum): |
| 1041 | + '''Audio mix modes. |
| 1042 | + ''' |
| 1043 | + _enum_names_ = { |
| 1044 | + 0: 'AudioMixMode_Unset', |
| 1045 | + 1: 'AudioMixMode_Stereo', |
| 1046 | + 2: 'AudioMixMode_Binaural', |
| 1047 | + 3: 'AudioMixMode_4_0', |
| 1048 | + 4: 'AudioMixMode_5_1', |
| 1049 | + 5: 'AudioMixMode_7_1', |
| 1050 | + } |
| 1051 | +AudioOutputMixmode.AudioMixMode_4_0 = AudioOutputMixmode(3) |
| 1052 | +AudioOutputMixmode.AudioMixMode_5_1 = AudioOutputMixmode(4) |
| 1053 | +AudioOutputMixmode.AudioMixMode_7_1 = AudioOutputMixmode(5) |
| 1054 | +AudioOutputMixmode.AudioMixMode_Binaural = AudioOutputMixmode(2) |
| 1055 | +AudioOutputMixmode.AudioMixMode_Stereo = AudioOutputMixmode(1) |
| 1056 | +AudioOutputMixmode.AudioMixMode_Unset = AudioOutputMixmode(0) |
1035 | 1057 |
|
1036 | 1058 | class MediaPlayerRole(_Enum):
|
1037 | 1059 | '''Media player roles.
|
@@ -1149,6 +1171,28 @@ class PictureType(_Enum):
|
1149 | 1171 |
|
1150 | 1172 | # End of generated enum types #
|
1151 | 1173 |
|
| 1174 | +class EventUnion(ctypes.Union): |
| 1175 | + _fields_ = [ |
| 1176 | + ('meta_type', ctypes.c_uint ), |
| 1177 | + ('new_child', ctypes.c_uint ), |
| 1178 | + ('new_duration', ctypes.c_longlong), |
| 1179 | + ('new_status', ctypes.c_int ), |
| 1180 | + ('media', ctypes.c_void_p ), |
| 1181 | + ('new_state', ctypes.c_uint ), |
| 1182 | + # FIXME: Media instance |
| 1183 | + ('new_cache', ctypes.c_float ), |
| 1184 | + ('new_position', ctypes.c_float ), |
| 1185 | + ('new_time', ctypes.c_longlong), |
| 1186 | + ('new_title', ctypes.c_int ), |
| 1187 | + ('new_seekable', ctypes.c_longlong), |
| 1188 | + ('new_pausable', ctypes.c_longlong), |
| 1189 | + ('new_scrambled', ctypes.c_longlong), |
| 1190 | + ('new_count', ctypes.c_longlong), |
| 1191 | + # FIXME: Skipped MediaList and MediaListView... |
| 1192 | + ('filename', ctypes.c_char_p ), |
| 1193 | + ('new_length', ctypes.c_longlong), |
| 1194 | + ] |
| 1195 | + |
1152 | 1196 | # Generated structs #
|
1153 | 1197 | class TrackDescription(ctypes.Structure):
|
1154 | 1198 | '''Description for video, audio tracks and subtitles. it contains
|
@@ -1188,11 +1232,13 @@ class Event(ctypes.Structure):
|
1188 | 1232 | '''A libvlc event.
|
1189 | 1233 | '''
|
1190 | 1234 | pass
|
1191 |
| -Event._fields_ = ( |
1192 |
| - ('type', ctypes.c_int), |
1193 |
| - ('p_obj', ctypes.c_void_p), |
1194 |
| - ('meta_type', Meta), |
1195 |
| - ) |
| 1235 | + _fields_ = [ |
| 1236 | + ('type', EventType ), |
| 1237 | + ('object', ctypes.c_void_p), |
| 1238 | + ('u', EventUnion ), |
| 1239 | + ] |
| 1240 | + |
| 1241 | + |
1196 | 1242 |
|
1197 | 1243 | class MediaStats(ctypes.Structure):
|
1198 | 1244 | '''Libvlc media or media_player state.
|
@@ -4395,19 +4441,50 @@ def audio_set_volume(self, i_volume):
|
4395 | 4441 | return libvlc_audio_set_volume(self, i_volume)
|
4396 | 4442 |
|
4397 | 4443 |
|
4398 |
| - def audio_get_channel(self): |
4399 |
| - '''Get current audio channel. |
4400 |
| - @return: the audio channel See L{AudioOutputChannel}. |
| 4444 | + def audio_get_stereomode(self): |
| 4445 | + '''Get current audio stereo-mode. |
| 4446 | + @return: the audio stereo-mode, See L{AudioOutputStereomode}. |
| 4447 | + @version: LibVLC 4.0.0 or later. |
4401 | 4448 | '''
|
4402 |
| - return libvlc_audio_get_channel(self) |
| 4449 | + return libvlc_audio_get_stereomode(self) |
4403 | 4450 |
|
4404 | 4451 |
|
4405 |
| - def audio_set_channel(self, channel): |
4406 |
| - '''Set current audio channel. |
4407 |
| - @param channel: the audio channel, See L{AudioOutputChannel}. |
| 4452 | + def audio_set_stereomode(self, mode): |
| 4453 | + '''Set current audio stereo-mode. |
| 4454 | + @param channel: the audio stereo-mode, See L{AudioOutputStereomode}. |
4408 | 4455 | @return: 0 on success, -1 on error.
|
| 4456 | + @version: LibVLC 4.0.0 or later. |
| 4457 | + ''' |
| 4458 | + return libvlc_audio_set_stereomode(self, mode) |
| 4459 | + |
| 4460 | + |
| 4461 | + def audio_get_mixmode(self): |
| 4462 | + '''Get current audio mix-mode. |
| 4463 | + @return: the audio mix-mode, See L{AudioOutputMixmode}. |
| 4464 | + @version: LibVLC 4.0.0 or later. |
| 4465 | + ''' |
| 4466 | + return libvlc_audio_get_mixmode(self) |
| 4467 | + |
| 4468 | + |
| 4469 | + def audio_set_mixmode(self, mode): |
| 4470 | + '''Set current audio mix-mode. |
| 4471 | + By default (libvlc_AudioMixMode_Unset), the audio output will keep its |
| 4472 | + original channel configuration (play stereo as stereo, or 5.1 as 5.1). Yet, |
| 4473 | + the OS and Audio API might refuse a channel configuration and asks VLC to |
| 4474 | + adapt (Stereo played as 5.1 or vice-versa). |
| 4475 | + This function allows to force a channel configuration, it will only work if |
| 4476 | + the OS and Audio API accept this configuration (otherwise, it won't have any |
| 4477 | + effects). Here are some examples: |
| 4478 | + - Play multi-channels (5.1, 7.1...) as stereo (libvlc_AudioMixMode_Stereo) |
| 4479 | + - Play Stereo or 5.1 as 7.1 (libvlc_AudioMixMode_7_1) |
| 4480 | + - Play multi-channels as stereo with a binaural effect |
| 4481 | + (libvlc_AudioMixMode_Binaural). It might be selected automatically if the |
| 4482 | + OS and Audio API can detect if a headphone is plugged. |
| 4483 | + @param channel: the audio mix-mode, See L{AudioOutputMixmode}. |
| 4484 | + @return: 0 on success, -1 on error. |
| 4485 | + @version: LibVLC 4.0.0 or later. |
4409 | 4486 | '''
|
4410 |
| - return libvlc_audio_set_channel(self, channel) |
| 4487 | + return libvlc_audio_set_mixmode(self, mode) |
4411 | 4488 |
|
4412 | 4489 |
|
4413 | 4490 | def audio_get_delay(self):
|
@@ -4908,6 +4985,18 @@ def libvlc_retain(p_instance):
|
4908 | 4985 | None, Instance)
|
4909 | 4986 | return f(p_instance)
|
4910 | 4987 |
|
| 4988 | +def libvlc_abi_version(): |
| 4989 | + '''Get the ABI version of the libvlc library. |
| 4990 | + This is different than the VLC version, which is the version of the whole |
| 4991 | + VLC package. The value is the same as LIBVLC_ABI_VERSION_INT used when |
| 4992 | + compiling. |
| 4993 | + @return: a value with the following mask in hexadecimal 0xFF000000: major VLC version, similar to VLC major version, 0x00FF0000: major ABI version, incremented incompatible changes are added, 0x0000FF00: minor ABI version, incremented when new functions are added 0x000000FF: micro ABI version, incremented with new release/builds @note This the same value as the .so version but cross platform. |
| 4994 | + ''' |
| 4995 | + f = _Cfunctions.get('libvlc_abi_version', None) or \ |
| 4996 | + _Cfunction('libvlc_abi_version', (), None, |
| 4997 | + ctypes.c_int) |
| 4998 | + return f() |
| 4999 | + |
4911 | 5000 | def libvlc_add_intf(p_instance, name):
|
4912 | 5001 | '''Try to start a user interface for the libvlc instance.
|
4913 | 5002 | @param p_instance: the instance.
|
@@ -7648,26 +7737,63 @@ def libvlc_audio_set_volume(p_mi, i_volume):
|
7648 | 7737 | ctypes.c_int, MediaPlayer, ctypes.c_int)
|
7649 | 7738 | return f(p_mi, i_volume)
|
7650 | 7739 |
|
7651 |
| -def libvlc_audio_get_channel(p_mi): |
7652 |
| - '''Get current audio channel. |
| 7740 | +def libvlc_audio_get_stereomode(p_mi): |
| 7741 | + '''Get current audio stereo-mode. |
7653 | 7742 | @param p_mi: media player.
|
7654 |
| - @return: the audio channel See L{AudioOutputChannel}. |
| 7743 | + @return: the audio stereo-mode, See L{AudioOutputStereomode}. |
| 7744 | + @version: LibVLC 4.0.0 or later. |
7655 | 7745 | '''
|
7656 |
| - f = _Cfunctions.get('libvlc_audio_get_channel', None) or \ |
7657 |
| - _Cfunction('libvlc_audio_get_channel', ((1,),), None, |
7658 |
| - ctypes.c_int, MediaPlayer) |
| 7746 | + f = _Cfunctions.get('libvlc_audio_get_stereomode', None) or \ |
| 7747 | + _Cfunction('libvlc_audio_get_stereomode', ((1,),), None, |
| 7748 | + AudioOutputStereomode, MediaPlayer) |
7659 | 7749 | return f(p_mi)
|
7660 | 7750 |
|
7661 |
| -def libvlc_audio_set_channel(p_mi, channel): |
7662 |
| - '''Set current audio channel. |
| 7751 | +def libvlc_audio_set_stereomode(p_mi, mode): |
| 7752 | + '''Set current audio stereo-mode. |
7663 | 7753 | @param p_mi: media player.
|
7664 |
| - @param channel: the audio channel, See L{AudioOutputChannel}. |
| 7754 | + @param channel: the audio stereo-mode, See L{AudioOutputStereomode}. |
7665 | 7755 | @return: 0 on success, -1 on error.
|
| 7756 | + @version: LibVLC 4.0.0 or later. |
7666 | 7757 | '''
|
7667 |
| - f = _Cfunctions.get('libvlc_audio_set_channel', None) or \ |
7668 |
| - _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None, |
7669 |
| - ctypes.c_int, MediaPlayer, ctypes.c_int) |
7670 |
| - return f(p_mi, channel) |
| 7758 | + f = _Cfunctions.get('libvlc_audio_set_stereomode', None) or \ |
| 7759 | + _Cfunction('libvlc_audio_set_stereomode', ((1,), (1,),), None, |
| 7760 | + ctypes.c_int, MediaPlayer, AudioOutputStereomode) |
| 7761 | + return f(p_mi, mode) |
| 7762 | + |
| 7763 | +def libvlc_audio_get_mixmode(p_mi): |
| 7764 | + '''Get current audio mix-mode. |
| 7765 | + @param p_mi: media player. |
| 7766 | + @return: the audio mix-mode, See L{AudioOutputMixmode}. |
| 7767 | + @version: LibVLC 4.0.0 or later. |
| 7768 | + ''' |
| 7769 | + f = _Cfunctions.get('libvlc_audio_get_mixmode', None) or \ |
| 7770 | + _Cfunction('libvlc_audio_get_mixmode', ((1,),), None, |
| 7771 | + AudioOutputMixmode, MediaPlayer) |
| 7772 | + return f(p_mi) |
| 7773 | + |
| 7774 | +def libvlc_audio_set_mixmode(p_mi, mode): |
| 7775 | + '''Set current audio mix-mode. |
| 7776 | + By default (libvlc_AudioMixMode_Unset), the audio output will keep its |
| 7777 | + original channel configuration (play stereo as stereo, or 5.1 as 5.1). Yet, |
| 7778 | + the OS and Audio API might refuse a channel configuration and asks VLC to |
| 7779 | + adapt (Stereo played as 5.1 or vice-versa). |
| 7780 | + This function allows to force a channel configuration, it will only work if |
| 7781 | + the OS and Audio API accept this configuration (otherwise, it won't have any |
| 7782 | + effects). Here are some examples: |
| 7783 | + - Play multi-channels (5.1, 7.1...) as stereo (libvlc_AudioMixMode_Stereo) |
| 7784 | + - Play Stereo or 5.1 as 7.1 (libvlc_AudioMixMode_7_1) |
| 7785 | + - Play multi-channels as stereo with a binaural effect |
| 7786 | + (libvlc_AudioMixMode_Binaural). It might be selected automatically if the |
| 7787 | + OS and Audio API can detect if a headphone is plugged. |
| 7788 | + @param p_mi: media player. |
| 7789 | + @param channel: the audio mix-mode, See L{AudioOutputMixmode}. |
| 7790 | + @return: 0 on success, -1 on error. |
| 7791 | + @version: LibVLC 4.0.0 or later. |
| 7792 | + ''' |
| 7793 | + f = _Cfunctions.get('libvlc_audio_set_mixmode', None) or \ |
| 7794 | + _Cfunction('libvlc_audio_set_mixmode', ((1,), (1,),), None, |
| 7795 | + ctypes.c_int, MediaPlayer, AudioOutputMixmode) |
| 7796 | + return f(p_mi, mode) |
7671 | 7797 |
|
7672 | 7798 | def libvlc_audio_get_delay(p_mi):
|
7673 | 7799 | '''Get current audio delay.
|
@@ -8299,7 +8425,8 @@ def libvlc_renderer_discoverer_list_release(pp_services, i_count):
|
8299 | 8425 | # libvlc_video_output_set_resize_cb
|
8300 | 8426 | # libvlc_video_set_output_callbacks
|
8301 | 8427 |
|
8302 |
| -# 54 function(s) not wrapped as methods: |
| 8428 | +# 55 function(s) not wrapped as methods: |
| 8429 | +# libvlc_abi_version |
8303 | 8430 | # libvlc_audio_equalizer_get_band_count
|
8304 | 8431 | # libvlc_audio_equalizer_get_band_frequency
|
8305 | 8432 | # libvlc_audio_equalizer_get_preset_count
|
|
0 commit comments