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