]> git.sesse.net Git - vlc/blobdiff - include/vlc/libvlc.h
Initial callback support in libvlc + example on how to use in the java bindings
[vlc] / include / vlc / libvlc.h
index c3110986ba191564f77ceae108bcaf43ecfc900e..8d1daa8081cd62af4b2c425888f1ff12a2f365cc 100644 (file)
@@ -34,6 +34,7 @@
 #define _LIBVLC_H 1
 
 #include <vlc/vlc.h>
+#include <vlc/libvlc_structures.h>
 
 # ifdef __cplusplus
 extern "C" {
@@ -48,13 +49,6 @@ extern "C" {
  * @{
  */
 
-typedef struct
-{
-    int b_raised;
-    int i_code;
-    char *psz_message;
-} libvlc_exception_t;
-
 /**
  * Initialize an exception structure. This can be called several times to reuse
  * an exception structure.
@@ -103,9 +97,6 @@ VLC_PUBLIC_API char* libvlc_exception_get_message( libvlc_exception_t *p_excepti
  * @{
  */
 
-/** This structure is opaque. It represents a libvlc instance */
-typedef struct libvlc_instance_t libvlc_instance_t;
-
 /**
  * Create an initialized libvlc instance
  * \param argc the number of arguments
@@ -139,13 +130,6 @@ VLC_PUBLIC_API void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * );
  * @{
  */
 
-typedef struct {
-    int i_id;
-    char * psz_uri;
-    char * psz_name;
-
-} libvlc_playlist_item_t;
-
 /**
  * Set loop variable
  */
@@ -188,6 +172,18 @@ VLC_PUBLIC_API int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_except
  */
 VLC_PUBLIC_API int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
 
+/**
+ * Lock the playlist instance
+ * \param p_instance the instance
+ */
+VLC_PUBLIC_API void libvlc_playlist_lock( libvlc_instance_t * );
+
+/**
+ * Unlock the playlist instance
+ * \param p_instance the instance
+ */
+VLC_PUBLIC_API void libvlc_playlist_unlock( libvlc_instance_t * );
+
 /**
  * Stop playing
  * \param p_instance the instance to stop
@@ -296,24 +292,6 @@ VLC_PUBLIC_API int         libvlc_input_get_state      ( libvlc_input_t *, libvl
  * @{
  */
 
-/**
-* Downcast to this general type as placeholder for a platform specific one, such as:
-*  Drawable on X11,
-*  CGrafPort on MacOSX,
-*  HWND on win32
-*/
-typedef int libvlc_drawable_t;
-
-/**
-* Rectangle type for video geometry
-*/
-typedef struct
-{
-    int top, left;
-    int bottom, right;
-}
-libvlc_rectangle_t;
-
 /**
  * Does this input have a video output ?
  * \param p_input the input
@@ -377,6 +355,22 @@ VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_input_t *, libvlc_exc
  */
 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_input_t *, char *, libvlc_exception_t * );
 
+/**
+ * Get current video subtitle
+ * \param p_input the input
+ * \param p_exception an initialized exception
+ * \return the video subtitle selected
+ */
+VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_input_t *, libvlc_exception_t * );
+
+/**
+ * Set new video subtitle
+ * \param p_input the input
+ * \param i_spu new video subtitle to select
+ * \param p_exception an initialized exception
+ */
+VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_input_t *, int , libvlc_exception_t * );
+
 /**
  * Get current crop filter geometry
  * \param p_input the input
@@ -422,6 +416,14 @@ VLC_PUBLIC_API void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exce
  */
 VLC_PUBLIC_API int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * );
 
+/**
+ * Tell windowless video output to redraw rectangular area (MacOS X only)
+ * \param p_instance libvlc instance
+ * \param area coordinates within video drawable
+ * \param p_exception an initialized exception
+ */
+VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_input_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
+
 /**
  * Set the default video output parent
  *  this settings will be used as default for all video outputs
@@ -431,6 +433,15 @@ VLC_PUBLIC_API int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, l
  */
 VLC_PUBLIC_API void libvlc_video_set_parent( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );
 
