blob: dd62b560bc3b9f473a5259dfab52220943682c74 [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;
Jeff Tinkercc82dc62013-02-08 10:18:35 -080035struct IDrm;
Andreas Huber59451f82012-09-18 10:36:32 -070036struct IHDCP;
Lajos Molnar1381d4b2014-08-07 15:18:35 -070037struct IMediaCodecList;
Andreas Huber1b86fe02014-01-29 11:13:26 -080038struct IMediaHTTPService;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080039class IMediaRecorder;
Andreas Huber20111aa2009-07-14 16:56:47 -070040class IOMX;
Jeff Brown2013a542012-09-04 21:38:42 -070041class IRemoteDisplay;
42class IRemoteDisplayClient;
Andreas Hubere2b10282010-11-23 11:41:34 -080043struct IStreamSource;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080044
45class IMediaPlayerService: public IInterface
46{
47public:
48 DECLARE_META_INTERFACE(MediaPlayerService);
49
Glenn Kastenf37971f2012-02-03 11:06:53 -080050 virtual sp<IMediaRecorder> createMediaRecorder() = 0;
51 virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0;
Glenn Kastenb187de12014-12-30 08:18:15 -080052 virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, int audioSessionId = 0)
53 = 0;
Andreas Hubere2b10282010-11-23 11:41:34 -080054
Andreas Huber1b86fe02014-01-29 11:13:26 -080055 virtual status_t decode(
56 const sp<IMediaHTTPService> &httpService,
57 const char* url,
58 uint32_t *pSampleRate,
59 int* pNumChannels,
60 audio_format_t* pFormat,
61 const sp<IMemoryHeap>& heap, size_t *pSize) = 0;
62
Eric Laurent3d00aa62013-09-24 09:53:27 -070063 virtual status_t decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate,
64 int* pNumChannels, audio_format_t* pFormat,
65 const sp<IMemoryHeap>& heap, size_t *pSize) = 0;
Andreas Huber318ad9c2009-10-15 13:46:54 -070066 virtual sp<IOMX> getOMX() = 0;
Andreas Hubered3e3e02012-03-26 11:13:27 -070067 virtual sp<ICrypto> makeCrypto() = 0;
Jeff Tinkercc82dc62013-02-08 10:18:35 -080068 virtual sp<IDrm> makeDrm() = 0;
Andreas Huber279dcd82013-01-30 10:41:25 -080069 virtual sp<IHDCP> makeHDCP(bool createEncryptionModule) = 0;
Lajos Molnar1381d4b2014-08-07 15:18:35 -070070 virtual sp<IMediaCodecList> getCodecList() const = 0;
Gloria Wang7cf180c2011-02-19 18:37:57 -080071
Jeff Brown2013a542012-09-04 21:38:42 -070072 // Connects to a remote display.
73 // 'iface' specifies the address of the local interface on which to listen for
74 // a connection from the remote display as an ip address and port number
75 // of the form "x.x.x.x:y". The media server should call back into the provided remote
76 // display client when display connection, disconnection or errors occur.
77 // The assumption is that at most one remote display will be connected to the
78 // provided interface at a time.
79 virtual sp<IRemoteDisplay> listenForRemoteDisplay(const sp<IRemoteDisplayClient>& client,
80 const String8& iface) = 0;
81
Gloria Wang9ee159b2011-02-24 14:51:45 -080082 // codecs and audio devices usage tracking for the battery app
Gloria Wang7cf180c2011-02-19 18:37:57 -080083 enum BatteryDataBits {
84 // tracking audio codec
Gloria Wang9ee159b2011-02-24 14:51:45 -080085 kBatteryDataTrackAudio = 0x1,
Gloria Wang7cf180c2011-02-19 18:37:57 -080086 // tracking video codec
Gloria Wang9ee159b2011-02-24 14:51:45 -080087 kBatteryDataTrackVideo = 0x2,
Gloria Wang7cf180c2011-02-19 18:37:57 -080088 // codec is started, otherwise codec is paused
Gloria Wang9ee159b2011-02-24 14:51:45 -080089 kBatteryDataCodecStarted = 0x4,
Gloria Wang7cf180c2011-02-19 18:37:57 -080090 // tracking decoder (for media player),
91 // otherwise tracking encoder (for media recorder)
Gloria Wang9ee159b2011-02-24 14:51:45 -080092 kBatteryDataTrackDecoder = 0x8,
93 // start to play an audio on an audio device
94 kBatteryDataAudioFlingerStart = 0x10,
95 // stop/pause the audio playback
96 kBatteryDataAudioFlingerStop = 0x20,
97 // audio is rounted to speaker
98 kBatteryDataSpeakerOn = 0x40,
99 // audio is rounted to devices other than speaker
100 kBatteryDataOtherAudioDeviceOn = 0x80,
Gloria Wang7cf180c2011-02-19 18:37:57 -0800101 };
102
103 virtual void addBatteryData(uint32_t params) = 0;
104 virtual status_t pullBatteryData(Parcel* reply) = 0;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800105};
106
107// ----------------------------------------------------------------------------
108
109class BnMediaPlayerService: public BnInterface<IMediaPlayerService>
110{
111public:
112 virtual status_t onTransact( uint32_t code,
113 const Parcel& data,
114 Parcel* reply,
115 uint32_t flags = 0);
116};
117
118}; // namespace android
119
120#endif // ANDROID_IMEDIAPLAYERSERVICE_H