Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015, 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_MEDIA_MEDIASYNC_H_ |
| 18 | #define _ANDROID_MEDIA_MEDIASYNC_H_ |
| 19 | |
| 20 | #include <media/stagefright/foundation/ABase.h> |
Lajos Molnar | 05ebffe | 2015-04-29 20:41:19 -0700 | [diff] [blame] | 21 | #include <media/stagefright/MediaSync.h> |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 22 | #include <utils/Errors.h> |
| 23 | #include <utils/RefBase.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
Lajos Molnar | 05ebffe | 2015-04-29 20:41:19 -0700 | [diff] [blame] | 27 | struct AudioPlaybackRate; |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 28 | class AudioTrack; |
| 29 | struct IGraphicBufferProducer; |
Wei Jia | 217ec0a | 2015-04-09 18:48:18 -0700 | [diff] [blame] | 30 | struct MediaClock; |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 31 | class MediaSync; |
| 32 | |
| 33 | struct JMediaSync : public RefBase { |
| 34 | JMediaSync(); |
| 35 | |
Wei Jia | d80d6f6 | 2015-05-04 15:59:20 -0700 | [diff] [blame^] | 36 | status_t setSurface(const sp<IGraphicBufferProducer> &bufferProducer); |
| 37 | status_t setAudioTrack(const sp<AudioTrack> &audioTrack); |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 38 | |
| 39 | status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer); |
| 40 | |
| 41 | status_t updateQueuedAudioData(int sizeInBytes, int64_t presentationTimeUs); |
| 42 | |
Wei Jia | 25b802d | 2015-04-23 14:10:30 -0700 | [diff] [blame] | 43 | status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs); |
| 44 | |
Lajos Molnar | 05ebffe | 2015-04-29 20:41:19 -0700 | [diff] [blame] | 45 | status_t setPlaybackSettings(const AudioPlaybackRate& rate); |
| 46 | void getPlaybackSettings(AudioPlaybackRate* rate /* nonnull */); |
| 47 | status_t setSyncSettings(const AVSyncSettings& syncSettings); |
| 48 | void getSyncSettings(AVSyncSettings* syncSettings /* nonnull */); |
| 49 | status_t setVideoFrameRateHint(float rate); |
| 50 | float getVideoFrameRate(); |
| 51 | |
Wei Jia | 217ec0a | 2015-04-09 18:48:18 -0700 | [diff] [blame] | 52 | sp<const MediaClock> getMediaClock(); |
| 53 | |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 54 | protected: |
| 55 | virtual ~JMediaSync(); |
| 56 | |
| 57 | private: |
| 58 | sp<MediaSync> mSync; |
| 59 | |
| 60 | DISALLOW_EVIL_CONSTRUCTORS(JMediaSync); |
| 61 | }; |
| 62 | |
| 63 | } // namespace android |
| 64 | |
| 65 | #endif // _ANDROID_MEDIA_MEDIASYNC_H_ |