blob: 26196917203fc0bba85183801c7518595a20c174 [file] [log] [blame]
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_IMEDIAPLAYER_H
18#define ANDROID_IMEDIAPLAYER_H
19
20#include <utils/RefBase.h>
Mathias Agopian75624082009-05-19 19:08:10 -070021#include <binder/IInterface.h>
22#include <binder/Parcel.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080023
24namespace android {
25
Nicolas Catania1d187f12009-05-12 23:25:55 -070026class Parcel;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080027class ISurface;
28
29class IMediaPlayer: public IInterface
30{
31public:
32 DECLARE_META_INTERFACE(MediaPlayer);
33
34 virtual void disconnect() = 0;
35
36 virtual status_t setVideoSurface(const sp<ISurface>& surface) = 0;
37 virtual status_t prepareAsync() = 0;
38 virtual status_t start() = 0;
39 virtual status_t stop() = 0;
40 virtual status_t pause() = 0;
41 virtual status_t isPlaying(bool* state) = 0;
42 virtual status_t seekTo(int msec) = 0;
43 virtual status_t getCurrentPosition(int* msec) = 0;
44 virtual status_t getDuration(int* msec) = 0;
45 virtual status_t reset() = 0;
46 virtual status_t setAudioStreamType(int type) = 0;
47 virtual status_t setLooping(int loop) = 0;
48 virtual status_t setVolume(float leftVolume, float rightVolume) = 0;
Andreas Huber4e92c7e2010-02-12 12:35:58 -080049 virtual status_t suspend() = 0;
50 virtual status_t resume() = 0;
Nicolas Catania1d187f12009-05-12 23:25:55 -070051
52 // Invoke a generic method on the player by using opaque parcels
53 // for the request and reply.
54 // @param request Parcel that must start with the media player
55 // interface token.
56 // @param[out] reply Parcel to hold the reply data. Cannot be null.
Nicolas Cataniaa7e0e8b2009-07-08 08:57:42 -070057 // @return OK if the invocation was made successfully.
Nicolas Catania1d187f12009-05-12 23:25:55 -070058 virtual status_t invoke(const Parcel& request, Parcel *reply) = 0;
Nicolas Cataniaa7e0e8b2009-07-08 08:57:42 -070059
60 // Set a new metadata filter.
61 // @param filter A set of allow and drop rules serialized in a Parcel.
62 // @return OK if the invocation was made successfully.
63 virtual status_t setMetadataFilter(const Parcel& filter) = 0;
Nicolas Catania8e1b6cc2009-07-09 09:21:33 -070064
65 // Retrieve a set of metadata.
66 // @param update_only Include only the metadata that have changed
67 // since the last invocation of getMetadata.
68 // The set is built using the unfiltered
69 // notifications the native player sent to the
70 // MediaPlayerService during that period of
71 // time. If false, all the metadatas are considered.
72 // @param apply_filter If true, once the metadata set has been built based
73 // on the value update_only, the current filter is
74 // applied.
75 // @param[out] metadata On exit contains a set (possibly empty) of metadata.
76 // Valid only if the call returned OK.
77 // @return OK if the invocation was made successfully.
78 virtual status_t getMetadata(bool update_only,
79 bool apply_filter,
80 Parcel *metadata) = 0;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080081};
82
83// ----------------------------------------------------------------------------
84
85class BnMediaPlayer: public BnInterface<IMediaPlayer>
86{
87public:
88 virtual status_t onTransact( uint32_t code,
89 const Parcel& data,
90 Parcel* reply,
91 uint32_t flags = 0);
92};
93
94}; // namespace android
95
96#endif // ANDROID_IMEDIAPLAYER_H