blob: 10e3bccad5eda2b1abf9018c6b20d8aff73bec11 [file] [log] [blame]
Lajos Molnar3a474aa2015-04-24 17:10:07 -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_AV_SYNC_SETTINGS_H
18#define ANDROID_AV_SYNC_SETTINGS_H
19
20namespace android {
21
22enum AVSyncSource : unsigned {
23 // let the system decide the best sync source
24 AVSYNC_SOURCE_DEFAULT = 0,
25 // sync to the system clock
26 AVSYNC_SOURCE_SYSTEM_CLOCK = 1,
27 // sync to the audio track
28 AVSYNC_SOURCE_AUDIO = 2,
29 // sync to the display vsync
30 AVSYNC_SOURCE_VSYNC = 3,
31 AVSYNC_SOURCE_MAX,
32};
33
34enum AVSyncAudioAdjustMode : unsigned {
35 // let the system decide the best audio adjust mode
36 AVSYNC_AUDIO_ADJUST_MODE_DEFAULT = 0,
37 // adjust audio by time stretching
38 AVSYNC_AUDIO_ADJUST_MODE_STRETCH = 1,
39 // adjust audio by resampling
40 AVSYNC_AUDIO_ADJUST_MODE_RESAMPLE = 2,
41 AVSYNC_AUDIO_ADJUST_MODE_MAX,
42};
43
44// max tolerance when adjusting playback speed to desired playback speed
45#define AVSYNC_TOLERANCE_MAX 1.0f
46
47struct AVSyncSettings {
48 AVSyncSource mSource;
49 AVSyncAudioAdjustMode mAudioAdjustMode;
50 float mTolerance;
51 AVSyncSettings()
52 : mSource(AVSYNC_SOURCE_DEFAULT),
53 mAudioAdjustMode(AVSYNC_AUDIO_ADJUST_MODE_DEFAULT),
54 mTolerance(.044f) { }
55};
56
57} // namespace android
58
59// ---------------------------------------------------------------------------
60
61#endif // ANDROID_AV_SYNC_SETTINGS_H