Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 1 | /* |
bo.xiao | 00387eb | 2023-02-24 18:44:29 +0800 | [diff] [blame] | 2 | * Copyright (C) 2021 Amlogic Corporation. |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 3 | * |
bo.xiao | 00387eb | 2023-02-24 18:44:29 +0800 | [diff] [blame] | 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. |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 15 | * |
| 16 | * Description: |
| 17 | * User space AV sync module. |
| 18 | * |
| 19 | * Author: song.zhao@amlogic.com |
| 20 | */ |
| 21 | |
| 22 | #ifndef MSYNC_UTIL_H |
| 23 | #define MSYNC_UTIL_H |
| 24 | |
| 25 | #include <stdbool.h> |
| 26 | #include <stdint.h> |
| 27 | #include "aml_avsync.h" |
Song Zhao | d62bb39 | 2021-04-23 12:25:49 -0700 | [diff] [blame] | 28 | #include "msync.h" |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 29 | |
Song Zhao | 7600528 | 2022-03-08 16:49:41 -0800 | [diff] [blame] | 30 | enum internal_sync_stat { |
| 31 | MSYNC_STAT_INIT, |
| 32 | MSYNC_STAT_STARTING, |
| 33 | MSYNC_STAT_STARTED, |
| 34 | MSYNC_STAT_PAUSED, |
| 35 | MSYNC_STAT_TRANSITION, |
| 36 | MSYNC_STAT_TRANSITION_V_2_A, |
| 37 | MSYNC_STAT_TRANSITION_A_2_V, |
| 38 | }; |
| 39 | |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 40 | int msync_create_session(); |
| 41 | void msync_destory_session(int id); |
| 42 | |
| 43 | int msync_session_set_mode(int fd, enum sync_mode mode); |
| 44 | int msync_session_get_mode(int fd, enum sync_mode *mode); |
bo.xiao | 5821fc7 | 2021-07-11 22:47:00 -0400 | [diff] [blame] | 45 | int msync_session_get_start_policy(int fd, uint32_t *policy, int *timeout); |
| 46 | int msync_session_set_start_policy(int fd, uint32_t policy, int timeout); |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 47 | int msync_session_set_pause(int fd, bool pause); |
| 48 | int msync_session_set_video_start(int fd, pts90K pts); |
| 49 | int msync_session_get_wall(int fd, uint32_t *wall, uint32_t *interval); |
| 50 | int msync_session_set_video_start(int fd, pts90K pts); |
| 51 | int msync_session_set_audio_start(int fd, pts90K pts, pts90K delay, uint32_t *mode); |
| 52 | int msync_session_set_video_dis(int fd, pts90K pts); |
| 53 | int msync_session_set_audio_dis(int fd, pts90K pts); |
| 54 | int msync_session_set_rate(int fd, float speed); |
| 55 | int msync_session_get_rate(int fd, float *speed); |
| 56 | int msync_session_set_name(int fd, const char* name); |
| 57 | int msync_session_update_vpts(int fd, uint32_t system, uint32_t pts, uint32_t delay); |
| 58 | int msync_session_update_apts(int fd, uint32_t system, uint32_t pts, uint32_t delay); |
| 59 | int msync_session_set_audio_stop(int fd); |
| 60 | int msync_session_set_video_stop(int fd); |
Song Zhao | 9fef59c | 2022-08-17 12:43:10 -0700 | [diff] [blame] | 61 | int msync_session_get_stat (int fd, |
| 62 | bool clean_poll, enum sync_mode *mode, |
Song Zhao | 7600528 | 2022-03-08 16:49:41 -0800 | [diff] [blame] | 63 | enum internal_sync_stat *stat, |
Song Zhao | e0bf6ad | 2021-07-09 11:28:42 -0700 | [diff] [blame] | 64 | bool *v_active, bool *a_active, bool *v_timeout, |
| 65 | bool *a_switch, enum src_flag flag); |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 66 | bool msync_clock_started(int fd); |
Song Zhao | d62bb39 | 2021-04-23 12:25:49 -0700 | [diff] [blame] | 67 | int msync_session_set_pcr(int fd, pts90K pts, uint64_t mono_clock); |
| 68 | int msync_session_get_pcr(int fd, pts90K *pts, uint64_t *mono_clock); |
| 69 | int msync_session_get_debug_mode(int fd, struct session_debug *debug); |
yongchun.li | 107a616 | 2021-05-05 02:38:57 -0700 | [diff] [blame] | 70 | int msync_session_set_audio_switch(int fd, bool start); |
Song Zhao | 8039f56 | 2021-05-18 18:11:25 -0700 | [diff] [blame] | 71 | int msync_session_get_clock_dev(int fd, int32_t *ppm); |
| 72 | int msync_session_set_clock_dev(int fd, int32_t ppm); |
Song Zhao | 7e24b18 | 2022-04-01 08:46:40 -0700 | [diff] [blame] | 73 | int msync_session_set_wall_adj_thres(int fd, int32_t thres); |
Song Zhao | f46932e | 2021-05-21 01:51:45 -0700 | [diff] [blame] | 74 | int msync_session_get_disc_thres(int session_id, uint32_t *min, uint32_t *max); |
Song Zhao | 7e24b18 | 2022-04-01 08:46:40 -0700 | [diff] [blame] | 75 | int msync_session_set_disc_thres(int session_id, uint32_t min, uint32_t max); |
Song Zhao | 6183ca9 | 2022-07-29 09:57:03 -0700 | [diff] [blame] | 76 | int msync_session_stop_audio(int fd); |
Song Zhao | f4e3c86 | 2022-09-01 14:00:11 -0700 | [diff] [blame] | 77 | int msync_session_set_start_thres(int fd, uint32_t thres); |
Song Zhao | ea5a041 | 2021-01-18 16:40:08 -0800 | [diff] [blame] | 78 | #endif |