Changeset e0003bec24b8241621d4bb6ce0fe5160835d84d0

Show
Ignore:
Timestamp:
02/14/06 22:41:23 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1139953283 +0000
git-parent:

[f0f9014510bebfe8ea372ce5e6dc01f62ea2df4e]

git-author:
Clément Stenac <zorglub@videolan.org> 1139953283 +0000
Message:

* Beginning of VLM API
* Some test work
* Export vlm_MediaSearch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r2f6ad03 re0003be  
    476476    src/control/core.c \ 
    477477    src/control/playlist.c \ 
     478    src/control/vlm.c \ 
    478479    src/control/input.c \ 
    479480    src/control/video.c \ 
  • include/libvlc_internal.h

    r473fef1 re0003be  
    3636    vlc_t *p_vlc; 
    3737    playlist_t *p_playlist; 
     38    vlm_t      *p_vlm; 
    3839    int    i_vlc_id; 
    3940}; 
  • include/vlc/libvlc.h

    r2f6ad03 re0003be  
    7474 * \param psz_message the exception message 
    7575 */ 
    76 void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_message ); 
     76void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... ); 
    7777 
    7878/** 
     
    147147 
    148148/** 
     149 * Pause a running playlist, resume if it was stopped 
     150 * \param p_instance the instance to pause 
     151 * \param p_exception an initialized exception 
     152 */ 
     153void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * ); 
     154 
     155/** 
     156 * Checks if the playlist is running 
     157 * \param p_instance the instance 
     158 * \param p_exception an initialized exception 
     159 * \return 0 if the playlist is stopped or paused, 1 if it is running 
     160 */ 
     161int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * ); 
     162 
     163/** 
     164 * Get the number of items in the playlist 
     165 * \param p_instance the instance 
     166 * \param p_exception an initialized exception 
     167 * \return the number of items 
     168 */ 
     169int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * ); 
     170 
     171 
     172 
     173 
     174 
     175/** 
    149176 * Stop playing 
    150177 * \param p_instance the instance to stop 
     
    154181 
    155182/** 
    156  * Remove all playlist ites 
     183 * Go to next playlist item (starts playback if it was stopped) 
     184 * \param p_instance the instance to use 
     185 * \param p_exception an initialized exception 
     186 */ 
     187void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * ); 
     188 
     189/** 
     190 * Go to previous playlist item (starts playback if it was stopped) 
     191 * \param p_instance the instance to use 
     192 * \param p_exception an initialized exception 
     193 */ 
     194void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * ); 
     195 
     196/** 
     197 * Remove all playlist items 
    157198 * \param p_instance the instance 
    158199 * \param p_exception an initialized exception 
     
    200241 
    201242 
    202  
    203243typedef struct libvlc_input_t libvlc_input_t; 
    204244 
    205 ///\todo document me 
     245/* Get the input that is currently being played by the playlist 
     246 * \param p_instance the instance to use 
     247 * \param p_exception an initialized excecption 
     248 * \return an input object 
     249 */ 
    206250libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *, 
    207251                                           libvlc_exception_t * ); 
     
    231275 
    232276 
     277/** @} */ 
     278 
     279/** defgroup libvlc_video Video 
     280 * \ingroup libvlc 
     281 * LibVLC Video handling 
     282 * @{ 
     283 */ 
     284 
     285/** 
     286 * Toggle fullscreen status on video output 
     287 * \param p_input the input 
     288 * \param p_exception an initialized exception 
     289 */ 
    233290void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * ); 
    234291 
     292/** 
     293 * Enable or disable fullscreen on a video output 
     294 * \param p_input the input 
     295 * \param b_fullscreen boolean for fullscreen status 
     296 * \param p_exception an initialized exception 
     297 */ 
     298void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * ); 
     299 
     300/** 
     301 * Get current fullscreen status 
     302 * \param p_input the input 
     303 * \param p_exception an initialized exception 
     304 * \return the fullscreen status (boolean) 
     305 */ 
     306int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * ); 
     307 
     308/** @} 
     309 * defgroup libvlc_vlm VLM 
     310 * \ingroup libvlc 
     311 * LibVLC VLM handling 
     312 * @{ 
     313 */ 
     314 
     315 
     316/** 
     317 * Add a broadcast, with one input 
     318 * \param p_instance the instance 
     319 * \param psz_name the name of the new broadcast 
     320 * \param psz_input the input MRL 
     321 * \param psz_output the output MRL (the parameter to the "sout" variable) 
     322 * \param i_options number of additional options 
     323 * \param ppsz_options additional options 
     324 * \param b_enabled boolean for enabling the new broadcast 
     325 * \param b_loop Should this broadcast be played in loop ? 
     326 * \param p_exception an initialized exception 
     327 */ 
     328void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* , 
     329                               int, char **, int, int, libvlc_exception_t * ); 
     330 
     331/** 
     332 * Delete a media (vod or broadcast) 
     333 * \param p_instance the instance 
     334 * \param psz_name the media to delete 
     335 * \param p_exception an initialized exception 
     336 */ 
     337void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * ); 
     338 
     339/** 
     340 * Enable or disable a media (vod or broadcast) 
     341 * \param p_instance the instance 
     342 * \param psz_name the media to work on 
     343 * \param b_enabled the new status 
     344 * \param p_exception an initialized exception 
     345 */ 
     346void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int, 
     347                             libvlc_exception_t *); 
     348 
     349/** 
     350 * Edit the parameters of a media. This will delete all existing inputs and 
     351 * add the specified one. 
     352 * \param p_instance the instance 
     353 * \param psz_name the name of the new broadcast 
     354 * \param psz_input the input MRL 
     355 * \param psz_output the output MRL (the parameter to the "sout" variable) 
     356 * \param i_options number of additional options 
     357 * \param ppsz_options additional options 
     358 * \param b_enabled boolean for enabling the new broadcast 
     359 * \param b_loop Should this broadcast be played in loop ? 
     360 * \param p_exception an initialized exception 
     361 */ 
     362void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* , 
     363                              int, char **, int, int, libvlc_exception_t * ); 
     364 
    235365 
    236366/** @} */ 
    237  
    238  
    239367 
    240368# ifdef __cplusplus 
     
    242370# endif 
    243371 
    244 #endif /* <vlc/vlc_control.h> */ 
     372#endif /* <vlc/libvlc.h> */ 
  • include/vlc_symbols.h

    r491a077 re0003be  
    363363char * mstrtime (char *psz_buffer, mtime_t date); 
    364364void aout_FormatPrepare (audio_sample_format_t * p_format); 
     365vlm_media_t* vlm_MediaSearch (vlm_t *, const char *); 
    365366void spu_DisplaySubpicture (spu_t *, subpicture_t *); 
    366367int intf_RunThread (intf_thread_t *); 
     
    940941    char * (*FromLocaleDup_inner) (const char *); 
    941942    int (*utf8_mkdir_inner) (const char *filename); 
     943    vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *); 
    942944}; 
    943945#  if defined (__PLUGIN__) 
     
    13941396#  define FromLocaleDup (p_symbols)->FromLocaleDup_inner 
    13951397#  define utf8_mkdir (p_symbols)->utf8_mkdir_inner 
     1398#  define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner 
    13961399#  elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 
    13971400/****************************************************************** 
     
    18511854    ((p_symbols)->FromLocaleDup_inner) = FromLocaleDup; \ 
    18521855    ((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \ 
     1856    ((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \ 
    18531857    (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 
    18541858    (p_symbols)->__stats_CounterGet_deprecated = NULL; \ 
  • include/vlc_vlm.h

    r2cb472d re0003be  
    140140VLC_EXPORT( int, vlm_MediaSetup, ( vlm_t *, vlm_media_t *, const char *, const char * ) ); 
    141141VLC_EXPORT( int, vlm_MediaControl, ( vlm_t *, vlm_media_t *, const char *, const char *, const char * ) ); 
     142VLC_EXPORT( vlm_media_t* , vlm_MediaSearch,( vlm_t *, const char *) ); 
    142143VLC_EXPORT( vlm_schedule_t *, vlm_ScheduleNew, ( vlm_t *, const char * ) ); 
    143144VLC_EXPORT( void, vlm_ScheduleDelete, ( vlm_t *, vlm_schedule_t *, const char * ) ); 
  • src/control/core.c

    r711b5da re0003be  
    2121 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 
    2222 *****************************************************************************/ 
    23  
     23#include <stdarg.h> 
    2424#include <libvlc_internal.h> 
    2525#include <vlc/libvlc.h> 
     
    5959 
    6060inline void libvlc_exception_raise( libvlc_exception_t *p_exception, 
    61                                     char *psz_message
     61                                    char *psz_format, ...
    6262{ 
     63    va_list args; 
     64    char *psz_message; 
     65    va_start( args, psz_message ); 
     66    vasprintf( &psz_message, psz_format, args ); 
     67    va_end( args ); 
     68 
    6369    if( p_exception == NULL ) return; 
    6470    p_exception->b_raised = 1; 
     
    98104    p_new->p_playlist = (playlist_t *)vlc_object_find( p_new->p_vlc, 
    99105                                VLC_OBJECT_PLAYLIST, FIND_CHILD ); 
     106    p_new->p_vlm = NULL; 
    100107 
    101108    if( !p_new->p_playlist ) 
  • src/misc/vlm.c

    r1c35288 re0003be  
    5555static vlm_message_t *vlm_Help( vlm_t *, char * ); 
    5656 
    57 static vlm_media_t *vlm_MediaSearch ( vlm_t *, const char * ); 
    5857static vlm_media_instance_t *vlm_MediaInstanceSearch( vlm_t *, vlm_media_t *, const char * ); 
    5958 
     
    819818} 
    820819 
    821 static vlm_media_t *vlm_MediaSearch( vlm_t *vlm, const char *psz_name ) 
     820vlm_media_t *vlm_MediaSearch( vlm_t *vlm, const char *psz_name ) 
    822821{ 
    823822    int i; 
  • test/native/libvlc.c

    rd0802e7 re0003be  
    5656 
    5757    p_instance = libvlc_new( 2, argv, &exception ); 
    58     ASSERT_EXCEPTION; 
     58    ASSERT_NOEXCEPTION; 
    5959 
    6060    /* Initial status */ 
     
    6666 
    6767    i_playing  = libvlc_playlist_isplaying( p_instance, &exception  ); 
    68     ASSERT_EXCEPTION; 
     68    ASSERT_NOEXCEPTION; 
    6969    ASSERT( i_playing == 0, "Playlist shouldn't be running" ); 
    7070    i_items = libvlc_playlist_items_count( p_instance, &exception ); 
    71     ASSERT_EXCEPTION; 
     71    ASSERT_NOEXCEPTION; 
    7272    ASSERT( i_items == 0, "Playlist should be empty" ); 
    7373 
     
    7575    libvlc_exception_clear( &exception ); 
    7676    i_id = libvlc_playlist_add( p_instance, "test" , NULL , &exception ); 
    77     ASSERT_EXCEPTION; 
     77    ASSERT_NOEXCEPTION; 
    7878    ASSERT( i_id > 0 , "Returned identifier is <= 0" ); 
    7979    i_items = libvlc_playlist_items_count( p_instance, &exception ); 
    80     ASSERT_EXCEPTION; 
     80    ASSERT_NOEXCEPTION; 
    8181    ASSERT( i_items == 1, "Playlist should have 1 item" ); 
    8282    i_playing  = libvlc_playlist_isplaying( p_instance, &exception  ); 
    83     ASSERT_EXCEPTION; 
     83    ASSERT_NOEXCEPTION; 
    8484    ASSERT( i_playing == 0, "Playlist shouldn't be running" ); 
    8585 
     
    9090} 
    9191 
     92static PyObject *vlm_test( PyObject *self, PyObject *args ) 
     93{ 
     94    libvlc_instance_t *p_instance; 
     95    char *argv[] = { "vlc", "--quiet" }; 
     96    libvlc_exception_t exception; 
     97    libvlc_exception_init( &exception ); 
     98    
     99    libvlc_vlm_set_enabled( p_instance, "test", 1, &exception ); 
     100    ASSERT_EXCEPTION; 
     101    libvlc_exception_clear( &exception ); 
     102 
     103    Py_INCREF( Py_None ); 
     104    return Py_None; 
     105} 
     106 
    92107static PyMethodDef native_libvlc_test_methods[] = { 
    93108   DEF_METHOD( create_destroy, "Create and destroy" ) 
    94109   DEF_METHOD( exception_test, "Test Exception handling" ) 
    95110   DEF_METHOD( playlist_test, "Test Playlist interaction" ) 
     111   DEF_METHOD( vlm_test, "Test VLM" ) 
    96112   { NULL, NULL, 0, NULL } 
    97113}; 
  • test/pyunit.h

    r661a6c1 re0003be  
    77} 
    88 
    9 #define ASSERT_EXCEPTION if( libvlc_exception_raised( &exception ) ) { \ 
     9#define ASSERT_NOEXCEPTION if( libvlc_exception_raised( &exception ) ) { \ 
    1010         if( libvlc_exception_get_message( &exception ) )  PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \ 
    1111         else PyErr_SetString( PyExc_AssertionError, "Exception raised" ); return NULL; } 
    1212 
     13#define ASSERT_EXCEPTION if( !libvlc_exception_raised( &exception ) ) { \ 
     14         if( libvlc_exception_get_message( &exception ) )  PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \ 
     15         else PyErr_SetString( PyExc_AssertionError, "Exception not raised" ); return NULL; } 
     16 
     17 
     18 
    1319#define DEF_METHOD( method, desc ) { #method, method, METH_VARARGS, desc},