IMediaPlayerService.h revision 7cf180c9bff69e5cc4a2f4e53b432db45ebbebab
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 27#include <media/IMediaPlayerClient.h> 28#include <media/IMediaPlayer.h> 29#include <media/IMediaMetadataRetriever.h> 30 31namespace android { 32 33class IMediaRecorder; 34class IOMX; 35struct IStreamSource; 36 37class IMediaPlayerService: public IInterface 38{ 39public: 40 DECLARE_META_INTERFACE(MediaPlayerService); 41 42 virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0; 43 virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0; 44 virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, 45 const char* url, const KeyedVector<String8, String8> *headers = NULL, 46 int audioSessionId = 0) = 0; 47 virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, 48 int fd, int64_t offset, int64_t length, int audioSessionId) = 0; 49 50 virtual sp<IMediaPlayer> create( 51 pid_t pid, const sp<IMediaPlayerClient> &client, 52 const sp<IStreamSource> &source, int audioSessionId) = 0; 53 54 virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; 55 virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; 56 virtual sp<IOMX> getOMX() = 0; 57 58 // codecs usage tracking for the battery app 59 enum BatteryDataBits { 60 // tracking audio codec 61 kBatteryDataTrackAudio = 1, 62 // tracking video codec 63 kBatteryDataTrackVideo = 2, 64 // codec is started, otherwise codec is paused 65 kBatteryDataCodecStarted = 4, 66 // tracking decoder (for media player), 67 // otherwise tracking encoder (for media recorder) 68 kBatteryDataTrackDecoder = 8, 69 }; 70 71 virtual void addBatteryData(uint32_t params) = 0; 72 virtual status_t pullBatteryData(Parcel* reply) = 0; 73}; 74 75// ---------------------------------------------------------------------------- 76 77class BnMediaPlayerService: public BnInterface<IMediaPlayerService> 78{ 79public: 80 virtual status_t onTransact( uint32_t code, 81 const Parcel& data, 82 Parcel* reply, 83 uint32_t flags = 0); 84}; 85 86}; // namespace android 87 88#endif // ANDROID_IMEDIAPLAYERSERVICE_H 89