IMediaPlayerService.h revision b7319a7eb0a06ef4fd3a0c9157ee63e637ad7aa1
1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)/* 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * Copyright (C) 2008 The Android Open Source Project 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * Licensed under the Apache License, Version 2.0 (the "License"); 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * you may not use this file except in compliance with the License. 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * You may obtain a copy of the License at 7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * http://www.apache.org/licenses/LICENSE-2.0 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * Unless required by applicable law or agreed to in writing, software 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * distributed under the License is distributed on an "AS IS" BASIS, 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * See the License for the specific language governing permissions and 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * limitations under the License. 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) */ 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef ANDROID_IMEDIAPLAYERSERVICE_H 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#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 32namespace android { 33 34struct ICrypto; 35struct IDrm; 36struct IHDCP; 37class IMediaRecorder; 38class IOMX; 39class IRemoteDisplay; 40class IRemoteDisplayClient; 41struct IStreamSource; 42 43class IMediaPlayerService: public IInterface 44{ 45public: 46 DECLARE_META_INTERFACE(MediaPlayerService); 47 48 virtual sp<IMediaRecorder> createMediaRecorder() = 0; 49 virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0; 50 virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0; 51 52 virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; 53 virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; 54 virtual sp<IOMX> getOMX() = 0; 55 virtual sp<ICrypto> makeCrypto() = 0; 56 virtual sp<IDrm> makeDrm() = 0; 57 virtual sp<IHDCP> makeHDCP(bool createEncryptionModule) = 0; 58 59 // Connects to a remote display. 60 // 'iface' specifies the address of the local interface on which to listen for 61 // a connection from the remote display as an ip address and port number 62 // of the form "x.x.x.x:y". The media server should call back into the provided remote 63 // display client when display connection, disconnection or errors occur. 64 // The assumption is that at most one remote display will be connected to the 65 // provided interface at a time. 66 virtual sp<IRemoteDisplay> listenForRemoteDisplay(const sp<IRemoteDisplayClient>& client, 67 const String8& iface) = 0; 68 69 // codecs and audio devices usage tracking for the battery app 70 enum BatteryDataBits { 71 // tracking audio codec 72 kBatteryDataTrackAudio = 0x1, 73 // tracking video codec 74 kBatteryDataTrackVideo = 0x2, 75 // codec is started, otherwise codec is paused 76 kBatteryDataCodecStarted = 0x4, 77 // tracking decoder (for media player), 78 // otherwise tracking encoder (for media recorder) 79 kBatteryDataTrackDecoder = 0x8, 80 // start to play an audio on an audio device 81 kBatteryDataAudioFlingerStart = 0x10, 82 // stop/pause the audio playback 83 kBatteryDataAudioFlingerStop = 0x20, 84 // audio is rounted to speaker 85 kBatteryDataSpeakerOn = 0x40, 86 // audio is rounted to devices other than speaker 87 kBatteryDataOtherAudioDeviceOn = 0x80, 88 }; 89 90 virtual void addBatteryData(uint32_t params) = 0; 91 virtual status_t pullBatteryData(Parcel* reply) = 0; 92 93 virtual status_t updateProxyConfig( 94 const char *host, int32_t port, const char *exclusionList) = 0; 95}; 96 97// ---------------------------------------------------------------------------- 98 99class BnMediaPlayerService: public BnInterface<IMediaPlayerService> 100{ 101public: 102 virtual status_t onTransact( uint32_t code, 103 const Parcel& data, 104 Parcel* reply, 105 uint32_t flags = 0); 106}; 107 108}; // namespace android 109 110#endif // ANDROID_IMEDIAPLAYERSERVICE_H 111