]> git.sesse.net Git - vlc/blob - bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlc.java
Revert broken loading of libvlc with OPTION_DLOPEN_GLOBAL in jvlc
[vlc] / bindings / java / core / src / main / java / org / videolan / jvlc / internal / LibVlc.java
1 /*****************************************************************************
2  * LibVlc.java: VLC Java Bindings JNA Glue
3  *****************************************************************************
4  * Copyright (C) 1998-2008 the VideoLAN team
5  *
6  * Authors: Filippo Carone <filippo@carone.org>
7  *
8  *
9  * $Id $
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 package org.videolan.jvlc.internal;
27
28 import com.sun.jna.Callback;
29 import com.sun.jna.Library;
30 import com.sun.jna.Native;
31 import com.sun.jna.NativeLong;
32 import com.sun.jna.Platform;
33 import com.sun.jna.Pointer;
34 import com.sun.jna.PointerType;
35 import com.sun.jna.Structure;
36 import com.sun.jna.Union;
37
38
39 public interface LibVlc extends Library
40 {
41     LibVlc INSTANCE = (LibVlc) Native.loadLibrary(Platform.isWindows()? "libvlc" : "vlc", LibVlc.class);
42
43     LibVlc SYNC_INSTANCE = (LibVlc) Native.synchronizedLibrary(INSTANCE);
44
45     public static class libvlc_exception_t extends Structure
46     {
47
48         public int raised;
49
50         public int code;
51
52         public String message;
53     }
54
55     public static class libvlc_log_message_t extends Structure
56     {
57
58         public int sizeof_msg; /* sizeof() of message structure, must be filled in by user */
59
60         public int i_severity; /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
61
62         public String psz_type; /* module type */
63
64         public String psz_name; /* module name */
65
66         public String psz_header; /* optional header */
67
68         public String psz_message; /* message */
69     }
70
71     public static class libvlc_event_t extends Structure
72     {
73
74         public int type;
75
76         public Pointer obj;
77
78         public event_type_specific event_type_specific;
79
80     }
81
82     public class media_meta_changed extends Structure
83     {
84
85         public Pointer meta_type;
86     }
87
88     public class media_subitem_added extends Structure
89     {
90
91         public LibVlcMedia new_child;
92     }
93
94     public class media_duration_changed extends Structure
95     {
96
97         public NativeLong new_duration;
98     }
99
100     public class media_preparsed_changed extends Structure
101     {
102
103         public int new_status;
104     }
105
106     public class media_freed extends Structure
107     {
108
109         public LibVlcMedia md;
110     }
111
112     public class media_state_changed extends Structure
113     {
114
115         // @todo: check this one
116         public int new_state;
117     }
118
119     /* media instance */
120
121     public class media_player_position_changed extends Structure
122     {
123
124         public float new_position;
125     }
126
127     public class media_player_time_changed extends Structure
128     {
129
130         // @todo: check this one
131         public long new_time;
132     }
133
134     /* media list */
135     public class media_list_item_added extends Structure
136     {
137
138         public LibVlcMedia item;
139
140         public int index;
141     }
142
143     public class media_list_will_add_item extends Structure
144     {
145
146         public LibVlcMedia item;
147
148         public int index;
149     }
150
151     public class media_list_item_deleted extends Structure
152     {
153
154         public LibVlcMedia item;
155
156         public int index;
157     }
158
159     public class media_list_will_delete_item extends Structure
160     {
161
162         public LibVlcMedia item;
163
164         public int index;
165     }
166
167     /* media list view */
168     public class media_list_view_item_added extends Structure
169     {
170
171         public LibVlcMedia item;
172
173         public int index;
174     }
175
176     public class media_list_view_will_add_item extends Structure
177     {
178
179         public LibVlcMedia item;
180
181         public int index;
182     }
183
184     public class media_list_view_item_deleted extends Structure
185     {
186
187         public LibVlcMedia item;
188
189         public int index;
190     }
191
192     public class media_list_view_will_delete_item extends Structure
193     {
194
195         public LibVlcMedia item;
196
197         public int index;
198     }
199
200     /* media discoverer */
201     public class media_media_discoverer_started extends Structure
202     {
203
204         public Pointer unused;
205     }
206
207     public class media_media_discoverer_ended extends Structure
208     {
209
210         public Pointer unused;
211     }
212
213     public class event_type_specific extends Union
214     {
215
216         public media_meta_changed media_meta_changed;
217
218         public media_subitem_added media_subitem_added;
219
220         public media_duration_changed media_duration_changed;
221
222         public media_preparsed_changed media_preparsed_changed;
223
224         public media_freed media_freed;
225
226         public media_state_changed media_state_changed;
227
228         public media_player_position_changed media_player_position_changed;
229
230         public media_player_time_changed media_player_time_changed;
231
232         public media_list_item_added media_list_item_added;
233
234         public media_list_will_add_item media_list_will_add_item;
235
236         public media_list_item_deleted media_list_item_deleted;
237
238         public media_list_will_delete_item media_list_will_delete_item;
239
240         public media_list_view_item_added media_list_view_item_added;
241
242         public media_list_view_will_add_item media_list_view_will_add_item;
243
244         public media_list_view_item_deleted media_list_view_item_deleted;
245
246         public media_list_view_will_delete_item media_list_view_will_delete_item;
247     }
248
249     public class LibVlcInstance extends PointerType
250     {
251     }
252
253     public class LibVlcMedia extends PointerType
254     {
255     }
256
257     public class LibVlcMediaPlayer extends PointerType
258     {
259     }
260
261     public class LibVlcMediaList extends PointerType
262     {
263     }
264
265     public class LibVlcMediaListPlayer extends PointerType
266     {
267     }
268
269     public class LibVlcEventManager extends PointerType
270     {
271     }
272
273     public class LibVlcLog extends PointerType
274     {
275     }
276
277     public class LibVlcLogIterator extends PointerType
278     {
279     }
280
281     // exception handling
282     void libvlc_exception_init(libvlc_exception_t exception);
283
284     int libvlc_exception_raised(final libvlc_exception_t exception);
285
286     void libvlc_exception_raise(libvlc_exception_t exception, String format, Object... args);
287
288     void libvlc_exception_clear(libvlc_exception_t exception);
289
290     String libvlc_exception_get_message(libvlc_exception_t exception);
291
292     // core
293     LibVlcInstance libvlc_new(int argc, String[] argv, libvlc_exception_t exception);
294
295     void libvlc_release(LibVlcInstance libvlc_instance_t);
296
297     void libvlc_add_intf(LibVlcInstance libvlc_instance_t, String name, libvlc_exception_t exception);
298
299     void libvlc_wait(LibVlcInstance libvlc_instance_t);
300
301     String libvlc_get_version();
302
303     String libvlc_get_compiler();
304
305     String libvlc_get_changeset();
306
307     // video
308
309     void libvlc_video_set_parent(LibVlcInstance libvlc_instance, long drawable, libvlc_exception_t exception);
310
311     void libvlc_toggle_fullscreen(LibVlcMediaPlayer libvlc_instance);
312
313     void libvlc_set_fullscreen(LibVlcMediaPlayer instance, int fullscreen, libvlc_exception_t exception);
314
315     int libvlc_get_fullscreen(LibVlcMediaPlayer instance, libvlc_exception_t exception);
316
317     int libvlc_video_get_height(LibVlcMediaPlayer instance, libvlc_exception_t exception);
318
319     int libvlc_video_get_width(LibVlcMediaPlayer instance, libvlc_exception_t exception);
320
321     String libvlc_video_get_aspect_ration(LibVlcMediaPlayer instance, libvlc_exception_t exception);
322
323     void libvlc_video_set_aspect_ration(LibVlcMediaPlayer instance, String ratio, libvlc_exception_t exception);
324
325     int libvlc_video_get_spu(LibVlcMediaPlayer instance, libvlc_exception_t exception);
326
327     int libvlc_video_set_spu(LibVlcMediaPlayer instance, int spu, libvlc_exception_t exception);
328
329     String libvlc_video_get_crop_geometry(LibVlcMediaPlayer instance, libvlc_exception_t exception);
330
331     void libvlc_video_set_crop_geometry(LibVlcMediaPlayer instance, String geometry, libvlc_exception_t exception);
332
333     void libvlc_video_take_snapshot(LibVlcMediaPlayer instance, String filename, int width, int height,
334         libvlc_exception_t exception);
335
336     void libvlc_video_destroy(LibVlcMediaPlayer instance, libvlc_exception_t exception);
337
338     void libvlc_video_resize(LibVlcMediaPlayer instance, int width, int height, libvlc_exception_t exception);
339
340     void libvlc_video_reparent(LibVlcMediaPlayer instance, long drawable, libvlc_exception_t exception);
341
342     void libvlc_video_set_size(LibVlcInstance instance, int width, int height, libvlc_exception_t exception);
343
344     // audio
345
346     void libvlc_audio_toggle_mute(LibVlcInstance instance, libvlc_exception_t exception);
347
348     void libvlc_audio_set_mute(LibVlcInstance instance, int mute, libvlc_exception_t exception);
349
350     int libvlc_audio_get_mute(LibVlcInstance instance, libvlc_exception_t exception);
351
352     int libvlc_audio_get_volume(LibVlcInstance instance, libvlc_exception_t exception);
353
354     int libvlc_audio_set_volume(LibVlcInstance instance, int volume, libvlc_exception_t exception);
355
356     int libvlc_audio_get_track_count(LibVlcMediaPlayer mediaInstance, libvlc_exception_t exception);
357
358     int libvlc_audio_get_track(LibVlcMediaPlayer mediaInstance, libvlc_exception_t exception);
359
360     void libvlc_audio_set_track(LibVlcMediaPlayer mediaInstance, int channel, libvlc_exception_t exception);
361
362     int libvlc_audio_get_channel(LibVlcInstance instance, libvlc_exception_t exception);
363
364     void libvlc_audio_set_channel(LibVlcInstance instance, int channel, libvlc_exception_t exception);
365
366     // playlist
367
368     void libvlc_playlist_loop(LibVlcInstance instance, int loop, libvlc_exception_t exception);
369
370     void libvlc_playlist_play(LibVlcInstance instance, int itemIndex, int optionsCount, String[] options,
371         libvlc_exception_t exception);
372
373     void libvlc_playlist_pause(LibVlcInstance instance, libvlc_exception_t exception);
374
375     void libvlc_playlist_stop(LibVlcInstance instance, libvlc_exception_t exception);
376
377     int libvlc_playlist_isplaying(LibVlcInstance instance, libvlc_exception_t exception);
378
379     int libvlc_playlist_items_count(LibVlcInstance instance, libvlc_exception_t exception);
380
381     void libvlc_playlist_next(LibVlcInstance instance, libvlc_exception_t exception);
382
383     void libvlc_playlist_prev(LibVlcInstance instance, libvlc_exception_t exception);
384
385     void libvlc_playlist_clear(LibVlcInstance instance, libvlc_exception_t exception);
386
387     int libvlc_playlist_add(LibVlcInstance instance, String uri, String name, libvlc_exception_t exception);
388
389     int libvlc_playlist_delete_item(LibVlcInstance instance, int itemIndex, libvlc_exception_t exception);
390
391     LibVlcMediaPlayer libvlc_playlist_get_media_player(LibVlcInstance instance, libvlc_exception_t exception);
392
393     int libvlc_media_player_is_seekable(LibVlcMediaPlayer instance, libvlc_exception_t exception);
394
395     int libvlc_media_player_can_pause(LibVlcMediaPlayer instance, libvlc_exception_t exception);
396
397     // media descriptor
398
399     LibVlcMedia libvlc_media_new(LibVlcInstance libvlc_instance, String mrl, libvlc_exception_t exception);
400
401     void libvlc_media_add_option(LibVlcMedia media, String option, libvlc_exception_t exception);
402
403     LibVlcMedia libvlc_media_duplicate(LibVlcMedia media);
404
405     String libvlc_media_get_mrl(LibVlcMedia media);
406
407     void libvlc_media_retain(LibVlcMedia media);
408
409     void libvlc_media_release(LibVlcMedia media);
410
411     int libvlc_media_get_state(LibVlcMedia media, libvlc_exception_t exception);
412
413     LibVlcMediaList libvlc_media_subitems(LibVlcMedia media, libvlc_exception_t exception);
414
415     LibVlcEventManager libvlc_media_event_manager(LibVlcMedia media, libvlc_exception_t exception);
416
417     long libvlc_get_duration(LibVlcMedia media, libvlc_exception_t exception);
418
419     int libvlc_media_is_preparsed(LibVlcMedia media, libvlc_exception_t exception);
420
421     // media player
422
423     LibVlcMediaPlayer libvlc_media_player_new(LibVlcInstance instance, libvlc_exception_t exception);
424
425     LibVlcMediaPlayer libvlc_media_player_new_from_media(LibVlcMedia media, libvlc_exception_t exception);
426
427     void libvlc_media_player_play(LibVlcMediaPlayer media_player, libvlc_exception_t exception);
428
429     void libvlc_media_player_pause(LibVlcMediaPlayer media_player, libvlc_exception_t exception);
430
431     void libvlc_media_player_stop(LibVlcMediaPlayer media_player, libvlc_exception_t exception);
432
433     void libvlc_media_player_set_drawable(LibVlcMediaPlayer libvlc_media_player, int drawable,
434         libvlc_exception_t exception);
435
436     long libvlc_media_player_get_length(LibVlcMediaPlayer instance, libvlc_exception_t exception);
437
438     long libvlc_media_player_get_time(LibVlcMediaPlayer instance, libvlc_exception_t exception);
439
440     void libvlc_media_player_set_time(LibVlcMediaPlayer instance, long time, libvlc_exception_t exception);
441
442     float libvlc_media_player_get_position(LibVlcMediaPlayer instance, libvlc_exception_t exception);
443
444     void libvlc_media_player_set_position(LibVlcMediaPlayer instance, float position, libvlc_exception_t exception);
445
446     int libvlc_media_player_is_playing(LibVlcMediaPlayer instance, libvlc_exception_t exception);
447
448     int libvlc_media_player_will_play(LibVlcMediaPlayer instance, libvlc_exception_t exception);
449
450     void libvlc_media_player_set_rate(LibVlcMediaPlayer instance, float rate, libvlc_exception_t exception);
451
452     float libvlc_media_player_get_rate(LibVlcMediaPlayer instance, libvlc_exception_t exception);
453
454     int libvlc_media_player_has_vout(LibVlcMediaPlayer instance2, libvlc_exception_t exception);
455
456     float libvlc_media_player_get_fps(LibVlcMediaPlayer instance2, libvlc_exception_t exception);
457
458     void libvlc_media_player_release(LibVlcMediaPlayer instance);
459
460     LibVlcEventManager libvlc_media_player_event_manager(LibVlcMediaPlayer media_player, libvlc_exception_t exception);
461
462     // media list
463
464     LibVlcMediaList libvlc_media_list_new(LibVlcInstance libvlc_instance, libvlc_exception_t exception);
465
466     void libvlc_media_list_release(LibVlcMediaList libVlcMediaList);
467
468     void libvlc_media_list_add_file_content(LibVlcMediaList libvlc_media_list, String fileName,
469         libvlc_exception_t exception);
470
471     void libvlc_media_list_set_media(LibVlcMediaList libvlc_media_list, LibVlcMedia libvlc_media,
472         libvlc_exception_t exception);
473
474     LibVlcMedia libvlc_media_list_media(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
475
476     void libvlc_media_list_add_media(LibVlcMediaList libvlc_media_list, LibVlcMedia libvlc_media,
477         libvlc_exception_t exception);
478
479     void libvlc_media_list_insert_media(LibVlcMediaList libvlc_media_list, LibVlcMedia libvlc_media,
480         int position, libvlc_exception_t exception);
481
482     void libvlc_media_list_remove_index(LibVlcMediaList libvlc_media_list, int position, libvlc_exception_t exception);
483
484     int libvlc_media_list_count(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
485
486     LibVlcMedia libvlc_media_list_item_at_index(LibVlcMediaList libvlc_media_list, int position,
487         libvlc_exception_t exception);
488
489     int libvlc_media_list_index_of_item(LibVlcMediaList libvlc_media_list, LibVlcMedia libvlc_media,
490         libvlc_exception_t exception);
491
492     int libvlc_media_list_is_readonly(LibVlcMediaList libvlc_media_list);
493
494     LibVlcEventManager libvlc_media_list_event_manager(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
495
496     // libvlc_media_list_player
497
498     LibVlcMediaListPlayer libvlc_media_list_player_new(LibVlcInstance libvlc_media_player, libvlc_exception_t exception);
499
500     void libvlc_media_list_player_release(LibVlcMediaListPlayer libvlc_media_list_player);
501
502     void libvlc_media_list_player_set_media_player(LibVlcMediaListPlayer libvlc_media_list_player,
503         LibVlcMediaPlayer libvlc_media_player, libvlc_exception_t exception);
504
505     void libvlc_media_list_player_set_media_list(LibVlcMediaListPlayer libvlc_media_list_player,
506         LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
507
508     void libvlc_media_list_player_play(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
509
510     void libvlc_media_list_player_pause(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
511
512     int libvlc_media_list_player_is_playing(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
513
514     int libvlc_media_list_player_get_state(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
515
516     void libvlc_media_list_player_play_item_at_index(LibVlcMediaListPlayer libvlc_media_list_player, int position,
517         libvlc_exception_t exception);
518
519     void libvlc_media_list_player_play_item(LibVlcMediaListPlayer libvlc_media_list_player,
520         LibVlcMedia libvlc_media, libvlc_exception_t exception);
521
522     void libvlc_media_list_player_stop(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
523
524     void libvlc_media_list_player_next(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
525
526     // VLM
527
528     void libvlc_vlm_add_broadcast(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
529         int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
530
531     void libvlc_vlm_add_vod(LibVlcInstance p_instance, String psz_name, String psz_input, int i_options,
532         String[] ppsz_options, int b_enabled, String psz_mux, libvlc_exception_t p_e);
533
534     void libvlc_vlm_del_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
535
536     void libvlc_vlm_set_enabled(LibVlcInstance p_instance, String psz_name, int b_enabled, libvlc_exception_t p_e);
537
538     void libvlc_vlm_set_output(LibVlcInstance p_instance, String psz_name, String psz_output, libvlc_exception_t p_e);
539
540     void libvlc_vlm_set_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
541
542     void libvlc_vlm_add_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
543
544     void libvlc_vlm_set_loop(LibVlcInstance p_instance, String psz_name, int b_loop, libvlc_exception_t p_e);
545
546     void libvlc_vlm_set_mux(LibVlcInstance p_instance, String psz_name, String psz_mux, libvlc_exception_t p_e);
547
548     void libvlc_vlm_change_media(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
549         int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
550
551     void libvlc_vlm_play_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
552
553     void libvlc_vlm_stop_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
554
555     void libvlc_vlm_pause_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
556
557     void libvlc_vlm_seek_media(LibVlcInstance p_instance, String psz_name, float f_percentage, libvlc_exception_t p_e);
558
559     String libvlc_vlm_show_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
560
561     void libvlc_vlm_release(LibVlcInstance p_instance, libvlc_exception_t p_e);
562
563     // event manager
564
565     public static interface LibVlcCallback extends Callback
566     {
567
568         void callback(libvlc_event_t libvlc_event, Pointer userData);
569     }
570
571     void libvlc_event_attach(LibVlcEventManager event_manager, int event_type, LibVlcCallback callback,
572         Pointer userData, libvlc_exception_t exception);
573
574     void libvlc_event_detach(LibVlcEventManager event_manager, int event_type, LibVlcCallback callback,
575         Pointer userData, libvlc_exception_t excecption);
576
577     void libvlc_toggle_fullscreen(LibVlcMediaPlayer instance, libvlc_exception_t exception);
578
579     // logging
580
581     int libvlc_get_log_verbosity(LibVlcInstance p_instance, libvlc_exception_t p_e);
582
583     void libvlc_set_log_verbosity(LibVlcInstance p_instance, int level, libvlc_exception_t p_e);
584
585     LibVlcLog libvlc_log_open(LibVlcInstance p_instance, libvlc_exception_t p_e);
586
587     void libvlc_log_close(LibVlcLog p_log, libvlc_exception_t p_e);
588
589     int libvlc_log_count(LibVlcLog p_log, libvlc_exception_t p_e);
590
591     void libvlc_log_clear(LibVlcLog p_log, libvlc_exception_t p_e);
592
593     LibVlcLogIterator libvlc_log_get_iterator(LibVlcLog p_log, libvlc_exception_t p_e);
594
595     void libvlc_log_iterator_free(LibVlcLogIterator p_iter, libvlc_exception_t p_e);
596
597     int libvlc_log_iterator_has_next(LibVlcLogIterator p_iter, libvlc_exception_t p_e);
598
599     libvlc_log_message_t libvlc_log_iterator_next(LibVlcLogIterator p_iter, libvlc_log_message_t p_buffer,
600         libvlc_exception_t p_e);
601
602 }