1 /*****************************************************************************
2 * LibVlc.java: VLC Java Bindings JNA Glue
3 *****************************************************************************
4 * Copyright (C) 1998-2008 the VideoLAN team
6 * Authors: Filippo Carone <filippo@carone.org>
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.
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.
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 *****************************************************************************/
26 package org.videolan.jvlc.internal;
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.Pointer;
33 import com.sun.jna.PointerType;
34 import com.sun.jna.Structure;
35 import com.sun.jna.Union;
38 public interface LibVlc extends Library
41 LibVlc INSTANCE = (LibVlc) Native.loadLibrary("vlc", LibVlc.class);
43 LibVlc SYNC_INSTANCE = (LibVlc) Native.synchronizedLibrary(INSTANCE);
45 public static class libvlc_exception_t extends Structure
52 public String message;
55 public static class libvlc_log_message_t extends Structure
58 public int sizeof_msg; /* sizeof() of message structure, must be filled in by user */
60 public int i_severity; /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
62 public String psz_type; /* module type */
64 public String psz_name; /* module name */
66 public String psz_header; /* optional header */
68 public String psz_message; /* message */
71 public static class libvlc_event_t extends Structure
78 public event_type_specific event_type_specific;
82 public class media_meta_changed extends Structure
85 public Pointer meta_type;
88 public class media_subitem_added extends Structure
91 public LibVlcMediaDescriptor new_child;
94 public class media_duration_changed extends Structure
97 public NativeLong new_duration;
100 public class media_preparsed_changed extends Structure
103 public int new_status;
106 public class media_freed extends Structure
109 public LibVlcMediaDescriptor md;
112 public class media_state_changed extends Structure
115 // @todo: check this one
116 public int new_state;
121 public class media_player_position_changed extends Structure
124 public float new_position;
127 public class media_player_time_changed extends Structure
130 // @todo: check this one
131 public long new_time;
135 public class media_list_item_added extends Structure
138 public LibVlcMediaDescriptor item;
143 public class media_list_will_add_item extends Structure
146 public LibVlcMediaDescriptor item;
151 public class media_list_item_deleted extends Structure
154 public LibVlcMediaDescriptor item;
159 public class media_list_will_delete_item extends Structure
162 public LibVlcMediaDescriptor item;
167 /* media list view */
168 public class media_list_view_item_added extends Structure
171 public LibVlcMediaDescriptor item;
176 public class media_list_view_will_add_item extends Structure
179 public LibVlcMediaDescriptor item;
184 public class media_list_view_item_deleted extends Structure
187 public LibVlcMediaDescriptor item;
192 public class media_list_view_will_delete_item extends Structure
195 public LibVlcMediaDescriptor item;
200 /* media discoverer */
201 public class media_media_discoverer_started extends Structure
204 public Pointer unused;
207 public class media_media_discoverer_ended extends Structure
210 public Pointer unused;
213 public class event_type_specific extends Union
216 public media_meta_changed media_meta_changed;
218 public media_subitem_added media_subitem_added;
220 public media_duration_changed media_duration_changed;
222 public media_preparsed_changed media_preparsed_changed;
224 public media_freed media_freed;
226 public media_state_changed media_state_changed;
228 public media_player_position_changed media_player_position_changed;
230 public media_player_time_changed media_player_time_changed;
232 public media_list_item_added media_list_item_added;
234 public media_list_will_add_item media_list_will_add_item;
236 public media_list_item_deleted media_list_item_deleted;
238 public media_list_will_delete_item media_list_will_delete_item;
240 public media_list_view_item_added media_list_view_item_added;
242 public media_list_view_will_add_item media_list_view_will_add_item;
244 public media_list_view_item_deleted media_list_view_item_deleted;
246 public media_list_view_will_delete_item media_list_view_will_delete_item;
249 public class LibVlcInstance extends PointerType
253 public class LibVlcMediaDescriptor extends PointerType
257 public class LibVlcMediaInstance extends PointerType
261 public class LibVlcMediaList extends PointerType
265 public class LibVlcMediaListPlayer extends PointerType
269 public class LibVlcEventManager extends PointerType
273 public class LibVlcLog extends PointerType
277 public class LibVlcLogIterator extends PointerType
281 // exception handling
282 void libvlc_exception_init(libvlc_exception_t exception);
284 int libvlc_exception_raised(final libvlc_exception_t exception);
286 void libvlc_exception_raise(libvlc_exception_t exception, String format, Object... args);
288 void libvlc_exception_clear(libvlc_exception_t exception);
290 String libvlc_exception_get_message(libvlc_exception_t exception);
293 LibVlcInstance libvlc_new(int argc, String[] argv, libvlc_exception_t exception);
295 void libvlc_release(LibVlcInstance libvlc_instance_t);
297 String libvlc_get_version();
299 String libvlc_get_compiler();
301 String libvlc_get_changeset();
305 void libvlc_video_set_parent(LibVlcInstance libvlc_instance, long drawable, libvlc_exception_t exception);
307 void libvlc_toggle_fullscreen(LibVlcMediaInstance libvlc_instance);
309 void libvlc_set_fullscreen(LibVlcMediaInstance instance, int fullscreen, libvlc_exception_t exception);
311 int libvlc_get_fullscreen(LibVlcMediaInstance instance, libvlc_exception_t exception);
313 int libvlc_video_get_height(LibVlcMediaInstance instance, libvlc_exception_t exception);
315 int libvlc_video_get_width(LibVlcMediaInstance instance, libvlc_exception_t exception);
317 String libvlc_video_get_aspect_ration(LibVlcMediaInstance instance, libvlc_exception_t exception);
319 void libvlc_video_set_aspect_ration(LibVlcMediaInstance instance, String ratio, libvlc_exception_t exception);
321 int libvlc_video_get_spu(LibVlcMediaInstance instance, libvlc_exception_t exception);
323 int libvlc_video_set_spu(LibVlcMediaInstance instance, int spu, libvlc_exception_t exception);
325 String libvlc_video_get_crop_geometry(LibVlcMediaInstance instance, libvlc_exception_t exception);
327 void libvlc_video_set_crop_geometry(LibVlcMediaInstance instance, String geometry, libvlc_exception_t exception);
329 void libvlc_video_take_snapshot(LibVlcMediaInstance instance, String filename, int width, int height,
330 libvlc_exception_t exception);
332 void libvlc_video_destroy(LibVlcMediaInstance instance, libvlc_exception_t exception);
334 void libvlc_video_resize(LibVlcMediaInstance instance, int width, int height, libvlc_exception_t exception);
336 void libvlc_video_reparent(LibVlcMediaInstance instance, long drawable, libvlc_exception_t exception);
338 void libvlc_video_set_size(LibVlcInstance instance, int width, int height, libvlc_exception_t exception);
342 void libvlc_audio_toggle_mute(LibVlcInstance instance, libvlc_exception_t exception);
344 void libvlc_audio_set_mute(LibVlcInstance instance, int mute, libvlc_exception_t exception);
346 int libvlc_audio_get_mute(LibVlcInstance instance, libvlc_exception_t exception);
348 int libvlc_audio_get_volume(LibVlcInstance instance, libvlc_exception_t exception);
350 int libvlc_audio_set_volume(LibVlcInstance instance, int volume, libvlc_exception_t exception);
352 int libvlc_audio_get_track_count(LibVlcMediaInstance mediaInstance, libvlc_exception_t exception);
354 int libvlc_audio_get_track(LibVlcMediaInstance mediaInstance, libvlc_exception_t exception);
356 void libvlc_audio_set_track(LibVlcMediaInstance mediaInstance, int channel, libvlc_exception_t exception);
358 int libvlc_audio_get_channel(LibVlcInstance instance, libvlc_exception_t exception);
360 void libvlc_audio_set_channel(LibVlcInstance instance, int channel, libvlc_exception_t exception);
364 void libvlc_playlist_loop(LibVlcInstance instance, int loop, libvlc_exception_t exception);
366 void libvlc_playlist_play(LibVlcInstance instance, int itemIndex, int optionsCount, String[] options,
367 libvlc_exception_t exception);
369 void libvlc_playlist_pause(LibVlcInstance instance, libvlc_exception_t exception);
371 void libvlc_playlist_stop(LibVlcInstance instance, libvlc_exception_t exception);
373 int libvlc_playlist_isplaying(LibVlcInstance instance, libvlc_exception_t exception);
375 int libvlc_playlist_items_count(LibVlcInstance instance, libvlc_exception_t exception);
377 void libvlc_playlist_next(LibVlcInstance instance, libvlc_exception_t exception);
379 void libvlc_playlist_prev(LibVlcInstance instance, libvlc_exception_t exception);
381 void libvlc_playlist_clear(LibVlcInstance instance, libvlc_exception_t exception);
383 int libvlc_playlist_add(LibVlcInstance instance, String uri, String name, libvlc_exception_t exception);
385 int libvlc_playlist_delete_item(LibVlcInstance instance, int itemIndex, libvlc_exception_t exception);
387 LibVlcMediaInstance libvlc_playlist_get_media_player(LibVlcInstance instance, libvlc_exception_t exception);
389 int libvlc_media_player_is_seekable(LibVlcMediaInstance instance, libvlc_exception_t exception);
391 int libvlc_media_player_can_pause(LibVlcMediaInstance instance, libvlc_exception_t exception);
395 LibVlcMediaDescriptor libvlc_media_new(LibVlcInstance libvlc_instance, String mrl, libvlc_exception_t exception);
397 void libvlc_media_add_option(LibVlcMediaDescriptor media, String option, libvlc_exception_t exception);
399 String libvlc_media_get_mrl(LibVlcMediaDescriptor media);
401 void libvlc_media_release(LibVlcMediaDescriptor media);
403 LibVlcEventManager libvlc_media_event_manager(LibVlcMediaDescriptor media, libvlc_exception_t exception);
407 LibVlcMediaInstance libvlc_media_player_new(LibVlcInstance instance, libvlc_exception_t exception);
409 LibVlcMediaInstance libvlc_media_player_new_from_media(LibVlcMediaDescriptor media, libvlc_exception_t exception);
411 void libvlc_media_player_play(LibVlcMediaInstance media_player, libvlc_exception_t exception);
413 void libvlc_media_player_pause(LibVlcMediaInstance media_player, libvlc_exception_t exception);
415 void libvlc_media_player_stop(LibVlcMediaInstance media_player, libvlc_exception_t exception);
417 void libvlc_media_player_set_drawable(LibVlcMediaInstance libvlc_media_player, long drawable,
418 libvlc_exception_t exception);
420 long libvlc_media_player_get_length(LibVlcMediaInstance instance, libvlc_exception_t exception);
422 long libvlc_media_player_get_time(LibVlcMediaInstance instance, libvlc_exception_t exception);
424 void libvlc_media_player_set_time(LibVlcMediaInstance instance, long time, libvlc_exception_t exception);
426 float libvlc_media_player_get_position(LibVlcMediaInstance instance, libvlc_exception_t exception);
428 void libvlc_media_player_set_position(LibVlcMediaInstance instance, float position, libvlc_exception_t exception);
430 int libvlc_media_player_will_play(LibVlcMediaInstance instance, libvlc_exception_t exception);
432 void libvlc_media_player_set_rate(LibVlcMediaInstance instance, float rate, libvlc_exception_t exception);
434 float libvlc_media_player_get_rate(LibVlcMediaInstance instance, libvlc_exception_t exception);
436 int libvlc_media_player_has_vout(LibVlcMediaInstance instance2, libvlc_exception_t exception);
438 float libvlc_media_player_get_fps(LibVlcMediaInstance instance2, libvlc_exception_t exception);
440 void libvlc_media_player_release(LibVlcMediaInstance instance);
442 LibVlcEventManager libvlc_media_player_event_manager(LibVlcMediaInstance media_player, libvlc_exception_t exception);
446 LibVlcMediaList libvlc_media_list_new(LibVlcInstance libvlc_instance, libvlc_exception_t exception);
448 void libvlc_media_list_release(LibVlcMediaList libVlcMediaList);
450 void libvlc_media_list_add_file_content(LibVlcMediaList libvlc_media_list, String fileName,
451 libvlc_exception_t exception);
453 void libvlc_media_list_set_media(LibVlcMediaList libvlc_media_list, LibVlcMediaDescriptor libvlc_media,
454 libvlc_exception_t exception);
456 LibVlcMediaDescriptor libvlc_media_list_media(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
458 void libvlc_media_list_add_media(LibVlcMediaList libvlc_media_list, LibVlcMediaDescriptor libvlc_media,
459 libvlc_exception_t exception);
461 void libvlc_media_list_insert_media(LibVlcMediaList libvlc_media_list, LibVlcMediaDescriptor libvlc_media,
462 int position, libvlc_exception_t exception);
464 void libvlc_media_list_remove_index(LibVlcMediaList libvlc_media_list, int position, libvlc_exception_t exception);
466 int libvlc_media_list_count(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
468 LibVlcMediaDescriptor libvlc_media_list_item_at_index(LibVlcMediaList libvlc_media_list, int position,
469 libvlc_exception_t exception);
471 int libvlc_media_list_index_of_item(LibVlcMediaList libvlc_media_list, LibVlcMediaDescriptor libvlc_media,
472 libvlc_exception_t exception);
474 int libvlc_media_list_is_readonly(LibVlcMediaList libvlc_media_list);
476 LibVlcEventManager libvlc_media_list_event_manager(LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
478 // libvlc_media_list_player
480 LibVlcMediaListPlayer libvlc_media_list_player_new(LibVlcInstance libvlc_media_player, libvlc_exception_t exception);
482 void libvlc_media_list_player_release(LibVlcMediaListPlayer libvlc_media_list_player);
484 void libvlc_media_list_player_set_media_player(LibVlcMediaListPlayer libvlc_media_list_player,
485 LibVlcMediaInstance libvlc_media_player, libvlc_exception_t exception);
487 void libvlc_media_list_player_set_media_list(LibVlcMediaListPlayer libvlc_media_list_player,
488 LibVlcMediaList libvlc_media_list, libvlc_exception_t exception);
490 void libvlc_media_list_player_play(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
492 void libvlc_media_list_player_pause(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
494 int libvlc_media_list_player_is_playing(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
496 int libvlc_media_list_player_get_state(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
498 void libvlc_media_list_player_play_item_at_index(LibVlcMediaListPlayer libvlc_media_list_player, int position,
499 libvlc_exception_t exception);
501 void libvlc_media_list_player_play_item(LibVlcMediaListPlayer libvlc_media_list_player,
502 LibVlcMediaDescriptor libvlc_media, libvlc_exception_t exception);
504 void libvlc_media_list_player_stop(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
506 void libvlc_media_list_player_next(LibVlcMediaListPlayer libvlc_media_list_player, libvlc_exception_t exception);
510 void libvlc_vlm_add_broadcast(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
511 int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
513 void libvlc_vlm_del_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
515 void libvlc_vlm_set_enabled(LibVlcInstance p_instance, String psz_name, int b_enabled, libvlc_exception_t p_e);
517 void libvlc_vlm_set_output(LibVlcInstance p_instance, String psz_name, String psz_output, libvlc_exception_t p_e);
519 void libvlc_vlm_set_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
521 void libvlc_vlm_add_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
523 void libvlc_vlm_set_loop(LibVlcInstance p_instance, String psz_name, int b_loop, libvlc_exception_t p_e);
525 void libvlc_vlm_change_media(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
526 int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
528 void libvlc_vlm_play_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
530 void libvlc_vlm_stop_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
532 void libvlc_vlm_pause_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
534 void libvlc_vlm_seek_media(LibVlcInstance p_instance, String psz_name, float f_percentage, libvlc_exception_t p_e);
536 String libvlc_vlm_show_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
538 void libvlc_vlm_release(LibVlcInstance p_instance, libvlc_exception_t p_e);
542 public static interface LibVlcCallback extends Callback
545 void callback(libvlc_event_t libvlc_event, Pointer userData);
548 void libvlc_event_attach(LibVlcEventManager event_manager, int event_type, LibVlcCallback callback,
549 Pointer userData, libvlc_exception_t exception);
551 void libvlc_event_detach(LibVlcEventManager event_manager, int event_type, LibVlcCallback callback,
552 Pointer userData, libvlc_exception_t excecption);
554 void libvlc_toggle_fullscreen(LibVlcMediaInstance instance, libvlc_exception_t exception);
558 int libvlc_get_log_verbosity(LibVlcInstance p_instance, libvlc_exception_t p_e);
560 void libvlc_set_log_verbosity(LibVlcInstance p_instance, int level, libvlc_exception_t p_e);
562 LibVlcLog libvlc_log_open(LibVlcInstance p_instance, libvlc_exception_t p_e);
564 void libvlc_log_close(LibVlcLog p_log, libvlc_exception_t p_e);
566 int libvlc_log_count(LibVlcLog p_log, libvlc_exception_t p_e);
568 void libvlc_log_clear(LibVlcLog p_log, libvlc_exception_t p_e);
570 LibVlcLogIterator libvlc_log_get_iterator(LibVlcLog p_log, libvlc_exception_t p_e);
572 void libvlc_log_iterator_free(LibVlcLogIterator p_iter, libvlc_exception_t p_e);
574 int libvlc_log_iterator_has_next(LibVlcLogIterator p_iter, libvlc_exception_t p_e);
576 libvlc_log_message_t libvlc_log_iterator_next(LibVlcLogIterator p_iter, libvlc_log_message_t p_buffer,
577 libvlc_exception_t p_e);