blob: 517b69a4dc96afa3d216f36c0c7841651a284680
1 | /** |
2 | * \file adec-pts-mgt.h |
3 | * \brief Function prototypes of Pts manage. |
4 | * \version 1.0.0 |
5 | * \date 2011-03-08 |
6 | */ |
7 | /* Copyright (C) 2007-2011, Amlogic Inc. |
8 | * All right reserved |
9 | * |
10 | */ |
11 | #ifndef ADEC_PTS_H |
12 | #define ADEC_PTS_H |
13 | |
14 | #include <audio-dec.h> |
15 | #define TIME_UNIT90K 90000 |
16 | ADEC_BEGIN_DECLS |
17 | |
18 | typedef enum { |
19 | TSYNC_MODE_VMASTER, |
20 | TSYNC_MODE_AMASTER, |
21 | TSYNC_MODE_PCRMASTER, |
22 | } tsync_mode_t; |
23 | |
24 | #define AMSTREAM_IOC_MAGIC 'S' |
25 | #define AMSTREAM_IOC_GET_LAST_CHECKIN_APTS _IOR(AMSTREAM_IOC_MAGIC, 0xa9, unsigned long) |
26 | #define AMSTREAM_IOC_GET_LAST_CHECKIN_VPTS _IOR(AMSTREAM_IOC_MAGIC, 0xaa, unsigned long) |
27 | #define AMSTREAM_IOC_GET_LAST_CHECKOUT_APTS _IOR(AMSTREAM_IOC_MAGIC, 0xab, unsigned long) |
28 | #define AMSTREAM_IOC_GET_LAST_CHECKOUT_VPTS _IOR(AMSTREAM_IOC_MAGIC, 0xac, unsigned long) |
29 | #define AMSTREAM_IOC_AB_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x09, int) |
30 | |
31 | #define TSYNC_PCR_DISPOINT "/sys/class/tsync_pcr/tsync_pcr_discontinue_point" |
32 | #define TSYNC_PCRSCR "/sys/class/tsync/pts_pcrscr" |
33 | #define TSYNC_EVENT "/sys/class/tsync/event" |
34 | #define TSYNC_APTS "/sys/class/tsync/pts_audio" |
35 | #define TSYNC_VPTS "/sys/class/tsync/pts_video" |
36 | #define TSYNC_ENABLE "/sys/class/tsync/enable" |
37 | #define TSYNC_LAST_CHECKIN_APTS "/sys/class/tsync/last_checkin_apts" |
38 | #define TSYNC_MODE "/sys/class/tsync/mode" |
39 | #define TSYNC_FIRSTVPTS "/sys/class/tsync/firstvpts" |
40 | #define TSYNC_FIRSTAPTS "/sys/class/tsync/firstapts" |
41 | #define TSYNC_CHECKIN_FIRSTVPTS "/sys/class/tsync/checkin_firstvpts" |
42 | #define TSYNC_PCR_DISCONTINUE "/sys/class/tsync_pcr/tsync_pcr_discontinue" |
43 | #define TSYNC_PCR_PLAY_MODE "/sys/class/tsync_pcr/play_mode" |
44 | |
45 | #define SYSTIME_CORRECTION_THRESHOLD (90000*6/100)//modified for amlogic-pd-91949 |
46 | #define APTS_DISCONTINUE_THRESHOLD (90000*3) |
47 | #define REFRESH_PTS_TIME_MS (1000/10) |
48 | #define VIDEO_DISCONTINUE 0x02 |
49 | |
50 | //#define abs(x) ({ \ |
51 | // long __x = (x); \ |
52 | // (__x < 0) ? -__x : __x; \ |
53 | // }) |
54 | |
55 | |
56 | /**********************************************************************/ |
57 | int sysfs_get_int(char *path, unsigned long *val); |
58 | unsigned long adec_calc_pts(aml_audio_dec_t *audec); |
59 | int adec_pts_start(aml_audio_dec_t *audec); |
60 | int adec_pts_pause(void); |
61 | int adec_pts_resume(void); |
62 | int adec_refresh_pts(aml_audio_dec_t *audec); |
63 | int avsync_en(int e); |
64 | int track_switch_pts(aml_audio_dec_t *audec); |
65 | int adec_get_tsync_info(int *tsync_mode); |
66 | |
67 | struct buf_status { |
68 | int size; |
69 | int data_len; |
70 | int free_len; |
71 | unsigned int read_pointer; |
72 | unsigned int write_pointer; |
73 | }; |
74 | |
75 | struct am_io_param { |
76 | int data; |
77 | int len; //buffer size; |
78 | struct buf_status status; |
79 | }; |
80 | ADEC_END_DECLS |
81 | |
82 | #endif |
83 |