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 <media/stagefright/MediaSync.h> 22 #include <utils/Errors.h> 23 #include <utils/RefBase.h> 24 25 namespace android { 26 27 struct AudioPlaybackRate; 28 class AudioTrack; 29 class IGraphicBufferProducer; 30 struct MediaClock; 31 class MediaSync; 32 33 struct JMediaSync : public RefBase { 34 JMediaSync(); 35 36 status_t setSurface(const sp<IGraphicBufferProducer> &bufferProducer); 37 status_t setAudioTrack(const sp<AudioTrack> &audioTrack); 38 39 status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer); 40 41 status_t updateQueuedAudioData(int sizeInBytes, int64_t presentationTimeUs); 42 43 status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs); 44 45 status_t setPlaybackParams(const AudioPlaybackRate& rate); 46 void getPlaybackParams(AudioPlaybackRate* rate /* nonnull */); 47 status_t setSyncParams(const AVSyncSettings& syncParams); 48 void getSyncParams(AVSyncSettings* syncParams /* nonnull */); 49 status_t setVideoFrameRateHint(float rate); 50 float getVideoFrameRate(); 51 52 void flush(); 53 54 sp<const MediaClock> getMediaClock(); 55 56 protected: 57 virtual ~JMediaSync(); 58 59 private: 60 sp<MediaSync> mSync; 61 62 DISALLOW_EVIL_CONSTRUCTORS(JMediaSync); 63 }; 64 65 } // namespace android 66 67 #endif // _ANDROID_MEDIA_MEDIASYNC_H_ 68