]> git.sesse.net Git - vlc/blob - bindings/java/org/videolan/jvlc/Playlist.java
Java bindings update:
[vlc] / bindings / java / org / videolan / jvlc / Playlist.java
1  /*****************************************************************************
2  * PlaylistIntf.java: The playlist interface
3  *****************************************************************************
4  *
5  * Copyright (C) 1998-2006 the VideoLAN team
6  * 
7  * Author: Filippo Carone <filippo@carone.org>
8  *
9  * Created on 28-feb-2006
10  *
11  * $Id$
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2 of the
16  * License, or (at your option) any later version.
17  * 
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * General Public License for more details.
22  * 
23  * You should have received a copy of the GNU General Public
24  * License along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  * 
27  */
28
29
30 package org.videolan.jvlc;
31
32 public class Playlist implements PlaylistIntf {
33     
34     
35     private long libvlcInstance;
36
37     public Playlist(long _libvlcInstance) {
38         this.libvlcInstance = _libvlcInstance;
39     }
40     
41     native private int _playlist_add(String uri, String name, String[] options);
42     native private void _play(int _id, String[] options);
43     native private void _pause();
44     native private void _stop();
45     native private void _next();
46     native private void _prev();
47     native private void _clear();
48     native private void _deleteItem(int itemID);
49     
50     native private int _itemsCount();
51     native private int _isRunning();
52     
53     native private boolean _inputIsPlaying();
54         native private boolean _inputHasVout();
55
56
57     public synchronized void play(int id, String[] options) {
58         _play(id, options);
59         while (! _inputIsPlaying()) ;
60     }
61
62     public synchronized void play() {
63         play(-1, null);
64     }
65
66     public synchronized void pause() {
67         _pause();
68     }
69
70     public synchronized void stop() {
71         _stop();
72
73     }
74
75     public boolean isRunning() {
76          return (_isRunning() == 0)? false : true ;
77     }
78
79     public synchronized int itemsCount() {
80         return _itemsCount();
81     }
82
83     public synchronized void next() {
84         if (! isRunning())
85             play();
86         _next();
87     }
88
89     public synchronized void prev() {
90         if (! isRunning())
91             play();
92         _prev();
93     }
94
95     public synchronized void clear() {
96         /*
97          * This method has been commented out until
98          * playlist_Clear has been fixed in vlc.
99          */
100         //_clear();
101     }
102
103     public synchronized int add(String uri, String name, String[] options) {
104         return _playlist_add(uri, name, options);
105     }
106     
107     public synchronized int add(String uri, String name) {
108         return add(uri, name, null);
109     }
110
111     public synchronized void addExtended() {
112     }
113
114     public synchronized void deleteItem(int itemID) {
115         _deleteItem(itemID);
116     }
117     
118     public long getInstance() {
119         return libvlcInstance;
120     }
121     
122     public synchronized boolean inputIsPlaying() {
123         return _inputIsPlaying();
124     }
125
126     public synchronized boolean inputHasVout() {
127         return _inputHasVout();
128     }
129     
130 }