A simple arrangement of libvlc external APIs

Source: Internet
Author: User
Libvlc. h defines the external API of libvlc. By referencing this header file, you can embed the VLC into our Program .
Libvlc objects must be initialized before they can be used.
Libvlc Core

  • Libvlc_new () is used to initialize a libvlc instance. argc indicates the number of parameters, argv indicates parameters, and return NULL if an error occurs for the created instance.
  • Libvlc_release () is used to destroy an libvlc instance.
  • Libvlc error handling

  • Libvlc_errmsg () returns the latest libvlc error generated in the current thread. This error message is valid at least before another error occurs (at least once libvlc is called, if no error is returned, null is returned.
  • Libvlc_clearerr () is used to clear the libvlc error status of the current thread. This operation is optional. By default, the error status is overwritten when a new error occurs.
  • Libvlc_vprinterr () is used to set the error status and message of libvlc of the current thread. a nul character is returned at any time.
  • The comments in libvlc_printerr ()/source code are exactly the same as those in the previous one.
  • Libvlc_retain () increases the reference count of libvlc. The reference count of any new libvlc instance is 1.
  • Libvlc_add_intf (): indicates the user interface used to start the libvlc instance. p_instance indicates the instance to be started, name indicates the Interface Name, null indicates the default value, and 0 indicates success-1 indicates an error occurred.
  • Libvlc_set_exits_handler (): registers a callback for an existing libvlc event. this method is useful when you use libvlc_add_intf () to enable at least one interface. typically, this function will wake up your main program loop (from other threads ). the parameter p_instance indicates the libvlc instance, and CB indicates the callback to be called when libvlc is about to exit. opaque indicates the Data Pointer of the callback. warning: This function cannot be called at the same time as libvlc_wait.
  • Libvlc_wait (): Wait for an interface to trigger the launch action of the instance. At least one interface must be enabled with libvlc_add_intf.
  • Libvlc_set_user_agent (): sets the application name. When there is a protocol requirement, libvlc will pass this name to it as a user proxy string. the parameter name should be a readable Application name, for example, "foobar player 1.2.3". The HTTP parameter is HTTP user agent. For example, "foobar/1.2.3 Python/2.6.0.
  • Libvlc_get_version (): returns the version number of libvlc.
  • Libvlc_get_compiler (): returns the version of the compiler that compiles libvlc.
  • Libvlc_get_changeset (): returns the libvlc Changeset?
  • Libvlc asynchronous events libvlc Issues Non-synchronous events
    Many libvlc objects, such as libvlc_instance_t libvlc_media_player_t, provide the libvlc_event_manager_t event manager for each of them. You can use libvlc_event_attach () to subscribe to these events and use libvlc_event_detach () to unsubscribe to events.

  • Libvlc_event_manager_t is the event manager of the libvlc object.
  • Libvlc_event_type_t: indicates the libvlc event.
  • Libvlc_callback_t (): callback function notification (call back function notification translation is not accurate). The parameter p_event is the time when the callback is triggered.
  • Libvlc_event_attach (): registers an event notification. The parameter p_event_manager is the event manager to bind. generally, it is obtained from vlc_my_object_event_manager (). Here, my_object is the object you want to listen to, I _event_type is the event you want to listen to, and f_callback is the function to be called when I _event_type occurs. User_data is the data transmitted along with the event provided by the user. If the function is successful, 0 is returned. If an error occurs, enomem is returned.
  • Libvlc_event_detach () unsubscribes to an event notification.
  • Libvlc_event_type_name (): obtains the type name of an event.
  • Libvlc_log libvlc logginglibvlc_log series functions provide methods to access libvlc message logs. These functions are only used for advanced users or debugging.

  • Libvlc_get_log_verbosity (): gets the details of a VLC message.
  • Libvlc_set_log_verbosity (): sets the VLC message detail level.
  • Libvlc_log_open (): Enable the VLC Message Log instance (obtain its message log instance from a libvlc instance)
  • Libvlc_log_close (): disables a VLC Message Log instance.
  • Libvlc_log_count (): number of messages in the returned log
  • Libvlc_log_clear (): clears the log instance. All messages in the instance will be deleted. To prevent message blocking, it should be cleared frequently.
  • Libvlc_log_get_iterator (): locates and returns the iterator recorded in a log.
  • Libvlc_log_iterator_free (): release an iterator
  • Libvlc_log_iterator_next (): returns the next log message. If it is null, null is returned. Otherwise, the next message object is returned.
  • Libvlc_media.hlibvlc_media_t is an abstract expression of a playable media. It contains the media location and various optional metadata.

  • Libvlc_state_t: the sequence of this enumeration type must be strictly consistent with the source code. For more information, see mediacontrol_playerstatus, input_state_e Enumeration type, and VideoLAN. libvlc. State (in bindings/pencil/src/media. CS)
  • Libvlc_media_stats_t: libvlc media statistics
  • Libvlc_media_track_info_t: no comments, mainly including other information about fourcc and docec.
  • Libvlc_media_new_location(): Use a given media resource path to create a libvlc_media object. The parameter psz_mrl is the MRL (media resource location) to be read. This function returns the new object or null.
  • Libvlc_media_new_path (): create a file from the path of the local file system. For more information, see the previous
  • Libvlc_media_new_as_node (): Use the given name to create a libvlc_media_t and use it as an empty node.
  • Libvlc_media_add_option (): adds an option to the existing libvlc_media_t. This option is used to determine how media_player reads media. In this way, you can specify the advanced reading/streaming options for each VLC on each media.
  • Libvlc_media_add_option_flag (): reduces the price of an existing libvlc_media_t with configurable tags.
  • Libvlc_media_retain (): retain a reference to a media description object (libvlc_media_t. Use libvlc_media_release () to reduce the reference count of a media description object
  • Libvlc_media_release (): reduces the reference count of a libvlc_media_t. If it is reduced to 0, this function releases this object (destroyed). It sends a libvlc_mediafreed event to all listeners. If a libvlc_media_t is released, it cannot be used any more.
  • Libvlc_media_get_mrl (): obtains its MRL from a media description object.
  • Libvlc_media_duplicate (): image media description object
  • Libvlc_media_get_meta (): Read the metadata of the media. If the media has not been parsed, null is returned. This method automatically calls libvlc_media_parse_async (). Therefore, after calling this method, you can receive a libvlc_mediametachanged event. If you want to use a synchronous version, make sure that you call libvlc_media_parse () before calling get_meta ();
  • Libvlc_media_set_meta (): sets the metadata of the media. This method does not save data. You also need to call libvlc_media_save_meta () to save it.
  • Libvlc_media_get_state (): gets the status of the current media description object. The possible status is defined in livblc_structures.c.
  • Libvlc_media_subitems (): gets a subitem of a media description object. This method increases the reference count of the media description object and uses libvlc_media_list_release () to reduce the reference count.
  • Libvlc_media_event_manager (): gets the event manager of a media description object.
  • Libvlc_media_get_duration (): gets the duration of a media description object. If an error occurs,-1 is returned.
  • Libvlc_media_parse (): parses the metadata and track information of a local media. This method is synchronous.
  • Libvlc_media_parse_async (): Same as above. This method is not synchronized. You can listen to the libvlc_mediaparsedchanged event to track it. If it has already been parsed, this event will not be triggered.
  • Libvlc_media_is_parsed (): obtains the analysis status of a media description object. True is returned after analysis.
  • Libvlc_media_set_user_data (): sets the user data of the media descriptor. This data is only accessed by the Host Program. VLC. framework uses it as a pointer to a local object that references a libvlc_media_t pointer.
  • Libvle_media_get_tracks_info (): obtains the basic stream information of the media descriptor. Note that you must use -- sout = "# description" to play the media exactly once. Otherwise, an empty array is obtained. Multiple playback results in multiple duplicate data records.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.