我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用winreg.error()。
def media_new_fd(self, fd): '''Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are supported where available. Directory descriptors are supported on systems that provide fdopendir(). Sockets are supported on all platforms where they are file descriptors, i.e. all except Windows. @note: This library will B{not} automatically close the file descriptor under any circumstance. Nevertheless, a file descriptor can usually only be rendered once in a media player. To render it a second time, the file descriptor should probably be rewound to the beginning with lseek(). See L{media_release}. @param fd: open file descriptor. @return: the newly created media or None on error. @version: LibVLC 1.1.5 and later. ''' return libvlc_media_new_fd(self, fd)
def media_discoverer_new(self, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to events in order to be notified of the discoverer state. You should also attach to media_list events in order to be notified of new items discovered. You need to call L{media_discoverer_start}() in order to start the discovery. See L{media_discoverer_media_list} See L{media_discoverer_event_manager} See L{media_discoverer_start}. @param psz_name: service name; use L{media_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. @return: media discover object or None in case of error. @version: LibVLC 3.0.0 or later. ''' return libvlc_media_discoverer_new(self, str_to_bytes(psz_name))
def parse_with_options(self, parse_flag): '''Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. This method is the extended version of L{parse_async}(). To track when this is over you can listen to libvlc_MediaParsedChanged event. However if this functions returns an error, you will not receive this event. It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All these flags can be combined. By default, media is parsed if it's a local file. See libvlc_MediaParsedChanged See L{get_meta} See L{tracks_get} See libvlc_media_parse_flag_t. @param parse_flag: parse options: @return: -1 in case of error, 0 otherwise. @version: LibVLC 3.0.0 or later. ''' return libvlc_media_parse_with_options(self, parse_flag)
def audio_output_device_get(self): '''Get the current audio output device identifier. This complements L{audio_output_device_set}(). @warning: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifiers (e.g. those that were previously retrieved by a call to L{audio_output_device_enum} or L{audio_output_device_list_get}) to find the current audio output device. It is possible that the selected audio output device changes (an external change) without a call to L{audio_output_device_set}. That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen. @return: the current audio output device identifier None if no device is selected or in case of error (the result must be released with free() or L{free}()). @version: LibVLC 3.0.0 or later. ''' return libvlc_audio_output_device_get(self)
def libvlc_media_new_fd(p_instance, fd): '''Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are supported where available. Directory descriptors are supported on systems that provide fdopendir(). Sockets are supported on all platforms where they are file descriptors, i.e. all except Windows. @note: This library will B{not} automatically close the file descriptor under any circumstance. Nevertheless, a file descriptor can usually only be rendered once in a media player. To render it a second time, the file descriptor should probably be rewound to the beginning with lseek(). See L{libvlc_media_release}. @param p_instance: the instance. @param fd: open file descriptor. @return: the newly created media or None on error. @version: LibVLC 1.1.5 and later. ''' f = _Cfunctions.get('libvlc_media_new_fd', None) or \ _Cfunction('libvlc_media_new_fd', ((1,), (1,),), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_int) return f(p_instance, fd)
def libvlc_media_discoverer_new(p_inst, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to events in order to be notified of the discoverer state. You should also attach to media_list events in order to be notified of new items discovered. You need to call L{libvlc_media_discoverer_start}() in order to start the discovery. See L{libvlc_media_discoverer_media_list} See L{libvlc_media_discoverer_event_manager} See L{libvlc_media_discoverer_start}. @param p_inst: libvlc instance. @param psz_name: service name; use L{libvlc_media_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. @return: media discover object or None in case of error. @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_media_discoverer_new', None) or \ _Cfunction('libvlc_media_discoverer_new', ((1,), (1,),), class_result(MediaDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name)
def libvlc_audio_output_device_get(mp): '''Get the current audio output device identifier. This complements L{libvlc_audio_output_device_set}(). @warning: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifiers (e.g. those that were previously retrieved by a call to L{libvlc_audio_output_device_enum} or L{libvlc_audio_output_device_list_get}) to find the current audio output device. It is possible that the selected audio output device changes (an external change) without a call to L{libvlc_audio_output_device_set}. That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen. @param mp: media player. @return: the current audio output device identifier None if no device is selected or in case of error (the result must be released with free() or L{libvlc_free}()). @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_audio_output_device_get', None) or \ _Cfunction('libvlc_audio_output_device_get', ((1,),), None, ctypes.c_char_p, MediaPlayer) return f(mp)
def libvlc_media_player_set_equalizer(p_mi, p_equalizer): '''Apply new equalizer settings to a media player. The equalizer is first created by invoking L{libvlc_audio_equalizer_new}() or L{libvlc_audio_equalizer_new_from_preset}(). It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not. Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any. If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. @param p_mi: opaque media player handle. @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. @return: zero on success, -1 on error. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_media_player_set_equalizer', None) or \ _Cfunction('libvlc_media_player_set_equalizer', ((1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_void_p) return f(p_mi, p_equalizer)
def libvlc_vlm_change_media(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param p_instance: the instance. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_change_media', None) or \ _Cfunction('libvlc_vlm_change_media', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)
def libvlc_vlm_show_media(p_instance, psz_name): '''Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. @param p_instance: the instance. @param psz_name: the name of the media, if the name is an empty string, all media is described. @return: string with information about named media, or None on error. ''' f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_name)
def media_discoverer_new(self, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to events in order to be notified of the discoverer state. You should also attach to media_list events in order to be notified of new items discovered. You need to call L{media_discoverer_start}() in order to start the discovery. See L{media_discoverer_media_list} See L{media_discoverer_event_manager} See L{media_discoverer_start}. @param psz_name: service name. @return: media discover object or None in case of error. @version: LibVLC 3.0.0 or later. ''' return libvlc_media_discoverer_new(self, str_to_bytes(psz_name))
def set_equalizer(self, p_equalizer): '''Apply new equalizer settings to a media player. The equalizer is first created by invoking L{audio_equalizer_new}() or L{audio_equalizer_new_from_preset}(). It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not. Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any. If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. @return: zero on success, -1 on error. @version: LibVLC 2.2.0 or later. ''' return libvlc_media_player_set_equalizer(self, p_equalizer) # LibVLC __version__ functions #
def libvlc_media_new_location(p_instance, psz_mrl): '''Create a media with a certain given media resource location, for instance a valid URL. @note: To refer to a local file with this function, the file://... URI syntax B{must} be used (see IETF RFC3986). We recommend using L{libvlc_media_new_path}() instead when dealing with local files. See L{libvlc_media_release}. @param p_instance: the instance. @param psz_mrl: the media location. @return: the newly created media or None on error. ''' f = _Cfunctions.get('libvlc_media_new_location', None) or \ _Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_mrl)
def libvlc_media_parse_with_options(p_md, parse_flag): '''Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. This method is the extended version of L{libvlc_media_parse_async}(). To track when this is over you can listen to libvlc_MediaParsedChanged event. However if this functions returns an error, you will not receive this event. It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All these flags can be combined. By default, media is parsed if it's a local file. See libvlc_MediaParsedChanged See L{libvlc_media_get_meta} See L{libvlc_media_tracks_get} See libvlc_media_parse_flag_t. @param p_md: media descriptor object. @param parse_flag: parse options: @return: -1 in case of error, 0 otherwise. @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_media_parse_with_options', None) or \ _Cfunction('libvlc_media_parse_with_options', ((1,), (1,),), None, ctypes.c_int, Media, MediaParseFlag) return f(p_md, parse_flag)
def libvlc_media_discoverer_new(p_inst, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to events in order to be notified of the discoverer state. You should also attach to media_list events in order to be notified of new items discovered. You need to call L{libvlc_media_discoverer_start}() in order to start the discovery. See L{libvlc_media_discoverer_media_list} See L{libvlc_media_discoverer_event_manager} See L{libvlc_media_discoverer_start}. @param p_inst: libvlc instance. @param psz_name: service name. @return: media discover object or None in case of error. @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_media_discoverer_new', None) or \ _Cfunction('libvlc_media_discoverer_new', ((1,), (1,),), class_result(MediaDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name)
def libvlc_vlm_add_broadcast(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Add a broadcast, with one input. @param p_instance: the instance. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_vlm_add_broadcast', None) or \ _Cfunction('libvlc_vlm_add_broadcast', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)
def add_intf(self, name): '''Try to start a user interface for the libvlc instance. @param name: interface name, or None for default. @return: 0 on success, -1 on error. ''' return libvlc_add_intf(self, str_to_bytes(name))
def media_new_location(self, psz_mrl): '''Create a media with a certain given media resource location, for instance a valid URL. @note: To refer to a local file with this function, the file://... URI syntax B{must} be used (see IETF RFC3986). We recommend using L{media_new_path}() instead when dealing with local files. See L{media_release}. @param psz_mrl: the media location. @return: the newly created media or None on error. ''' return libvlc_media_new_location(self, str_to_bytes(psz_mrl))
def media_new_path(self, path): '''Create a media for a certain file path. See L{media_release}. @param path: local filesystem path. @return: the newly created media or None on error. ''' return libvlc_media_new_path(self, str_to_bytes(path))
def media_new_as_node(self, psz_name): '''Create a media as an empty node with a given name. See L{media_release}. @param psz_name: the name of the node. @return: the new empty media or None on error. ''' return libvlc_media_new_as_node(self, str_to_bytes(psz_name))
def media_discoverer_list_get(self, i_cat, ppp_services): '''Get media discoverer services by category. @param i_cat: category of services to fetch. @param ppp_services: address to store an allocated array of media discoverer services (must be freed with L{media_discoverer_list_release}() by the caller) [OUT]. @return: the number of media discoverer services (zero on error). @version: LibVLC 3.0.0 and later. ''' return libvlc_media_discoverer_list_get(self, i_cat, ppp_services)
def media_library_new(self): '''Create an new Media Library object. @return: a new object or None on error. ''' return libvlc_media_library_new(self)
def audio_output_list_get(self): '''Gets the list of available audio output modules. @return: list of available audio outputs. It must be freed with In case of error, None is returned. ''' return libvlc_audio_output_list_get(self)
def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux): '''Add a vod, with one input. @param psz_name: the name of the new vod media. @param psz_input: the input MRL. @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new vod. @param psz_mux: the muxer of the vod media. @return: 0 on success, -1 on error. ''' return libvlc_vlm_add_vod(self, str_to_bytes(psz_name), str_to_bytes(psz_input), i_options, ppsz_options, b_enabled, str_to_bytes(psz_mux))
def vlm_del_media(self, psz_name): '''Delete a media (VOD or broadcast). @param psz_name: the media to delete. @return: 0 on success, -1 on error. ''' return libvlc_vlm_del_media(self, str_to_bytes(psz_name))
def vlm_set_enabled(self, psz_name, b_enabled): '''Enable or disable a media (VOD or broadcast). @param psz_name: the media to work on. @param b_enabled: the new status. @return: 0 on success, -1 on error. ''' return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled)
def vlm_set_output(self, psz_name, psz_output): '''Set the output for a media. @param psz_name: the media to work on. @param psz_output: the output MRL (the parameter to the "sout" variable). @return: 0 on success, -1 on error. ''' return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output))
def vlm_set_input(self, psz_name, psz_input): '''Set a media's input MRL. This will delete all existing inputs and add the specified one. @param psz_name: the media to work on. @param psz_input: the input MRL. @return: 0 on success, -1 on error. ''' return libvlc_vlm_set_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))
def vlm_set_loop(self, psz_name, b_loop): '''Set a media's loop status. @param psz_name: the media to work on. @param b_loop: the new status. @return: 0 on success, -1 on error. ''' return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop)
def vlm_set_mux(self, psz_name, psz_mux): '''Set a media's vod muxer. @param psz_name: the media to work on. @param psz_mux: the new muxer. @return: 0 on success, -1 on error. ''' return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux))
def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of additional options. @param ppsz_options: additional options. @param b_enabled: boolean for enabling the new broadcast. @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop)
def vlm_play_media(self, psz_name): '''Play the named broadcast. @param psz_name: the name of the broadcast. @return: 0 on success, -1 on error. ''' return libvlc_vlm_play_media(self, str_to_bytes(psz_name))
def vlm_stop_media(self, psz_name): '''Stop the named broadcast. @param psz_name: the name of the broadcast. @return: 0 on success, -1 on error. ''' return libvlc_vlm_stop_media(self, str_to_bytes(psz_name))
def vlm_seek_media(self, psz_name, f_percentage): '''Seek in the named broadcast. @param psz_name: the name of the broadcast. @param f_percentage: the percentage to seek to. @return: 0 on success, -1 on error. ''' return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage)
def vlm_show_media(self, psz_name): '''Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. @param psz_name: the name of the media, if the name is an empty string, all media is described. @return: string with information about named media, or None on error. ''' return libvlc_vlm_show_media(self, str_to_bytes(psz_name))
def vlm_get_media_instance_position(self, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: position as float or -1. on error. ''' return libvlc_vlm_get_media_instance_position(self, str_to_bytes(psz_name), i_instance)
def vlm_get_media_instance_time(self, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: time as integer or -1 on error. ''' return libvlc_vlm_get_media_instance_time(self, str_to_bytes(psz_name), i_instance)
def vlm_get_media_instance_length(self, psz_name, i_instance): '''Get vlm_media instance length by name or instance id. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: length of media item or -1 on error. ''' return libvlc_vlm_get_media_instance_length(self, str_to_bytes(psz_name), i_instance)
def vlm_get_media_instance_title(self, psz_name, i_instance): '''Get vlm_media instance title number by name or instance id. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: title as number or -1 on error. @bug: will always return 0. ''' return libvlc_vlm_get_media_instance_title(self, str_to_bytes(psz_name), i_instance)
def vlm_get_media_instance_chapter(self, psz_name, i_instance): '''Get vlm_media instance chapter number by name or instance id. @param psz_name: name of vlm media instance. @param i_instance: instance id. @return: chapter as number or -1 on error. @bug: will always return 0. ''' return libvlc_vlm_get_media_instance_chapter(self, str_to_bytes(psz_name), i_instance)
def get_duration(self): '''Get duration (in ms) of media descriptor object item. @return: duration of media item or -1 on error. ''' return libvlc_media_get_duration(self)
def player_new_from_media(self): '''Create a Media Player object from a Media. @return: a new media player object, or None on error. ''' return libvlc_media_player_new_from_media(self)
def load(self): '''Load media library. @return: 0 on success, -1 on error. ''' return libvlc_media_library_load(self)