The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Nicolas Catania | 1d187f1 | 2009-05-12 23:25:55 -0700 | [diff] [blame] | 20 | #include <utils/Errors.h> // for status_t |
Andreas Huber | 2db8455 | 2010-01-28 11:19:57 -0800 | [diff] [blame] | 21 | #include <utils/KeyedVector.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | #include <utils/RefBase.h> |
Andreas Huber | 2db8455 | 2010-01-28 11:19:57 -0800 | [diff] [blame] | 23 | #include <utils/String8.h> |
Mathias Agopian | 7562408 | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 24 | #include <binder/IInterface.h> |
| 25 | #include <binder/Parcel.h> |
Glenn Kasten | e1c3962 | 2012-01-04 09:36:37 -0800 | [diff] [blame] | 26 | #include <system/audio.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | |
| 28 | #include <media/IMediaPlayerClient.h> |
| 29 | #include <media/IMediaPlayer.h> |
| 30 | #include <media/IMediaMetadataRetriever.h> |
| 31 | |
| 32 | namespace android { |
| 33 | |
Andreas Huber | 59451f8 | 2012-09-18 10:36:32 -0700 | [diff] [blame] | 34 | struct IHDCP; |
Lajos Molnar | 1381d4b | 2014-08-07 15:18:35 -0700 | [diff] [blame] | 35 | struct IMediaCodecList; |
Andreas Huber | 1b86fe0 | 2014-01-29 11:13:26 -0800 | [diff] [blame] | 36 | struct IMediaHTTPService; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 37 | class IMediaRecorder; |
Andreas Huber | 20111aa | 2009-07-14 16:56:47 -0700 | [diff] [blame] | 38 | class IOMX; |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 39 | class IRemoteDisplay; |
| 40 | class IRemoteDisplayClient; |
Andreas Huber | e2b1028 | 2010-11-23 11:41:34 -0800 | [diff] [blame] | 41 | struct IStreamSource; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | |
| 43 | class IMediaPlayerService: public IInterface |
| 44 | { |
| 45 | public: |
| 46 | DECLARE_META_INTERFACE(MediaPlayerService); |
| 47 | |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 48 | virtual sp<IMediaRecorder> createMediaRecorder(const String16 &opPackageName) = 0; |
Glenn Kasten | f37971f | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 49 | virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0; |
Glenn Kasten | d848eb4 | 2016-03-08 13:42:11 -0800 | [diff] [blame] | 50 | virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, |
| 51 | audio_session_t audioSessionId = AUDIO_SESSION_ALLOCATE) = 0; |
Marco Nelissen | 260e56c | 2016-01-28 21:41:25 +0000 | [diff] [blame] | 52 | virtual sp<IOMX> getOMX() = 0; |
Andreas Huber | 279dcd8 | 2013-01-30 10:41:25 -0800 | [diff] [blame] | 53 | virtual sp<IHDCP> makeHDCP(bool createEncryptionModule) = 0; |
Lajos Molnar | 1381d4b | 2014-08-07 15:18:35 -0700 | [diff] [blame] | 54 | virtual sp<IMediaCodecList> getCodecList() const = 0; |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 55 | |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 56 | // Connects to a remote display. |
| 57 | // 'iface' specifies the address of the local interface on which to listen for |
| 58 | // a connection from the remote display as an ip address and port number |
| 59 | // of the form "x.x.x.x:y". The media server should call back into the provided remote |
| 60 | // display client when display connection, disconnection or errors occur. |
| 61 | // The assumption is that at most one remote display will be connected to the |
| 62 | // provided interface at a time. |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 63 | virtual sp<IRemoteDisplay> listenForRemoteDisplay(const String16 &opPackageName, |
| 64 | const sp<IRemoteDisplayClient>& client, const String8& iface) = 0; |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 65 | |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 66 | // codecs and audio devices usage tracking for the battery app |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 67 | enum BatteryDataBits { |
| 68 | // tracking audio codec |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 69 | kBatteryDataTrackAudio = 0x1, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 70 | // tracking video codec |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 71 | kBatteryDataTrackVideo = 0x2, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 72 | // codec is started, otherwise codec is paused |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 73 | kBatteryDataCodecStarted = 0x4, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 74 | // tracking decoder (for media player), |
| 75 | // otherwise tracking encoder (for media recorder) |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 76 | kBatteryDataTrackDecoder = 0x8, |
| 77 | // start to play an audio on an audio device |
| 78 | kBatteryDataAudioFlingerStart = 0x10, |
| 79 | // stop/pause the audio playback |
| 80 | kBatteryDataAudioFlingerStop = 0x20, |
| 81 | // audio is rounted to speaker |
| 82 | kBatteryDataSpeakerOn = 0x40, |
| 83 | // audio is rounted to devices other than speaker |
| 84 | kBatteryDataOtherAudioDeviceOn = 0x80, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | virtual void addBatteryData(uint32_t params) = 0; |
| 88 | virtual status_t pullBatteryData(Parcel* reply) = 0; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | // ---------------------------------------------------------------------------- |
| 92 | |
| 93 | class BnMediaPlayerService: public BnInterface<IMediaPlayerService> |
| 94 | { |
| 95 | public: |
| 96 | virtual status_t onTransact( uint32_t code, |
| 97 | const Parcel& data, |
| 98 | Parcel* reply, |
| 99 | uint32_t flags = 0); |
| 100 | }; |
| 101 | |
| 102 | }; // namespace android |
| 103 | |
| 104 | #endif // ANDROID_IMEDIAPLAYERSERVICE_H |