]> git.sesse.net Git - vlc/commitdiff
Revert "Remove enums from public APIs"
authorPierre d'Herbemont <pdherbemont@free.fr>
Mon, 6 Jul 2009 02:50:03 +0000 (19:50 -0700)
committerPierre d'Herbemont <pdherbemont@free.fr>
Mon, 6 Jul 2009 02:51:56 +0000 (19:51 -0700)
This reverts commit 3d0ef0165c1c9189192d6f7dad3fd5901db6034c.

As agreed, the information loss is too important, even for sanitizing the ABI. And there are alternative solutions available.

include/vlc/libvlc_events.h
include/vlc/libvlc_media.h
include/vlc/libvlc_media_list_player.h
include/vlc/libvlc_media_player.h
src/control/media.c
src/control/media_internal.h
src/control/media_list_player.c
src/control/media_player.c
src/control/mediacontrol_core.c
src/control/video.c

index 51c637e1fab7be2568e794379ff61c91ceb71075..9373896861d48bad3a496ab5a51fe55655728e52 100644 (file)
@@ -111,14 +111,14 @@ enum libvlc_event_type_t {
 
 struct libvlc_event_t
 {
-    unsigned type;
+    libvlc_event_type_t type;
     void * p_obj;
     union event_type_specific
     {
         /* media descriptor */
         struct
         {
-            unsigned meta_type;
+            libvlc_meta_t meta_type;
         } media_meta_changed;
         struct
         {
@@ -138,7 +138,7 @@ struct libvlc_event_t
         } media_freed;
         struct
         {
-            unsigned new_state;
+            libvlc_state_t new_state;
         } media_state_changed;
 
         /* media instance */
index 7473be8ae89eeb5092e5d39447110819af2daae5..a67778d98aba5b90a81fa9e6843375f44049236f 100644 (file)
@@ -49,7 +49,7 @@ typedef struct libvlc_media_t libvlc_media_t;
  * @{
  */
 
-enum libvlc_meta_t {
+typedef enum libvlc_meta_t {
     libvlc_meta_Title,
     libvlc_meta_Artist,
     libvlc_meta_Genre,
@@ -68,7 +68,7 @@ enum libvlc_meta_t {
     libvlc_meta_ArtworkURL,
     libvlc_meta_TrackID,
     /* Add new meta types HERE */
-};
+} libvlc_meta_t;
 
 /** @}*/
 
@@ -81,7 +81,7 @@ enum libvlc_meta_t {
  * IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4,
  * STOPPING=5, ENDED=6, ERROR=7
  */
-enum libvlc_state_t
+typedef enum libvlc_state_t
 {
     libvlc_NothingSpecial=0,
     libvlc_Opening,
@@ -91,13 +91,13 @@ enum libvlc_state_t
     libvlc_Stopped,
     libvlc_Ended,
     libvlc_Error
-};
+} libvlc_state_t;
 
-enum libvlc_media_option_t
+typedef enum libvlc_media_option_t
 {
     libvlc_media_option_trusted = 0x2,
     libvlc_media_option_unique = 0x100
-};
+} libvlc_media_option_t;
 
 /**
  * Create a media with the given MRL.
@@ -159,7 +159,7 @@ VLC_PUBLIC_API void libvlc_media_add_option(
 VLC_PUBLIC_API void libvlc_media_add_option_flag(
                                    libvlc_media_t * p_md,
                                    const char * ppsz_options,
-                                   unsigned i_flags,
+                                   libvlc_media_option_t i_flags,
                                    libvlc_exception_t * p_e );
 
 
@@ -213,7 +213,7 @@ VLC_PUBLIC_API libvlc_media_t * libvlc_media_duplicate( libvlc_media_t * );
  */
 VLC_PUBLIC_API char * libvlc_media_get_meta(
                                    libvlc_media_t *p_meta_desc,
-                                   unsigned e_meta,
+                                   libvlc_meta_t e_meta,
                                    libvlc_exception_t *p_e );
 /**
  * Get current state of media descriptor object. Possible media states
@@ -227,7 +227,7 @@ VLC_PUBLIC_API char * libvlc_media_get_meta(
  * \param p_e an initialized exception object
  * \return state of media descriptor object
  */
-VLC_PUBLIC_API unsigned libvlc_media_get_state(
+VLC_PUBLIC_API libvlc_state_t libvlc_media_get_state(
                                    libvlc_media_t *p_meta_desc,
                                    libvlc_exception_t *p_e );
 
index ead584eeb93a2faff714df91e0329cbc02e12c2d..d2f21515cd2cce6f46075c396cf16bef35a66374 100644 (file)
@@ -121,7 +121,7 @@ VLC_PUBLIC_API int
  * \param p_e initialized exception instance
  * \return libvlc_state_t for media list player
  */
-VLC_PUBLIC_API unsigned
+VLC_PUBLIC_API libvlc_state_t
     libvlc_media_list_player_get_state( libvlc_media_list_player_t * p_mlp,
                                         libvlc_exception_t * p_e );
 
index 962a80c94133527148f21193c332ae1e3c996332..d44c0062552a137c93c8dd828b951df489bc8a2d 100644 (file)
@@ -79,7 +79,7 @@ typedef struct libvlc_rectangle_t
 /**
  * Marq int options definition
  */
-enum libvlc_video_marquee_int_option_t {
+typedef enum libvlc_video_marquee_int_option_t {
     libvlc_marquee_Enabled = 0,
     libvlc_marquee_Color,
     libvlc_marquee_Opacity,
@@ -88,15 +88,15 @@ enum libvlc_video_marquee_int_option_t {
     libvlc_marquee_Size,
     libvlc_marquee_Timeout,
     libvlc_marquee_X,
-    libvlc_marquee_Y,
-};
+    libvlc_marquee_Y
+} libvlc_video_marquee_int_option_t;
 
 /**
  * Marq string options definition
  */
-enum libvlc_video_marquee_string_option_t {
-    libvlc_marquee_Text = 0,
-};
+typedef enum libvlc_video_marquee_string_option_t {
+    libvlc_marquee_Text = 0
+} libvlc_video_marquee_string_option_t;
 
 
 /**
@@ -436,7 +436,7 @@ VLC_PUBLIC_API void libvlc_media_player_set_rate( libvlc_media_player_t *, float
  * \param p_e an initialized exception pointer
  * \return current movie state as libvlc_state_t
  */
-VLC_PUBLIC_API unsigned libvlc_media_player_get_state( libvlc_media_player_t *, libvlc_exception_t *);
+VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *, libvlc_exception_t *);
 
 /**
  * Get movie fps rate
@@ -756,7 +756,7 @@ VLC_PUBLIC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *,
  * \param p_e an initialized exception pointer
  */
 VLC_PUBLIC_API int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t *,
-                                                        unsigned,
+                                                        libvlc_video_marquee_int_option_t,
                                                         libvlc_exception_t * );
 
 /**
@@ -767,7 +767,7 @@ VLC_PUBLIC_API int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t
  * \param p_e an initialized exception pointer
  */
 VLC_PUBLIC_API char *libvlc_video_get_marquee_option_as_string( libvlc_media_player_t *,
-                                                             unsigned,
+                                                             libvlc_video_marquee_string_option_t,
                                                              libvlc_exception_t * );
 
 /**
@@ -779,7 +779,7 @@ VLC_PUBLIC_API char *libvlc_video_get_marquee_option_as_string( libvlc_media_pla
  * \param p_e an initialized exception pointer
  */
 VLC_PUBLIC_API void libvlc_video_set_marquee_option_as_int( libvlc_media_player_t *,
-                                                         unsigned,
+                                                         libvlc_video_marquee_int_option_t,
                                                          int, libvlc_exception_t * );
 
 /**
@@ -791,7 +791,7 @@ VLC_PUBLIC_API void libvlc_video_set_marquee_option_as_int( libvlc_media_player_
  * \param p_e an initialized exception pointer
  */
 VLC_PUBLIC_API void libvlc_video_set_marquee_option_as_string( libvlc_media_player_t *,
-                                                            unsigned,
+                                                            libvlc_video_marquee_string_option_t,
                                                             const char *,
                                                             libvlc_exception_t * );
 
@@ -806,7 +806,7 @@ VLC_PUBLIC_API void libvlc_video_set_marquee_option_as_string( libvlc_media_play
 /**
  * Audio device types
  */
-enum libvlc_audio_output_device_types_t {
+typedef enum libvlc_audio_output_device_types_t {
     libvlc_AudioOutputDevice_Error  = -1,
     libvlc_AudioOutputDevice_Mono   =  1,
     libvlc_AudioOutputDevice_Stereo =  2,
@@ -815,20 +815,20 @@ enum libvlc_audio_output_device_types_t {
     libvlc_AudioOutputDevice_5_1    =  6,
     libvlc_AudioOutputDevice_6_1    =  7,
     libvlc_AudioOutputDevice_7_1    =  8,
-    libvlc_AudioOutputDevice_SPDIF  = 10,
-};
+    libvlc_AudioOutputDevice_SPDIF  = 10
+} libvlc_audio_output_device_types_t;
 
 /**
  * Audio channels
  */
-enum libvlc_audio_output_channel_t {
+typedef enum libvlc_audio_output_channel_t {
     libvlc_AudioChannel_Error   = -1,
     libvlc_AudioChannel_Stereo  =  1,
     libvlc_AudioChannel_RStereo =  2,
     libvlc_AudioChannel_Left    =  3,
     libvlc_AudioChannel_Right   =  4,
-    libvlc_AudioChannel_Dolbys  =  5,
-};
+    libvlc_AudioChannel_Dolbys  =  5
+} libvlc_audio_output_channel_t;
 
 
 /**
index f7122fe4ca24edc72db732dc7d4f978fc7997d17..4b3ee382b6e54e66f360762dc0f7d0fbd88b55a1 100644 (file)
@@ -61,7 +61,7 @@ static const vlc_meta_type_t libvlc_to_vlc_meta[] =
     [libvlc_meta_TrackID]      = vlc_meta_TrackID
 };
 
-static const enum libvlc_meta_t vlc_to_libvlc_meta[] =
+static const libvlc_meta_t vlc_to_libvlc_meta[] =
 {
     [vlc_meta_Title]        = libvlc_meta_Title,
     [vlc_meta_Artist]       = libvlc_meta_Artist,
@@ -366,7 +366,7 @@ void libvlc_media_add_option(
 void libvlc_media_add_option_flag(
                                    libvlc_media_t * p_md,
                                    const char * ppsz_option,
-                                   unsigned i_flags,
+                                   libvlc_media_option_t i_flags,
                                    libvlc_exception_t *p_e )
 {
     VLC_UNUSED(p_e);
@@ -442,7 +442,8 @@ libvlc_media_get_mrl( libvlc_media_t * p_md,
  * Getter for meta information
  **************************************************************************/
 
-char * libvlc_media_get_meta( libvlc_media_t *p_md, unsigned e_meta,
+char * libvlc_media_get_meta( libvlc_media_t *p_md,
+                                         libvlc_meta_t e_meta,
                                          libvlc_exception_t *p_e )
 {
     char * psz_meta;
@@ -477,7 +478,7 @@ char * libvlc_media_get_meta( libvlc_media_t *p_md, unsigned e_meta,
  * Can be error, playing, buffering, NothingSpecial.
  **************************************************************************/
 
-unsigned
+libvlc_state_t
 libvlc_media_get_state( libvlc_media_t *p_md,
                                    libvlc_exception_t *p_e )
 {
@@ -490,7 +491,8 @@ libvlc_media_get_state( libvlc_media_t *p_md,
  **************************************************************************/
 
 void
-libvlc_media_set_state( libvlc_media_t *p_md, enum libvlc_state_t state,
+libvlc_media_set_state( libvlc_media_t *p_md,
+                                   libvlc_state_t state,
                                    libvlc_exception_t *p_e )
 {
     libvlc_event_t event;
index 9a73c331afcb59321b7787774b14137b7d2dfb39..48a6fa8fad77f2533ecac9a391230dc9064dea00 100644 (file)
@@ -38,7 +38,7 @@ struct libvlc_media_t
     input_item_t      *p_input_item;
     int                i_refcount;
     libvlc_instance_t *p_libvlc_instance;
-    enum libvlc_state_t state;
+    libvlc_state_t     state;
     VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t*) p_subitems; /* A media descriptor can have Sub items. This is the only dependancy we really have on media_list */
     void *p_user_data;
 };
@@ -49,7 +49,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
         libvlc_exception_t * );
 
 void libvlc_media_set_state(
-        libvlc_media_t *, enum libvlc_state_t,
+        libvlc_media_t *, libvlc_state_t,
         libvlc_exception_t * );
 
 #endif
index 9f705e58bffb9518bac0f1eb75e45781d509b4d8..4a0618bd4fb7fd4ae7d77eaaa3ecd664609fbffd 100644 (file)
@@ -436,9 +436,7 @@ int
 libvlc_media_list_player_is_playing( libvlc_media_list_player_t * p_mlp,
                                      libvlc_exception_t * p_e )
 {
-    enum libvlc_state_t state;
-
-    state = libvlc_media_player_get_state( p_mlp->p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mlp->p_mi, p_e );
     return (state == libvlc_Opening) || (state == libvlc_Buffering) ||
            (state == libvlc_Playing);
 }
@@ -446,7 +444,7 @@ libvlc_media_list_player_is_playing( libvlc_media_list_player_t * p_mlp,
 /**************************************************************************
  *        State (Public)
  **************************************************************************/
-enum libvlc_state_t
+libvlc_state_t
 libvlc_media_list_player_get_state( libvlc_media_list_player_t * p_mlp,
                                     libvlc_exception_t * p_e )
 {
index f6b8507e9bac8c01d522833f134940f3eadd3e40..1c8ac775206468263dbddf6c1a59be1a0c213900 100644 (file)
@@ -57,7 +57,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
 static int SnapshotTakenCallback( vlc_object_t *p_this, char const *psz_cmd,
                        vlc_value_t oldval, vlc_value_t newval, void *p_data );
 
-static const enum libvlc_state_t vlc_to_libvlc_state_array[] =
+static const libvlc_state_t vlc_to_libvlc_state_array[] =
 {
     [INIT_S]        = libvlc_NothingSpecial,
     [OPENING_S]     = libvlc_Opening,
@@ -67,7 +67,7 @@ static const enum libvlc_state_t vlc_to_libvlc_state_array[] =
     [ERROR_S]       = libvlc_Error,
 };
 
-static enum libvlc_state_t vlc_to_libvlc_state( int vlc_state )
+static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
 {
     if( vlc_state < 0 || vlc_state > 6 )
         return libvlc_Ended;
@@ -190,7 +190,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
 
     if( newval.i_int == INPUT_EVENT_STATE )
     {
-        enum libvlc_state_t libvlc_state;
+        libvlc_state_t libvlc_state;
 
         switch ( var_GetInteger( p_input, "state" ) )
         {
@@ -623,7 +623,7 @@ void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
     if( !p_input_thread )
         return;
 
-    enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
     if( state == libvlc_Playing || state == libvlc_Buffering )
     {
         if( libvlc_media_player_can_pause( p_mi, p_e ) )
@@ -645,7 +645,7 @@ void libvlc_media_player_pause( libvlc_media_player_t *p_mi,
 int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi,
                                      libvlc_exception_t *p_e )
 {
-    enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
     return (libvlc_Playing == state) || (libvlc_Buffering == state);
 }
 
@@ -655,7 +655,7 @@ int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi,
 void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
                                  libvlc_exception_t *p_e )
 {
-    enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+    libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
 
     if( state == libvlc_Playing ||
         state == libvlc_Paused ||
@@ -1121,12 +1121,12 @@ float libvlc_media_player_get_rate(
     return (float)1000.0f/val.i_int;
 }
 
-enum libvlc_state_t libvlc_media_player_get_state(
+libvlc_state_t libvlc_media_player_get_state(
                                  libvlc_media_player_t *p_mi,
                                  libvlc_exception_t *p_e )
 {
     input_thread_t *p_input_thread;
-    enum libvlc_state_t state;
+    libvlc_state_t state = libvlc_Ended;
     vlc_value_t val;
 
     p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
@@ -1135,7 +1135,7 @@ enum libvlc_state_t libvlc_media_player_get_state(
         /* We do return the right value, no need to throw an exception */
         if( libvlc_exception_raised( p_e ) )
             libvlc_exception_clear( p_e );
-        return libvlc_Ended;
+        return state;
     }
 
     var_Get( p_input_thread, "state", &val );
index d56a92027fa71165616b22dbc007f062bdf51a30..240c93fb7dc9b1498cdfd78dac1557cb5d14a508 100644 (file)
@@ -365,7 +365,7 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
     }
     else
     {
-        enum libvlc_state_t state;
+        libvlc_state_t state;
 
         state = libvlc_media_player_get_state( self->p_media_player, &ex );
         if( libvlc_exception_raised( &ex ) )
index e4720e9fbe9a1762bf39ca7afd6aecafc24212a9..3345dd311b5f6f8030d34b0b951ed3f5d80d58f5 100644 (file)
@@ -683,7 +683,7 @@ static vlc_object_t *get_marquee_object( libvlc_media_player_t * p_mi )
  * libvlc_video_get_marquee_option_as_int : get a marq option value
  *****************************************************************************/
 int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t *p_mi,
-                                            unsigned option,
+                                            libvlc_video_marquee_int_option_t option,
                                             libvlc_exception_t *p_e )
 {
     const char * identifier = get_marquee_int_option_identifier(option);
@@ -717,7 +717,7 @@ int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t *p_mi,
  * libvlc_video_get_marquee_option_as_string : get a marq option value
  *****************************************************************************/
 char * libvlc_video_get_marquee_option_as_string( libvlc_media_player_t *p_mi,
-                                                  unsigned option,
+                                                  libvlc_video_marquee_string_option_t option,
                                                   libvlc_exception_t *p_e )
 {
     const char * identifier = get_marquee_string_option_identifier(option);
@@ -742,7 +742,7 @@ char * libvlc_video_get_marquee_option_as_string( libvlc_media_player_t *p_mi,
  * libvlc_video_set_marquee_option_as_int: enable, disable or set an int option
  *****************************************************************************/
 void libvlc_video_set_marquee_option_as_int( libvlc_media_player_t *p_mi,
-                                             unsigned option,
+                                          libvlc_video_marquee_int_option_t option,
                                           int value, libvlc_exception_t *p_e )
 {
     const char * identifier = get_marquee_int_option_identifier(option);
@@ -785,7 +785,7 @@ void libvlc_video_set_marquee_option_as_int( libvlc_media_player_t *p_mi,
  * libvlc_video_set_marquee_option_as_string: set a string option
  *****************************************************************************/
 void libvlc_video_set_marquee_option_as_string( libvlc_media_player_t *p_mi,
-                                                unsigned option,
+                                             libvlc_video_marquee_string_option_t option,
                                              const char * value,
                                              libvlc_exception_t *p_e )
 {