Commit 528f1c64 authored by Olivier Aubert's avatar Olivier Aubert

python bindings: begin to complete the libvlc API bindings. Cf TODO for what is left to be done.

parent 22d8f2ec
API not yet implemented (from svn rev. 24237)
---------------------------------------------
VLC_PUBLIC_API libvlc_media_descriptor_t * libvlc_media_descriptor_new_as_node(
libvlc_instance_t *p_instance,
const char * psz_name,
libvlc_exception_t *p_e );
VLC_PUBLIC_API libvlc_tag_t
libvlc_media_descriptor_tag_at_index_for_key( libvlc_media_descriptor_t *p_md,
int i,
const char * key,
libvlc_exception_t *p_e );
VLC_PUBLIC_API libvlc_media_list_t *
libvlc_media_descriptor_subitems( libvlc_media_descriptor_t *p_md,
libvlc_exception_t *p_e );
VLC_PUBLIC_API libvlc_event_manager_t *
libvlc_media_descriptor_event_manager( libvlc_media_descriptor_t * p_md,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_descriptor_set_user_data( libvlc_media_descriptor_t * p_md,
void * p_new_user_data,
libvlc_exception_t * p_e);
VLC_PUBLIC_API void *
libvlc_media_descriptor_get_user_data( libvlc_media_descriptor_t * p_md,
libvlc_exception_t * p_e);
/** Get the Event Manager from which the media instance send event.
* \param p_mi the Media Instance
*/
VLC_PUBLIC_API libvlc_event_manager_t * libvlc_media_instance_event_manager ( libvlc_media_instance_t *, libvlc_exception_t * );
/*****************************************************************************
* Tag Query
*****************************************************************************/
/** defgroup libvlc_tag_query Tag Query
* \ingroup libvlc
* LibVLC Tag query
* @{
*/
VLC_PUBLIC_API libvlc_tag_query_t *
libvlc_tag_query_new( libvlc_instance_t *, libvlc_exception_t * );
VLC_PUBLIC_API void
libvlc_tag_query_release( libvlc_tag_query_t * );
VLC_PUBLIC_API void
libvlc_tag_query_retain( libvlc_tag_query_t * );
VLC_PUBLIC_API void
libvlc_tag_query_set_match_tag_and_key( libvlc_tag_query_t * p_q,
libvlc_tag_t tag,
char * psz_tag_key,
libvlc_exception_t * );
VLC_PUBLIC_API vlc_bool_t
libvlc_tag_query_match( libvlc_tag_query_t *, libvlc_media_descriptor_t *,
libvlc_exception_t * );
/** @} */
/*****************************************************************************
* Media List
*****************************************************************************/
/** defgroup libvlc_media_list MediaList
* \ingroup libvlc
* LibVLC Media List
* @{
*/
VLC_PUBLIC_API libvlc_media_list_t *
libvlc_media_list_new( libvlc_instance_t *, libvlc_exception_t * );
VLC_PUBLIC_API void
libvlc_media_list_release( libvlc_media_list_t * );
VLC_PUBLIC_API void
libvlc_media_list_retain( libvlc_media_list_t * );
VLC_PUBLIC_API void
libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
const char * psz_uri,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_set_media_descriptor( libvlc_media_list_t *,
libvlc_media_descriptor_t *,
libvlc_exception_t *);
VLC_PUBLIC_API libvlc_media_descriptor_t *
libvlc_media_list_media_descriptor( libvlc_media_list_t *,
libvlc_exception_t *);
VLC_PUBLIC_API void
libvlc_media_list_add_media_descriptor( libvlc_media_list_t *,
libvlc_media_descriptor_t *,
libvlc_exception_t * );
VLC_PUBLIC_API void
libvlc_media_list_insert_media_descriptor( libvlc_media_list_t *,
libvlc_media_descriptor_t *,
int,
libvlc_exception_t * );
VLC_PUBLIC_API void
libvlc_media_list_remove_index( libvlc_media_list_t *, int,
libvlc_exception_t * );
VLC_PUBLIC_API int
libvlc_media_list_count( libvlc_media_list_t * p_mlist,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_media_descriptor_t *
libvlc_media_list_item_at_index( libvlc_media_list_t *, int,
libvlc_exception_t * );
VLC_PUBLIC_API int
libvlc_media_list_index_of_item( libvlc_media_list_t *,
libvlc_media_descriptor_t *,
libvlc_exception_t * );
/* This indicates if this media list is read-only from a user point of view */
VLC_PUBLIC_API vlc_bool_t
libvlc_media_list_is_readonly( libvlc_media_list_t * p_mlist );
VLC_PUBLIC_API void
libvlc_media_list_lock( libvlc_media_list_t * );
VLC_PUBLIC_API void
libvlc_media_list_unlock( libvlc_media_list_t * );
VLC_PUBLIC_API libvlc_media_list_view_t *
libvlc_media_list_flat_view( libvlc_media_list_t *,
libvlc_exception_t * );
VLC_PUBLIC_API libvlc_media_list_view_t *
libvlc_media_list_hierarchical_view( libvlc_media_list_t *,
libvlc_exception_t * );
VLC_PUBLIC_API libvlc_media_list_view_t *
libvlc_media_list_hierarchical_node_view( libvlc_media_list_t *,
libvlc_exception_t * );
VLC_PUBLIC_API libvlc_event_manager_t *
libvlc_media_list_event_manager( libvlc_media_list_t *,
libvlc_exception_t * );
/** @} */
/*****************************************************************************
* Media List View
*****************************************************************************/
/** defgroup libvlc_media_list_view MediaListView
* \ingroup libvlc
* LibVLC Media List View
* @{ */
VLC_PUBLIC_API void
libvlc_media_list_view_retain( libvlc_media_list_view_t * p_mlv );
VLC_PUBLIC_API void
libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv );
VLC_PUBLIC_API libvlc_event_manager_t *
libvlc_media_list_view_event_manager( libvlc_media_list_view_t * p_mlv );
VLC_PUBLIC_API int
libvlc_media_list_view_count( libvlc_media_list_view_t * p_mlv,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_media_descriptor_t *
libvlc_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
int index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_media_list_view_t *
libvlc_media_list_view_children_at_index( libvlc_media_list_view_t * p_mlv,
int index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API int
libvlc_media_list_view_index_of_item( libvlc_media_list_view_t * p_mlv,
libvlc_media_descriptor_t * p_md,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_view_insert_at_index( libvlc_media_list_view_t * p_mlv,
libvlc_media_descriptor_t * p_md,
int index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_view_remove_at_index( libvlc_media_list_view_t * p_mlv,
int index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_view_add_item( libvlc_media_list_view_t * p_mlv,
libvlc_media_descriptor_t * p_md,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_media_list_t *
libvlc_media_list_view_parent_media_list( libvlc_media_list_view_t * p_mlv,
libvlc_exception_t * p_e );
/** @} */
/*****************************************************************************
* Dynamic Media List (Deprecated)
*****************************************************************************/
/** defgroup libvlc_media_list MediaList
* \ingroup libvlc
* LibVLC Media List
* @{ */
VLC_PUBLIC_API libvlc_dynamic_media_list_t *
libvlc_dynamic_media_list_new( libvlc_media_list_t * p_mlist,
libvlc_tag_query_t * p_query,
libvlc_tag_t tag,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_dynamic_media_list_release( libvlc_dynamic_media_list_t * p_dmlist );
VLC_PUBLIC_API void
libvlc_dynamic_media_list_retain( libvlc_dynamic_media_list_t * p_dmlist );
libvlc_media_list_t *
libvlc_dynamic_media_list_media_list( libvlc_dynamic_media_list_t * p_dmlist,
libvlc_exception_t * p_e );
/** @} */
/*****************************************************************************
* Media Library
*****************************************************************************/
/** defgroup libvlc_media_library Media Library
* \ingroup libvlc
* LibVLC Media Library
* @{
*/
VLC_PUBLIC_API libvlc_media_library_t *
libvlc_media_library_new( libvlc_instance_t * p_inst,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_library_release( libvlc_media_library_t * p_mlib );
VLC_PUBLIC_API void
libvlc_media_library_retain( libvlc_media_library_t * p_mlib );
VLC_PUBLIC_API void
libvlc_media_library_load( libvlc_media_library_t * p_mlib,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_library_save( libvlc_media_library_t * p_mlib,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_media_list_t *
libvlc_media_library_media_list( libvlc_media_library_t * p_mlib,
libvlc_exception_t * p_e );
/** @} */
/*****************************************************************************
* Media List Player
*****************************************************************************/
/** defgroup libvlc_media_list_player MediaListPlayer
* \ingroup libvlc
* LibVLC Media List Player
* @{
*/
VLC_PUBLIC_API libvlc_media_list_player_t *
libvlc_media_list_player_new( libvlc_instance_t * p_instance,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp );
VLC_PUBLIC_API void
libvlc_media_list_player_set_media_instance(
libvlc_media_list_player_t * p_mlp,
libvlc_media_instance_t * p_mi,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_set_media_list(
libvlc_media_list_player_t * p_mlp,
libvlc_media_list_t * p_mlist,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_pause( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
VLC_PUBLIC_API vlc_bool_t
libvlc_media_list_player_is_playing( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
VLC_PUBLIC_API libvlc_state_t
libvlc_media_list_player_get_state( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_play_item_at_index(
libvlc_media_list_player_t * p_mlp,
int i_index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_play_item(
libvlc_media_list_player_t * p_mlp,
libvlc_media_descriptor_t * p_md,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void
libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
libvlc_exception_t * p_e );
/** @} */
/**
* Get current crop filter geometry
* \param p_input the input
* \param p_exception an initialized exception
* \return the crop filter geometry
*/
VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_instance_t *, libvlc_exception_t * );
/**
* Set new crop filter geometry
* \param p_input the input
* \param psz_geometry new crop filter geometry
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_media_instance_t *, char *, libvlc_exception_t * );
/**
* Toggle teletext transparent status on video output
* \param p_input the input
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_instance_t *, libvlc_exception_t * );
/**
* Get current teletext page requested.
* \param p_input the input
* \param p_exception an initialized exception
* \return the current teletext page requested.
*/
VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_instance_t *, libvlc_exception_t * );
/**
* Set new teletext page to retrieve
* \param p_input the input
* \param i_page teletex page number requested
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_instance_t *, int, libvlc_exception_t * );
/**
* Take a snapshot of the current video window
* If i_width AND i_height is 0, original size is used
* if i_width XOR i_height is 0, original aspect-ratio is preserved
* \param p_input the input
* \param psz_filepath the path where to save the screenshot to
* \param i_width the snapshot's width
* \param i_height the snapshot's height
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_media_instance_t *, char *,unsigned int, unsigned int, libvlc_exception_t * );
/**
* Tell windowless video output to redraw rectangular area (MacOS X only)
* \param p_instance libvlc instance
* \param area coordinates within video drawable
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_media_instance_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
* Set the default video output viewport for a windowless video output (MacOS X only)
* this settings will be used as default for all video outputs
* \param p_instance libvlc instance
* \param view coordinates within video drawable
* \param clip coordinates within video drawable
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_set_viewport( libvlc_instance_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
/** @} */
/**
* Get number of available audio tracks
* \param p_mi media instance
* \param p_e an initialized exception
* \return the number of available audio tracks (int)
*/
VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_instance_t *, libvlc_exception_t * );
/**
+ * Get current audio track
+ * \param p_input input instance
+ * \param p_exception an initialized exception
+ * \return the audio track (int)
+ */
VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_instance_t *, libvlc_exception_t * );
/**
* Set current audio track
* \param p_input input instance
* \param i_track the track (int)
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_media_instance_t *, int, libvlc_exception_t * );
/*****************************************************************************
* Services/Media Discovery
*****************************************************************************/
/** defgroup libvlc_media_discoverer Media Discoverer
* \ingroup libvlc
* LibVLC Media Discoverer
* @{
*/
VLC_PUBLIC_API libvlc_media_discoverer_t *
libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
const char * psz_name,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void libvlc_media_discoverer_release( libvlc_media_discoverer_t * p_mdis );
VLC_PUBLIC_API char * libvlc_media_discoverer_localized_name( libvlc_media_discoverer_t * p_mdis );
VLC_PUBLIC_API libvlc_media_list_t * libvlc_media_discoverer_media_list( libvlc_media_discoverer_t * p_mdis );
VLC_PUBLIC_API libvlc_event_manager_t *
libvlc_media_discoverer_event_manager( libvlc_media_discoverer_t * p_mdis );
VLC_PUBLIC_API vlc_bool_t
libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis );
/*****************************************************************************
* Message log handling
*****************************************************************************/
/** defgroup libvlc_log Log
* \ingroup libvlc
* LibVLC Message Logging
* @{
*/
/**
* Returns the VLC messaging verbosity level
* \param p_instance libvlc instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instance,
libvlc_exception_t *p_e );
/**
* Set the VLC messaging verbosity level
* \param p_log libvlc log instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level,
libvlc_exception_t *p_e );
/**
* Open an instance to VLC message log
* \param p_instance libvlc instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API libvlc_log_t *libvlc_log_open( libvlc_instance_t *, libvlc_exception_t *);
/**
* Close an instance of VLC message log
* \param p_log libvlc log instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_log_close( libvlc_log_t *, libvlc_exception_t *);
/**
* Returns the number of messages in log
* \param p_log libvlc log instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API unsigned libvlc_log_count( const libvlc_log_t *, libvlc_exception_t *);
/**
* Clear all messages in log
* the log should be cleared on a regular basis to avoid clogging
* \param p_log libvlc log instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_log_clear( libvlc_log_t *, libvlc_exception_t *);
/**
* Allocate and returns a new iterator to messages in log
* \param p_log libvlc log instance
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API libvlc_log_iterator_t *libvlc_log_get_iterator( const libvlc_log_t *, libvlc_exception_t *);
/**
* Releases a previoulsy allocated iterator
* \param p_log libvlc log iterator
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
/**
* Returns whether log iterator has more messages
* \param p_log libvlc log iterator
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API int libvlc_log_iterator_has_next( const libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
/**
* Returns next log message
* the content of message must not be freed
* \param p_log libvlc log iterator
* \param exception an initialized exception pointer
*/
VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterator_t *p_iter,
struct libvlc_log_message_t *buffer,
libvlc_exception_t *p_e );
/** @} */
/*****************************************************************************
* Event handling
*****************************************************************************/
/** defgroup libvlc_callbacks Callbacks
* \ingroup libvlc
* LibVLC Events
* @{
*/
/**
* Register for an event notification
* \param p_event_manager the event manager to which you want to attach to
* Generally it is obtained by vlc_my_object_event_manager() where my_object
* Is the object you want to listen to.
* \param i_event_type the desired event to which we want to listen
* \param f_callback the function to call when i_event_type occurs
* \param user_data user provided data to carry with the event
* \param p_e an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_event_attach( libvlc_event_manager_t *p_event_manager,
libvlc_event_type_t i_event_type,
libvlc_callback_t f_callback,
void *user_data,
libvlc_exception_t *p_e );
/**
* Unregister an event notification
* \param p_event_manager the event manager
* \param i_event_type the desired event to which we want to unregister
* \param f_callback the function to call when i_event_type occurs
* \param p_e an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
libvlc_event_type_t i_event_type,
libvlc_callback_t f_callback,
void *p_user_data,
libvlc_exception_t *p_e );
/**
* Get an event type name
* \param i_event_type the desired event
*/
VLC_PUBLIC_API const char * libvlc_event_type_name( libvlc_event_type_t event_type );
......@@ -27,29 +27,29 @@
***********************************************************************/
static PyObject *
vlcInput_get_length( PyObject *self, PyObject *args )
vlcMediaInstance_get_length( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
vlc_int64_t i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_get_length( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_get_length( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcInput_get_time( PyObject *self, PyObject *args )
vlcMediaInstance_get_time( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
vlc_int64_t i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_get_time( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_get_time( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcInput_set_time( PyObject *self, PyObject *args )
vlcMediaInstance_set_time( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
vlc_int64_t i_time;
......@@ -58,25 +58,25 @@ vlcInput_set_time( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_media_instance_set_time( LIBVLC_INPUT->p_md, i_time, &ex);
libvlc_media_instance_set_time( LIBVLC_MEDIAINSTANCE->p_mi, i_time, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_get_position( PyObject *self, PyObject *args )
vlcMediaInstance_get_position( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
f_ret = libvlc_media_instance_get_position( LIBVLC_INPUT->p_md, &ex);
f_ret = libvlc_media_instance_get_position( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
static PyObject *
vlcInput_set_position( PyObject *self, PyObject *args )
vlcMediaInstance_set_position( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
float f_pos;
......@@ -85,36 +85,36 @@ vlcInput_set_position( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_media_instance_set_position( LIBVLC_INPUT->p_md, f_pos, &ex);
libvlc_media_instance_set_position( LIBVLC_MEDIAINSTANCE->p_mi, f_pos, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_will_play( PyObject *self, PyObject *args )
vlcMediaInstance_will_play( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_will_play( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_will_play( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_get_rate( PyObject *self, PyObject *args )
vlcMediaInstance_get_rate( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
f_ret = libvlc_media_instance_get_rate( LIBVLC_INPUT->p_md, &ex);
f_ret = libvlc_media_instance_get_rate( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
static PyObject *
vlcInput_set_rate( PyObject *self, PyObject *args )
vlcMediaInstance_set_rate( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
float f_rate;
......@@ -123,59 +123,59 @@ vlcInput_set_rate( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_media_instance_set_rate( LIBVLC_INPUT->p_md, f_rate, &ex);
libvlc_media_instance_set_rate( LIBVLC_MEDIAINSTANCE->p_mi, f_rate, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_get_state( PyObject *self, PyObject *args )
vlcMediaInstance_get_state( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_get_state( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_get_state( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_has_vout( PyObject *self, PyObject *args )
vlcMediaInstance_has_vout( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_has_vout( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_has_vout( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_get_fps( PyObject *self, PyObject *args )
vlcMediaInstance_get_fps( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
f_ret = libvlc_media_instance_get_fps( LIBVLC_INPUT->p_md, &ex);
f_ret = libvlc_media_instance_get_fps( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
static PyObject *
vlcInput_audio_get_track( PyObject *self, PyObject *args )
vlcMediaInstance_audio_get_track( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_audio_get_track( LIBVLC_INPUT->p_md, &ex );
i_ret = libvlc_audio_get_track( LIBVLC_MEDIAINSTANCE->p_mi, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_audio_set_track( PyObject *self, PyObject *args )
vlcMediaInstance_audio_set_track( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_track;
......@@ -184,26 +184,67 @@ vlcInput_audio_set_track( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_audio_set_track( LIBVLC_INPUT->p_md, i_track, &ex );
libvlc_audio_set_track( LIBVLC_MEDIAINSTANCE->p_mi, i_track, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_toggle_fullscreen( PyObject *self, PyObject *args )
vlcMediaInstance_get_chapter( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_get_chapter( LIBVLC_MEDIAINSTANCE->p_mi, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaInstance_get_chapter_count( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
libvlc_toggle_fullscreen( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_media_instance_get_chapter_count( LIBVLC_MEDIAINSTANCE->p_mi, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaInstance_set_chapter( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_chapter;
if( !PyArg_ParseTuple( args, "i", &i_chapter ) )
return NULL;
LIBVLC_TRY;
libvlc_media_instance_set_chapter( LIBVLC_MEDIAINSTANCE->p_mi, i_chapter, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_set_fullscreen( PyObject *self, PyObject *args )
vlcMediaInstance_toggle_fullscreen( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
LIBVLC_TRY;
libvlc_toggle_fullscreen( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaInstance_set_fullscreen( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_fullscreen;
......@@ -212,57 +253,57 @@ vlcInput_set_fullscreen( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_set_fullscreen( LIBVLC_INPUT->p_md, i_fullscreen, &ex);
libvlc_set_fullscreen( LIBVLC_MEDIAINSTANCE->p_mi, i_fullscreen, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_get_fullscreen( PyObject *self, PyObject *args )
vlcMediaInstance_get_fullscreen( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_get_fullscreen( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_get_fullscreen( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_get_height( PyObject *self, PyObject *args )
vlcMediaInstance_get_height( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_video_get_height( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_video_get_height( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_get_width( PyObject *self, PyObject *args )
vlcMediaInstance_get_width( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_video_get_width( LIBVLC_INPUT->p_md, &ex);
i_ret = libvlc_video_get_width( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcInput_get_aspect_ratio( PyObject *self, PyObject *args )
vlcMediaInstance_get_aspect_ratio( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_ret;
PyObject* o_ret;
LIBVLC_TRY;
psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_INPUT->p_md, &ex);
psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
o_ret=Py_BuildValue( "s", psz_ret );
free( psz_ret );
......@@ -270,7 +311,7 @@ vlcInput_get_aspect_ratio( PyObject *self, PyObject *args )
}
static PyObject *
vlcInput_set_aspect_ratio( PyObject *self, PyObject *args )
vlcMediaInstance_set_aspect_ratio( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_ratio;
......@@ -279,7 +320,7 @@ vlcInput_set_aspect_ratio( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_video_set_aspect_ratio( LIBVLC_INPUT->p_md, psz_ratio, &ex);
libvlc_video_set_aspect_ratio( LIBVLC_MEDIAINSTANCE->p_mi, psz_ratio, &ex);
LIBVLC_EXCEPT;
free( psz_ratio );
Py_INCREF( Py_None );
......@@ -287,7 +328,7 @@ vlcInput_set_aspect_ratio( PyObject *self, PyObject *args )
}
static PyObject *
vlcInput_video_take_snapshot( PyObject *self, PyObject *args )
vlcMediaInstance_video_take_snapshot( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_filename;
......@@ -296,14 +337,14 @@ vlcInput_video_take_snapshot( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_video_take_snapshot( LIBVLC_INPUT->p_md, psz_filename, 0, 0, &ex);
libvlc_video_take_snapshot( LIBVLC_MEDIAINSTANCE->p_mi, psz_filename, 0, 0, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_video_resize( PyObject *self, PyObject *args )
vlcMediaInstance_video_resize( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_width;
......@@ -313,14 +354,14 @@ vlcInput_video_resize( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_video_resize( LIBVLC_INPUT->p_md, i_width, i_height, &ex);
libvlc_video_resize( LIBVLC_MEDIAINSTANCE->p_mi, i_width, i_height, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInput_video_reparent( PyObject *self, PyObject *args )
vlcMediaInstance_video_reparent( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
WINDOWHANDLE i_visual;
......@@ -330,69 +371,250 @@ vlcInput_video_reparent( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
i_ret = libvlc_video_reparent( LIBVLC_INPUT->p_md, i_visual, &ex);
i_ret = libvlc_video_reparent( LIBVLC_MEDIAINSTANCE->p_mi, i_visual, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaInstance_is_seekable( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_is_seekable( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaInstance_can_pause( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_instance_can_pause( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyMethodDef vlcInput_methods[] =
static PyObject *
vlcMediaInstance_play( PyObject *self, PyObject *args )
{
{ "get_length", vlcInput_get_length, METH_VARARGS,
libvlc_exception_t ex;
LIBVLC_TRY;
libvlc_media_instance_play( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaInstance_pause( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
LIBVLC_TRY;
libvlc_media_instance_pause( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaInstance_stop( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
LIBVLC_TRY;
libvlc_media_instance_stop( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaInstance_set_drawable( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_drawable;
if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
return NULL;
LIBVLC_TRY;
libvlc_media_instance_set_drawable( LIBVLC_MEDIAINSTANCE->p_mi, (libvlc_drawable_t) i_drawable, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaInstance_set_media_descriptor( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
PyObject* py_param = NULL;
if( !PyArg_ParseTuple( args, "O", &py_param ) )
return NULL;
if( PyObject_TypeCheck( py_param, &vlcMediaDescriptor_Type ) == 1 )
{
LIBVLC_TRY;
libvlc_media_instance_set_media_descriptor( LIBVLC_MEDIAINSTANCE->p_mi, ((vlcMediaDescriptor*)py_param)->p_md, &ex );
LIBVLC_EXCEPT;
}
else
{
PyObject *py_exc = vlcInstance_Exception;
PyErr_SetString( py_exc, "vlc.MediaDescriptor parameter needed" );
return NULL;
}
return NULL;
}
static PyObject *
vlcMediaInstance_get_media_descriptor( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_media_descriptor_t *p_md;
vlcMediaDescriptor *p_ret;
LIBVLC_TRY;
p_md = libvlc_media_instance_get_media_descriptor( LIBVLC_MEDIAINSTANCE->p_mi, &ex );
LIBVLC_EXCEPT;
if( !p_md )
{
Py_INCREF( Py_None );
return Py_None;
}
else
{
p_ret = PyObject_New( vlcMediaDescriptor, &vlcMediaDescriptor_Type );
p_ret->p_md = p_md;
Py_INCREF( p_ret ); /* Ah bon ? */
return ( PyObject * )p_ret;
}
}
static PyObject *
vlcMediaInstance_get_spu( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_video_get_spu( LIBVLC_MEDIAINSTANCE->p_mi, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaInstance_set_spu( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_spu;
if( !PyArg_ParseTuple( args, "i", &i_spu ) )
return NULL;
LIBVLC_TRY;
libvlc_video_set_spu( LIBVLC_MEDIAINSTANCE->p_mi, i_spu, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyMethodDef vlcMediaInstance_methods[] =
{
{ "get_length", vlcMediaInstance_get_length, METH_VARARGS,
"get_length() -> long " },
{ "get_time", vlcInput_get_time, METH_VARARGS,
{ "get_time", vlcMediaInstance_get_time, METH_VARARGS,
"get_time() -> long" },
{ "set_time", vlcInput_set_time, METH_VARARGS,
{ "set_time", vlcMediaInstance_set_time, METH_VARARGS,
"set_time(long)" },
{ "get_position", vlcInput_get_position, METH_VARARGS,
{ "get_position", vlcMediaInstance_get_position, METH_VARARGS,
"get_position() -> float" },
{ "set_position", vlcInput_set_position, METH_VARARGS,
{ "set_position", vlcMediaInstance_set_position, METH_VARARGS,
"set_position(float)" },
{ "will_play", vlcInput_will_play, METH_VARARGS,
{ "will_play", vlcMediaInstance_will_play, METH_VARARGS,
"will_play() -> int" },
{ "get_rate", vlcInput_get_rate, METH_VARARGS,
{ "is_seekable", vlcMediaInstance_is_seekable, METH_VARARGS,
"is_seekable() -> int" },
{ "can_pause", vlcMediaInstance_can_pause, METH_VARARGS,
"can_pause() -> int" },
{ "get_rate", vlcMediaInstance_get_rate, METH_VARARGS,
"get_rate() -> float" },
{ "set_rate", vlcInput_set_rate, METH_VARARGS,
{ "set_rate", vlcMediaInstance_set_rate, METH_VARARGS,
"set_rate(float)" },
{ "get_state", vlcInput_get_state, METH_VARARGS,
{ "get_state", vlcMediaInstance_get_state, METH_VARARGS,
"get_state() -> int" },
{ "has_vout", vlcInput_has_vout, METH_VARARGS,
{ "has_vout", vlcMediaInstance_has_vout, METH_VARARGS,
"has_vout() -> int" },
{ "get_fps", vlcInput_get_fps, METH_VARARGS,
{ "get_fps", vlcMediaInstance_get_fps, METH_VARARGS,
"get_fps() -> float" },
{ "audio_get_track", vlcInput_audio_get_track, METH_VARARGS,
{ "audio_get_track", vlcMediaInstance_audio_get_track, METH_VARARGS,
"audio_get_track() -> int Get current audio track" },
{ "audio_set_track", vlcInput_audio_set_track, METH_VARARGS,
{ "audio_set_track", vlcMediaInstance_audio_set_track, METH_VARARGS,
"audio_set_track(int) Set current audio track" },
{ "toggle_fullscreen", vlcInput_toggle_fullscreen, METH_VARARGS,
{ "toggle_fullscreen", vlcMediaInstance_toggle_fullscreen, METH_VARARGS,
"toggle_fullscreen() Toggle fullscreen status on video output" },
{ "set_fullscreen", vlcInput_set_fullscreen, METH_VARARGS,
{ "set_fullscreen", vlcMediaInstance_set_fullscreen, METH_VARARGS,
"set_fullscreen(bool) Enable or disable fullscreen on a video output" },
{ "get_fullscreen", vlcInput_get_fullscreen, METH_VARARGS,
{ "get_fullscreen", vlcMediaInstance_get_fullscreen, METH_VARARGS,
"get_fullscreen() -> bool Get current fullscreen status" },
{ "get_height", vlcInput_get_height, METH_VARARGS,
{ "get_height", vlcMediaInstance_get_height, METH_VARARGS,
"get_height() -> int Get current video height" },
{ "get_width", vlcInput_get_width, METH_VARARGS,
{ "get_width", vlcMediaInstance_get_width, METH_VARARGS,
"get_width() -> int Get current video width" },
{ "get_aspect_ratio", vlcInput_get_aspect_ratio, METH_VARARGS,
{ "get_aspect_ratio", vlcMediaInstance_get_aspect_ratio, METH_VARARGS,
"get_aspect_ratio() -> str Get current video aspect ratio" },
{ "set_aspect_ratio", vlcInput_set_aspect_ratio, METH_VARARGS,
{ "set_aspect_ratio", vlcMediaInstance_set_aspect_ratio, METH_VARARGS,
"set_aspect_ratio(str) Set new video aspect ratio" },
{ "video_take_snapshot", vlcInput_video_take_snapshot, METH_VARARGS,
{ "video_take_snapshot", vlcMediaInstance_video_take_snapshot, METH_VARARGS,
"video_take_snapshot(filename=str) Take a snapshot of the current video window" },
{ "video_resize", vlcInput_video_resize, METH_VARARGS,
{ "video_resize", vlcMediaInstance_video_resize, METH_VARARGS,
"video_resize(width=int, height=int) Resize the current video output window" },
{ "video_reparent", vlcInput_video_reparent, METH_VARARGS,
{ "video_reparent", vlcMediaInstance_video_reparent, METH_VARARGS,
"video_reparent(visual=int) change the parent for the current video output" },
{ "play", vlcMediaInstance_play, METH_VARARGS,
"play() Play the media instance" },
{ "pause", vlcMediaInstance_pause, METH_VARARGS,
"pause() Pause the media instance" },
{ "stop", vlcMediaInstance_stop, METH_VARARGS,
"stop() Stop the media instance" },
{ "set_drawable", vlcMediaInstance_set_drawable, METH_VARARGS,
"set_drawable() Set the drawable id" },
{ "get_chapter", vlcMediaInstance_get_chapter, METH_VARARGS,
"get_chapter() -> int Get current chapter" },
{ "set_chapter", vlcMediaInstance_set_chapter, METH_VARARGS,
"set_chapter(int) Set current chapter" },
{ "get_chapter_count", vlcMediaInstance_get_chapter_count, METH_VARARGS,
"get_chapter_count() -> int Get current chapter count" },
{ "set_mediadescriptor", vlcMediaInstance_set_media_descriptor, METH_VARARGS,
"set_mediadescriptor(vlc.MediaDescriptor) Set the media descriptor that will be used by the media_instance" },
{ "get_mediadescriptor", vlcMediaInstance_get_media_descriptor, METH_VARARGS,
"get_mediadescriptor() -> vlc.MediaDescriptor Get the media descriptor used by the media_instance (if any)." },
{ "get_spu", vlcMediaInstance_get_spu, METH_VARARGS,
"get_spu() -> int Get current video subtitle" },
{ "set_spu", vlcMediaInstance_set_spu, METH_VARARGS,
"set_spu(int) Set new video subtitle" },
{ NULL } /* Sentinel */
};
static PyTypeObject vlcInput_Type =
static PyTypeObject vlcMediaInstance_Type =
{
PyObject_HEAD_INIT( NULL )
0, /*ob_size*/
"vlc.Input", /*tp_name*/
sizeof( vlcInput_Type ), /*tp_basicsize*/
"vlc.MediaInstance", /*tp_name*/
sizeof( vlcMediaInstance_Type ), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
0, /*tp_print*/
......@@ -410,14 +632,14 @@ static PyTypeObject vlcInput_Type =
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"vlc.Input object\n\nIt cannot be instanciated standalone, it must be obtained from an existing vlc.Instance object", /* tp_doc */
"vlc.MediaInstance object\n\nIt cannot be instanciated standalone, it must be obtained from an existing vlc.Instance object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
vlcInput_methods, /* tp_methods */
vlcMediaInstance_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
......
......@@ -315,18 +315,18 @@ vlcInstance_playlist_delete_item( PyObject *self, PyObject *args )
}
static PyObject *
vlcInstance_playlist_get_input( PyObject *self, PyObject *args )
vlcInstance_playlist_get_media_instance( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_media_instance_t *p_md;
vlcInput *p_ret;
libvlc_media_instance_t *p_mi;
vlcMediaInstance *p_ret;
LIBVLC_TRY;
p_md = libvlc_playlist_get_media_instance( LIBVLC_INSTANCE->p_instance, &ex );
p_mi = libvlc_playlist_get_media_instance( LIBVLC_INSTANCE->p_instance, &ex );
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcInput, &vlcInput_Type );
p_ret->p_md = p_md;
p_ret = PyObject_New( vlcMediaInstance, &vlcMediaInstance_Type );
p_ret->p_mi = p_mi;
Py_INCREF( p_ret ); /* Ah bon ? */
return ( PyObject * )p_ret;
}
......@@ -348,6 +348,19 @@ vlcInstance_video_set_parent( PyObject *self, PyObject *args )
return Py_None;
}
static PyObject *
vlcInstance_video_get_parent( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_drawable_t i_ret;
LIBVLC_TRY;
i_ret = libvlc_video_get_parent( LIBVLC_INSTANCE->p_instance, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcInstance_video_set_size( PyObject *self, PyObject *args )
{
......@@ -566,6 +579,23 @@ vlcInstance_vlm_set_input( PyObject *self, PyObject *args )
return Py_None;
}
static PyObject *
vlcInstance_vlm_add_input( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_name;
char* psz_input;
if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
return NULL;
LIBVLC_TRY;
libvlc_vlm_add_input( LIBVLC_INSTANCE->p_instance, psz_name, psz_input, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcInstance_vlm_set_loop( PyObject *self, PyObject *args )
{
......@@ -702,6 +732,27 @@ vlcInstance_vlm_show_media( PyObject *self, PyObject *args )
return o_ret;
}
static PyObject *
vlcInstance_media_descriptor_new( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_media_descriptor_t *p_md;
char* psz_mrl = NULL;
vlcMediaDescriptor *p_ret;
if( !PyArg_ParseTuple( args, "s", &psz_mrl ) )
return NULL;
LIBVLC_TRY;
p_md = libvlc_media_descriptor_new( LIBVLC_INSTANCE->p_instance, psz_mrl, &ex );
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcMediaDescriptor, &vlcMediaDescriptor_Type );
p_ret->p_md = p_md;
Py_INCREF( p_ret ); /* Ah bon ? */
return ( PyObject * )p_ret;
}
/* Method table */
static PyMethodDef vlcInstance_methods[] =
{
......@@ -729,10 +780,12 @@ static PyMethodDef vlcInstance_methods[] =
"playlist_add(mrl=str, name=str, options=list) -> int Add a new item to the playlist. options is a list of strings."},
{ "playlist_delete_item", vlcInstance_playlist_delete_item, METH_VARARGS,
"playlist_delete_item(id=int) Delete the given item"},
{ "playlist_get_input", vlcInstance_playlist_get_input, METH_VARARGS,
"playlist_get_input() -> object Return the current input"},
{ "playlist_get_media_instance", vlcInstance_playlist_get_media_instance, METH_VARARGS,
"playlist_get_media_instance() -> object Return the current media instance"},
{ "video_set_parent", vlcInstance_video_set_parent, METH_VARARGS,
"video_set_parent(xid=int) Set the parent xid or HWND"},
"video_set_parent(xid=int) Set the parent xid/HWND/CGrafPort"},
{ "video_get_parent", vlcInstance_video_get_parent, METH_VARARGS,
"video_get_parent(xid=int) Get the parent xid/HWND/CGrafPort"},
{ "video_set_size", vlcInstance_video_set_size, METH_VARARGS,
"video_set_size(width=int, height=int) Set the video width and height"},
{ "audio_toggle_mute", vlcInstance_audio_toggle_mute, METH_VARARGS,
......@@ -749,6 +802,10 @@ static PyMethodDef vlcInstance_methods[] =
"audio_get_channel() -> int Get current audio channel" },
{ "audio_set_channel", vlcInstance_audio_set_channel, METH_VARARGS,
"audio_set_channel(int) Set current audio channel" },
{ "media_descriptor_new", vlcInstance_media_descriptor_new, METH_VARARGS,
"media_descriptor_new(str) -> object Create a media descriptor with the given mrl."},
{ "vlm_add_broadcast", vlcInstance_vlm_add_broadcast, METH_VARARGS | METH_KEYWORDS,
"vlm_add_broadcast(name=str, input=str, output=str, options=list, enable=int, loop=int) Add a new broadcast" },
{ "vlm_del_media", vlcInstance_vlm_del_media, METH_VARARGS,
......@@ -759,6 +816,8 @@ static PyMethodDef vlcInstance_methods[] =
"vlm_set_output(name=str, output=str) Set the output" },
{ "vlm_set_input", vlcInstance_vlm_set_input, METH_VARARGS,
"vlm_set_input(name=str, output=str) Set the input" },
{ "vlm_add_input", vlcInstance_vlm_add_input, METH_VARARGS,
"vlm_add_input(name=str, output=str) Add a media's input MRL" },
{ "vlm_set_loop", vlcInstance_vlm_set_loop, METH_VARARGS,
"vlm_set_loop(name=str, loop=int) Change the looping value" },
{ "vlm_change_media", vlcInstance_vlm_change_media, METH_VARARGS | METH_KEYWORDS,
......
/*****************************************************************************
* vlc_mediadescriptor.c: vlc.MediaDescriptor binding
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id: vlc_input.c 22643 2007-10-17 13:30:02Z funman $
*
* Authors: Olivier Aubert <oaubert at liris.cnrs.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*****************************************************************************/
#include "vlcglue.h"
/***********************************************************************
* vlc.MediaDescriptor
***********************************************************************/
static void
vlcMediaDescriptor_dealloc( PyObject *self )
{
libvlc_media_descriptor_release( LIBVLC_MEDIADESCRIPTOR->p_md );
PyObject_DEL( self );
}
static PyObject *
vlcMediaDescriptor_add_option( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_options = NULL;
if( !PyArg_ParseTuple( args, "s", &psz_options ) )
return NULL;
LIBVLC_TRY;
libvlc_media_descriptor_add_option( LIBVLC_MEDIADESCRIPTOR->p_md, psz_options, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_get_mrl( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char * psz_mrl;
PyObject * o_ret;
LIBVLC_TRY;
psz_mrl = libvlc_media_descriptor_get_mrl( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
LIBVLC_EXCEPT;
o_ret = Py_BuildValue( "s", psz_mrl );
free( psz_mrl );
return o_ret;
}
static PyObject *
vlcMediaDescriptor_get_state( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_state_t i_state;
LIBVLC_TRY;
i_state = libvlc_media_descriptor_get_state( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
LIBVLC_EXCEPT;
/* FIXME: return the defined state constant */
return Py_BuildValue( "i", i_state );
}
static PyObject *
vlcMediaDescriptor_add_tag( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_key;
char* psz_tag;
if( !PyArg_ParseTuple( args, "ss", &psz_key, &psz_tag ) )
return NULL;
LIBVLC_TRY;
libvlc_media_descriptor_add_tag( LIBVLC_MEDIADESCRIPTOR->p_md, psz_key, ( libvlc_tag_t )psz_tag, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_remove_tag( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_key;
char* psz_tag;
if( !PyArg_ParseTuple( args, "ss", &psz_key, &psz_tag ) )
return NULL;
LIBVLC_TRY;
libvlc_media_descriptor_remove_tag( LIBVLC_MEDIADESCRIPTOR->p_md, psz_key, ( libvlc_tag_t )psz_tag, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_tags_count_for_key( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_tag;
int i_ret;
if( !PyArg_ParseTuple( args, "s", &psz_tag ) )
return NULL;
LIBVLC_TRY;
i_ret=libvlc_media_descriptor_tags_count_for_key( LIBVLC_MEDIADESCRIPTOR->p_md, psz_tag, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaDescriptor_get_duration( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_time_t i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_descriptor_get_duration( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcMediaDescriptor_media_instance_new( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_media_instance_t *p_mi;
vlcMediaInstance *p_ret;
LIBVLC_TRY;
p_mi = libvlc_media_instance_new_from_media_descriptor( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcMediaInstance, &vlcMediaInstance_Type );
p_ret->p_mi = p_mi;
Py_INCREF( p_ret ); /* Ah bon ? */
return ( PyObject * )p_ret;
}
static PyObject *
vlcMediaDescriptor_is_preparsed( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_descriptor_is_preparsed( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcMediaDescriptor_get_meta( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char * psz_meta = NULL;
char * psz_ret = NULL;
PyObject* o_ret;
int i_index = -1;
int i_loop = 0;
static const char * meta_names[] = { "Title", "Artist", "Genre", "Copyright", "Album", "TrackNumber", "Description", "Rating", "Date", "Setting", "URL", "Language", "NowPlaying", "Publisher", "EncodedBy", "ArtworkURL", "TrackID", NULL };
if( !PyArg_ParseTuple( args, "s", &psz_meta ) )
return NULL;
while( !meta_names[i_loop] )
{
if( !strncmp(meta_names[i_loop], psz_meta, strlen(meta_names[i_loop])) )
{
i_index = i_loop;
break;
}
}
if( i_index < 0 )
{
PyObject *py_exc = vlcInstance_Exception;
PyErr_SetString( py_exc, "Unknown meta attribute" );
return NULL;
}
LIBVLC_TRY;
psz_ret = libvlc_media_descriptor_get_meta( LIBVLC_MEDIADESCRIPTOR->p_md, i_index, &ex);
LIBVLC_EXCEPT;
o_ret = Py_BuildValue( "s", psz_ret );
free( psz_ret );
return o_ret;
}
static PyMethodDef vlcMediaDescriptor_methods[] =
{
{ "add_option", vlcMediaDescriptor_add_option, METH_VARARGS,
"add_option(str) Add an option to the media descriptor." },
{ "get_mrl", vlcMediaDescriptor_get_mrl, METH_VARARGS,
"get_mrl() -> str" },
{ "get_state", vlcMediaDescriptor_get_state, METH_VARARGS,
"get_state() -> int" },
{ "add_tag", vlcMediaDescriptor_add_tag, METH_VARARGS,
"add_tag(key=str, tag=str) Add tag to the media descriptor." },
{ "remove_tag", vlcMediaDescriptor_remove_tag, METH_VARARGS,
"remove_tag(key=str, tag=str) Remove tag from the media descriptor." },
{ "tags_count_for_key", vlcMediaDescriptor_tags_count_for_key, METH_VARARGS,
"tags_count_for_key(str) ." },
{ "get_duration", vlcMediaDescriptor_get_duration, METH_VARARGS,
"get_duration() -> int" },
{ "mediainstance_new", vlcMediaDescriptor_media_instance_new, METH_VARARGS,
"mediainstance_new() -> vlc.MediaInstance Create a Media Instance object from a Media Descriptor" },
{ "is_preparsed", vlcMediaDescriptor_is_preparsed, METH_VARARGS,
"is_preparsed() -> int" },
{ "get_meta", vlcMediaDescriptor_get_meta, METH_VARARGS,
"get_meta(str) -> str Read the meta of the media descriptor." },
{ NULL } /* Sentinel */
};
static PyTypeObject vlcMediaDescriptor_Type =
{
PyObject_HEAD_INIT( NULL )
0, /*ob_size*/
"vlc.MediaDescriptor", /*tp_name*/
sizeof( vlcMediaDescriptor_Type ), /*tp_basicsize*/
0, /*tp_itemsize*/
vlcMediaDescriptor_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"vlc.MediaDescriptor object.", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
vlcMediaDescriptor_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
};
......@@ -47,8 +47,10 @@ initvlc( void )
{
PyObject* p_module;
vlcInput_Type.tp_new = PyType_GenericNew;
vlcInput_Type.tp_alloc = PyType_GenericAlloc;
vlcMediaInstance_Type.tp_new = PyType_GenericNew;
vlcMediaInstance_Type.tp_alloc = PyType_GenericAlloc;
vlcMediaDescriptor_Type.tp_new = PyType_GenericNew;
vlcMediaDescriptor_Type.tp_alloc = PyType_GenericAlloc;
p_module = Py_InitModule3( "vlc", vlc_methods,
"VLC media player embedding module." );
......@@ -62,7 +64,9 @@ initvlc( void )
return;
if( PyType_Ready( &vlcInstance_Type ) < 0 )
return;
if( PyType_Ready( &vlcInput_Type ) < 0 )
if( PyType_Ready( &vlcMediaInstance_Type ) < 0 )
return;
if( PyType_Ready( &vlcMediaDescriptor_Type ) < 0 )
return;
/* Exceptions */
......@@ -115,9 +119,12 @@ initvlc( void )
Py_INCREF( &vlcInstance_Type );
PyModule_AddObject( p_module, "Instance",
( PyObject * )&vlcInstance_Type );
Py_INCREF( &vlcInput_Type );
PyModule_AddObject( p_module, "Input",
( PyObject * )&vlcInput_Type );
Py_INCREF( &vlcMediaInstance_Type );
PyModule_AddObject( p_module, "MediaInstance",
( PyObject * )&vlcMediaInstance_Type );
Py_INCREF( &vlcMediaDescriptor_Type );
PyModule_AddObject( p_module, "MediaDescriptor",
( PyObject * )&vlcMediaDescriptor_Type );
/* Constants */
PyModule_AddIntConstant( p_module, "AbsolutePosition",
......@@ -133,6 +140,7 @@ initvlc( void )
mediacontrol_SampleCount );
PyModule_AddIntConstant( p_module, "MediaTime",
mediacontrol_MediaTime );
PyModule_AddIntConstant( p_module, "PlayingStatus",
mediacontrol_PlayingStatus );
PyModule_AddIntConstant( p_module, "PauseStatus",
......@@ -147,6 +155,7 @@ initvlc( void )
mediacontrol_EndStatus );
PyModule_AddIntConstant( p_module, "UndefinedStatus",
mediacontrol_UndefinedStatus );
}
......@@ -159,7 +168,7 @@ void * fast_memcpy( void * to, const void * from, size_t len )
/* Horrible hack... Please do not look. Temporary workaround for the
forward declaration mess of python types (cf vlcglue.h). If we do a
separate compilation, we have to declare some types as extern. But
the recommended way to forward declare types in python is
the recommended way to forward declared types in python is
static... I am sorting the mess but in the meantime, this will
produce a working python module.
*/
......@@ -167,3 +176,4 @@ void * fast_memcpy( void * to, const void * from, size_t len )
#include "vlc_position.c"
#include "vlc_instance.c"
#include "vlc_input.c"
#include "vlc_mediadescriptor.c"
......@@ -113,21 +113,33 @@ typedef struct
} PyPosition;
/**********************************************************************
* vlc.Input Object
* vlc.MediaInstance Object
**********************************************************************/
typedef struct
{
PyObject_HEAD
libvlc_media_instance_t* p_md;
} vlcInput;
libvlc_media_instance_t* p_mi;
} vlcMediaInstance;
/**********************************************************************
* vlc.MediaDescriptor Object
**********************************************************************/
typedef struct
{
PyObject_HEAD
libvlc_media_descriptor_t* p_md;
} vlcMediaDescriptor;
/* Forward declarations */
staticforward PyTypeObject MediaControl_Type;
staticforward PyTypeObject PyPosition_Type;
staticforward PyTypeObject vlcInstance_Type;
staticforward PyTypeObject vlcInput_Type;
staticforward PyTypeObject vlcMediaInstance_Type;
staticforward PyTypeObject vlcMediaDescriptor_Type;
#define LIBVLC_INPUT ((vlcInput*)self)
#define LIBVLC_INSTANCE ((vlcInstance*)self)
#define LIBVLC_MEDIAINSTANCE ((vlcMediaInstance*)self)
#define LIBVLC_MEDIADESCRIPTOR ((vlcMediaDescriptor*)self)
#define LIBVLC_TRY libvlc_exception_init( &ex );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment