libvlc_internal.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * libvlc_internal.h : Definition of opaque structures for libvlc exported API
00003  * Also contains some internal utility functions
00004  *****************************************************************************
00005  * Copyright (C) 2005-2009 the VideoLAN team
00006  * $Id: 6e7c173946c8b2cb89a8266465dcfa1a4164fac6 $
00007  *
00008  * Authors: Clément Stenac <zorglub@videolan.org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef _LIBVLC_INTERNAL_H
00026 #define _LIBVLC_INTERNAL_H 1
00027 
00028 #ifdef HAVE_CONFIG_H
00029 # include "config.h"
00030 #endif
00031 
00032 #include <vlc/libvlc_structures.h>
00033 #include <vlc/libvlc.h>
00034 #include <vlc/libvlc_media.h>
00035 #include <vlc/libvlc_events.h>
00036 
00037 #include <vlc_common.h>
00038 
00039 /* Note well: this header is included from LibVLC core.
00040  * Therefore, static inline functions MUST NOT call LibVLC functions here
00041  * (this can cause linkage failure on some platforms). */
00042 
00043 /***************************************************************************
00044  * Internal creation and destruction functions
00045  ***************************************************************************/
00046 VLC_API libvlc_int_t *libvlc_InternalCreate( void );
00047 VLC_API int libvlc_InternalInit( libvlc_int_t *, int, const char *ppsz_argv[] );
00048 VLC_API void libvlc_InternalCleanup( libvlc_int_t * );
00049 VLC_API void libvlc_InternalDestroy( libvlc_int_t * );
00050 
00051 VLC_API int libvlc_InternalAddIntf( libvlc_int_t *, const char * );
00052 VLC_API void libvlc_InternalWait( libvlc_int_t * );
00053 VLC_API void libvlc_SetExitHandler( libvlc_int_t *, void (*) (void *), void * );
00054 
00055 typedef void (*libvlc_vlm_release_func_t)( libvlc_instance_t * ) ;
00056 
00057 /***************************************************************************
00058  * Opaque structures for libvlc API
00059  ***************************************************************************/
00060 
00061 typedef struct libvlc_vlm_t
00062 {
00063     vlm_t                  *p_vlm;
00064     libvlc_event_manager_t *p_event_manager;
00065     libvlc_vlm_release_func_t pf_release;
00066 } libvlc_vlm_t;
00067 
00068 struct libvlc_instance_t
00069 {
00070     libvlc_int_t *p_libvlc_int;
00071     libvlc_vlm_t  libvlc_vlm;
00072     unsigned      ref_count;
00073     vlc_mutex_t   instance_lock;
00074     struct libvlc_callback_entry_list_t *p_callback_list;
00075 };
00076 
00077 
00078 /***************************************************************************
00079  * Other internal functions
00080  ***************************************************************************/
00081 
00082 /* Thread context */
00083 void libvlc_init_threads (void);
00084 void libvlc_deinit_threads (void);
00085 
00086 /* Events */
00087 libvlc_event_manager_t * libvlc_event_manager_new(
00088         void * p_obj, libvlc_instance_t * p_libvlc_inst );
00089 
00090 void libvlc_event_manager_release(
00091         libvlc_event_manager_t * p_em );
00092 
00093 void libvlc_event_manager_register_event_type(
00094         libvlc_event_manager_t * p_em,
00095         libvlc_event_type_t event_type );
00096 
00097 void libvlc_event_send(
00098         libvlc_event_manager_t * p_em,
00099         libvlc_event_t * p_event );
00100 
00101 void libvlc_event_attach_async( libvlc_event_manager_t * p_event_manager,
00102                                libvlc_event_type_t event_type,
00103                                libvlc_callback_t pf_callback,
00104                                void *p_user_data );
00105 
00106 static inline libvlc_time_t from_mtime(mtime_t time)
00107 {
00108     return (time + 500ULL)/ 1000ULL;
00109 }
00110 
00111 static inline mtime_t to_mtime(libvlc_time_t time)
00112 {
00113     return time * 1000ULL;
00114 }
00115 
00116 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines