blob: 70519ef3d510efaa1647b452c3a5c9ace3ccdb5c [file] [log] [blame]
The Android Open Source Project9066cfe2009-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 Agopian07952722009-05-19 19:08:10 -070021#include <binder/IInterface.h>
22#include <binder/Parcel.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023
24namespace android {
25
Nicolas Catania20cb94e2009-05-12 23:25:55 -070026class Parcel;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027class ISurface;
Andreas Hubere3c01832010-08-16 08:49:37 -070028class Surface;
Glenn Kastencc562a32011-02-08 17:26:17 -080029class ISurfaceTexture;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030
31class IMediaPlayer: public IInterface
32{
33public:
34 DECLARE_META_INTERFACE(MediaPlayer);
35
36 virtual void disconnect() = 0;
37
Andreas Hubere3c01832010-08-16 08:49:37 -070038 virtual status_t setVideoSurface(const sp<Surface>& surface) = 0;
Glenn Kastencc562a32011-02-08 17:26:17 -080039 virtual status_t setVideoSurfaceTexture(
40 const sp<ISurfaceTexture>& surfaceTexture) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041 virtual status_t prepareAsync() = 0;
42 virtual status_t start() = 0;
43 virtual status_t stop() = 0;
44 virtual status_t pause() = 0;
45 virtual status_t isPlaying(bool* state) = 0;
46 virtual status_t seekTo(int msec) = 0;
47 virtual status_t getCurrentPosition(int* msec) = 0;
48 virtual status_t getDuration(int* msec) = 0;
49 virtual status_t reset() = 0;
50 virtual status_t setAudioStreamType(int type) = 0;
51 virtual status_t setLooping(int loop) = 0;
52 virtual status_t setVolume(float leftVolume, float rightVolume) = 0;
Eric Laurent7070b362010-07-16 07:43:46 -070053 virtual status_t setAuxEffectSendLevel(float level) = 0;
54 virtual status_t attachAuxEffect(int effectId) = 0;
Nicolas Catania20cb94e2009-05-12 23:25:55 -070055
56 // Invoke a generic method on the player by using opaque parcels
57 // for the request and reply.
58 // @param request Parcel that must start with the media player
59 // interface token.
60 // @param[out] reply Parcel to hold the reply data. Cannot be null.
Nicolas Cataniab2c69392009-07-08 08:57:42 -070061 // @return OK if the invocation was made successfully.
Nicolas Catania20cb94e2009-05-12 23:25:55 -070062 virtual status_t invoke(const Parcel& request, Parcel *reply) = 0;
Nicolas Cataniab2c69392009-07-08 08:57:42 -070063
64 // Set a new metadata filter.
65 // @param filter A set of allow and drop rules serialized in a Parcel.
66 // @return OK if the invocation was made successfully.
67 virtual status_t setMetadataFilter(const Parcel& filter) = 0;
Nicolas Catania5d55c712009-07-09 09:21:33 -070068
69 // Retrieve a set of metadata.
70 // @param update_only Include only the metadata that have changed
71 // since the last invocation of getMetadata.
72 // The set is built using the unfiltered
73 // notifications the native player sent to the
74 // MediaPlayerService during that period of
75 // time. If false, all the metadatas are considered.
76 // @param apply_filter If true, once the metadata set has been built based
77 // on the value update_only, the current filter is
78 // applied.
79 // @param[out] metadata On exit contains a set (possibly empty) of metadata.
80 // Valid only if the call returned OK.
81 // @return OK if the invocation was made successfully.
82 virtual status_t getMetadata(bool update_only,
83 bool apply_filter,
84 Parcel *metadata) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085};
86
87// ----------------------------------------------------------------------------
88
89class BnMediaPlayer: public BnInterface<IMediaPlayer>
90{
91public:
92 virtual status_t onTransact( uint32_t code,
93 const Parcel& data,
94 Parcel* reply,
95 uint32_t flags = 0);
96};
97
98}; // namespace android
99
100#endif // ANDROID_IMEDIAPLAYER_H