blob: 5068612d02850b61ef2928b3147bc1ba0da2b99f [file] [log] [blame]
Song Zhaoea5a0412021-01-18 16:40:08 -08001/*
2 * Copyright (c) 2020 Amlogic, Inc. All rights reserved.
3 *
4 * This source code is subject to the terms and conditions defined in the
5 * file 'LICENSE' which is part of this source code package.
6 *
7 * Description:
8 * User space AV sync module.
9 *
10 * Author: song.zhao@amlogic.com
11 */
12
13#ifndef MSYNC_UTIL_H
14#define MSYNC_UTIL_H
15
16#include <stdbool.h>
17#include <stdint.h>
18#include "aml_avsync.h"
Song Zhaod62bb392021-04-23 12:25:49 -070019#include "msync.h"
Song Zhaoea5a0412021-01-18 16:40:08 -080020
Song Zhao76005282022-03-08 16:49:41 -080021enum internal_sync_stat {
22 MSYNC_STAT_INIT,
23 MSYNC_STAT_STARTING,
24 MSYNC_STAT_STARTED,
25 MSYNC_STAT_PAUSED,
26 MSYNC_STAT_TRANSITION,
27 MSYNC_STAT_TRANSITION_V_2_A,
28 MSYNC_STAT_TRANSITION_A_2_V,
29};
30
Song Zhaoea5a0412021-01-18 16:40:08 -080031int msync_create_session();
32void msync_destory_session(int id);
33
34int msync_session_set_mode(int fd, enum sync_mode mode);
35int msync_session_get_mode(int fd, enum sync_mode *mode);
bo.xiao5821fc72021-07-11 22:47:00 -040036int msync_session_get_start_policy(int fd, uint32_t *policy, int *timeout);
37int msync_session_set_start_policy(int fd, uint32_t policy, int timeout);
Song Zhaoea5a0412021-01-18 16:40:08 -080038int msync_session_set_pause(int fd, bool pause);
39int msync_session_set_video_start(int fd, pts90K pts);
40int msync_session_get_wall(int fd, uint32_t *wall, uint32_t *interval);
41int msync_session_set_video_start(int fd, pts90K pts);
42int msync_session_set_audio_start(int fd, pts90K pts, pts90K delay, uint32_t *mode);
43int msync_session_set_video_dis(int fd, pts90K pts);
44int msync_session_set_audio_dis(int fd, pts90K pts);
45int msync_session_set_rate(int fd, float speed);
46int msync_session_get_rate(int fd, float *speed);
47int msync_session_set_name(int fd, const char* name);
48int msync_session_update_vpts(int fd, uint32_t system, uint32_t pts, uint32_t delay);
49int msync_session_update_apts(int fd, uint32_t system, uint32_t pts, uint32_t delay);
50int msync_session_set_audio_stop(int fd);
51int msync_session_set_video_stop(int fd);
Song Zhao9fef59c2022-08-17 12:43:10 -070052int msync_session_get_stat (int fd,
53 bool clean_poll, enum sync_mode *mode,
Song Zhao76005282022-03-08 16:49:41 -080054 enum internal_sync_stat *stat,
Song Zhaoe0bf6ad2021-07-09 11:28:42 -070055 bool *v_active, bool *a_active, bool *v_timeout,
56 bool *a_switch, enum src_flag flag);
Song Zhaoea5a0412021-01-18 16:40:08 -080057bool msync_clock_started(int fd);
Song Zhaod62bb392021-04-23 12:25:49 -070058int msync_session_set_pcr(int fd, pts90K pts, uint64_t mono_clock);
59int msync_session_get_pcr(int fd, pts90K *pts, uint64_t *mono_clock);
60int msync_session_get_debug_mode(int fd, struct session_debug *debug);
yongchun.li107a6162021-05-05 02:38:57 -070061int msync_session_set_audio_switch(int fd, bool start);
Song Zhao8039f562021-05-18 18:11:25 -070062int msync_session_get_clock_dev(int fd, int32_t *ppm);
63int msync_session_set_clock_dev(int fd, int32_t ppm);
Song Zhao7e24b182022-04-01 08:46:40 -070064int msync_session_set_wall_adj_thres(int fd, int32_t thres);
Song Zhaof46932e2021-05-21 01:51:45 -070065int msync_session_get_disc_thres(int session_id, uint32_t *min, uint32_t *max);
Song Zhao7e24b182022-04-01 08:46:40 -070066int msync_session_set_disc_thres(int session_id, uint32_t min, uint32_t max);
Song Zhao6183ca92022-07-29 09:57:03 -070067int msync_session_stop_audio(int fd);
Song Zhaof4e3c862022-09-01 14:00:11 -070068int msync_session_set_start_thres(int fd, uint32_t thres);
Song Zhaoea5a0412021-01-18 16:40:08 -080069#endif