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