blob: 172975cb19111e4483ad8a2b17170ed5a4b5894c [file] [log] [blame]
The Android Open Source Project89fa4ad2009-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 Catania1d187f12009-05-12 23:25:55 -070020#include <utils/Errors.h> // for status_t
Andreas Huber2db84552010-01-28 11:19:57 -080021#include <utils/KeyedVector.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080022#include <utils/RefBase.h>
Andreas Huber2db84552010-01-28 11:19:57 -080023#include <utils/String8.h>
Mathias Agopian75624082009-05-19 19:08:10 -070024#include <binder/IInterface.h>
25#include <binder/Parcel.h>
Glenn Kastene1c39622012-01-04 09:36:37 -080026#include <system/audio.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080027
28#include <media/IMediaPlayerClient.h>
29#include <media/IMediaPlayer.h>
30#include <media/IMediaMetadataRetriever.h>
31
32namespace android {
33
Andreas Hubered3e3e02012-03-26 11:13:27 -070034struct ICrypto;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080035class IMediaRecorder;
Andreas Huber20111aa2009-07-14 16:56:47 -070036class IOMX;
Andreas Hubere2b10282010-11-23 11:41:34 -080037struct IStreamSource;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080038
39class IMediaPlayerService: public IInterface
40{
41public:
42 DECLARE_META_INTERFACE(MediaPlayerService);
43
Dave Burked681bbb2011-08-30 14:39:17 +010044 virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080045 virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0;
Dave Burked681bbb2011-08-30 14:39:17 +010046 virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0;
Andreas Hubere2b10282010-11-23 11:41:34 -080047
Glenn Kastene1c39622012-01-04 09:36:37 -080048 virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
49 virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
Andreas Huber318ad9c2009-10-15 13:46:54 -070050 virtual sp<IOMX> getOMX() = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070051 virtual sp<ICrypto> makeCrypto() = 0;
Gloria Wang7cf180c2011-02-19 18:37:57 -080052
Andreas Huberab1bd842012-08-30 14:51:40 -070053 // If iface == NULL, disable remote display, otherwise
54 // iface should be of the form "x.x.x.x:y", i.e. ip address
55 // of the local interface to bind to and the port number
56 // to listen on.
57 virtual status_t enableRemoteDisplay(const char *iface) = 0;
Andreas Huber35213f12012-08-29 11:41:50 -070058
Gloria Wang9ee159b2011-02-24 14:51:45 -080059 // codecs and audio devices usage tracking for the battery app
Gloria Wang7cf180c2011-02-19 18:37:57 -080060 enum BatteryDataBits {
61 // tracking audio codec
Gloria Wang9ee159b2011-02-24 14:51:45 -080062 kBatteryDataTrackAudio = 0x1,
Gloria Wang7cf180c2011-02-19 18:37:57 -080063 // tracking video codec
Gloria Wang9ee159b2011-02-24 14:51:45 -080064 kBatteryDataTrackVideo = 0x2,
Gloria Wang7cf180c2011-02-19 18:37:57 -080065 // codec is started, otherwise codec is paused
Gloria Wang9ee159b2011-02-24 14:51:45 -080066 kBatteryDataCodecStarted = 0x4,
Gloria Wang7cf180c2011-02-19 18:37:57 -080067 // tracking decoder (for media player),
68 // otherwise tracking encoder (for media recorder)
Gloria Wang9ee159b2011-02-24 14:51:45 -080069 kBatteryDataTrackDecoder = 0x8,
70 // start to play an audio on an audio device
71 kBatteryDataAudioFlingerStart = 0x10,
72 // stop/pause the audio playback
73 kBatteryDataAudioFlingerStop = 0x20,
74 // audio is rounted to speaker
75 kBatteryDataSpeakerOn = 0x40,
76 // audio is rounted to devices other than speaker
77 kBatteryDataOtherAudioDeviceOn = 0x80,
Gloria Wang7cf180c2011-02-19 18:37:57 -080078 };
79
80 virtual void addBatteryData(uint32_t params) = 0;
81 virtual status_t pullBatteryData(Parcel* reply) = 0;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080082};
83
84// ----------------------------------------------------------------------------
85
86class BnMediaPlayerService: public BnInterface<IMediaPlayerService>
87{
88public:
89 virtual status_t onTransact( uint32_t code,
90 const Parcel& data,
91 Parcel* reply,
92 uint32_t flags = 0);
93};
94
95}; // namespace android
96
97#endif // ANDROID_IMEDIAPLAYERSERVICE_H