blob: 6f808858a0c296928d3a8f4a3b1ee7e5af105935 [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;
Chih-Hung Hsieh9eb9dd32015-05-06 14:42:04 -070029class 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
Wei Jia2d61e2b2015-05-08 15:23:28 -070045 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 */);
Lajos Molnar05ebffe2015-04-29 20:41:19 -070049 status_t setVideoFrameRateHint(float rate);
50 float getVideoFrameRate();
51
Lajos Molnard08debcf2015-07-01 16:35:49 -070052 void flush();
53
Wei Jia217ec0a2015-04-09 18:48:18 -070054 sp<const MediaClock> getMediaClock();
55
Wei Jia071a8b72015-03-09 16:38:25 -070056protected:
57 virtual ~JMediaSync();
58
59private:
60 sp<MediaSync> mSync;
61
62 DISALLOW_EVIL_CONSTRUCTORS(JMediaSync);
63};
64
65} // namespace android
66
67#endif // _ANDROID_MEDIA_MEDIASYNC_H_