Coverage Report

Created: 2025-11-24 06:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/lib/libvlc_internal.h
Line
Count
Source
1
/*****************************************************************************
2
 * libvlc_internal.h : Definition of opaque structures for libvlc exported API
3
 * Also contains some internal utility functions
4
 *****************************************************************************
5
 * Copyright (C) 2005-2009 VLC authors and VideoLAN
6
 *
7
 * Authors: Clément Stenac <zorglub@videolan.org>
8
 *
9
 * This program is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU Lesser General Public License as published by
11
 * the Free Software Foundation; either version 2.1 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with this program; if not, write to the Free Software Foundation,
21
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
 *****************************************************************************/
23
24
#ifndef _LIBVLC_INTERNAL_H
25
#define _LIBVLC_INTERNAL_H 1
26
27
#include <vlc/libvlc.h>
28
#include <vlc/libvlc_dialog.h>
29
#include <vlc/libvlc_picture.h>
30
#include <vlc/libvlc_media.h>
31
#include <vlc/libvlc_events.h>
32
33
#include <vlc_atomic.h>
34
#include <vlc_common.h>
35
#include <vlc_arrays.h>
36
#include <vlc_threads.h>
37
38
typedef struct vlc_preparser_t vlc_preparser_t;
39
typedef struct vlc_preparser_t vlc_preparser_t;
40
41
/* Note well: this header is included from LibVLC core.
42
 * Therefore, static inline functions MUST NOT call LibVLC functions here
43
 * (this can cause linkage failure on some platforms). */
44
45
/***************************************************************************
46
 * Internal creation and destruction functions
47
 ***************************************************************************/
48
VLC_API libvlc_int_t *libvlc_InternalCreate( void );
49
VLC_API int libvlc_InternalInit( libvlc_int_t *, int, const char *ppsz_argv[] );
50
VLC_API void libvlc_InternalCleanup( libvlc_int_t * );
51
VLC_API void libvlc_InternalDestroy( libvlc_int_t * );
52
53
/**
54
 * Try to start a user interface for the libvlc instance.
55
 *
56
 * \param libvlcint the internal instance
57
 * \param name interface name, or NULL for default
58
 * \return 0 on success, -1 on error.
59
 */
60
VLC_API int libvlc_InternalAddIntf( libvlc_int_t *libvlcint, const char *name );
61
62
/**
63
 * Start playing the main playlist
64
 *
65
 * The main playlist can only be populated via an interface created by the
66
 * libvlc_InternalAddIntf() function. The control and media flow will only be
67
 * controlled by the interface previously added.
68
 *
69
 * One of these 2 functions (libvlc_InternalAddIntf() or libvlc_InternalPlay())
70
 * will trigger the creation of an internal playlist and player.
71
 *
72
 * \param libvlcint the internal instance
73
 */
74
VLC_API void libvlc_InternalPlay( libvlc_int_t *libvlcint );
75
VLC_API void libvlc_InternalWait( libvlc_int_t * );
76
77
/**
78
 * Registers a callback for the LibVLC exit event. This is mostly useful if
79
 * the VLC playlist and/or at least one interface are started with
80
 * libvlc_InternalPlay() or libvlc_InternalAddIntf () respectively.
81
 * Typically, this function will wake up your application main loop (from
82
 * another thread).
83
 *
84
 * \note This function should be called before the playlist or interface are
85
 * started. Otherwise, there is a small race condition: the exit event could
86
 * be raised before the handler is registered.
87
 *
88
 * \param libvlcint the internal instance
89
 * \param cb callback to invoke when LibVLC wants to exit,
90
 *           or NULL to disable the exit handler (as by default)
91
 * \param opaque data pointer for the callback
92
 */
93
VLC_API void libvlc_SetExitHandler( libvlc_int_t *libvlcint, void (*cb) (void *),
94
                                    void *opaque );
95
96
/***************************************************************************
97
 * Opaque structures for libvlc API
98
 ***************************************************************************/
99
100
struct libvlc_instance_t
101
{
102
    libvlc_int_t *p_libvlc_int;
103
    vlc_atomic_rc_t ref_count;
104
    struct libvlc_callback_entry_list_t *p_callback_list;
105
106
    vlc_mutex_t lazy_init_lock;
107
    vlc_preparser_t *parser;
108
    vlc_preparser_t *thumbnailer;
109
110
    struct
111
    {
112
        void (*cb) (void *, int, const libvlc_log_t *, const char *, va_list);
113
        void *data;
114
    } log;
115
    struct
116
    {
117
        libvlc_dialog_cbs cbs;
118
        void *data;
119
    } dialog;
120
};
121
122
struct libvlc_event_manager_t
123
{
124
    void * p_obj;
125
    vlc_array_t listeners;
126
    vlc_mutex_t lock;
127
};
128
129
/***************************************************************************
130
 * Other internal functions
131
 ***************************************************************************/
132
133
/* Thread context */
134
void libvlc_threads_init (void);
135
void libvlc_threads_deinit (void);
136
137
/* Events */
138
void libvlc_event_manager_init(libvlc_event_manager_t *, void *);
139
void libvlc_event_manager_destroy(libvlc_event_manager_t *);
140
141
void libvlc_event_send(
142
        libvlc_event_manager_t * p_em,
143
        libvlc_event_t * p_event );
144
145
static inline libvlc_time_t libvlc_time_from_vlc_tick(vlc_tick_t time)
146
0
{
147
0
    return MS_FROM_VLC_TICK(time + VLC_TICK_FROM_US(500));
148
0
}
Unexecuted instantiation: demux-run.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: common.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: decoder.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: core.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: error.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: libvlc.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: interface.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: exit.c:libvlc_time_from_vlc_tick
Unexecuted instantiation: specific.c:libvlc_time_from_vlc_tick
149
150
static inline vlc_tick_t vlc_tick_from_libvlc_time(libvlc_time_t time)
151
0
{
152
0
    return VLC_TICK_FROM_MS(time);
153
0
}
Unexecuted instantiation: demux-run.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: common.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: decoder.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: core.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: error.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: libvlc.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: interface.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: exit.c:vlc_tick_from_libvlc_time
Unexecuted instantiation: specific.c:vlc_tick_from_libvlc_time
154
155
vlc_preparser_t *libvlc_get_preparser(libvlc_instance_t *instance);
156
vlc_preparser_t *libvlc_get_thumbnailer(libvlc_instance_t *instance);
157
158
#endif