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 | ed3e3e0 | 2012-03-26 11:13:27 -0700 | [diff] [blame] | 34 | struct ICrypto; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | class IMediaRecorder; |
Andreas Huber | 20111aa | 2009-07-14 16:56:47 -0700 | [diff] [blame] | 36 | class IOMX; |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame^] | 37 | class IRemoteDisplay; |
| 38 | class IRemoteDisplayClient; |
Andreas Huber | e2b1028 | 2010-11-23 11:41:34 -0800 | [diff] [blame] | 39 | struct IStreamSource; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | |
| 41 | class IMediaPlayerService: public IInterface |
| 42 | { |
| 43 | public: |
| 44 | DECLARE_META_INTERFACE(MediaPlayerService); |
| 45 | |
Dave Burke | d681bbb | 2011-08-30 14:39:17 +0100 | [diff] [blame] | 46 | virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 47 | virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0; |
Dave Burke | d681bbb | 2011-08-30 14:39:17 +0100 | [diff] [blame] | 48 | virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0; |
Andreas Huber | e2b1028 | 2010-11-23 11:41:34 -0800 | [diff] [blame] | 49 | |
Glenn Kasten | e1c3962 | 2012-01-04 09:36:37 -0800 | [diff] [blame] | 50 | virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; |
| 51 | virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; |
Andreas Huber | 318ad9c | 2009-10-15 13:46:54 -0700 | [diff] [blame] | 52 | virtual sp<IOMX> getOMX() = 0; |
Andreas Huber | ed3e3e0 | 2012-03-26 11:13:27 -0700 | [diff] [blame] | 53 | virtual sp<ICrypto> makeCrypto() = 0; |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 54 | |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame^] | 55 | // Connects to a remote display. |
| 56 | // 'iface' specifies the address of the local interface on which to listen for |
| 57 | // a connection from the remote display as an ip address and port number |
| 58 | // of the form "x.x.x.x:y". The media server should call back into the provided remote |
| 59 | // display client when display connection, disconnection or errors occur. |
| 60 | // The assumption is that at most one remote display will be connected to the |
| 61 | // provided interface at a time. |
| 62 | virtual sp<IRemoteDisplay> listenForRemoteDisplay(const sp<IRemoteDisplayClient>& client, |
| 63 | const String8& iface) = 0; |
| 64 | |
Andreas Huber | ab1bd84 | 2012-08-30 14:51:40 -0700 | [diff] [blame] | 65 | // If iface == NULL, disable remote display, otherwise |
| 66 | // iface should be of the form "x.x.x.x:y", i.e. ip address |
| 67 | // of the local interface to bind to and the port number |
| 68 | // to listen on. |
| 69 | virtual status_t enableRemoteDisplay(const char *iface) = 0; |
Andreas Huber | 35213f1 | 2012-08-29 11:41:50 -0700 | [diff] [blame] | 70 | |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 71 | // codecs and audio devices usage tracking for the battery app |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 72 | enum BatteryDataBits { |
| 73 | // tracking audio codec |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 74 | kBatteryDataTrackAudio = 0x1, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 75 | // tracking video codec |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 76 | kBatteryDataTrackVideo = 0x2, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 77 | // codec is started, otherwise codec is paused |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 78 | kBatteryDataCodecStarted = 0x4, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 79 | // tracking decoder (for media player), |
| 80 | // otherwise tracking encoder (for media recorder) |
Gloria Wang | 9ee159b | 2011-02-24 14:51:45 -0800 | [diff] [blame] | 81 | kBatteryDataTrackDecoder = 0x8, |
| 82 | // start to play an audio on an audio device |
| 83 | kBatteryDataAudioFlingerStart = 0x10, |
| 84 | // stop/pause the audio playback |
| 85 | kBatteryDataAudioFlingerStop = 0x20, |
| 86 | // audio is rounted to speaker |
| 87 | kBatteryDataSpeakerOn = 0x40, |
| 88 | // audio is rounted to devices other than speaker |
| 89 | kBatteryDataOtherAudioDeviceOn = 0x80, |
Gloria Wang | 7cf180c | 2011-02-19 18:37:57 -0800 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | virtual void addBatteryData(uint32_t params) = 0; |
| 93 | virtual status_t pullBatteryData(Parcel* reply) = 0; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | }; |
| 95 | |
| 96 | // ---------------------------------------------------------------------------- |
| 97 | |
| 98 | class BnMediaPlayerService: public BnInterface<IMediaPlayerService> |
| 99 | { |
| 100 | public: |
| 101 | virtual status_t onTransact( uint32_t code, |
| 102 | const Parcel& data, |
| 103 | Parcel* reply, |
| 104 | uint32_t flags = 0); |
| 105 | }; |
| 106 | |
| 107 | }; // namespace android |
| 108 | |
| 109 | #endif // ANDROID_IMEDIAPLAYERSERVICE_H |