]> git.sesse.net Git - vlc/blobdiff - include/vlc/libvlc_events.h
libvlc: add mouse events as libvlc_MediaPlayerEvents
[vlc] / include / vlc / libvlc_events.h
index d900ba5c165406a015c7b23cf8781096017bfce3..94968395a250aff75832452cfd3b55a25ac1b9c6 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * libvlc_events.h:  libvlc_events external API structure
  *****************************************************************************
- * Copyright (C) 1998-2007 the VideoLAN team
+ * Copyright (C) 1998-2010 the VideoLAN team
  * $Id $
  *
  * Authors: Filippo Carone <littlejohn@videolan.org>
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef _LIBVLC_EVENTS_H
-#define _LIBVLC_EVENTS_H 1
+#ifndef LIBVLC_EVENTS_H
+#define LIBVLC_EVENTS_H 1
+
+/**
+ * \file
+ * This file defines libvlc_event external API
+ */
 
 # ifdef __cplusplus
 extern "C" {
@@ -34,47 +39,93 @@ extern "C" {
  *****************************************************************************/
 
 /** \defgroup libvlc_event libvlc_event
- * \ingroup libvlc
+ * \ingroup libvlc_core
  * LibVLC Available Events
  * @{
  */
 
-typedef enum libvlc_event_type_t {
-    libvlc_MediaMetaChanged,
-    libvlc_MediaSubItemAdded,
-    libvlc_MediaDurationChanged,
-    libvlc_MediaPreparsedChanged,
-    libvlc_MediaFreed,
-    libvlc_MediaStateChanged,
-
-    libvlc_MediaPlayerPlayed,
-    libvlc_MediaPlayerPaused,
-    libvlc_MediaPlayerEndReached,
-    libvlc_MediaPlayerStopped,
-    libvlc_MediaPlayerEncounteredError,
-    libvlc_MediaPlayerTimeChanged,
-    libvlc_MediaPlayerPositionChanged,
-    libvlc_MediaPlayerSeekableChanged,
-    libvlc_MediaPlayerPausableChanged,
-
-    libvlc_MediaListItemAdded,
-    libvlc_MediaListWillAddItem,
-    libvlc_MediaListItemDeleted,
-    libvlc_MediaListWillDeleteItem,
-
-    libvlc_MediaListViewItemAdded,
-    libvlc_MediaListViewWillAddItem,
-    libvlc_MediaListViewItemDeleted,
-    libvlc_MediaListViewWillDeleteItem,
-
-    libvlc_MediaListPlayerPlayed,
-    libvlc_MediaListPlayerNextItemSet,
-    libvlc_MediaListPlayerStopped,
-
-    libvlc_MediaDiscovererStarted,
-    libvlc_MediaDiscovererEnded
-
-} libvlc_event_type_t;
+    /* Append new event types at the end. Do not remove, insert or
+     * re-order any entry. The cpp will prepend libvlc_ to the symbols. */
+#define DEFINE_LIBVLC_EVENT_TYPES \
+    DEF( MediaMetaChanged ), \
+    DEF( MediaSubItemAdded ), \
+    DEF( MediaDurationChanged ), \
+    DEF( MediaPreparsedChanged ), \
+    DEF( MediaFreed ), \
+    DEF( MediaStateChanged ), \
+    \
+    DEF( MediaPlayerNothingSpecial ), \
+    DEF( MediaPlayerOpening ), \
+    DEF( MediaPlayerBuffering ), \
+    DEF( MediaPlayerPlaying ), \
+    DEF( MediaPlayerPaused ), \
+    DEF( MediaPlayerStopped ), \
+    DEF( MediaPlayerForward ), \
+    DEF( MediaPlayerBackward ), \
+    DEF( MediaPlayerEndReached ), \
+    DEF( MediaPlayerEncounteredError ), \
+    DEF( MediaPlayerTimeChanged ), \
+    DEF( MediaPlayerPositionChanged ), \
+    DEF( MediaPlayerSeekableChanged ), \
+    DEF( MediaPlayerPausableChanged ), \
+    \
+    DEF( MediaListItemAdded ), \
+    DEF( MediaListWillAddItem ), \
+    DEF( MediaListItemDeleted ), \
+    DEF( MediaListWillDeleteItem ), \
+    \
+    DEF( MediaListViewItemAdded ), \
+    DEF( MediaListViewWillAddItem ), \
+    DEF( MediaListViewItemDeleted ), \
+    DEF( MediaListViewWillDeleteItem ), \
+    \
+    DEF( MediaListPlayerPlayed ), \
+    DEF( MediaListPlayerNextItemSet ), \
+    DEF( MediaListPlayerStopped ), \
+    \
+    DEF( MediaDiscovererStarted ), \
+    DEF( MediaDiscovererEnded ), \
+    \
+    DEF( MediaPlayerTitleChanged ), \
+    DEF( MediaPlayerSnapshotTaken ), \
+    DEF( MediaPlayerLengthChanged ), \
+    \
+    DEF( VlmMediaAdded ), \
+    DEF( VlmMediaRemoved ), \
+    DEF( VlmMediaChanged ), \
+    DEF( VlmMediaInstanceStarted ), \
+    DEF( VlmMediaInstanceStopped ), \
+    DEF( VlmMediaInstanceStatusInit ), \
+    DEF( VlmMediaInstanceStatusOpening ), \
+    DEF( VlmMediaInstanceStatusPlaying ), \
+    DEF( VlmMediaInstanceStatusPause ), \
+    DEF( VlmMediaInstanceStatusEnd ), \
+    DEF( VlmMediaInstanceStatusError ), \
+    \
+    DEF( MediaPlayerMediaChanged ), \
+    \
+    DEF( MediaPlayerMouseMoved ), \
+    DEF( MediaPlayerMouseButton ), \
+    DEF( MediaPlayerMouseClick ), \
+    DEF( MediaPlayerMouseObject ), \
+    \
+/* New event types HERE */
+
+#ifdef __cplusplus
+enum libvlc_event_type_e {
+#else
+enum libvlc_event_type_t {
+#endif
+#define DEF(a) libvlc_##a
+    DEFINE_LIBVLC_EVENT_TYPES
+    libvlc_num_event_types
+#undef  DEF
+};
+
+/* Implementing libvlc_event_type_name() needs the definition too. */
+#ifndef LIBVLC_EVENT_TYPES_KEEP_DEFINE
+#undef  DEFINE_LIBVLC_EVENT_TYPES
+#endif
 
 /**
  * An Event
@@ -83,7 +134,7 @@ typedef enum libvlc_event_type_t {
  * \param u Event dependent content
  */
 
-typedef struct libvlc_event_t
+struct libvlc_event_t
 {
     libvlc_event_type_t type;
     void * p_obj;
@@ -100,7 +151,7 @@ typedef struct libvlc_event_t
         } media_subitem_added;
         struct
         {
-            vlc_int64_t new_duration;
+            int64_t new_duration;
         } media_duration_changed;
         struct
         {
@@ -126,11 +177,15 @@ typedef struct libvlc_event_t
         } media_player_time_changed;
         struct
         {
-            libvlc_time_t new_seekable;
+            int new_title;
+        } media_player_title_changed;
+        struct
+        {
+            int new_seekable;
         } media_player_seekable_changed;
         struct
         {
-            libvlc_time_t new_pausable;
+            int new_pausable;
         } media_player_pausable_changed;
 
         /* media list */
@@ -155,54 +210,66 @@ typedef struct libvlc_event_t
             int index;
         } media_list_will_delete_item;
 
-        /* media list view */
+        /* media list player */
         struct
         {
             libvlc_media_t * item;
-            int index;
-        } media_list_view_item_added;
+        } media_list_player_next_item_set;
+
+        /* snapshot taken */
         struct
         {
-            libvlc_media_t * item;
-            int index;
-        } media_list_view_will_add_item;
+             char* psz_filename ;
+        } media_player_snapshot_taken ;
+
+        /* Length changed */
         struct
         {
-            libvlc_media_t * item;
-            int index;
-        } media_list_view_item_deleted;
+            libvlc_time_t   new_length;
+        } media_player_length_changed;
+
+        /* VLM media */
         struct
         {
-            libvlc_media_t * item;
-            int index;
-        } media_list_view_will_delete_item;
+            const char * psz_media_name;
+            const char * psz_instance_name;
+        } vlm_media_event;
 
-        /* media discoverer */
+        /* Extra MediaPlayer */
         struct
         {
-            void * unused;
-        } media_media_discoverer_started;
+            libvlc_media_t * new_media;
+        } media_player_media_changed;
+
+        /* Mouse events */
         struct
         {
-            void * unused;
-        } media_media_discoverer_ended;
+            int x;
+            int y;
+        } media_player_mouse_moved;
 
-    } u;
-} libvlc_event_t;
+        struct
+        {
+            int mb_left;
+            int mb_center;
+            int mb_right;
+            int mb_wheel_up;
+            int mb_wheel_down;
+        } media_player_mouse_button;
 
-/**
- * Event manager that belongs to a libvlc object, and from whom events can
- * be received.
- */
+        struct
+        {
+            int clicked;
+        } media_player_mouse_clicked;
 
-typedef struct libvlc_event_manager_t libvlc_event_manager_t;
+        struct
+        {
+            int moved;
+        } media_player_mouse_object;
 
-/**
- * Callback function notification
- * \param p_event the event triggering the callback
- */
+    } u;
+};
 
-typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
 
 /**@} */