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