blob: b95b490864b52a985cd0d4f1fb80a49e3cad5340
1 | #ifndef _C_AV_H |
2 | #define _C_AV_H |
3 | #include "am_av.h" |
4 | #include "am_aout.h" |
5 | #include "CTvEv.h" |
6 | #include "CTvLog.h" |
7 | #include "../tvin/CTvin.h" |
8 | static const char *PATH_FRAME_COUNT = "/sys/module/di/parameters/frame_count"; |
9 | //3D===================================================================== |
10 | static const char *PATH_SET_3D_TYPE = "/sys/class/video/threedim_mode"; |
11 | static const char *PATH_VIDEO_AMVIDEO = "/dev/amvideo"; |
12 | //3和1是做不同的3dsclaer 0是不做任何scaler |
13 | static const char *PATH_3D_SCALER = "/sys/module/amvideo/parameters/force_3d_scaler"; |
14 | //0是不做3dscaler 1是做3dscaler |
15 | static const char *PATH_VIDEO_SCALER = "/sys/class/video/stereo_scaler"; |
16 | |
17 | static const char *PATH_MEPG_DTMB_LOOKUP_PTS_FLAG = "/sys/module/amvdec_mpeg12/parameters/dtmb_flag"; |
18 | static const char *PATH_VIDEO_HEIGHT = "/sys/class/video/frame_height"; |
19 | /*cmd use for 3d operation*/ |
20 | #define MODE_3D_DISABLE 0x00000000 |
21 | #define MODE_3D_ENABLE 0x00000001 |
22 | #define MODE_3D_AUTO 0x00000002 |
23 | #define MODE_3D_LR 0x00000004 |
24 | #define MODE_3D_TB 0x00000008 |
25 | #define MODE_3D_LA 0x00000010 |
26 | #define MODE_3D_FA 0x00000020 |
27 | #define MODE_3D_LR_SWITCH 0x00000100 |
28 | #define MODE_3D_TO_2D_L 0x00000200 |
29 | #define MODE_3D_TO_2D_R 0x00000400 |
30 | #define MODE_3D_MVC 0x00000800 |
31 | #define MODE_3D_OUT_TB 0x00010000 |
32 | #define MODE_3D_OUT_LR 0x00020000 |
33 | |
34 | /*when the output mode is field alterlative*/ |
35 | //LRLRLRLRL mode |
36 | #define MODE_3D_OUT_FA_L_FIRST 0x00001000 |
37 | #define MODE_3D_OUT_FA_R_FIRST 0x00002000 |
38 | //LBRBLBRB |
39 | #define MODE_3D_OUT_FA_LB_FIRST 0x00004000 |
40 | #define MODE_3D_OUT_FA_RB_FIRST 0x00008000 |
41 | |
42 | |
43 | typedef enum VIDEO_3D_MODE_E { |
44 | VIDEO_3D_MODE_DISABLE, |
45 | VIDEO_3D_MODE_AUTO, |
46 | VIDEO_3D_MODE_LR, |
47 | VIDEO_3D_MODE_TB, |
48 | VIDEO_3D_MODE_LA, |
49 | VIDEO_3D_MODE_FA |
50 | } VIDEO_3D_MODE_T; |
51 | |
52 | //end 3D=================================================================== |
53 | typedef enum video_display_resolution_e { |
54 | VPP_DISPLAY_RESOLUTION_1366X768, |
55 | VPP_DISPLAY_RESOLUTION_1920X1080, |
56 | VPP_DISPLAY_RESOLUTION_3840X2160, |
57 | VPP_DISPLAY_RESOLUTION_MAX, |
58 | } video_display_resolution_t; |
59 | |
60 | |
61 | class CAv { |
62 | public: |
63 | CAv(); |
64 | ~CAv(); |
65 | //video screen_mode |
66 | static const int VIDEO_WIDEOPTION_NORMAL = 0; |
67 | static const int VIDEO_WIDEOPTION_FULL_STRETCH = 1; |
68 | static const int VIDEO_WIDEOPTION_4_3 = 2; |
69 | static const int VIDEO_WIDEOPTION_16_9 = 3; |
70 | static const int VIDEO_WIDEOPTION_NONLINEAR = 4; |
71 | static const int VIDEO_WIDEOPTION_NORMAL_NOSCALEUP = 5; |
72 | static const int VIDEO_WIDEOPTION_CROP_FULL = 6; |
73 | static const int VIDEO_WIDEOPTION_CROP = 7; |
74 | // |
75 | static const int DISABLE_VIDEO_COLOR_BLUE = 1; |
76 | static const int DISABLE_VIDEO_COLOR_BLACK = 2; |
77 | class AVEvent : public CTvEv { |
78 | public: |
79 | AVEvent(): CTvEv(CTvEv::TV_EVENT_AV) |
80 | { |
81 | |
82 | }; |
83 | ~AVEvent() |
84 | {}; |
85 | static const int EVENT_AV_STOP = 1; |
86 | static const int EVENT_AV_RESUEM = 2; |
87 | static const int EVENT_AV_SCAMBLED = 3; |
88 | static const int EVENT_AV_UNSUPPORT = 4; |
89 | int type; |
90 | int param; |
91 | }; |
92 | |
93 | class IObserver { |
94 | public: |
95 | IObserver() {}; |
96 | virtual ~IObserver() {}; |
97 | virtual void onEvent(const AVEvent &ev) = 0; |
98 | }; |
99 | //1 VS n |
100 | //int addObserver(IObserver* ob); |
101 | //int removeObserver(IObserver* ob); |
102 | |
103 | //1 VS 1 |
104 | int setObserver(IObserver *ob) |
105 | { |
106 | mpObserver = ob; |
107 | return 0; |
108 | } |
109 | |
110 | int Open(); |
111 | int Close(); |
112 | int SetVideoWindow(int x, int y, int w, int h); |
113 | int GetVideoStatus(AM_AV_VideoStatus_t *status); |
114 | int SwitchTSAudio(int apid, AM_AV_AFormat_t afmt); |
115 | int ResetAudioDecoder(); |
116 | int SetTSSource(AM_AV_TSSource_t ts_source); |
117 | int StartTS(uint16_t vpid, uint16_t apid, AM_AV_VFormat_t vfmt, AM_AV_AFormat_t afmt); |
118 | int StopTS(); |
119 | int AudioGetOutputMode(AM_AOUT_OutputMode_t *mode); |
120 | int AudioSetOutputMode(AM_AOUT_OutputMode_t mode); |
121 | int SetVideoScreenColor (int vdin_blending_mask, int y, int u, int v); |
122 | int DisableVideoWithBlueColor(); |
123 | int DisableVideoWithBlackColor(); |
124 | int EnableVideoAuto(); |
125 | int EnableVideoNow(); |
126 | int EnableVideoWhenVideoPlaying(int minFrameCount = 8, int waitTime = 5000); |
127 | int WaittingVideoPlaying(int minFrameCount = 8, int waitTime = 5000); |
128 | int EnableVideoBlackout(); |
129 | int DisableVideoBlackout(); |
130 | int getVideoDisableValue(); |
131 | int SetVideoLayerDisable ( int value ); |
132 | int ClearVideoBuffer(); |
133 | bool videoIsPlaying(int minFrameCount = 8); |
134 | int setVideoScreenMode ( int value ); |
135 | int getVideoScreenMode(); |
136 | int setVideoAxis ( int h, int v, int width, int height ); |
137 | video_display_resolution_t getVideoDisplayResolution(); |
138 | //LR_switch: 1 is enable, 3D_TO_2D:1 is L , 2 is R |
139 | int set3DMode(VIDEO_3D_MODE_T mode, int LR_switch, int mode_3D_TO_2D); |
140 | // |
141 | int setLookupPtsForDtmb(int enable); |
142 | tvin_sig_fmt_t getVideoResolutionToFmt(); |
143 | private: |
144 | static void av_evt_callback ( long dev_no, int event_type, void *param, void *user_data ); |
145 | int getVideoFrameCount(); |
146 | int mTvPlayDevId; |
147 | IObserver *mpObserver; |
148 | AVEvent mCurAvEvent; |
149 | int mCurVideoLayerMuteState; |
150 | int mCurDisableVideoColor; |
151 | |
152 | int mFdAmVideo; |
153 | }; |
154 | #endif |
155 |