Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -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 | |
Wei Jia | 2d61e2b | 2015-05-08 15:23:28 -0700 | [diff] [blame] | 17 | #ifndef _ANDROID_MEDIA_SYNC_PARAMS_H_ |
| 18 | #define _ANDROID_MEDIA_SYNC_PARAMS_H_ |
Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -0700 | [diff] [blame] | 19 | |
| 20 | #include "jni.h" |
| 21 | |
Lajos Molnar | 05ebffe | 2015-04-29 20:41:19 -0700 | [diff] [blame] | 22 | #include <media/stagefright/MediaSync.h> |
| 23 | |
Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -0700 | [diff] [blame] | 24 | namespace android { |
| 25 | |
Wei Jia | 2d61e2b | 2015-05-08 15:23:28 -0700 | [diff] [blame] | 26 | struct SyncParams { |
Lajos Molnar | 05ebffe | 2015-04-29 20:41:19 -0700 | [diff] [blame] | 27 | AVSyncSettings sync; |
Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -0700 | [diff] [blame] | 28 | float frameRate; |
| 29 | |
| 30 | bool syncSourceSet; |
| 31 | bool audioAdjustModeSet; |
| 32 | bool toleranceSet; |
| 33 | bool frameRateSet; |
| 34 | |
| 35 | struct fields_t { |
| 36 | jclass clazz; |
| 37 | jmethodID constructID; |
| 38 | |
| 39 | jfieldID sync_source; |
| 40 | jfieldID audio_adjust_mode; |
| 41 | jfieldID tolerance; |
| 42 | jfieldID frame_rate; |
| 43 | jfieldID set; |
| 44 | jint set_sync_source; |
| 45 | jint set_audio_adjust_mode; |
| 46 | jint set_tolerance; |
| 47 | jint set_frame_rate; |
| 48 | |
| 49 | // initializes fields |
| 50 | void init(JNIEnv *env); |
| 51 | |
| 52 | // releases global references held |
| 53 | void exit(JNIEnv *env); |
| 54 | }; |
| 55 | |
Wei Jia | 2d61e2b | 2015-05-08 15:23:28 -0700 | [diff] [blame] | 56 | // fills this from an android.media.SyncParams object |
| 57 | void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject params); |
Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -0700 | [diff] [blame] | 58 | |
Wei Jia | 2d61e2b | 2015-05-08 15:23:28 -0700 | [diff] [blame] | 59 | // returns this as a android.media.SyncParams object |
Lajos Molnar | c98f58e | 2015-04-22 19:28:53 -0700 | [diff] [blame] | 60 | jobject asJobject(JNIEnv *env, const fields_t& fields); |
| 61 | }; |
| 62 | |
| 63 | } // namespace android |
| 64 | |
Wei Jia | 2d61e2b | 2015-05-08 15:23:28 -0700 | [diff] [blame] | 65 | #endif // _ANDROID_MEDIA_SYNC_PARAMS_H_ |