+/**
+ * Set the default video output parent
+ *  this settings will be used as default for all video outputs
+ * \param p_instance libvlc instance
+ * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
+ * \param p_exception an initialized exception
+ */
+VLC_PUBLIC_API libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *, libvlc_exception_t * );
+
 /**
  * Set the default video output size
  *  this settings will be used as default for all video outputs
@@ -451,7 +462,6 @@ VLC_PUBLIC_API void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc
  */
 VLC_PUBLIC_API void libvlc_video_set_viewport( libvlc_instance_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
 
-
 /** @} */
 
 /**
@@ -597,6 +607,15 @@ VLC_PUBLIC_API void libvlc_vlm_set_output( libvlc_instance_t *, char *, char*,
 VLC_PUBLIC_API void libvlc_vlm_set_input( libvlc_instance_t *, char *, char*,
                                           libvlc_exception_t *);
 
+/**
+ * Add a media's input MRL. This will add the specified one.
+ * \param p_instance the instance
+ * \param psz_name the media to work on
+ * \param psz_input the input MRL
+ * \param p_exception an initialized exception
+ */
+VLC_PUBLIC_API void libvlc_vlm_add_input( libvlc_instance_t *, char *, char *,
+                                          libvlc_exception_t *p_exception );
 /**
  * Set output for a media
  * \param p_instance the instance
@@ -692,22 +711,6 @@ VLC_PUBLIC_API LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( seekable, int, Bool, 0);
  * @{
  */
 
-/** This structure is opaque. It represents a libvlc log instance */
-typedef struct libvlc_log_t libvlc_log_t;
-
-/** This structure is opaque. It represents a libvlc log iterator */
-typedef struct libvlc_log_iterator_t libvlc_log_iterator_t;
-
-typedef struct libvlc_log_message_t
-{
-    unsigned    sizeof_msg;   /* sizeof() of message structure, must be filled in by user */
-    int         i_severity;   /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
-    const char *psz_type;     /* module type */
-    const char *psz_name;     /* module name */
-    const char *psz_header;   /* optional header */
-    const char *psz_message;  /* message */
-} libvlc_log_message_t;
-
 /**
  * Returns the VLC messaging verbosity level
  * \param p_instance libvlc instance
@@ -786,6 +789,45 @@ VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterat
 
 /** @} */
 
+/*****************************************************************************
+ * Callbacks handling
+ *****************************************************************************/
+
+/** defgroup libvlc_callbacks Callbacks
+ * \ingroup libvlc
+ * LibVLC Event Callbacks
+ * @{
+ */
+
+/**
+ * Register for a callback notification
+ * \param p_instance the libvlc instance
+ * \param i_event_type the desired event mask to which we want to listen
+ * \param f_callback the function to call when i_event_type occurs
+ * \param user_data user provided data to carry with the event
+ * \param p_e an initialized exception pointer
+ */
+VLC_PUBLIC_API void libvlc_callback_register_for_event( libvlc_instance_t *p_instance,
+                                                        libvlc_event_type_t i_event_type,
+                                                        libvlc_callback_t f_callback,
+                                                        void *user_data,
+                                                        libvlc_exception_t *p_e );
+
+/**
+ * Unregister a callback notification
+ * \param p_instance the libvlc instance
+ * \param i_event_type the desired event mask to which we want to unregister
+ * \param f_callback the function to call when i_event_type occurs
+ * \param p_e an initialized exception pointer
+ */
+VLC_PUBLIC_API void libvlc_callback_unregister_for_event( libvlc_instance_t *p_instance,
+                                                          libvlc_event_type_t i_event_type,
+                                                          libvlc_callback_t f_callback,
+                                                          libvlc_exception_t *p_e );
+
+/** @} */
+
+
 # ifdef __cplusplus
 }
 # endif