chenqiyang
2022-09-02 6a99d9bf65aa5878cb409945ed2bdbdcb916d047
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
 * Copyright (c) 2010-2019 Belledonne Communications SARL.
 *
 * This file is part of Liblinphone.
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */
 
#ifndef LINPHONE_PLAYER_H_
#define LINPHONE_PLAYER_H_
 
 
#include "linphone/types.h"
#include "mediastreamer2/msinterfaces.h"
 
 
#ifdef __cplusplus
extern "C" {
#endif
 
 
/**
 * @addtogroup call_control
 * @{
 */
 
/**
 * Acquire a reference to the player.
 * @param player #LinphonePlayer object. @notnil
 * @return The same #LinphonePlayer object. @notnil
**/
LINPHONE_PUBLIC LinphonePlayer * linphone_player_ref(LinphonePlayer *player);
 
/**
 * Release reference to the player.
 * @param player #LinphonePlayer object. @notnil
**/
LINPHONE_PUBLIC void linphone_player_unref(LinphonePlayer *player);
 
/**
 * Retrieve the user pointer associated with the player.
 * @param player #LinphonePlayer object. @notnil
 * @return The user pointer associated with the player. @maybenil
**/
LINPHONE_PUBLIC void *linphone_player_get_user_data(const LinphonePlayer *player);
 
/**
 * Assign a user pointer to the player.
 * @param player #LinphonePlayer object. @notnil
 * @param user_data The user pointer to associate with the player. @maybenil
**/
LINPHONE_PUBLIC void linphone_player_set_user_data(LinphonePlayer *player, void *user_data);
 
/**
 * Adds a #LinphonePlayerCbs object associated to the LinphonePlayer.
 * @param player #LinphonePlayer object @notnil
 * @param cbs The #LinphonePlayerCbs object to be added to the LinphonePlayer. @notnil
 */
LINPHONE_PUBLIC void linphone_player_add_callbacks(LinphonePlayer *player, LinphonePlayerCbs *cbs);
 
/**
 * Removes a #LinphonePlayerCbs object associated to the LinphonePlayer.
 * @param player #LinphonePlayer object @notnil
 * @param cbs The #LinphonePlayerCbs object to be removed from the LinphonePlayer. @notnil
 */
LINPHONE_PUBLIC void linphone_player_remove_callbacks(LinphonePlayer *player, LinphonePlayerCbs *cbs);
 
/**
 * Returns the current LinphonePlayerCbsCbs object
 * @param player #LinphonePlayer object @notnil
 * @return The current #LinphonePlayerCbs object @maybenil
 */
LINPHONE_PUBLIC LinphonePlayerCbs *linphone_player_get_current_callbacks(const LinphonePlayer *player);
 
/**
 * Open a file for playing.
 * @param player #LinphonePlayer object @notnil
 * @param filename The path to the file to open @notnil
 */
LINPHONE_PUBLIC LinphoneStatus linphone_player_open(LinphonePlayer *player, const char *filename);
 
/**
 * Start playing a file that has been opened with linphone_player_open().
 * @param player #LinphonePlayer object @notnil
 * @return 0 on success, a negative value otherwise
 */
LINPHONE_PUBLIC LinphoneStatus linphone_player_start(LinphonePlayer *player);
 
/**
 * Pause the playing of a file.
 * @param player #LinphonePlayer object @notnil
 * @return 0 on success, a negative value otherwise
 */
LINPHONE_PUBLIC LinphoneStatus linphone_player_pause(LinphonePlayer *player);
 
/**
 * Seek in an opened file.
 * @param player #LinphonePlayer object @notnil
 * @param time_ms The time we want to go to in the file (in milliseconds).
 * @return 0 on success, a negative value otherwise.
 */
LINPHONE_PUBLIC LinphoneStatus linphone_player_seek(LinphonePlayer *player, int time_ms);
 
/**
 * Get the current state of a player.
 * @param player #LinphonePlayer object @notnil
 * @return The current #LinphonePlayerState of the player.
 */
LINPHONE_PUBLIC LinphonePlayerState linphone_player_get_state(LinphonePlayer *player);
 
/**
 * Get the duration of the opened file.
 * @param player #LinphonePlayer object @notnil
 * @return The duration of the opened file
 */
LINPHONE_PUBLIC int linphone_player_get_duration(LinphonePlayer *player);
 
/**
 * Get the current position in the opened file.
 * @param player #LinphonePlayer object @notnil
 * @return The current position in the opened file
 */
LINPHONE_PUBLIC int linphone_player_get_current_position(LinphonePlayer *player);
 
/**
 * Close the opened file.
 * @param player #LinphonePlayer object @notnil
 */
LINPHONE_PUBLIC void linphone_player_close(LinphonePlayer *player);
 
/**
 * Sets a window id to be used to display video if any.
 * @param player #LinphonePlayer object @notnil
 * @param window_id The window id pointer to use. @maybenil
 */
LINPHONE_PUBLIC void linphone_player_set_window_id(LinphonePlayer *player, void *window_id);
 
/**
 * Returns whether the file has video and if it can be displayed
 * @param player #LinphonePlayer object @notnil
 * @return TRUE if file has video and it can be displayed, FALSE otherwise
 */
LINPHONE_PUBLIC bool_t linphone_player_get_is_video_available(LinphonePlayer *player);
 
/**
 * Returns the #LinphoneCore object managing this player's call, if any.
 * @param player #LinphonePlayer object @notnil
 * @return the #LinphoneCore object associated @notnil
 */
LINPHONE_PUBLIC LinphoneCore *linphone_player_get_core(const LinphonePlayer *player);
 
/**
 * Acquire a reference to the #LinphonePlayerCbs object.
 * @param cbs #LinphonePlayerCbs object. @notnil
 * @return The same #LinphonePlayerCbs object. @notnil
 */
LINPHONE_PUBLIC LinphonePlayerCbs * linphone_player_cbs_ref(LinphonePlayerCbs *cbs);
 
/**
 * Release reference to the #LinphonePlayerCbs object.
 * @param cbs #LinphonePlayerCbs object. @notnil
 */
LINPHONE_PUBLIC void linphone_player_cbs_unref(LinphonePlayerCbs *cbs);
 
/**
 * Retrieve the user pointer associated with the #LinphonePlayerCbs object.
 * @param cbs #LinphonePlayerCbs object. @notnil
 * @return The user pointer associated with the #LinphonePlayerCbs object. @maybenil
 */
LINPHONE_PUBLIC void *linphone_player_cbs_get_user_data(const LinphonePlayerCbs *cbs);
 
/**
 * Assign a user pointer to the #LinphonePlayerCbs object.
 * @param cbs #LinphonePlayerCbs object. @notnil
 * @param user_data The user pointer to associate with the #LinphonePlayerCbs object. @maybenil
 */
LINPHONE_PUBLIC void linphone_player_cbs_set_user_data(LinphonePlayerCbs *cbs, void *user_data);
 
/**
 * Get the end-of-file reached callback.
 * @param cbs #LinphonePlayerCbs object. @notnil
 * @return The current end-of-file reached callback.
 */
LINPHONE_PUBLIC LinphonePlayerCbsEofReachedCb linphone_player_cbs_get_eof_reached(const LinphonePlayerCbs *cbs);
 
/**
 * Set the end-of-file reached callback.
 * @param cbs #LinphonePlayerCbs object. @notnil
 * @param cb The end-of-file reached callback to be used.
 */
LINPHONE_PUBLIC void linphone_player_cbs_set_eof_reached(LinphonePlayerCbs *cbs, LinphonePlayerCbsEofReachedCb cb);
 
/************ */
/* DEPRECATED */
/* ********** */
 
/**
 * Get the #LinphonePlayerCbs object associated with the LinphonePlayer.
 * @param player #LinphonePlayer object @notnil
 * @return The #LinphonePlayerCbs object associated with the LinphonePlayer.
 * @deprecated 19/02/2019 use add_callbacks / remove_callbacks instead @notnil
 */
LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphonePlayerCbs * linphone_player_get_callbacks(const LinphonePlayer *player);
 
/**
 * @}
**/
 
 
#ifdef __cplusplus
}
#endif
 
#endif /* LINPHONE_PLAYER_H_ */