Home | History | Annotate | Download | only in jni
      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_SYNC_PARAMS_H_
     18 #define _ANDROID_MEDIA_SYNC_PARAMS_H_
     19 
     20 #include "jni.h"
     21 
     22 #include <media/stagefright/MediaSync.h>
     23 
     24 namespace android {
     25 
     26 struct SyncParams {
     27     AVSyncSettings sync;
     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 
     56     // fills this from an android.media.SyncParams object
     57     void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject params);
     58 
     59     // returns this as a android.media.SyncParams object
     60     jobject asJobject(JNIEnv *env, const fields_t& fields);
     61 };
     62 
     63 }  // namespace android
     64 
     65 #endif  // _ANDROID_MEDIA_SYNC_PARAMS_H_
     66