* libvlc_internal.h : Definition of opaque structures for libvlc exported API
* Also contains some internal utility functions
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
- * $Id: control_structures.h 13752 2005-12-15 10:14:42Z oaubert $
+ * Copyright (C) 2005-2009 the VideoLAN team
+ * $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
#ifndef _LIBVLC_INTERNAL_H
#define _LIBVLC_INTERNAL_H 1
-# ifdef __cplusplus
-extern "C" {
-# endif
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
-#include <vlc/vlc.h>
#include <vlc/libvlc_structures.h>
-
+#include <vlc/libvlc.h>
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_events.h>
+
+#include <vlc_common.h>
+
/***************************************************************************
* Internal creation and destruction functions
***************************************************************************/
VLC_EXPORT (libvlc_int_t *, libvlc_InternalCreate, ( void ) );
-VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, char *ppsz_argv[] ) );
-VLC_EXPORT (int, libvlc_InternalCleanup, ( libvlc_int_t * ) );
-VLC_EXPORT (int, libvlc_InternalDestroy, ( libvlc_int_t *, vlc_bool_t ) );
+VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, const char *ppsz_argv[] ) );
+VLC_EXPORT (void, libvlc_InternalCleanup, ( libvlc_int_t * ) );
+VLC_EXPORT (void, libvlc_InternalDestroy, ( libvlc_int_t * ) );
-VLC_EXPORT (int, libvlc_InternalAddIntf, ( libvlc_int_t *, const char *, vlc_bool_t,
- vlc_bool_t, int, const char *const * ) );
+VLC_EXPORT (int, libvlc_InternalAddIntf, ( libvlc_int_t *, const char * ) );
+VLC_EXPORT (void, libvlc_InternalWait, ( libvlc_int_t * ) );
-VLC_EXPORT (void, libvlc_event_init, ( libvlc_instance_t *, libvlc_exception_t * ) );
-VLC_EXPORT (void, libvlc_event_fini, ( libvlc_instance_t *, libvlc_exception_t * ) );
+typedef void (*libvlc_vlm_release_func_t)( libvlc_instance_t * ) ;
/***************************************************************************
* Opaque structures for libvlc API
***************************************************************************/
-struct libvlc_callback_entry_t
+typedef struct libvlc_vlm_t
{
- libvlc_instance_t *p_instance;
- libvlc_callback_t f_callback;
- libvlc_event_type_t i_event_type;
- void *p_user_data;
-};
+ vlm_t *p_vlm;
+ libvlc_event_manager_t *p_event_manager;
+ libvlc_vlm_release_func_t pf_release;
+} libvlc_vlm_t;
-struct libvlc_callback_entry_list_t
-{
- struct libvlc_callback_entry_t *elmt;
- struct libvlc_callback_entry_list_t *next;
- struct libvlc_callback_entry_list_t *prev;
-};
-
struct libvlc_instance_t
{
libvlc_int_t *p_libvlc_int;
- vlm_t *p_vlm;
- int b_playlist_locked;
+ libvlc_vlm_t libvlc_vlm;
+ unsigned ref_count;
+ int verbosity;
vlc_mutex_t instance_lock;
- vlc_mutex_t event_callback_lock;
struct libvlc_callback_entry_list_t *p_callback_list;
};
-struct libvlc_media_descriptor_t
-{
- int b_preparsed;
- input_item_t *p_input_item;
- libvlc_instance_t *p_libvlc_instance;
-};
-
-struct libvlc_input_t
-{
- int i_input_id; ///< Input object id. We don't use a pointer to
- /// avoid any crash
- struct libvlc_instance_t *p_instance; ///< Parent instance
-};
/***************************************************************************
* Other internal functions
***************************************************************************/
-VLC_EXPORT (input_thread_t *, libvlc_get_input_thread,
- ( struct libvlc_input_t *, libvlc_exception_t * ) );
-#define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
- return NULL; }
-#define RAISEVOID( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
- return; }
-#define RAISEZERO( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
- return 0; }
+/* Thread context */
+void libvlc_init_threads (void);
+void libvlc_deinit_threads (void);
-# ifdef __cplusplus
+/* Events */
+libvlc_event_manager_t * libvlc_event_manager_new(
+ void * p_obj, libvlc_instance_t * p_libvlc_inst );
+
+void libvlc_event_manager_release(
+ libvlc_event_manager_t * p_em );
+
+void libvlc_event_manager_register_event_type(
+ libvlc_event_manager_t * p_em,
+ libvlc_event_type_t event_type );
+
+void libvlc_event_send(
+ libvlc_event_manager_t * p_em,
+ libvlc_event_t * p_event );
+
+void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
+ libvlc_event_type_t event_type,
+ libvlc_callback_t pf_callback,
+ void *p_user_data );
+
+/* Exception shorcuts */
+
+#define RAISENULL( ... ) { libvlc_printerr(__VA_ARGS__); \
+ libvlc_exception_raise( p_e ); \
+ return NULL; }
+#define RAISEZERO( ... ) { libvlc_printerr(__VA_ARGS__); \
+ libvlc_exception_raise( p_e ); \
+ return 0; }
+
+static inline libvlc_time_t from_mtime(mtime_t time)
+{
+ return (time + 500ULL)/ 1000ULL;
+}
+
+static inline mtime_t to_mtime(libvlc_time_t time)
+{
+ return time * 1000ULL;
}
-# endif
#endif