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> |
| 21 | #include <utils/Errors.h> |
| 22 | #include <utils/RefBase.h> |
| 23 | |
| 24 | namespace android { |
| 25 | |
| 26 | class AudioTrack; |
| 27 | struct IGraphicBufferProducer; |
Wei Jia | 217ec0a | 2015-04-09 18:48:18 -0700 | [diff] [blame] | 28 | struct MediaClock; |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 29 | class MediaSync; |
| 30 | |
| 31 | struct JMediaSync : public RefBase { |
| 32 | JMediaSync(); |
| 33 | |
| 34 | status_t configureSurface(const sp<IGraphicBufferProducer> &bufferProducer); |
| 35 | status_t configureAudioTrack( |
| 36 | const sp<AudioTrack> &audioTrack, int32_t nativeSampleRateInHz); |
| 37 | |
| 38 | status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer); |
| 39 | |
| 40 | status_t updateQueuedAudioData(int sizeInBytes, int64_t presentationTimeUs); |
| 41 | |
Wei Jia | 0feab71 | 2015-04-15 13:24:35 -0700 | [diff] [blame] | 42 | status_t setPlaybackRate(float rate); |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 43 | |
Wei Jia | 25b802d | 2015-04-23 14:10:30 -0700 | [diff] [blame^] | 44 | status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs); |
| 45 | |
Wei Jia | 217ec0a | 2015-04-09 18:48:18 -0700 | [diff] [blame] | 46 | sp<const MediaClock> getMediaClock(); |
| 47 | |
Wei Jia | 071a8b7 | 2015-03-09 16:38:25 -0700 | [diff] [blame] | 48 | protected: |
| 49 | virtual ~JMediaSync(); |
| 50 | |
| 51 | private: |
| 52 | sp<MediaSync> mSync; |
| 53 | |
| 54 | DISALLOW_EVIL_CONSTRUCTORS(JMediaSync); |
| 55 | }; |
| 56 | |
| 57 | } // namespace android |
| 58 | |
| 59 | #endif // _ANDROID_MEDIA_MEDIASYNC_H_ |