Home | History | Annotate | Download | only in media
      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_IMEDIAPLAYERSERVICE_H
     18 #define ANDROID_IMEDIAPLAYERSERVICE_H
     19 
     20 #include <utils/Errors.h>  // for status_t
     21 #include <utils/KeyedVector.h>
     22 #include <utils/RefBase.h>
     23 #include <utils/String8.h>
     24 #include <binder/IInterface.h>
     25 #include <binder/Parcel.h>
     26 #include <system/audio.h>
     27 
     28 #include <media/IMediaPlayerClient.h>
     29 #include <media/IMediaPlayer.h>
     30 #include <media/IMediaMetadataRetriever.h>
     31 
     32 namespace android {
     33 
     34 class IMediaCodecList;
     35 struct IMediaHTTPService;
     36 class IMediaRecorder;
     37 class IOMX;
     38 class IRemoteDisplay;
     39 class IRemoteDisplayClient;
     40 struct IStreamSource;
     41 
     42 class IMediaPlayerService: public IInterface
     43 {
     44 public:
     45     DECLARE_META_INTERFACE(MediaPlayerService);
     46 
     47     virtual sp<IMediaRecorder> createMediaRecorder(const String16 &opPackageName) = 0;
     48     virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0;
     49     virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client,
     50             audio_session_t audioSessionId = AUDIO_SESSION_ALLOCATE) = 0;
     51     virtual sp<IMediaCodecList> getCodecList() const = 0;
     52 
     53     // Connects to a remote display.
     54     // 'iface' specifies the address of the local interface on which to listen for
     55     // a connection from the remote display as an ip address and port number
     56     // of the form "x.x.x.x:y".  The media server should call back into the provided remote
     57     // display client when display connection, disconnection or errors occur.
     58     // The assumption is that at most one remote display will be connected to the
     59     // provided interface at a time.
     60     virtual sp<IRemoteDisplay> listenForRemoteDisplay(const String16 &opPackageName,
     61             const sp<IRemoteDisplayClient>& client, const String8& iface) = 0;
     62 
     63     // codecs and audio devices usage tracking for the battery app
     64     enum BatteryDataBits {
     65         // tracking audio codec
     66         kBatteryDataTrackAudio          = 0x1,
     67         // tracking video codec
     68         kBatteryDataTrackVideo          = 0x2,
     69         // codec is started, otherwise codec is paused
     70         kBatteryDataCodecStarted        = 0x4,
     71         // tracking decoder (for media player),
     72         // otherwise tracking encoder (for media recorder)
     73         kBatteryDataTrackDecoder        = 0x8,
     74         // start to play an audio on an audio device
     75         kBatteryDataAudioFlingerStart   = 0x10,
     76         // stop/pause the audio playback
     77         kBatteryDataAudioFlingerStop    = 0x20,
     78         // audio is rounted to speaker
     79         kBatteryDataSpeakerOn           = 0x40,
     80         // audio is rounted to devices other than speaker
     81         kBatteryDataOtherAudioDeviceOn  = 0x80,
     82     };
     83 
     84     virtual void addBatteryData(uint32_t params) = 0;
     85     virtual status_t pullBatteryData(Parcel* reply) = 0;
     86 };
     87 
     88 // ----------------------------------------------------------------------------
     89 
     90 class BnMediaPlayerService: public BnInterface<IMediaPlayerService>
     91 {
     92 public:
     93     virtual status_t    onTransact( uint32_t code,
     94                                     const Parcel& data,
     95                                     Parcel* reply,
     96                                     uint32_t flags = 0);
     97 };
     98 
     99 }; // namespace android
    100 
    101 #endif // ANDROID_IMEDIAPLAYERSERVICE_H
    102