Hi,<br>So as the title says, 7 new API for projectm, to get info on presets, change it or lock it.<br><br>diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h<br>index 8ac784a..c592028 100644<br>
--- a/include/vlc/libvlc_media_player.h<br>+++ b/include/vlc/libvlc_media_player.h<br>@@ -1391,6 +1391,69 @@ VLC_PUBLIC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );<br> */<br> VLC_PUBLIC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );<br>
<br>+/**<br>+ * Set a random projectm preset<br>+ *<br>+ * \param p_mi media player<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API void libvlc_projectm_random( libvlc_media_player_t *p_mi );<br>+<br>+/**<br>
+ * Set a projectm preset<br>+ *<br>+ * \param p_mi media player<br>+ * \param i_id preset id<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API void libvlc_projectm_set_preset( libvlc_media_player_t *p_mi, int i_id );<br>
+<br>+/**<br>+ * Get projectm preset count<br>+ *<br>+ * \param p_mi media player<br>+ * \return number of presets loaded by projectm<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API int libvlc_projectm_get_preset_count( libvlc_media_player_t *p_mi );<br>
+<br>+/**<br>+ * Get the current preset id<br>+ *<br>+ * \param p_mi media player<br>+ * \return current preset id<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API int libvlc_projectm_get_preset_current_id( libvlc_media_player_t *p_mi );<br>
+<br>+/**<br>+ * Get the name of a preset<br>+ *<br>+ * \param p_mi media player<br>+ * \param i_id preset id<br>+ * \return name of the preset<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API char *libvlc_projectm_get_preset_name( libvlc_media_player_t *p_mi, int i_id );<br>
+<br>+/**<br>+ * Get whether projectm is locked or not<br>+ *<br>+ * \param p_mi media player<br>+ * \return the lock status (boolean)<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API int libvlc_projectm_is_locked( libvlc_media_player_t *p_mi );<br>
+<br>+/**<br>+ * Lock/Unlock projectm on the current preset<br>+ *<br>+ * \param p_mi media player<br>+ * \param b_locked boolean for the lock status<br>+ * \version LibVLC 1.1.6 or later<br>+ */<br>+VLC_PUBLIC_API void libvlc_projectm_lock( libvlc_media_player_t *p_mi, int b_locked );<br>
+<br> /** @} audio */<br> <br> /** @} media_player */<br>diff --git a/include/vlc_common.h b/include/vlc_common.h<br>index 3e9de44..909e82e 100644<br>--- a/include/vlc_common.h<br>+++ b/include/vlc_common.h<br>@@ -882,4 +882,15 @@ VLC_EXPORT( const char *, VLC_Compiler, ( void ) LIBVLC_USED );<br>
"Public License;\nsee the file named COPYING for details.\n" \<br> "Written by the VideoLAN team; see the AUTHORS file.\n")<br> <br>+/*****************************************************************************<br>
+ * ProjectM stuff<br>+ *****************************************************************************/<br>+#define VLC_PROJECTM_CMD_RANDOM -1<br>+#define VLC_PROJECTM_CMD_LOCK -2<br>+#define VLC_PROJECTM_CMD_UNLOCK -3<br>
+#define VLC_PROJECTM_CMD_IS_LOCKED -4<br>+#define VLC_PROJECTM_CMD_GET_COUNT -5<br>+#define VLC_PROJECTM_CMD_GET_CURRENT -6<br>+#define VLC_PROJECTM_CMD_GET_NAME -7<br>+<br> #endif /* !VLC_COMMON_H */<br>diff --git a/src/control/audio.c b/src/control/audio.c<br>
index a6e7888..9099083 100644<br>--- a/src/control/audio.c<br>+++ b/src/control/audio.c<br>@@ -515,3 +515,136 @@ int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay )<br> }<br> return ret;<br>
}<br>+<br>+/*****************************************************************************<br>+ * get_projectm : Find and return projectm object<br>+ *****************************************************************************/<br>
+static vlc_object_t *get_projectm( libvlc_media_player_t *p_mi )<br>+{<br>+ aout_instance_t *p_aout = GetAOut( p_mi );<br>+ vlc_object_t *p_projectm = NULL;<br>+ if( !p_aout )<br>+ return NULL;<br>+<br>+ p_projectm = vlc_object_find_name( p_aout, "projectm", FIND_CHILD );<br>
+ vlc_object_release( p_aout );<br>+ if (!p_projectm)<br>+ {<br>+ libvlc_printerr( "projectm not enabled" );<br>+ }<br>+ return p_projectm;<br>+}<br>+<br>+/*****************************************************************************<br>
+ * send_projectm_cmd : Find projectm, send a command, and return the object<br>+ *****************************************************************************/<br>+static vlc_object_t *send_projectm_cmd( libvlc_media_player_t *p_mi, int i_cmd )<br>
+{<br>+ vlc_object_t *p_projectm = get_projectm( p_mi );<br>+ if ( !p_projectm )<br>+ return NULL;<br>+<br>+ if( var_SetInteger( p_projectm, "projectm-preset-cmd", i_cmd ) < 0 )<br>+ {<br>+ libvlc_printerr( "projectm-preset-cmd out of range" );<br>
+ }<br>+ return p_projectm;<br>+}<br>+<br>+/*****************************************************************************<br>+ * libvlc_projectm_random : Set a random projectm preset<br>+ *****************************************************************************/<br>
+void libvlc_projectm_random( libvlc_media_player_t *p_mi )<br>+{<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, VLC_PROJECTM_CMD_RANDOM );<br>+ if ( p_projectm )<br>+ vlc_object_release( p_projectm );<br>
+}<br>+<br>+/*****************************************************************************<br>+ * libvlc_projectm_set_preset : Set a projectm preset<br>+ *****************************************************************************/<br>
+void libvlc_projectm_set_preset( libvlc_media_player_t *p_mi, int i_id )<br>+{<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, i_id );<br>+ if ( p_projectm )<br>+ vlc_object_release( p_projectm );<br>
+}<br>+<br>+/*****************************************************************************<br>+ * libvlc_projectm_get_preset_count : Get projectm preset count<br>+ *****************************************************************************/<br>
+int libvlc_projectm_get_preset_count( libvlc_media_player_t *p_mi )<br>+{<br>+ int count = 0;<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, VLC_PROJECTM_CMD_GET_COUNT );<br>+ if ( !p_projectm )<br>+ return count;<br>
+<br>+ count = var_GetInteger( p_projectm, "projectm-preset-id" );<br>+ vlc_object_release( p_projectm );<br>+ return count;<br>+}<br>+<br>+/*****************************************************************************<br>
+ * libvlc_projectm_get_preset_current_id : Get the current preset id<br>+ *****************************************************************************/<br>+int libvlc_projectm_get_preset_current_id( libvlc_media_player_t *p_mi )<br>
+{<br>+ int id = 0;<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, VLC_PROJECTM_CMD_GET_CURRENT );<br>+ if ( !p_projectm )<br>+ return id;<br>+<br>+ id = var_GetInteger( p_projectm, "projectm-preset-id" );<br>
+ vlc_object_release( p_projectm );<br>+ return id;<br>+}<br>+<br>+/*****************************************************************************<br>+ * libvlc_projectm_get_preset_name : Get the name of a preset<br>
+ *****************************************************************************/<br>+char *libvlc_projectm_get_preset_name( libvlc_media_player_t *p_mi, int i_id )<br>+{<br>+ char *name = NULL;<br>+ vlc_object_t *p_projectm = get_projectm( p_mi );<br>
+ if ( !p_projectm )<br>+ return name;<br>+<br>+ if( var_SetInteger( p_projectm, "projectm-preset-id", i_id ) < 0 )<br>+ {<br>+ libvlc_printerr( "projectm-preset-id out of range" );<br>
+ }<br>+ else<br>+ {<br>+ var_SetInteger( p_projectm, "projectm-preset-cmd", VLC_PROJECTM_CMD_GET_NAME );<br>+ name = var_GetString( p_projectm, "projectm-preset-name" );<br>+ }<br>
+ vlc_object_release( p_projectm );<br>+ return strdup(name);<br>+}<br>+<br>+/*****************************************************************************<br>+ * libvlc_projectm_is_locked : Get whether projectm is locked or not<br>
+ *****************************************************************************/<br>+int libvlc_projectm_is_locked( libvlc_media_player_t *p_mi )<br>+{<br>+ int id = 0;<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, VLC_PROJECTM_CMD_IS_LOCKED );<br>
+ if ( !p_projectm )<br>+ return id;<br>+<br>+ id = var_GetInteger( p_projectm, "projectm-preset-id" );<br>+ vlc_object_release( p_projectm );<br>+ return id;<br>+}<br>+<br>+/*****************************************************************************<br>
+ * libvlc_projectm_lock : Lock/Unlock projectm on the current preset<br>+ *****************************************************************************/<br>+void libvlc_projectm_lock( libvlc_media_player_t *p_mi, int b_locked )<br>
+{<br>+ vlc_object_t *p_projectm = send_projectm_cmd( p_mi, b_locked ? VLC_PROJECTM_CMD_LOCK : VLC_PROJECTM_CMD_UNLOCK );<br>+ if ( p_projectm )<br>+ vlc_object_release( p_projectm );<br>+}<br>diff --git a/src/libvlc.sym b/src/libvlc.sym<br>
index 1a401d1..5ce0a46 100644<br>--- a/src/libvlc.sym<br>+++ b/src/libvlc.sym<br>@@ -162,6 +162,13 @@ libvlc_media_subitems<br> libvlc_new<br> libvlc_new_with_builtins<br> libvlc_playlist_play<br>+libvlc_projectm_get_preset_count<br>
+libvlc_projectm_get_preset_current_id<br>+libvlc_projectm_get_preset_name<br>+libvlc_projectm_set_preset<br>+libvlc_projectm_random<br>+libvlc_projectm_is_locked<br>+libvlc_projectm_lock<br> libvlc_release<br> libvlc_retain<br>
libvlc_set_fullscreen<br><br>