1
2
3
4
5 package sk.baka.ambient.playerservice;
6 import java.lang.String;
7 import android.os.RemoteException;
8 import android.os.IBinder;
9 import android.os.IInterface;
10 import android.os.Binder;
11 import android.os.Parcel;
12 /***
13 * The player service command packet.
14 *
15 * @author Martin Vysny
16 */
17 public interface IPlayer extends android.os.IInterface
18 {
19 /*** Local-side IPC implementation stub class. */
20 public static abstract class Stub extends android.os.Binder implements sk.baka.ambient.playerservice.IPlayer
21 {
22 private static final java.lang.String DESCRIPTOR = "sk.baka.ambient.playerservice.IPlayer";
23 /*** Construct the stub at attach it to the interface. */
24 public Stub()
25 {
26 this.attachInterface(this, DESCRIPTOR);
27 }
28 /***
29 * Cast an IBinder object into an IPlayer interface,
30 * generating a proxy if needed.
31 */
32 public static sk.baka.ambient.playerservice.IPlayer asInterface(android.os.IBinder obj)
33 {
34 if ((obj==null)) {
35 return null;
36 }
37 sk.baka.ambient.playerservice.IPlayer in = (sk.baka.ambient.playerservice.IPlayer)obj.queryLocalInterface(DESCRIPTOR);
38 if ((in!=null)) {
39 return in;
40 }
41 return new sk.baka.ambient.playerservice.IPlayer.Stub.Proxy(obj);
42 }
43 public android.os.IBinder asBinder()
44 {
45 return this;
46 }
47 public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
48 {
49 switch (code)
50 {
51 case INTERFACE_TRANSACTION:
52 {
53 reply.writeString(DESCRIPTOR);
54 return true;
55 }
56 case TRANSACTION_pause:
57 {
58 data.enforceInterface(DESCRIPTOR);
59 this.pause();
60 reply.writeNoException();
61 return true;
62 }
63 case TRANSACTION_play:
64 {
65 data.enforceInterface(DESCRIPTOR);
66 java.lang.String _arg0;
67 _arg0 = data.readString();
68 int _arg1;
69 _arg1 = data.readInt();
70 int _arg2;
71 _arg2 = data.readInt();
72 this.play(_arg0, _arg1, _arg2);
73 reply.writeNoException();
74 return true;
75 }
76 case TRANSACTION_stop:
77 {
78 data.enforceInterface(DESCRIPTOR);
79 this.stop();
80 reply.writeNoException();
81 return true;
82 }
83 case TRANSACTION_seek:
84 {
85 data.enforceInterface(DESCRIPTOR);
86 int _arg0;
87 _arg0 = data.readInt();
88 boolean _result = this.seek(_arg0);
89 reply.writeNoException();
90 reply.writeInt(((_result)?(1):(0)));
91 return true;
92 }
93 case TRANSACTION_getPlaybackState:
94 {
95 data.enforceInterface(DESCRIPTOR);
96 int _result = this.getPlaybackState();
97 reply.writeNoException();
98 reply.writeInt(_result);
99 return true;
100 }
101 case TRANSACTION_getPosition:
102 {
103 data.enforceInterface(DESCRIPTOR);
104 int _result = this.getPosition();
105 reply.writeNoException();
106 reply.writeInt(_result);
107 return true;
108 }
109 }
110 return super.onTransact(code, data, reply, flags);
111 }
112 private static class Proxy implements sk.baka.ambient.playerservice.IPlayer
113 {
114 private android.os.IBinder mRemote;
115 Proxy(android.os.IBinder remote)
116 {
117 mRemote = remote;
118 }
119 public android.os.IBinder asBinder()
120 {
121 return mRemote;
122 }
123 public java.lang.String getInterfaceDescriptor()
124 {
125 return DESCRIPTOR;
126 }
127 /***
128 * Pauses the player, or resumes playback if the player was paused.
129 * Does nothing if the player is stopped.
130 */
131 public void pause() throws android.os.RemoteException
132 {
133 android.os.Parcel _data = android.os.Parcel.obtain();
134 android.os.Parcel _reply = android.os.Parcel.obtain();
135 try {
136 _data.writeInterfaceToken(DESCRIPTOR);
137 mRemote.transact(Stub.TRANSACTION_pause, _data, _reply, 0);
138 _reply.readException();
139 }
140 finally {
141 _reply.recycle();
142 _data.recycle();
143 }
144 }
145 /***
146 * Plays given file.
147 * @param file Absolute file name which to play.
148 * @param origin the origin, ordinal of the <code>TrackOriginEnum</code> enum.
149 * @param initialSeekMills start playback here. Ignored when the stream is not
150 * seekable.
151 */
152 public void play(java.lang.String file, int origin, int initialSeekMillis) throws android.os.RemoteException
153 {
154 android.os.Parcel _data = android.os.Parcel.obtain();
155 android.os.Parcel _reply = android.os.Parcel.obtain();
156 try {
157 _data.writeInterfaceToken(DESCRIPTOR);
158 _data.writeString(file);
159 _data.writeInt(origin);
160 _data.writeInt(initialSeekMillis);
161 mRemote.transact(Stub.TRANSACTION_play, _data, _reply, 0);
162 _reply.readException();
163 }
164 finally {
165 _reply.recycle();
166 _data.recycle();
167 }
168 }
169 /***
170 * Stops playback. Does nothing if the playback is not started.
171 */
172 public void stop() throws android.os.RemoteException
173 {
174 android.os.Parcel _data = android.os.Parcel.obtain();
175 android.os.Parcel _reply = android.os.Parcel.obtain();
176 try {
177 _data.writeInterfaceToken(DESCRIPTOR);
178 mRemote.transact(Stub.TRANSACTION_stop, _data, _reply, 0);
179 _reply.readException();
180 }
181 finally {
182 _reply.recycle();
183 _data.recycle();
184 }
185 }
186 /***
187 * Seeks to given position. If the position is invalid then the result
188 * is undefined. Does nothing if the playback is stopped. Does not unpause
189 * the playback.
190 * @param position Seek to this position in milliseconds.
191 * @return true if the playback position changed, false otherwise. false can
192 * be returned for example when the playback is stopped or the stream is not
193 * seekable.
194 */
195 public boolean seek(int position) throws android.os.RemoteException
196 {
197 android.os.Parcel _data = android.os.Parcel.obtain();
198 android.os.Parcel _reply = android.os.Parcel.obtain();
199 boolean _result;
200 try {
201 _data.writeInterfaceToken(DESCRIPTOR);
202 _data.writeInt(position);
203 mRemote.transact(Stub.TRANSACTION_seek, _data, _reply, 0);
204 _reply.readException();
205 _result = (0!=_reply.readInt());
206 }
207 finally {
208 _reply.recycle();
209 _data.recycle();
210 }
211 return _result;
212 }
213 /***
214 * Returns the playback state.
215 * @returns 0 for stopped, 1 for paused, 2 for playing, as specified in the
216 * <code>PlayerStateEnum</code>.
217 */
218 public int getPlaybackState() throws android.os.RemoteException
219 {
220 android.os.Parcel _data = android.os.Parcel.obtain();
221 android.os.Parcel _reply = android.os.Parcel.obtain();
222 int _result;
223 try {
224 _data.writeInterfaceToken(DESCRIPTOR);
225 mRemote.transact(Stub.TRANSACTION_getPlaybackState, _data, _reply, 0);
226 _reply.readException();
227 _result = _reply.readInt();
228 }
229 finally {
230 _reply.recycle();
231 _data.recycle();
232 }
233 return _result;
234 }
235 /***
236 * Returns current position in millis of the playback. Returns 0 if the
237 * playback is stopped.
238 *
239 * @return current player position in millis.
240 */
241 public int getPosition() throws android.os.RemoteException
242 {
243 android.os.Parcel _data = android.os.Parcel.obtain();
244 android.os.Parcel _reply = android.os.Parcel.obtain();
245 int _result;
246 try {
247 _data.writeInterfaceToken(DESCRIPTOR);
248 mRemote.transact(Stub.TRANSACTION_getPosition, _data, _reply, 0);
249 _reply.readException();
250 _result = _reply.readInt();
251 }
252 finally {
253 _reply.recycle();
254 _data.recycle();
255 }
256 return _result;
257 }
258 }
259 static final int TRANSACTION_pause = (IBinder.FIRST_CALL_TRANSACTION + 0);
260 static final int TRANSACTION_play = (IBinder.FIRST_CALL_TRANSACTION + 1);
261 static final int TRANSACTION_stop = (IBinder.FIRST_CALL_TRANSACTION + 2);
262 static final int TRANSACTION_seek = (IBinder.FIRST_CALL_TRANSACTION + 3);
263 static final int TRANSACTION_getPlaybackState = (IBinder.FIRST_CALL_TRANSACTION + 4);
264 static final int TRANSACTION_getPosition = (IBinder.FIRST_CALL_TRANSACTION + 5);
265 }
266 /***
267 * Pauses the player, or resumes playback if the player was paused.
268 * Does nothing if the player is stopped.
269 */
270 public void pause() throws android.os.RemoteException;
271 /***
272 * Plays given file.
273 * @param file Absolute file name which to play.
274 * @param origin the origin, ordinal of the <code>TrackOriginEnum</code> enum.
275 * @param initialSeekMills start playback here. Ignored when the stream is not
276 * seekable.
277 */
278 public void play(java.lang.String file, int origin, int initialSeekMillis) throws android.os.RemoteException;
279 /***
280 * Stops playback. Does nothing if the playback is not started.
281 */
282 public void stop() throws android.os.RemoteException;
283 /***
284 * Seeks to given position. If the position is invalid then the result
285 * is undefined. Does nothing if the playback is stopped. Does not unpause
286 * the playback.
287 * @param position Seek to this position in milliseconds.
288 * @return true if the playback position changed, false otherwise. false can
289 * be returned for example when the playback is stopped or the stream is not
290 * seekable.
291 */
292 public boolean seek(int position) throws android.os.RemoteException;
293 /***
294 * Returns the playback state.
295 * @returns 0 for stopped, 1 for paused, 2 for playing, as specified in the
296 * <code>PlayerStateEnum</code>.
297 */
298 public int getPlaybackState() throws android.os.RemoteException;
299 /***
300 * Returns current position in millis of the playback. Returns 0 if the
301 * playback is stopped.
302 *
303 * @return current player position in millis.
304 */
305 public int getPosition() throws android.os.RemoteException;
306 }