IMediaPlayer.h revision 05ea6434ed399395e2dbe9f68abb44f04b274cb0
1/*
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>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23
24namespace android {
25
26class Parcel;
27class ISurface;
28class Surface;
29
30class IMediaPlayer: public IInterface
31{
32public:
33    DECLARE_META_INTERFACE(MediaPlayer);
34
35    virtual void            disconnect() = 0;
36
37    virtual status_t        setVideoISurface(const sp<ISurface>& surface) = 0;
38    virtual status_t        setVideoSurface(const sp<Surface>& surface) = 0;
39    virtual status_t        prepareAsync() = 0;
40    virtual status_t        start() = 0;
41    virtual status_t        stop() = 0;
42    virtual status_t        pause() = 0;
43    virtual status_t        isPlaying(bool* state) = 0;
44    virtual status_t        seekTo(int msec) = 0;
45    virtual status_t        getCurrentPosition(int* msec) = 0;
46    virtual status_t        getDuration(int* msec) = 0;
47    virtual status_t        reset() = 0;
48    virtual status_t        setAudioStreamType(int type) = 0;
49    virtual status_t        setLooping(int loop) = 0;
50    virtual status_t        setVolume(float leftVolume, float rightVolume) = 0;
51    virtual status_t        setAuxEffectSendLevel(float level) = 0;
52    virtual status_t        attachAuxEffect(int effectId) = 0;
53
54    // Invoke a generic method on the player by using opaque parcels
55    // for the request and reply.
56    // @param request Parcel that must start with the media player
57    // interface token.
58    // @param[out] reply Parcel to hold the reply data. Cannot be null.
59    // @return OK if the invocation was made successfully.
60    virtual status_t        invoke(const Parcel& request, Parcel *reply) = 0;
61
62    // Set a new metadata filter.
63    // @param filter A set of allow and drop rules serialized in a Parcel.
64    // @return OK if the invocation was made successfully.
65    virtual status_t        setMetadataFilter(const Parcel& filter) = 0;
66
67    // Retrieve a set of metadata.
68    // @param update_only Include only the metadata that have changed
69    //                    since the last invocation of getMetadata.
70    //                    The set is built using the unfiltered
71    //                    notifications the native player sent to the
72    //                    MediaPlayerService during that period of
73    //                    time. If false, all the metadatas are considered.
74    // @param apply_filter If true, once the metadata set has been built based
75    //                     on the value update_only, the current filter is
76    //                     applied.
77    // @param[out] metadata On exit contains a set (possibly empty) of metadata.
78    //                      Valid only if the call returned OK.
79    // @return OK if the invocation was made successfully.
80    virtual status_t        getMetadata(bool update_only,
81                                        bool apply_filter,
82                                        Parcel *metadata) = 0;
83};
84
85// ----------------------------------------------------------------------------
86
87class BnMediaPlayer: public BnInterface<IMediaPlayer>
88{
89public:
90    virtual status_t    onTransact( uint32_t code,
91                                    const Parcel& data,
92                                    Parcel* reply,
93                                    uint32_t flags = 0);
94};
95
96}; // namespace android
97
98#endif // ANDROID_IMEDIAPLAYER_H
99