blob: 510e64e1f67571ed5608bb695a3eedfac2bc02ea
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 | static const char *PATH_FRAME_COUNT = "/sys/module/di/parameters/frame_count"; |
8 | //3D===================================================================== |
9 | static const char *PATH_SET_3D_TYPE = "/sys/class/video/threedim_mode"; |
10 | static const char *PATH_VIDEO_AMVIDEO = "/dev/amvideo"; |
11 | //3和1是做不同的3dsclaer 0是不做任何scaler |
12 | static const char *PATH_3D_SCALER = "/sys/module/amvideo/parameters/force_3d_scaler"; |
13 | //0是不做3dscaler 1是做3dscaler |
14 | static const char *PATH_VIDEO_SCALER = "/sys/class/video/stereo_scaler"; |
15 | |
16 | /*cmd use for 3d operation*/ |
17 | #define MODE_3D_DISABLE 0x00000000 |
18 | #define MODE_3D_ENABLE 0x00000001 |
19 | #define MODE_3D_AUTO 0x00000002 |
20 | #define MODE_3D_LR 0x00000004 |
21 | #define MODE_3D_TB 0x00000008 |
22 | #define MODE_3D_LA 0x00000010 |
23 | #define MODE_3D_FA 0x00000020 |
24 | #define MODE_3D_LR_SWITCH 0x00000100 |
25 | #define MODE_3D_TO_2D_L 0x00000200 |
26 | #define MODE_3D_TO_2D_R 0x00000400 |
27 | #define MODE_3D_MVC 0x00000800 |
28 | #define MODE_3D_OUT_TB 0x00010000 |
29 | #define MODE_3D_OUT_LR 0x00020000 |
30 | |
31 | /*when the output mode is field alterlative*/ |
32 | //LRLRLRLRL mode |
33 | #define MODE_3D_OUT_FA_L_FIRST 0x00001000 |
34 | #define MODE_3D_OUT_FA_R_FIRST 0x00002000 |
35 | //LBRBLBRB |
36 | #define MODE_3D_OUT_FA_LB_FIRST 0x00004000 |
37 | #define MODE_3D_OUT_FA_RB_FIRST 0x00008000 |
38 | |
39 | |
40 | typedef enum VIDEO_3D_MODE_E { |
41 | VIDEO_3D_MODE_DISABLE, |
42 | VIDEO_3D_MODE_AUTO, |
43 | VIDEO_3D_MODE_LR, |
44 | VIDEO_3D_MODE_TB, |
45 | VIDEO_3D_MODE_LA, |
46 | VIDEO_3D_MODE_FA |
47 | } VIDEO_3D_MODE_T; |
48 | |
49 | //end 3D=================================================================== |
50 | typedef enum video_display_resolution_e { |
51 | VPP_DISPLAY_RESOLUTION_1366X768, |
52 | VPP_DISPLAY_RESOLUTION_1920X1080, |
53 | VPP_DISPLAY_RESOLUTION_3840X2160, |
54 | VPP_DISPLAY_RESOLUTION_MAX, |
55 | } video_display_resolution_t; |
56 | |
57 | |
58 | class CAv |
59 | { |
60 | public: |
61 | CAv(); |
62 | ~CAv(); |
63 | //video screen_mode |
64 | static const int VIDEO_WIDEOPTION_NORMAL = 0; |
65 | static const int VIDEO_WIDEOPTION_FULL_STRETCH = 1; |
66 | static const int VIDEO_WIDEOPTION_4_3 = 2; |
67 | static const int VIDEO_WIDEOPTION_16_9 = 3; |
68 | static const int VIDEO_WIDEOPTION_NONLINEAR = 4; |
69 | static const int VIDEO_WIDEOPTION_NORMAL_NOSCALEUP = 5; |
70 | static const int VIDEO_WIDEOPTION_CROP_FULL = 6; |
71 | static const int VIDEO_WIDEOPTION_CROP = 7; |
72 | // |
73 | static const int DISABLE_VIDEO_COLOR_BLUE = 1; |
74 | static const int DISABLE_VIDEO_COLOR_BLACK = 2; |
75 | class AVEvent : public CTvEv |
76 | { |
77 | public: |
78 | AVEvent(): CTvEv(CTvEv::TV_EVENT_AV) |
79 | { |
80 | |
81 | }; |
82 | ~AVEvent() |
83 | {}; |
84 | static const int EVENT_AV_STOP = 1; |
85 | static const int EVENT_AV_RESUEM = 2; |
86 | static const int EVENT_AV_SCAMBLED = 3; |
87 | static const int EVENT_AV_UNSUPPORT = 4; |
88 | int type; |
89 | int param; |
90 | }; |
91 | |
92 | class IObserver |
93 | { |
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 EnableVideoBlackout(); |
127 | int DisableVideoBlackout(); |
128 | int getVideoDisableValue(); |
129 | int SetVideoLayerDisable ( int value ); |
130 | int ClearVideoBuffer(); |
131 | int setVideoScreenMode ( int value ); |
132 | int getVideoScreenMode(); |
133 | int setVideoAxis ( int h, int v, int width, int height ); |
134 | video_display_resolution_t getVideoDisplayResolution(); |
135 | //LR_switch: 1 is enable, 3D_TO_2D:1 is L , 2 is R |
136 | int set3DMode(VIDEO_3D_MODE_T mode, int LR_switch, int mode_3D_TO_2D); |
137 | // |
138 | private: |
139 | static void av_evt_callback ( int dev_no, int event_type, void *param, void *user_data ); |
140 | int mTvPlayDevId; |
141 | IObserver *mpObserver; |
142 | AVEvent mCurAvEvent; |
143 | int mCurVideoLayerMuteState; |
144 | int mCurDisableVideoColor; |
145 | |
146 | int mFdAmVideo; |
147 | }; |
148 | #endif |
149 |