blob: fa5e5e0301f93b7f6d9df81d22216badcb4196cc [file] [log] [blame]
Wei Jia071a8b72015-03-09 16:38:25 -07001/*
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 Molnar05ebffe2015-04-29 20:41:19 -070021#include <media/stagefright/MediaSync.h>
Wei Jia071a8b72015-03-09 16:38:25 -070022#include <utils/Errors.h>
23#include <utils/RefBase.h>
24
25namespace android {
26
Lajos Molnar05ebffe2015-04-29 20:41:19 -070027struct AudioPlaybackRate;
Wei Jia071a8b72015-03-09 16:38:25 -070028class AudioTrack;
29struct IGraphicBufferProducer;
Wei Jia217ec0a2015-04-09 18:48:18 -070030struct MediaClock;
Wei Jia071a8b72015-03-09 16:38:25 -070031class MediaSync;
32
33struct JMediaSync : public RefBase {
34 JMediaSync();
35
Wei Jiad80d6f62015-05-04 15:59:20 -070036 status_t setSurface(const sp<IGraphicBufferProducer> &bufferProducer);
37 status_t setAudioTrack(const sp<AudioTrack> &audioTrack);
Wei Jia071a8b72015-03-09 16:38:25 -070038
39 status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
40
41 status_t updateQueuedAudioData(int sizeInBytes, int64_t presentationTimeUs);
42
Wei Jia25b802d2015-04-23 14:10:30 -070043 status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs);
44
Lajos Molnar05ebffe2015-04-29 20:41:19 -070045 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 Jia217ec0a2015-04-09 18:48:18 -070052 sp<const MediaClock> getMediaClock();
53
Wei Jia071a8b72015-03-09 16:38:25 -070054protected:
55 virtual ~JMediaSync();
56
57private:
58 sp<MediaSync> mSync;
59
60 DISALLOW_EVIL_CONSTRUCTORS(JMediaSync);
61};
62
63} // namespace android
64
65#endif // _ANDROID_MEDIA_MEDIASYNC_H_