blob: 795678881a01200a37f549d775d4729fdd3db555 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
Nicolas Catania20cb94e2009-05-12 23:25:55 -070020#include <utils/Errors.h> // for status_t
Andreas Huber25643002010-01-28 11:19:57 -080021#include <utils/KeyedVector.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022#include <utils/RefBase.h>
Andreas Huber25643002010-01-28 11:19:57 -080023#include <utils/String8.h>
Mathias Agopian07952722009-05-19 19:08:10 -070024#include <binder/IInterface.h>
25#include <binder/Parcel.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026
27#include <media/IMediaPlayerClient.h>
28#include <media/IMediaPlayer.h>
29#include <media/IMediaMetadataRetriever.h>
30
31namespace android {
32
33class IMediaRecorder;
Andreas Hubere46b7be2009-07-14 16:56:47 -070034class IOMX;
Andreas Huber52b52cd2010-11-23 11:41:34 -080035struct IStreamSource;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
37class IMediaPlayerService: public IInterface
38{
39public:
40 DECLARE_META_INTERFACE(MediaPlayerService);
41
Nicolas Catania32f82772009-06-11 16:33:49 -070042 virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043 virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0;
Eric Laurent619346f2010-06-21 09:27:30 -070044 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;
Andreas Huber52b52cd2010-11-23 11:41:34 -080049
50 virtual sp<IMediaPlayer> create(
51 pid_t pid, const sp<IMediaPlayerClient> &client,
52 const sp<IStreamSource> &source, int audioSessionId) = 0;
53
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 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;
Andreas Huber784202e2009-10-15 13:46:54 -070056 virtual sp<IOMX> getOMX() = 0;
Gloria Wangd211f412011-02-19 18:37:57 -080057
Gloria Wang9b3f1522011-02-24 14:51:45 -080058 // codecs and audio devices usage tracking for the battery app
Gloria Wangd211f412011-02-19 18:37:57 -080059 enum BatteryDataBits {
60 // tracking audio codec
Gloria Wang9b3f1522011-02-24 14:51:45 -080061 kBatteryDataTrackAudio = 0x1,
Gloria Wangd211f412011-02-19 18:37:57 -080062 // tracking video codec
Gloria Wang9b3f1522011-02-24 14:51:45 -080063 kBatteryDataTrackVideo = 0x2,
Gloria Wangd211f412011-02-19 18:37:57 -080064 // codec is started, otherwise codec is paused
Gloria Wang9b3f1522011-02-24 14:51:45 -080065 kBatteryDataCodecStarted = 0x4,
Gloria Wangd211f412011-02-19 18:37:57 -080066 // tracking decoder (for media player),
67 // otherwise tracking encoder (for media recorder)
Gloria Wang9b3f1522011-02-24 14:51:45 -080068 kBatteryDataTrackDecoder = 0x8,
69 // start to play an audio on an audio device
70 kBatteryDataAudioFlingerStart = 0x10,
71 // stop/pause the audio playback
72 kBatteryDataAudioFlingerStop = 0x20,
73 // audio is rounted to speaker
74 kBatteryDataSpeakerOn = 0x40,
75 // audio is rounted to devices other than speaker
76 kBatteryDataOtherAudioDeviceOn = 0x80,
Gloria Wangd211f412011-02-19 18:37:57 -080077 };
78
79 virtual void addBatteryData(uint32_t params) = 0;
80 virtual status_t pullBatteryData(Parcel* reply) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081};
82
83// ----------------------------------------------------------------------------
84
85class BnMediaPlayerService: public BnInterface<IMediaPlayerService>
86{
87public:
88 virtual status_t onTransact( uint32_t code,
89 const Parcel& data,
90 Parcel* reply,
91 uint32_t flags = 0);
92};
93
94}; // namespace android
95
96#endif // ANDROID_IMEDIAPLAYERSERVICE_H