libvlc_internal.h 3.84 KB
Newer Older
1
/*****************************************************************************
2 3
 * libvlc_internal.h : Definition of opaque structures for libvlc exported API
 * Also contains some internal utility functions
4
 *****************************************************************************
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
5
 * Copyright (C) 2005-2009 VLC authors and VideoLAN
6
 * $Id$
7
 *
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
8
 * Authors: Clément Stenac <zorglub@videolan.org>
9
 *
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
10 11 12
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
13 14 15 16
 * (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
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
17 18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
19
 *
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
20 21 22
 * You should have received a copy of the GNU Lesser 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.
23 24
 *****************************************************************************/

25 26
#ifndef _LIBVLC_INTERNAL_H
#define _LIBVLC_INTERNAL_H 1
27

28 29 30 31
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

32
#include <vlc/libvlc.h>
Thomas Guillem's avatar
Thomas Guillem committed
33
#include <vlc/libvlc_dialog.h>
34 35
#include <vlc/libvlc_media.h>
#include <vlc/libvlc_events.h>
36

37
#include <vlc_common.h>
38

39 40 41 42
/* Note well: this header is included from LibVLC core.
 * Therefore, static inline functions MUST NOT call LibVLC functions here
 * (this can cause linkage failure on some platforms). */

Clément Stenac's avatar
Clément Stenac committed
43 44 45
/***************************************************************************
 * Internal creation and destruction functions
 ***************************************************************************/
46 47 48 49
VLC_API libvlc_int_t *libvlc_InternalCreate( void );
VLC_API int libvlc_InternalInit( libvlc_int_t *, int, const char *ppsz_argv[] );
VLC_API void libvlc_InternalCleanup( libvlc_int_t * );
VLC_API void libvlc_InternalDestroy( libvlc_int_t * );
Clément Stenac's avatar
Clément Stenac committed
50

51
VLC_API int libvlc_InternalAddIntf( libvlc_int_t *, const char * );
52
VLC_API void libvlc_InternalPlay( libvlc_int_t * );
53 54
VLC_API void libvlc_InternalWait( libvlc_int_t * );
VLC_API void libvlc_SetExitHandler( libvlc_int_t *, void (*) (void *), void * );
Clément Stenac's avatar
Clément Stenac committed
55

56 57
typedef void (*libvlc_vlm_release_func_t)( libvlc_instance_t * ) ;

Clément Stenac's avatar
Clément Stenac committed
58 59 60 61
/***************************************************************************
 * Opaque structures for libvlc API
 ***************************************************************************/

62 63 64 65 66 67 68
typedef struct libvlc_vlm_t
{
    vlm_t                  *p_vlm;
    libvlc_event_manager_t *p_event_manager;
    libvlc_vlm_release_func_t pf_release;
} libvlc_vlm_t;

69 70
struct libvlc_instance_t
{
71
    libvlc_int_t *p_libvlc_int;
72
    libvlc_vlm_t  libvlc_vlm;
73
    unsigned      ref_count;
74
    vlc_mutex_t   instance_lock;
75
    struct libvlc_callback_entry_list_t *p_callback_list;
76 77 78 79 80
    struct
    {
        void (*cb) (void *, int, const libvlc_log_t *, const char *, va_list);
        void *data;
    } log;
Thomas Guillem's avatar
Thomas Guillem committed
81 82 83 84 85
    struct
    {
        libvlc_dialog_cbs cbs;
        void *data;
    } dialog;
86 87
};

88

89 90 91
/***************************************************************************
 * Other internal functions
 ***************************************************************************/
92

93
/* Thread context */
94 95
void libvlc_threads_init (void);
void libvlc_threads_deinit (void);
96

97
/* Events */
98
libvlc_event_manager_t * libvlc_event_manager_new(void * p_obj);
99

100
void libvlc_event_manager_release(
101
        libvlc_event_manager_t * p_em );
102

103
void libvlc_event_send(
104 105
        libvlc_event_manager_t * p_em,
        libvlc_event_t * p_event );
106

107 108 109 110 111 112 113 114 115 116
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;
}

117
#endif