mirror of
https://github.com/videolan/vlc.git
synced 2025-01-27 01:56:19 +08:00
* Beginning of VLM API
* Some test work * Export vlm_MediaSearch
This commit is contained in:
parent
f0f9014510
commit
e0003bec24
@ -475,6 +475,7 @@ SOURCES_libvlc_common = \
|
||||
src/extras/libc.c \
|
||||
src/control/core.c \
|
||||
src/control/playlist.c \
|
||||
src/control/vlm.c \
|
||||
src/control/input.c \
|
||||
src/control/video.c \
|
||||
src/control/mediacontrol_core.c \
|
||||
|
@ -1,34 +0,0 @@
|
||||
###########################
|
||||
# STATUS for VLC bindings #
|
||||
###########################
|
||||
|
||||
* General
|
||||
---------
|
||||
* TODO
|
||||
- Integrate bindings creation with build system
|
||||
|
||||
* API
|
||||
-----
|
||||
* TODO
|
||||
- Clean up / Use VLC coding styles
|
||||
- VLM control
|
||||
|
||||
* Python: (Olivier Aubert)
|
||||
---------
|
||||
* Implements the mediacontrol API
|
||||
* TODO
|
||||
- Fix win32 build
|
||||
- Clean up glue file
|
||||
|
||||
* Java: (Filippo Carone)
|
||||
-------
|
||||
* Implements libvlc base API
|
||||
* Only works with gcj
|
||||
* TODO
|
||||
- Fix crash with command line arguments
|
||||
- Implement mediacontrol
|
||||
- provide "make install"
|
||||
|
||||
* .NET: (jlj)
|
||||
-------
|
||||
* Not commited yet :)
|
@ -35,6 +35,7 @@ struct libvlc_instance_t
|
||||
{
|
||||
vlc_t *p_vlc;
|
||||
playlist_t *p_playlist;
|
||||
vlm_t *p_vlm;
|
||||
int i_vlc_id;
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ int libvlc_exception_raised( libvlc_exception_t *p_exception );
|
||||
* \param p_exception the exception to raise
|
||||
* \param psz_message the exception message
|
||||
*/
|
||||
void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_message );
|
||||
void libvlc_exception_raise( libvlc_exception_t *p_exception, char *psz_format, ... );
|
||||
|
||||
/**
|
||||
* Clear an exception object so it can be reused.
|
||||
@ -145,6 +145,33 @@ void libvlc_destroy( libvlc_instance_t *);
|
||||
void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
|
||||
libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Pause a running playlist, resume if it was stopped
|
||||
* \param p_instance the instance to pause
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_playlist_pause( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Checks if the playlist is running
|
||||
* \param p_instance the instance
|
||||
* \param p_exception an initialized exception
|
||||
* \return 0 if the playlist is stopped or paused, 1 if it is running
|
||||
*/
|
||||
int libvlc_playlist_isplaying( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Get the number of items in the playlist
|
||||
* \param p_instance the instance
|
||||
* \param p_exception an initialized exception
|
||||
* \return the number of items
|
||||
*/
|
||||
int libvlc_playlist_items_count( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Stop playing
|
||||
* \param p_instance the instance to stop
|
||||
@ -153,7 +180,21 @@ void libvlc_playlist_play( libvlc_instance_t*, int, int, char **,
|
||||
void libvlc_playlist_stop( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Remove all playlist ites
|
||||
* Go to next playlist item (starts playback if it was stopped)
|
||||
* \param p_instance the instance to use
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_playlist_next( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Go to previous playlist item (starts playback if it was stopped)
|
||||
* \param p_instance the instance to use
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_playlist_prev( libvlc_instance_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Remove all playlist items
|
||||
* \param p_instance the instance
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
@ -199,10 +240,13 @@ int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct libvlc_input_t libvlc_input_t;
|
||||
|
||||
///\todo document me
|
||||
/* Get the input that is currently being played by the playlist
|
||||
* \param p_instance the instance to use
|
||||
* \param p_exception an initialized excecption
|
||||
* \return an input object
|
||||
*/
|
||||
libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *,
|
||||
libvlc_exception_t * );
|
||||
|
||||
@ -230,15 +274,99 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *);
|
||||
float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
/** defgroup libvlc_video Video
|
||||
* \ingroup libvlc
|
||||
* LibVLC Video handling
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Toggle fullscreen status on video output
|
||||
* \param p_input the input
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Enable or disable fullscreen on a video output
|
||||
* \param p_input the input
|
||||
* \param b_fullscreen boolean for fullscreen status
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Get current fullscreen status
|
||||
* \param p_input the input
|
||||
* \param p_exception an initialized exception
|
||||
* \return the fullscreen status (boolean)
|
||||
*/
|
||||
int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
|
||||
|
||||
/** @}
|
||||
* defgroup libvlc_vlm VLM
|
||||
* \ingroup libvlc
|
||||
* LibVLC VLM handling
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Add a broadcast, with one input
|
||||
* \param p_instance the instance
|
||||
* \param psz_name the name of the new broadcast
|
||||
* \param psz_input the input MRL
|
||||
* \param psz_output the output MRL (the parameter to the "sout" variable)
|
||||
* \param i_options number of additional options
|
||||
* \param ppsz_options additional options
|
||||
* \param b_enabled boolean for enabling the new broadcast
|
||||
* \param b_loop Should this broadcast be played in loop ?
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_vlm_add_broadcast( libvlc_instance_t *, char *, char *, char* ,
|
||||
int, char **, int, int, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Delete a media (vod or broadcast)
|
||||
* \param p_instance the instance
|
||||
* \param psz_name the media to delete
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_vlm_del_media( libvlc_instance_t *, char *, libvlc_exception_t * );
|
||||
|
||||
/**
|
||||
* Enable or disable a media (vod or broadcast)
|
||||
* \param p_instance the instance
|
||||
* \param psz_name the media to work on
|
||||
* \param b_enabled the new status
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_vlm_set_enabled( libvlc_instance_t *, char *, int,
|
||||
libvlc_exception_t *);
|
||||
|
||||
/**
|
||||
* Edit the parameters of a media. This will delete all existing inputs and
|
||||
* add the specified one.
|
||||
* \param p_instance the instance
|
||||
* \param psz_name the name of the new broadcast
|
||||
* \param psz_input the input MRL
|
||||
* \param psz_output the output MRL (the parameter to the "sout" variable)
|
||||
* \param i_options number of additional options
|
||||
* \param ppsz_options additional options
|
||||
* \param b_enabled boolean for enabling the new broadcast
|
||||
* \param b_loop Should this broadcast be played in loop ?
|
||||
* \param p_exception an initialized exception
|
||||
*/
|
||||
void libvlc_vlm_change_media( libvlc_instance_t *, char *, char *, char* ,
|
||||
int, char **, int, int, libvlc_exception_t * );
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* <vlc/vlc_control.h> */
|
||||
#endif /* <vlc/libvlc.h> */
|
||||
|
@ -362,6 +362,7 @@ unsigned int update_iterator_ChooseMirrorAndFile (update_iterator_t *, int, int,
|
||||
void intf_InteractionManage (playlist_t *);
|
||||
char * mstrtime (char *psz_buffer, mtime_t date);
|
||||
void aout_FormatPrepare (audio_sample_format_t * p_format);
|
||||
vlm_media_t* vlm_MediaSearch (vlm_t *, const char *);
|
||||
void spu_DisplaySubpicture (spu_t *, subpicture_t *);
|
||||
int intf_RunThread (intf_thread_t *);
|
||||
decoder_t * input_DecoderNew (input_thread_t *, es_format_t *, vlc_bool_t b_force_decoder);
|
||||
@ -939,6 +940,7 @@ struct module_symbols_t
|
||||
int (*utf8_lstat_inner) (const char *filename, void *buf);
|
||||
char * (*FromLocaleDup_inner) (const char *);
|
||||
int (*utf8_mkdir_inner) (const char *filename);
|
||||
vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
|
||||
};
|
||||
# if defined (__PLUGIN__)
|
||||
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
|
||||
@ -1393,6 +1395,7 @@ struct module_symbols_t
|
||||
# define utf8_lstat (p_symbols)->utf8_lstat_inner
|
||||
# define FromLocaleDup (p_symbols)->FromLocaleDup_inner
|
||||
# define utf8_mkdir (p_symbols)->utf8_mkdir_inner
|
||||
# define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner
|
||||
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
|
||||
/******************************************************************
|
||||
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
|
||||
@ -1850,6 +1853,7 @@ struct module_symbols_t
|
||||
((p_symbols)->utf8_lstat_inner) = utf8_lstat; \
|
||||
((p_symbols)->FromLocaleDup_inner) = FromLocaleDup; \
|
||||
((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \
|
||||
((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \
|
||||
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
|
||||
(p_symbols)->__stats_CounterGet_deprecated = NULL; \
|
||||
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
|
||||
|
@ -139,6 +139,7 @@ VLC_EXPORT( vlm_media_t *, vlm_MediaNew, ( vlm_t *, const char *, int ) );
|
||||
VLC_EXPORT( void, vlm_MediaDelete, ( vlm_t *, vlm_media_t *, const char * ) );
|
||||
VLC_EXPORT( int, vlm_MediaSetup, ( vlm_t *, vlm_media_t *, const char *, const char * ) );
|
||||
VLC_EXPORT( int, vlm_MediaControl, ( vlm_t *, vlm_media_t *, const char *, const char *, const char * ) );
|
||||
VLC_EXPORT( vlm_media_t* , vlm_MediaSearch,( vlm_t *, const char *) );
|
||||
VLC_EXPORT( vlm_schedule_t *, vlm_ScheduleNew, ( vlm_t *, const char * ) );
|
||||
VLC_EXPORT( void, vlm_ScheduleDelete, ( vlm_t *, vlm_schedule_t *, const char * ) );
|
||||
VLC_EXPORT( int, vlm_ScheduleSetup, ( vlm_schedule_t *, const char *, const char * ) );
|
||||
|
@ -20,7 +20,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <libvlc_internal.h>
|
||||
#include <vlc/libvlc.h>
|
||||
|
||||
@ -58,8 +58,14 @@ inline char* libvlc_exception_get_message( libvlc_exception_t *p_exception )
|
||||
}
|
||||
|
||||
inline void libvlc_exception_raise( libvlc_exception_t *p_exception,
|
||||
char *psz_message )
|
||||
char *psz_format, ... )
|
||||
{
|
||||
va_list args;
|
||||
char *psz_message;
|
||||
va_start( args, psz_message );
|
||||
vasprintf( &psz_message, psz_format, args );
|
||||
va_end( args );
|
||||
|
||||
if( p_exception == NULL ) return;
|
||||
p_exception->b_raised = 1;
|
||||
if( psz_message )
|
||||
@ -97,6 +103,7 @@ libvlc_instance_t * libvlc_new( int argc, char **argv,
|
||||
p_new->p_vlc = p_vlc;
|
||||
p_new->p_playlist = (playlist_t *)vlc_object_find( p_new->p_vlc,
|
||||
VLC_OBJECT_PLAYLIST, FIND_CHILD );
|
||||
p_new->p_vlm = NULL;
|
||||
|
||||
if( !p_new->p_playlist )
|
||||
{
|
||||
|
@ -54,7 +54,6 @@
|
||||
static vlm_message_t *vlm_Show( vlm_t *, vlm_media_t *, vlm_schedule_t *, char * );
|
||||
static vlm_message_t *vlm_Help( vlm_t *, char * );
|
||||
|
||||
static vlm_media_t *vlm_MediaSearch ( vlm_t *, const char * );
|
||||
static vlm_media_instance_t *vlm_MediaInstanceSearch( vlm_t *, vlm_media_t *, const char * );
|
||||
|
||||
static vlm_message_t *vlm_MessageNew( char *, const char *, ... );
|
||||
@ -818,7 +817,7 @@ error:
|
||||
return VLC_EGENERIC;
|
||||
}
|
||||
|
||||
static vlm_media_t *vlm_MediaSearch( vlm_t *vlm, const char *psz_name )
|
||||
vlm_media_t *vlm_MediaSearch( vlm_t *vlm, const char *psz_name )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -55,7 +55,7 @@ static PyObject *playlist_test( PyObject *self, PyObject *args )
|
||||
libvlc_exception_init( &exception );
|
||||
|
||||
p_instance = libvlc_new( 2, argv, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
|
||||
/* Initial status */
|
||||
libvlc_playlist_play( p_instance, 0, 0, argv, &exception );
|
||||
@ -65,22 +65,22 @@ static PyObject *playlist_test( PyObject *self, PyObject *args )
|
||||
libvlc_exception_clear( &exception );
|
||||
|
||||
i_playing = libvlc_playlist_isplaying( p_instance, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
ASSERT( i_playing == 0, "Playlist shouldn't be running" );
|
||||
i_items = libvlc_playlist_items_count( p_instance, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
ASSERT( i_items == 0, "Playlist should be empty" );
|
||||
|
||||
/* Add 1 item */
|
||||
libvlc_exception_clear( &exception );
|
||||
i_id = libvlc_playlist_add( p_instance, "test" , NULL , &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
ASSERT( i_id > 0 , "Returned identifier is <= 0" );
|
||||
i_items = libvlc_playlist_items_count( p_instance, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
ASSERT( i_items == 1, "Playlist should have 1 item" );
|
||||
i_playing = libvlc_playlist_isplaying( p_instance, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
ASSERT_NOEXCEPTION;
|
||||
ASSERT( i_playing == 0, "Playlist shouldn't be running" );
|
||||
|
||||
/* */
|
||||
@ -89,10 +89,26 @@ static PyObject *playlist_test( PyObject *self, PyObject *args )
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *vlm_test( PyObject *self, PyObject *args )
|
||||
{
|
||||
libvlc_instance_t *p_instance;
|
||||
char *argv[] = { "vlc", "--quiet" };
|
||||
libvlc_exception_t exception;
|
||||
libvlc_exception_init( &exception );
|
||||
|
||||
libvlc_vlm_set_enabled( p_instance, "test", 1, &exception );
|
||||
ASSERT_EXCEPTION;
|
||||
libvlc_exception_clear( &exception );
|
||||
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyMethodDef native_libvlc_test_methods[] = {
|
||||
DEF_METHOD( create_destroy, "Create and destroy" )
|
||||
DEF_METHOD( exception_test, "Test Exception handling" )
|
||||
DEF_METHOD( playlist_test, "Test Playlist interaction" )
|
||||
DEF_METHOD( vlm_test, "Test VLM" )
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,14 @@
|
||||
Py_InitModule( #module, module##_methods ); \
|
||||
}
|
||||
|
||||
#define ASSERT_EXCEPTION if( libvlc_exception_raised( &exception ) ) { \
|
||||
#define ASSERT_NOEXCEPTION if( libvlc_exception_raised( &exception ) ) { \
|
||||
if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
|
||||
else PyErr_SetString( PyExc_AssertionError, "Exception raised" ); return NULL; }
|
||||
|
||||
#define ASSERT_EXCEPTION if( !libvlc_exception_raised( &exception ) ) { \
|
||||
if( libvlc_exception_get_message( &exception ) ) PyErr_SetString( PyExc_AssertionError, libvlc_exception_get_message( &exception ) ); \
|
||||
else PyErr_SetString( PyExc_AssertionError, "Exception not raised" ); return NULL; }
|
||||
|
||||
|
||||
|
||||
#define DEF_METHOD( method, desc ) { #method, method, METH_VARARGS, desc},
|
||||
|
Loading…
Reference in New Issue
Block a user