blob: eb16a1b13b3891f74a71e4cfa1d48695f09a8c64
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 | /*cmd use for 3d operation*/ |
19 | #define MODE_3D_DISABLE 0x00000000 |
20 | #define MODE_3D_ENABLE 0x00000001 |
21 | #define MODE_3D_AUTO 0x00000002 |
22 | #define MODE_3D_LR 0x00000004 |
23 | #define MODE_3D_TB 0x00000008 |
24 | #define MODE_3D_LA 0x00000010 |
25 | #define MODE_3D_FA 0x00000020 |
26 | #define MODE_3D_LR_SWITCH 0x00000100 |
27 | #define MODE_3D_TO_2D_L 0x00000200 |
28 | #define MODE_3D_TO_2D_R 0x00000400 |
29 | #define MODE_3D_MVC 0x00000800 |
30 | #define MODE_3D_OUT_TB 0x00010000 |
31 | #define MODE_3D_OUT_LR 0x00020000 |
32 | |
33 | /*when the output mode is field alterlative*/ |
34 | //LRLRLRLRL mode |
35 | #define MODE_3D_OUT_FA_L_FIRST 0x00001000 |
36 | #define MODE_3D_OUT_FA_R_FIRST 0x00002000 |
37 | //LBRBLBRB |
38 | #define MODE_3D_OUT_FA_LB_FIRST 0x00004000 |
39 | #define MODE_3D_OUT_FA_RB_FIRST 0x00008000 |
40 | |
41 | |
42 | typedef enum VIDEO_3D_MODE_E { |
43 | VIDEO_3D_MODE_DISABLE, |
44 | VIDEO_3D_MODE_AUTO, |
45 | VIDEO_3D_MODE_LR, |
46 | VIDEO_3D_MODE_TB, |
47 | VIDEO_3D_MODE_LA, |
48 | VIDEO_3D_MODE_FA |
49 | } VIDEO_3D_MODE_T; |
50 | |
51 | //end 3D=================================================================== |
52 | typedef enum video_display_resolution_e { |
53 | VPP_DISPLAY_RESOLUTION_1366X768, |
54 | VPP_DISPLAY_RESOLUTION_1920X1080, |
55 | VPP_DISPLAY_RESOLUTION_3840X2160, |
56 | VPP_DISPLAY_RESOLUTION_MAX, |
57 | } video_display_resolution_t; |
58 | |
59 | |
60 | class CAv { |
61 | public: |
62 | CAv(); |
63 | ~CAv(); |
64 | //video screen_mode |
65 | static const int VIDEO_WIDEOPTION_NORMAL = 0; |
66 | static const int VIDEO_WIDEOPTION_FULL_STRETCH = 1; |
67 | static const int VIDEO_WIDEOPTION_4_3 = 2; |
68 | static const int VIDEO_WIDEOPTION_16_9 = 3; |
69 | static const int VIDEO_WIDEOPTION_NONLINEAR = 4; |
70 | static const int VIDEO_WIDEOPTION_NORMAL_NOSCALEUP = 5; |
71 | static const int VIDEO_WIDEOPTION_CROP_FULL = 6; |
72 | static const int VIDEO_WIDEOPTION_CROP = 7; |
73 | // |
74 | static const int DISABLE_VIDEO_COLOR_BLUE = 1; |
75 | static const int DISABLE_VIDEO_COLOR_BLACK = 2; |
76 | class AVEvent : public CTvEv { |
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 | public: |
94 | IObserver() {}; |
95 | virtual ~IObserver() {}; |
96 | virtual void onEvent(const AVEvent &ev) = 0; |
97 | }; |
98 | //1 VS n |
99 | //int addObserver(IObserver* ob); |
100 | //int removeObserver(IObserver* ob); |
101 | |
102 | //1 VS 1 |
103 | int setObserver(IObserver *ob) |
104 | { |
105 | mpObserver = ob; |
106 | return 0; |
107 | } |
108 | |
109 | int Open(); |
110 | int Close(); |
111 | int SetVideoWindow(int x, int y, int w, int h); |
112 | int GetVideoStatus(AM_AV_VideoStatus_t *status); |
113 | int SwitchTSAudio(int apid, AM_AV_AFormat_t afmt); |
114 | int ResetAudioDecoder(); |
115 | int SetTSSource(AM_AV_TSSource_t ts_source); |
116 | int StartTS(uint16_t vpid, uint16_t apid, AM_AV_VFormat_t vfmt, AM_AV_AFormat_t afmt); |
117 | int StopTS(); |
118 | int AudioGetOutputMode(AM_AOUT_OutputMode_t *mode); |
119 | int AudioSetOutputMode(AM_AOUT_OutputMode_t mode); |
120 | int SetVideoScreenColor (int vdin_blending_mask, int y, int u, int v); |
121 | int DisableVideoWithBlueColor(); |
122 | int DisableVideoWithBlackColor(); |
123 | int EnableVideoAuto(); |
124 | int EnableVideoNow(); |
125 | int EnableVideoWhenVideoPlaying(int minFrameCount = 8, int waitTime = 5000); |
126 | int WaittingVideoPlaying(int minFrameCount = 8, int waitTime = 5000); |
127 | int EnableVideoBlackout(); |
128 | int DisableVideoBlackout(); |
129 | int getVideoDisableValue(); |
130 | int SetVideoLayerDisable ( int value ); |
131 | int ClearVideoBuffer(); |
132 | bool videoIsPlaying(int minFrameCount = 8); |
133 | int setVideoScreenMode ( int value ); |
134 | int getVideoScreenMode(); |
135 | int setVideoAxis ( int h, int v, int width, int height ); |
136 | video_display_resolution_t getVideoDisplayResolution(); |
137 | //LR_switch: 1 is enable, 3D_TO_2D:1 is L , 2 is R |
138 | int set3DMode(VIDEO_3D_MODE_T mode, int LR_switch, int mode_3D_TO_2D); |
139 | // |
140 | int setLookupPtsForDtmb(int enable); |
141 | tvin_sig_fmt_t getVideoResolutionToFmt(); |
142 | private: |
143 | static void av_evt_callback ( long dev_no, int event_type, void *param, void *user_data ); |
144 | int getVideoFrameCount(); |
145 | int mTvPlayDevId; |
146 | IObserver *mpObserver; |
147 | AVEvent mCurAvEvent; |
148 | int mCurVideoLayerMuteState; |
149 | int mCurDisableVideoColor; |
150 | |
151 | int mFdAmVideo; |
152 | }; |
153 | #endif |
154 |