| 1 | /******************************************************************** |
|---|
| 2 | DHL_AVCAP.c |
|---|
| 3 | |
|---|
| 4 | PHOENIX Driver HAL library |
|---|
| 5 | AudioVideo decoding/capture/output implementation |
|---|
| 6 | |
|---|
| 7 | Copyright 2010 Digital STREAM Technology, Inc. |
|---|
| 8 | All Rights Reserved |
|---|
| 9 | |
|---|
| 10 | $Id: DHL_AVCAP.c v1.00 2006/04 cafrii Exp $ |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | ********************************************************************/ |
|---|
| 14 | |
|---|
| 15 | #include "DHL_OSAL.h" |
|---|
| 16 | #include "DHL_DBG.h" |
|---|
| 17 | #include "DHL_SYS.h" |
|---|
| 18 | #include "DHL_AVCAP.h" |
|---|
| 19 | #include "DHL_AVCAP_Impl.h" |
|---|
| 20 | #include "bsettop.h" |
|---|
| 21 | #include "bsettop_user_io.h" |
|---|
| 22 | #include "bsettop_rfm.h" |
|---|
| 23 | #include "bsettop_tuner.h" |
|---|
| 24 | |
|---|
| 25 | ////#include <string.h> |
|---|
| 26 | |
|---|
| 27 | /* |
|---|
| 28 | ¸ðµç Çì´õ ÆÄÀÏÀ» Æ÷ÇÔÇÏÁö´Â ¾ÊÀ¸¸ç, compile timeÀ» ÁÙÀ̱â À§ÇØ |
|---|
| 29 | °¢ ¸ðµâÀº ÇÊ¿äÇÑ ¸¸ÅÀÇ Çì´õ¸¦ ¼±¾ðÇϵµ·Ï ÇÔ. |
|---|
| 30 | */ |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | /* |
|---|
| 35 | DHL µð¹ö±× ¸ðµâ À̸§ Á¤ÀÇ ·ê Âü°í: |
|---|
| 36 | |
|---|
| 37 | DHL ¸ðµâµéÀº ¸ðµÎ * ·Î ½ÃÀÛ. |
|---|
| 38 | API´Â ´ë¹®ÀÚ, Platform ¹× ±âŸ´Â ¼Ò¹®ÀÚ »ç¿ë. |
|---|
| 39 | |
|---|
| 40 | µðÆúÆ® ·¹º§Àº 0À¸·Î ¼³Á¤ÇÑ´Ù. (0: ¿¡·¯ ¸Þ½ÃÁö¸¸ Ãâ·Â) |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | */ |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | //DHL_MODULE("*AV", 0); |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | #if COMMENT |
|---|
| 51 | ____Config____(){} |
|---|
| 52 | #endif |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | #define AV_EVT_TASK_STACK_SIZE 0x1000 |
|---|
| 56 | #define AV_EVT_TASK_PRIORITY TASK_PRI_DHL_AV_EVT |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | #define MAX_NUM_608_STORED_DATA 256 |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | #define TICK_1SEC DHL_OS_GetTicksPerSecond() |
|---|
| 66 | #define TICK_CUR DHL_OS_GetTickCount() |
|---|
| 67 | #define TICK_PASS(stTick) (TICK_CUR-stTick) |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | //----------------------------------------------------------- |
|---|
| 72 | |
|---|
| 73 | // |
|---|
| 74 | // from MPEG-2 System: Transport Stream Packet layer |
|---|
| 75 | // |
|---|
| 76 | // PES·Î »ç¿ë °¡´ÉÇÑ PID´Â 0x10 ~ 0x1FFE |
|---|
| 77 | // PCR·Î »ç¿ë °¡´ÉÇÑ PID´Â 0x0, 0x1, 0x10 ~ 0x1FFE |
|---|
| 78 | // |
|---|
| 79 | // from ATSC A/53, Annex C |
|---|
| 80 | // PES PID is base_PID + 1 ~ base_PID + 0xA (?) |
|---|
| 81 | // PCR PID is base_PID + 1 |
|---|
| 82 | // |
|---|
| 83 | // |
|---|
| 84 | // Cable »ç¾÷ÀÚÀÇ °æ¿ì¸¦ °í·ÁÇØ¾ß Çϱ⠶§¹®¿¡ |
|---|
| 85 | // ÃÖ´ëÇÑ MPEG-2 ¼öÁØÀÇ resriction¸¸ °¡Áö°í °¡ÀÚ. |
|---|
| 86 | // |
|---|
| 87 | // |
|---|
| 88 | #define IS_VALID_PES_PID(p) ((p)>=0x10 && (p)<=0x1ffe) |
|---|
| 89 | |
|---|
| 90 | #define IS_VALID_PCR_PID(p) ((p)>=0x10 && (p)<=0x1ffe) |
|---|
| 91 | |
|---|
| 92 | // todo.. |
|---|
| 93 | // pcr pid 0¸¦ reserved·Î »ç¿ëÇÏ´Â Äڵ尡 ¸¹¾Æ¼ |
|---|
| 94 | // ´çºÐ°£ ¾Æ·¡ Àû¿ëÀº Èûµé´Ù.. |
|---|
| 95 | //#define IS_VALID_PCR_PID(pid) ((pid)==0 || (pid)==1 || ((pid)>=0x10 && (pid)<=1ffe)) |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | // ´ÜÀ§´Â milisec |
|---|
| 99 | int g_Timeout_ContextCreation = 6000; |
|---|
| 100 | |
|---|
| 101 | int g_Timeout_AudioStart = 2000; |
|---|
| 102 | // cafrii 060711 add |
|---|
| 103 | // audioµµ ½ÃÀÛÇÏ°í ³ª¼ µðÄÚµùÀÌ ÀÌ·ç¾îÁö´Â °ÍÀ» È®ÀÎÇÒ °æ¿ì |
|---|
| 104 | // ÃÖ´ë ´ë±â ½Ã°£.. |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | #if COMMENT |
|---|
| 110 | ____Types____(){} |
|---|
| 111 | #endif |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | #if COMMENT |
|---|
| 117 | ____Global____(){} |
|---|
| 118 | #endif |
|---|
| 119 | /* |
|---|
| 120 | Audio/Video ¸ðµç Áß¿ä Á¤º¸¸¦ ÀúÀåÇÏ´Â °ø°£. |
|---|
| 121 | |
|---|
| 122 | ÀÌ º¯¼öÀÇ ÁÖ¿ä °ü¸®ÀÚ´Â DHL_AVCAPÀ̸ç |
|---|
| 123 | Çʿ信 µû¶ó °¢ impl ¿¡¼µµ »ç¿ëÇϱ⵵ ÇÑ´Ù. |
|---|
| 124 | |
|---|
| 125 | */ |
|---|
| 126 | DHL_AV_CONFIG g_dhlav; |
|---|
| 127 | |
|---|
| 128 | static BOOL is_inited=FALSE; |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | static tDHL_VideoCodingType g_vid_type = eDHL_VIDEO_TYPE_UNKNOWN; |
|---|
| 132 | static tDHL_AudioCodingType g_aud_type = eDHL_AUDIO_TYPE_UNKNOWN; |
|---|
| 133 | static UINT16 g_pcr_pid = 0x0000, g_vid_pid = 0x0000, g_aud_pid = 0x0000; |
|---|
| 134 | static BOOL g_pcr_start = FALSE, g_vid_start = FALSE, g_aud_start = FALSE; |
|---|
| 135 | |
|---|
| 136 | static BOOL g_vid_alive = FALSE, g_aud_alive = FALSE; |
|---|
| 137 | static UINT32 g_vid_alive_chk_time = 0, g_aud_alive_chk_time = 0; |
|---|
| 138 | static UINT32 g_vid_frm_cnt = 0, g_aud_frm_cnt = 0; |
|---|
| 139 | |
|---|
| 140 | static UINT32 g_audVolumeMin = 0, g_audVolumeMax = 100, g_audVolume = 100; |
|---|
| 141 | static UINT32 g_audMixType = eDHL_AUDIO_MIX_TYPE_LTRT; |
|---|
| 142 | |
|---|
| 143 | static tDHL_AVCALLBACK g_vid_seq_hdr_cb = NULL, g_vid_usr_data_cb = NULL, |
|---|
| 144 | g_vid_first_show_cb = NULL; |
|---|
| 145 | |
|---|
| 146 | tDHL_VideoSeqHdr g_vid_seq_hdr; |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | int crop_w = 1000, crop_h = 1000, crop_x = 0, crop_y = 0; |
|---|
| 150 | int disp_w = 1000, disp_h = 1000, disp_x = 0, disp_y = 0; |
|---|
| 151 | |
|---|
| 152 | //static UINT16 f1_data[MAX_NUM_608_STORED_DATA], |
|---|
| 153 | // f2_data[MAX_NUM_608_STORED_DATA]; |
|---|
| 154 | //static UINT32 wrCntF1 = 0, rdCntF1 = 0, wrCntF2 = 0, rdCntF2 = 0; |
|---|
| 155 | |
|---|
| 156 | #if COMMENT |
|---|
| 157 | _______API_______(){} |
|---|
| 158 | #endif |
|---|
| 159 | |
|---|
| 160 | DHL_RESULT DHL_SetRFM34(UINT8 chnum) |
|---|
| 161 | { |
|---|
| 162 | extern brfm_t g_sys_rfm; |
|---|
| 163 | if(chnum) |
|---|
| 164 | brfm_set_ch3(g_sys_rfm, 1);//RFMCH4 |
|---|
| 165 | else |
|---|
| 166 | brfm_set_ch3(g_sys_rfm, 0);//RFMCH3 |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | DHL_RESULT DHL_SetLTO(BOOL onoff) |
|---|
| 170 | { |
|---|
| 171 | if(onoff) |
|---|
| 172 | NXP_TDA182I4_SetPowerState(1); |
|---|
| 173 | else |
|---|
| 174 | NXP_TDA182I4_SetPowerState(0); |
|---|
| 175 | } |
|---|
| 176 | void DHL_AV_TakeMutex(void) |
|---|
| 177 | { |
|---|
| 178 | //TODO: DHL_OS_TakeSemaphore(g_dhlav.Mutex); |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | void DHL_AV_GiveMutex(void) |
|---|
| 182 | { |
|---|
| 183 | //TODO: DHL_OS_GiveSemaphore(g_dhlav.Mutex); |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | #if COMMENT |
|---|
| 188 | ____Video____(){} |
|---|
| 189 | #endif |
|---|
| 190 | |
|---|
| 191 | #if 0 |
|---|
| 192 | |
|---|
| 193 | void dhl_av_video_feeding_608_cb(InterruptNum eIntNum) |
|---|
| 194 | { |
|---|
| 195 | |
|---|
| 196 | char c1, c2; |
|---|
| 197 | |
|---|
| 198 | if (eIntNum != E_INT_FIQ_FIELD_VE4VBI) |
|---|
| 199 | { |
|---|
| 200 | DHL_OS_Printf("|%s| wrong interrupt(0x%x).\n", __FUNCTION__, eIntNum); |
|---|
| 201 | |
|---|
| 202 | return; |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | if (rdCntF1 != wrCntF1) |
|---|
| 206 | { |
|---|
| 207 | MDrv_VE_SendCcData(1, f1_data[rdCntF1]); |
|---|
| 208 | /*c1 = isprint((f1_data[rdCntF1] >> 8) & 0x7f) ? (f1_data[rdCntF1] >> 8) & 0x7f : '.'; |
|---|
| 209 | c2 = isprint(f1_data[rdCntF1] & 0x7f) ? f1_data[rdCntF1] & 0x7f : '.'; |
|---|
| 210 | DHL_OS_Printf("f1_rd(%4d):%4X(%c,%c)\n", DHL_OS_GetMsCount(), f1_data[rdCntF1], c1, c2);*/ |
|---|
| 211 | |
|---|
| 212 | rdCntF1++; |
|---|
| 213 | if (MAX_NUM_608_STORED_DATA <= rdCntF1) |
|---|
| 214 | { |
|---|
| 215 | rdCntF1 = 0; |
|---|
| 216 | } |
|---|
| 217 | } |
|---|
| 218 | else |
|---|
| 219 | { |
|---|
| 220 | MDrv_VE_SendCcData(1, 0x8080); |
|---|
| 221 | } |
|---|
| 222 | if (rdCntF2 != wrCntF2) |
|---|
| 223 | { |
|---|
| 224 | MDrv_VE_SendCcData(0, f2_data[rdCntF2]); |
|---|
| 225 | /*c1 = isprint((f2_data[rdCntF2] >> 8) & 0x7f) ? (f2_data[rdCntF2] >> 8) & 0x7f : '.'; |
|---|
| 226 | c2 = isprint(f2_data[rdCntF2] & 0x7f) ? f2_data[rdCntF2] & 0x7f : '.'; |
|---|
| 227 | DHL_OS_Printf("f2_rd(%4d):%4X(%c,%c)\n", DHL_OS_GetMsCount(), f2_data[rdCntF2], c1, c2);*/ |
|---|
| 228 | |
|---|
| 229 | rdCntF2++; |
|---|
| 230 | if (MAX_NUM_608_STORED_DATA <= rdCntF2) |
|---|
| 231 | { |
|---|
| 232 | rdCntF2 = 0; |
|---|
| 233 | } |
|---|
| 234 | } |
|---|
| 235 | else |
|---|
| 236 | { |
|---|
| 237 | MDrv_VE_SendCcData(0, 0x8080); |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | MsOS_EnableInterrupt(E_INT_FIQ_FIELD_VE4VBI); |
|---|
| 241 | } |
|---|
| 242 | #endif |
|---|
| 243 | |
|---|
| 244 | //void dhl_av_video_event_cb(MS_U32 eFlag, void *param) |
|---|
| 245 | //{ |
|---|
| 246 | // |
|---|
| 247 | //} |
|---|
| 248 | |
|---|
| 249 | #if 0 |
|---|
| 250 | void dhl_av_video_event_process(MS_U32 eFlag, void *param) |
|---|
| 251 | { |
|---|
| 252 | if ((eFlag & E_VDEC_EX_EVENT_USER_DATA_FOUND) == |
|---|
| 253 | E_VDEC_EX_EVENT_USER_DATA_FOUND) |
|---|
| 254 | { |
|---|
| 255 | while (MApi_VDEC_IsCCAvailable()) |
|---|
| 256 | { |
|---|
| 257 | VDEC_CC_Info stVdecCCInfo; |
|---|
| 258 | |
|---|
| 259 | memset(&stVdecCCInfo, 0, sizeof(VDEC_EX_CC_Info)); |
|---|
| 260 | if (MApi_VDEC_GetCCInfo(&stVdecCCInfo, sizeof(stVdecCCInfo))) |
|---|
| 261 | { |
|---|
| 262 | if (g_vid_usr_data_cb) |
|---|
| 263 | { |
|---|
| 264 | UINT32 fType; |
|---|
| 265 | UINT32 info[3]; |
|---|
| 266 | |
|---|
| 267 | switch ((VDEC_FrameType)param) |
|---|
| 268 | { |
|---|
| 269 | case E_VDEC_FRM_TYPE_I: |
|---|
| 270 | fType = 1; |
|---|
| 271 | |
|---|
| 272 | break; |
|---|
| 273 | |
|---|
| 274 | case E_VDEC_FRM_TYPE_P: |
|---|
| 275 | fType = 2; |
|---|
| 276 | |
|---|
| 277 | break; |
|---|
| 278 | |
|---|
| 279 | case E_VDEC_FRM_TYPE_B: |
|---|
| 280 | fType = 3; |
|---|
| 281 | |
|---|
| 282 | break; |
|---|
| 283 | |
|---|
| 284 | default: |
|---|
| 285 | fType = 0; |
|---|
| 286 | |
|---|
| 287 | break; |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | // get userdata here |
|---|
| 291 | info[0] = (UINT32)stVdecCCInfo.u32UserDataBuf; // userdata |
|---|
| 292 | info[1] = stVdecCCInfo.u32UserDataSize; // userdata size |
|---|
| 293 | // ÇöÀç ¹Ìµé¿þ¾îÀÇ userdata ¼ø¼ ¼³Á¤ÀÌ display order·Î |
|---|
| 294 | // µÇ¾î ÀÖ°í, ºñµð¿À µðÄÚ´õ°¡ÀÇ userdata ¼ø¼ ¼³Á¤µµ |
|---|
| 295 | // display order·Î µÇ¾î ÀÖÀ¸¹Ç·Î, pic typeÀ» ¹«Á¶°Ç |
|---|
| 296 | // I·Î ¼³Á¤ÇÏ¿© ³Ñ±ä´Ù. |
|---|
| 297 | info[2] = 1; // pic type(I,P,B...) |
|---|
| 298 | (*g_vid_usr_data_cb)(eDHL_CB_VideoUserData, (UINT32)info); |
|---|
| 299 | } |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | eFlag &= ~E_VDEC_EX_EVENT_USER_DATA_FOUND; |
|---|
| 304 | } |
|---|
| 305 | if ((eFlag & E_VDEC_EVENT_DISP_INFO_CHG) == E_VDEC_EVENT_DISP_INFO_CHG || |
|---|
| 306 | (eFlag & E_VDEC_EVENT_DISP_INFO_RDY) == E_VDEC_EVENT_DISP_INFO_RDY) |
|---|
| 307 | { |
|---|
| 308 | VDEC_DispInfo dispInfo; |
|---|
| 309 | MS_WINDOW_TYPE capWin, dispWin; |
|---|
| 310 | int art[][2]={{2, DAR_3_4}, |
|---|
| 311 | {3, DAR_9_16}, |
|---|
| 312 | {1, SAR_SquarePixel}}; |
|---|
| 313 | int frt[][2]={{23, FRAMERATE_23_976}, |
|---|
| 314 | {23976, FRAMERATE_23_976}, |
|---|
| 315 | {24, FRAMERATE_24}, |
|---|
| 316 | {24000, FRAMERATE_24}, |
|---|
| 317 | {25, FRAMERATE_25}, |
|---|
| 318 | {25000, FRAMERATE_25}, |
|---|
| 319 | {29, FRAMERATE_29_97}, |
|---|
| 320 | {29970, FRAMERATE_29_97}, |
|---|
| 321 | {30, FRAMERATE_30}, |
|---|
| 322 | {30000, FRAMERATE_30}, |
|---|
| 323 | {50, FRAMERATE_50}, |
|---|
| 324 | {50000, FRAMERATE_50}, |
|---|
| 325 | {59, FRAMERATE_59_94}, |
|---|
| 326 | {59940, FRAMERATE_59_94}, |
|---|
| 327 | {60, FRAMERATE_60}, |
|---|
| 328 | {60000, FRAMERATE_60}}; |
|---|
| 329 | static UINT32 refresh_cnt; |
|---|
| 330 | int i; |
|---|
| 331 | |
|---|
| 332 | // change video scaler |
|---|
| 333 | msAPI_XC_EnableCCIRInput(0, DISABLE); |
|---|
| 334 | MApi_VDEC_SetBlueScreen(FALSE); |
|---|
| 335 | MApi_VDEC_GetDispInfo(&dispInfo); |
|---|
| 336 | msAPI_XC_SetVDECInfo(dispInfo); |
|---|
| 337 | if (g_vid_type == eDHL_VIDEO_TYPE_H264) |
|---|
| 338 | { |
|---|
| 339 | msAPI_XC_SetMVOPConfig(MVOP_INPUT_H264); |
|---|
| 340 | } |
|---|
| 341 | else if (g_vid_type == eDHL_VIDEO_TYPE_MPEG2) |
|---|
| 342 | { |
|---|
| 343 | msAPI_XC_SetMVOPConfig(MVOP_INPUT_MVD); |
|---|
| 344 | } |
|---|
| 345 | msAPI_XC_DTV_SetMode(); |
|---|
| 346 | capWin.x = dispInfo.u16HorSize * crop_x / 1000; |
|---|
| 347 | capWin.y = dispInfo.u16VerSize * crop_y / 1000; |
|---|
| 348 | capWin.width = dispInfo.u16HorSize * crop_w / 1000; |
|---|
| 349 | capWin.height = dispInfo.u16VerSize * crop_h / 1000; |
|---|
| 350 | dispWin.x = 720 * disp_x / 1000; |
|---|
| 351 | dispWin.y = 480 * disp_y / 1000; |
|---|
| 352 | dispWin.width = 720 * disp_w / 1000; |
|---|
| 353 | dispWin.height= 480 * disp_h / 1000; |
|---|
| 354 | msAPI_XC_SetWin(NULL, &capWin, &dispWin, MAIN_WINDOW); |
|---|
| 355 | msAPI_VE_SetMode(); |
|---|
| 356 | MApi_XC_WaitOutputVSync(2, 100, MAIN_WINDOW); |
|---|
| 357 | |
|---|
| 358 | // get sequence header |
|---|
| 359 | g_vid_seq_hdr.generationNumber = 0; |
|---|
| 360 | g_vid_seq_hdr.aspect_ratio_information = aspectRatioUnknown; /* default °ª */ |
|---|
| 361 | for (i = 0; i < (int)(sizeof(art) / sizeof(art[0])); i++) |
|---|
| 362 | { |
|---|
| 363 | if (art[i][0] == (int)dispInfo.u8AspectRate) |
|---|
| 364 | { |
|---|
| 365 | g_vid_seq_hdr.aspect_ratio_information = art[i][1]; |
|---|
| 366 | |
|---|
| 367 | break; |
|---|
| 368 | } |
|---|
| 369 | } |
|---|
| 370 | if (10000 <= dispInfo.u32FrameRate) |
|---|
| 371 | { |
|---|
| 372 | // ½ºÆ®¸²¿¡ µû¶ó framerateÀÇ ¼Ò¼öÁ¡ ¼Â° ÀÚ¸®°¡ 0ÀÌ |
|---|
| 373 | // ¾Æ´Ñ °ªÀ¸·Î ¿À´Â °æ¿ì°¡ ÀÖÀ¸¹Ç·Î 0À¸·Î °Á¦·Î ¸¸µç´Ù. |
|---|
| 374 | dispInfo.u32FrameRate /= 10; |
|---|
| 375 | dispInfo.u32FrameRate *= 10; |
|---|
| 376 | } |
|---|
| 377 | g_vid_seq_hdr.frame_rate_code = (MPEG_FRAME_RATE)-1; /* default °ª, unknown ¿¡ ´ëÇÑ type Á¤Àǰ¡ ¾ø¾î ÀÓÀÇ·Î -1 °ª Àû¿ë */ |
|---|
| 378 | for (i=0; i < (int)(sizeof(frt) / sizeof(frt[0])); i++) |
|---|
| 379 | { |
|---|
| 380 | if (frt[i][0] == (int)dispInfo.u32FrameRate) |
|---|
| 381 | { |
|---|
| 382 | g_vid_seq_hdr.frame_rate_code = frt[i][1]; |
|---|
| 383 | |
|---|
| 384 | break; |
|---|
| 385 | } |
|---|
| 386 | } |
|---|
| 387 | g_vid_seq_hdr.horizontal_size = dispInfo.u16HorSize; |
|---|
| 388 | g_vid_seq_hdr.vertical_size = dispInfo.u16VerSize; |
|---|
| 389 | g_vid_seq_hdr.progressive_sequence = dispInfo.u8Interlace ? 0 : 1; |
|---|
| 390 | // ¹Ø¿¡ ÆÄ¶ó¹ÌÅͰªÀº M/W¿¡¼ »ç¿ë ¾ÈÇϹǷΠ0 °ª ó¸®.. |
|---|
| 391 | g_vid_seq_hdr.bit_rate = 0; |
|---|
| 392 | g_vid_seq_hdr.chroma_format = 0; |
|---|
| 393 | g_vid_seq_hdr.constrained_parameter_flag = 0; |
|---|
| 394 | g_vid_seq_hdr.frame_rate = 0; |
|---|
| 395 | g_vid_seq_hdr.low_delay = 0; |
|---|
| 396 | g_vid_seq_hdr.MPEG2 = 0; |
|---|
| 397 | g_vid_seq_hdr.profile_and_level_indication = 0; |
|---|
| 398 | g_vid_seq_hdr.vbv_buffer_size = 0; |
|---|
| 399 | g_vid_seq_hdr.generationNumber = 0x80000000 | refresh_cnt++; |
|---|
| 400 | |
|---|
| 401 | if(g_vid_seq_hdr_cb) |
|---|
| 402 | { |
|---|
| 403 | (*g_vid_seq_hdr_cb)(eDHL_CB_VideoSeqHdr, (UINT32)&g_vid_seq_hdr); |
|---|
| 404 | } |
|---|
| 405 | |
|---|
| 406 | eFlag &= ~E_VDEC_EVENT_DISP_INFO_CHG; |
|---|
| 407 | eFlag &= ~E_VDEC_EVENT_DISP_INFO_RDY; |
|---|
| 408 | } |
|---|
| 409 | if ((eFlag & E_VDEC_EVENT_VIDEO_UNMUTE) == E_VDEC_EVENT_VIDEO_UNMUTE) |
|---|
| 410 | { |
|---|
| 411 | #define AV_SYNC_TIMEOUT 2000 |
|---|
| 412 | |
|---|
| 413 | UINT32 sync_start_tick; |
|---|
| 414 | BOOL sync_done; |
|---|
| 415 | |
|---|
| 416 | sync_start_tick = DHL_OS_GetMsCount(); |
|---|
| 417 | sync_done = FALSE; |
|---|
| 418 | while (!sync_done) |
|---|
| 419 | { |
|---|
| 420 | if (MApi_VDEC_IsAVSyncOn() == E_VDEC_FAIL) |
|---|
| 421 | { |
|---|
| 422 | sync_done = TRUE; |
|---|
| 423 | |
|---|
| 424 | continue; |
|---|
| 425 | } |
|---|
| 426 | if (MApi_VDEC_IsReachSync() == E_VDEC_OK) |
|---|
| 427 | { |
|---|
| 428 | sync_done = TRUE; |
|---|
| 429 | |
|---|
| 430 | continue; |
|---|
| 431 | } |
|---|
| 432 | |
|---|
| 433 | if (AV_SYNC_TIMEOUT < (DHL_OS_GetMsCount() - sync_start_tick)) |
|---|
| 434 | { |
|---|
| 435 | sync_done = TRUE; |
|---|
| 436 | |
|---|
| 437 | continue; |
|---|
| 438 | } |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | dhl_av_video_hide(0, 0, FALSE); |
|---|
| 442 | |
|---|
| 443 | if (g_vid_first_show_cb) |
|---|
| 444 | { |
|---|
| 445 | (*g_vid_first_show_cb)(eDHL_CB_FirstVideoShow, 0); |
|---|
| 446 | } |
|---|
| 447 | |
|---|
| 448 | eFlag &= ~E_VDEC_EVENT_VIDEO_UNMUTE; |
|---|
| 449 | } |
|---|
| 450 | if (eFlag) |
|---|
| 451 | { |
|---|
| 452 | DHL_OS_Printf("|%s| wrong event(0x%x).\n", __FUNCTION__, eFlag); |
|---|
| 453 | } |
|---|
| 454 | } |
|---|
| 455 | #endif |
|---|
| 456 | |
|---|
| 457 | DHL_RESULT DHL_AV_VideoStart(tDHL_VDID id, |
|---|
| 458 | UINT16 vid_pid, UINT16 pcr_pid, tDHL_VideoCodingType vid_type) |
|---|
| 459 | { |
|---|
| 460 | |
|---|
| 461 | DHL_RESULT dhlResult; |
|---|
| 462 | UINT32 tickStart; |
|---|
| 463 | UINT32 waitTime=TICK_1SEC*g_Timeout_ContextCreation/1000; |
|---|
| 464 | |
|---|
| 465 | printf("%s: vidpid 0x%x pcrpid 0x%x vid_type %d\n", __FUNCTION__, vid_pid, pcr_pid, vid_type); |
|---|
| 466 | |
|---|
| 467 | if (!IS_VALID_PES_PID(vid_pid) || |
|---|
| 468 | !IS_VALID_PCR_PID(pcr_pid)) |
|---|
| 469 | { |
|---|
| 470 | printf("!! %s: invalid pid (video 0x%x, pcr 0x%x)\n", __FUNCTION__, |
|---|
| 471 | vid_pid, pcr_pid); |
|---|
| 472 | return DHL_FAIL; |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | dhlResult = dhl_av_video_start(vid_pid, pcr_pid, 0, vid_type); |
|---|
| 476 | if (dhlResult == DHL_OK) |
|---|
| 477 | { |
|---|
| 478 | //dhl_av_video_hide(0); |
|---|
| 479 | dhl_av_video_start_end(vid_pid, pcr_pid, TRUE); // success |
|---|
| 480 | |
|---|
| 481 | DHL_AV_TakeMutex(); |
|---|
| 482 | |
|---|
| 483 | g_dhlav.curVideoContext=(void *)0x1; |
|---|
| 484 | g_dhlav.uVidPID = vid_pid; |
|---|
| 485 | g_dhlav.uPcrPID = pcr_pid; |
|---|
| 486 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_READY; |
|---|
| 487 | |
|---|
| 488 | g_pcr_pid = pcr_pid; |
|---|
| 489 | g_pcr_start = TRUE; |
|---|
| 490 | g_vid_type = vid_type; |
|---|
| 491 | g_vid_pid = vid_pid; |
|---|
| 492 | g_vid_start = TRUE; |
|---|
| 493 | |
|---|
| 494 | g_vid_alive = TRUE; |
|---|
| 495 | g_vid_alive_chk_time = DHL_OS_GetMsCount(); |
|---|
| 496 | dhl_av_get_video_pts(&g_vid_frm_cnt); |
|---|
| 497 | |
|---|
| 498 | DHL_AV_GiveMutex(); |
|---|
| 499 | |
|---|
| 500 | return dhlResult; |
|---|
| 501 | } |
|---|
| 502 | else |
|---|
| 503 | { |
|---|
| 504 | g_vid_alive = FALSE; |
|---|
| 505 | dhl_av_video_start_end(vid_pid, pcr_pid, FALSE); // fail |
|---|
| 506 | return DHL_FAIL; |
|---|
| 507 | } |
|---|
| 508 | #if 0//khw140408 blocking. |
|---|
| 509 | dhlResult=DHL_FAIL_TIMEOUT; |
|---|
| 510 | |
|---|
| 511 | for (tickStart=TICK_CUR; TICK_PASS(tickStart) < waitTime;) |
|---|
| 512 | { |
|---|
| 513 | //printf("video trying\n"); |
|---|
| 514 | |
|---|
| 515 | if (TICK_PASS(tickStart)>TICK_1SEC/10 && // timeout not reached, |
|---|
| 516 | dhl_av_video_decoding_ready()) // video decoder is ready |
|---|
| 517 | { |
|---|
| 518 | dhlResult = DHL_OK; |
|---|
| 519 | break; |
|---|
| 520 | } |
|---|
| 521 | |
|---|
| 522 | //BKTODO (MW) |
|---|
| 523 | // if (ckFn && ckFn()) { |
|---|
| 524 | // dhlResult = DHL_FAIL_CANCELLED_BY_USER; |
|---|
| 525 | // break; |
|---|
| 526 | // } |
|---|
| 527 | DHL_OS_Delay(OS_GetTicksPerSecond()/10); |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | if (dhlResult) { |
|---|
| 532 | dhl_av_video_start_end(vid_pid, pcr_pid, FALSE); // fail |
|---|
| 533 | } |
|---|
| 534 | else |
|---|
| 535 | { |
|---|
| 536 | dhl_av_video_start_end(vid_pid, pcr_pid, TRUE); // success |
|---|
| 537 | |
|---|
| 538 | DHL_AV_TakeMutex(); |
|---|
| 539 | |
|---|
| 540 | g_dhlav.curVideoContext=(void *)0x1; |
|---|
| 541 | g_dhlav.uVidPID = vid_pid; |
|---|
| 542 | g_dhlav.uPcrPID = pcr_pid; |
|---|
| 543 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_READY; |
|---|
| 544 | |
|---|
| 545 | |
|---|
| 546 | g_pcr_pid = pcr_pid; |
|---|
| 547 | g_pcr_start = TRUE; |
|---|
| 548 | g_vid_type = vid_type; |
|---|
| 549 | g_vid_pid = vid_pid; |
|---|
| 550 | g_vid_start = TRUE; |
|---|
| 551 | |
|---|
| 552 | g_vid_alive = TRUE; |
|---|
| 553 | g_vid_alive_chk_time = DHL_OS_GetMsCount(); |
|---|
| 554 | dhl_av_get_video_pts(&g_vid_frm_cnt); |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | DHL_AV_GiveMutex(); |
|---|
| 559 | } |
|---|
| 560 | |
|---|
| 561 | return dhlResult; |
|---|
| 562 | #endif |
|---|
| 563 | } |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | DHL_RESULT DHL_AV_VideoStop (tDHL_VDID id) |
|---|
| 567 | { |
|---|
| 568 | |
|---|
| 569 | DHL_AV_TakeMutex(); |
|---|
| 570 | // pes stop |
|---|
| 571 | if (g_vid_start == TRUE) |
|---|
| 572 | { |
|---|
| 573 | |
|---|
| 574 | dhl_av_video_stop(g_dhlav.uVidPID); |
|---|
| 575 | |
|---|
| 576 | g_dhlav.curVideoContext = NULL; |
|---|
| 577 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_STOP; // cafrii 060621 add bugfix |
|---|
| 578 | g_dhlav.uVidPID = 0; |
|---|
| 579 | if (g_dhlav.uAudPID == 0) // cafrii 070718 add. PCR pidµµ resetÀÌ ÇÊ¿ä. |
|---|
| 580 | g_dhlav.uPcrPID = 0; |
|---|
| 581 | |
|---|
| 582 | |
|---|
| 583 | g_vid_type = eDHL_VIDEO_TYPE_UNKNOWN; |
|---|
| 584 | g_vid_pid = 0x0000; |
|---|
| 585 | g_vid_start = FALSE; |
|---|
| 586 | |
|---|
| 587 | g_vid_alive = FALSE; |
|---|
| 588 | g_vid_alive_chk_time = 0; |
|---|
| 589 | g_vid_frm_cnt = 0; |
|---|
| 590 | |
|---|
| 591 | g_vid_seq_hdr.generationNumber = 0; |
|---|
| 592 | |
|---|
| 593 | } |
|---|
| 594 | DHL_AV_GiveMutex(); |
|---|
| 595 | |
|---|
| 596 | return DHL_OK; |
|---|
| 597 | } |
|---|
| 598 | |
|---|
| 599 | void DHL_AV_DispStop(BOOL onoff) |
|---|
| 600 | { |
|---|
| 601 | DHL_AV_TakeMutex(); |
|---|
| 602 | |
|---|
| 603 | dhl_av_disp_stop(onoff); |
|---|
| 604 | |
|---|
| 605 | DHL_AV_GiveMutex(); |
|---|
| 606 | } |
|---|
| 607 | |
|---|
| 608 | |
|---|
| 609 | DHL_RESULT DHL_AV_VideoHide(tDHL_VDID id, BOOL bHide) |
|---|
| 610 | { |
|---|
| 611 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 612 | |
|---|
| 613 | printf("%s: %d\n", __FUNCTION__, bHide); |
|---|
| 614 | |
|---|
| 615 | DHL_AV_TakeMutex(); |
|---|
| 616 | |
|---|
| 617 | dhlResult = dhl_av_video_hide(bHide); |
|---|
| 618 | g_dhlav.bVideoHide = bHide ? TRUE : FALSE; |
|---|
| 619 | |
|---|
| 620 | DHL_AV_GiveMutex(); |
|---|
| 621 | |
|---|
| 622 | return dhlResult; |
|---|
| 623 | |
|---|
| 624 | } |
|---|
| 625 | |
|---|
| 626 | |
|---|
| 627 | DHL_RESULT DHL_AV_VideoFreeze(tDHL_VDID id, BOOL bFreeze) |
|---|
| 628 | { |
|---|
| 629 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 630 | #if 0 |
|---|
| 631 | printf("%s: %d\n", __FUNCTION__, bFreeze); |
|---|
| 632 | |
|---|
| 633 | DHL_AV_TakeMutex(); |
|---|
| 634 | |
|---|
| 635 | if (g_dhlav.curVideoContext == NULL) |
|---|
| 636 | { |
|---|
| 637 | if (g_dhlav.uCurVideoStatus != DHL_AV_VIDEO_STOP) { |
|---|
| 638 | printf("!! Null context with non-stopped state?\n"); |
|---|
| 639 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_STOP; |
|---|
| 640 | } |
|---|
| 641 | printf("!! video stop state\n"); |
|---|
| 642 | dhlResult = DHL_FAIL_INVALID_STATE; |
|---|
| 643 | goto label_end; |
|---|
| 644 | } |
|---|
| 645 | |
|---|
| 646 | if (bFreeze) |
|---|
| 647 | { |
|---|
| 648 | if (g_dhlav.uCurVideoStatus == DHL_AV_VIDEO_START) |
|---|
| 649 | { |
|---|
| 650 | printf("\t freeze video context\n"); |
|---|
| 651 | |
|---|
| 652 | dhl_av_video_freeze(TRUE); |
|---|
| 653 | |
|---|
| 654 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_FREEZE; |
|---|
| 655 | } |
|---|
| 656 | else if (g_dhlav.uCurVideoStatus == DHL_AV_VIDEO_FREEZE) |
|---|
| 657 | printf("\t video already freezed..\n"); |
|---|
| 658 | else |
|---|
| 659 | printf("!! video invalid state %d for freeze\n", g_dhlav.uCurVideoStatus); |
|---|
| 660 | } |
|---|
| 661 | else |
|---|
| 662 | { |
|---|
| 663 | // todo.. |
|---|
| 664 | // timeoutÀ» ÀûÀýÇÏ°Ô µÎ°í ¹®Á¦°¡ »ý±â¸é error¸¦ ¸®ÅÏÇÏ´Â°Ô ÁÁ°ÚÀ½ |
|---|
| 665 | // |
|---|
| 666 | if (g_dhlav.uCurVideoStatus == DHL_AV_VIDEO_FREEZE) |
|---|
| 667 | { |
|---|
| 668 | printf("\t unfreeze video\n"); |
|---|
| 669 | |
|---|
| 670 | dhl_av_video_freeze(FALSE); |
|---|
| 671 | |
|---|
| 672 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_START; |
|---|
| 673 | } |
|---|
| 674 | else if (g_dhlav.uCurVideoStatus == DHL_AV_VIDEO_START) |
|---|
| 675 | printf("\t video already unfreezed\n"); |
|---|
| 676 | else |
|---|
| 677 | printf("!! video invalid state %d for unfreeze\n", g_dhlav.uCurVideoStatus); |
|---|
| 678 | } |
|---|
| 679 | |
|---|
| 680 | label_end: |
|---|
| 681 | DHL_AV_GiveMutex(); |
|---|
| 682 | #endif |
|---|
| 683 | return dhlResult; |
|---|
| 684 | |
|---|
| 685 | } |
|---|
| 686 | |
|---|
| 687 | |
|---|
| 688 | DHL_RESULT DHL_AV_VideoResize(tDHL_VDID id, int x, int y, int w, int h) |
|---|
| 689 | { |
|---|
| 690 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 691 | |
|---|
| 692 | printf( "%s: (%d,%d %d,%d)\n", __FUNCTION__, x, y, w, h); |
|---|
| 693 | |
|---|
| 694 | DHL_AV_TakeMutex(); |
|---|
| 695 | |
|---|
| 696 | dhlResult = dhl_av_video_resize(x, y, w, h); |
|---|
| 697 | |
|---|
| 698 | if (dhlResult == DHL_OK) |
|---|
| 699 | { |
|---|
| 700 | g_dhlav.curWinRect.x = x; |
|---|
| 701 | g_dhlav.curWinRect.y = y; |
|---|
| 702 | g_dhlav.curWinRect.w = w; |
|---|
| 703 | g_dhlav.curWinRect.h = h; |
|---|
| 704 | } |
|---|
| 705 | else |
|---|
| 706 | goto label_end; |
|---|
| 707 | |
|---|
| 708 | label_end: |
|---|
| 709 | DHL_AV_GiveMutex(); |
|---|
| 710 | |
|---|
| 711 | return dhlResult; |
|---|
| 712 | |
|---|
| 713 | } |
|---|
| 714 | |
|---|
| 715 | // cafrii 060928 add |
|---|
| 716 | const char *DHL_AV_AdjustmentString(tDHL_DispARC adj) |
|---|
| 717 | { |
|---|
| 718 | return |
|---|
| 719 | adj == eDHL_ARC_FULLSCREEN ? "eDHL_ARC_FULLSCREEN" : |
|---|
| 720 | adj == eDHL_ARC_LETTERBOX ? "eDHL_ARC_LETTERBOX" : |
|---|
| 721 | adj == eDHL_ARC_SIDEBAR ? "eDHL_ARC_SIDEBAR" : |
|---|
| 722 | adj == eDHL_ARC_PAN_AND_SCAN ? "eDHL_ARC_PAN_AND_SCAN" : |
|---|
| 723 | adj == eDHL_ARC_TILT_AND_SCAN ? "eDHL_ARC_TILT_AND_SCAN" : |
|---|
| 724 | adj == eDHL_ARC_PARTIAL_LETTERBOX ? "eDHL_ARC_PARTIAL_LETTERBOX" : |
|---|
| 725 | adj == eDHL_ARC_PARTIAL_SIDEBAR ? "eDHL_ARC_PARTIAL_SIDEBAR" : |
|---|
| 726 | adj == eDHL_ARC_ZOOM1 ? "eDHL_ARC_ZOOM1" : |
|---|
| 727 | adj == eDHL_ARC_ZOOM2 ? "eDHL_ARC_ZOOM2" : |
|---|
| 728 | adj == eDHL_ARC_USER ? "eDHL_ARC_USER" : "?"; |
|---|
| 729 | } |
|---|
| 730 | |
|---|
| 731 | |
|---|
| 732 | DHL_RESULT DHL_AV_VideoSetARC(tDHL_DispARC adj_hd, tDHL_DispARC adj_sd) |
|---|
| 733 | { |
|---|
| 734 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 735 | |
|---|
| 736 | |
|---|
| 737 | DHL_AV_TakeMutex(); |
|---|
| 738 | |
|---|
| 739 | if (g_dhlav.curARAdjustment == adj_hd) { |
|---|
| 740 | printf("\t same adj %d. skip\n", adj_hd); |
|---|
| 741 | goto label_end; |
|---|
| 742 | } |
|---|
| 743 | |
|---|
| 744 | printf("\t change to %d '%s'\n", adj_hd, DHL_AV_AdjustmentString(adj_hd)); |
|---|
| 745 | |
|---|
| 746 | dhlResult = dhl_av_change_display_adjustment(adj_hd, 0); |
|---|
| 747 | |
|---|
| 748 | if (dhlResult == DHL_OK) |
|---|
| 749 | { |
|---|
| 750 | g_dhlav.curARAdjustment = (tDHL_DispARC) adj_hd; |
|---|
| 751 | } |
|---|
| 752 | |
|---|
| 753 | label_end: |
|---|
| 754 | DHL_AV_GiveMutex(); |
|---|
| 755 | |
|---|
| 756 | return dhlResult; |
|---|
| 757 | |
|---|
| 758 | } |
|---|
| 759 | |
|---|
| 760 | |
|---|
| 761 | DHL_RESULT DHL_AV_DispSetFormat( |
|---|
| 762 | tDHL_DispPort port, tDHL_DispFormat format, tDHL_DispColorSpace color) |
|---|
| 763 | { |
|---|
| 764 | DHL_RESULT result = DHL_OK; |
|---|
| 765 | |
|---|
| 766 | //BKTODO |
|---|
| 767 | return result; |
|---|
| 768 | } |
|---|
| 769 | |
|---|
| 770 | |
|---|
| 771 | DHL_RESULT DHL_AV_VideoSeqInfo(tDHL_VDID id, tDHL_VideoSeqHdr *pSeq) |
|---|
| 772 | { |
|---|
| 773 | if (pSeq == NULL) { |
|---|
| 774 | printf("!! %s: null arg\n", __FUNCTION__); |
|---|
| 775 | return DHL_FAIL_INVALID_PARAM; |
|---|
| 776 | } |
|---|
| 777 | |
|---|
| 778 | return dhl_av_get_seq_hdr(pSeq); |
|---|
| 779 | } |
|---|
| 780 | |
|---|
| 781 | |
|---|
| 782 | DHL_RESULT DHL_AV_VideoGetStatus(tDHL_VDID id, tDHL_VideoStatus *pStatus) |
|---|
| 783 | { |
|---|
| 784 | DHL_RESULT result = DHL_OK; |
|---|
| 785 | |
|---|
| 786 | if (pStatus == NULL) |
|---|
| 787 | { |
|---|
| 788 | DHL_OS_Printf("|%s| null arg(pStatus).\n", __FUNCTION__); |
|---|
| 789 | |
|---|
| 790 | result = DHL_FAIL_NULL_POINTER; |
|---|
| 791 | |
|---|
| 792 | return result; |
|---|
| 793 | } |
|---|
| 794 | |
|---|
| 795 | if (g_vid_start == TRUE) |
|---|
| 796 | { |
|---|
| 797 | |
|---|
| 798 | UINT32 curr_frm_cnt; |
|---|
| 799 | dhl_av_get_video_pts(&curr_frm_cnt); |
|---|
| 800 | if (curr_frm_cnt == g_vid_frm_cnt) |
|---|
| 801 | { |
|---|
| 802 | #define VID_ALIVE_CHK_PERIOD 12000 // ms |
|---|
| 803 | UINT32 curr_time; |
|---|
| 804 | curr_time = DHL_OS_GetMsCount(); |
|---|
| 805 | if (VID_ALIVE_CHK_PERIOD <= (curr_time - g_vid_alive_chk_time)) |
|---|
| 806 | { |
|---|
| 807 | g_vid_alive = FALSE; |
|---|
| 808 | } |
|---|
| 809 | } |
|---|
| 810 | else |
|---|
| 811 | { |
|---|
| 812 | g_vid_alive = TRUE; |
|---|
| 813 | g_vid_alive_chk_time = DHL_OS_GetMsCount(); |
|---|
| 814 | } |
|---|
| 815 | g_vid_frm_cnt = curr_frm_cnt; |
|---|
| 816 | } |
|---|
| 817 | else |
|---|
| 818 | { |
|---|
| 819 | g_vid_alive = FALSE; |
|---|
| 820 | } |
|---|
| 821 | |
|---|
| 822 | memset(pStatus, 0, sizeof(tDHL_VideoStatus)); |
|---|
| 823 | pStatus->bDecoding = g_vid_start; |
|---|
| 824 | pStatus->type = g_vid_type; |
|---|
| 825 | pStatus->bOutputExist = g_vid_alive; |
|---|
| 826 | pStatus->bScrambleDetected = FALSE; |
|---|
| 827 | pStatus->bHdmiConnected = FALSE; |
|---|
| 828 | pStatus->curDisplayFormat = eDHL_DISP_720x480i; |
|---|
| 829 | |
|---|
| 830 | return result; |
|---|
| 831 | } |
|---|
| 832 | |
|---|
| 833 | DHL_RESULT DHL_AV_VideoFeeding608(BOOL is_even, UINT8 data1, UINT8 data2, |
|---|
| 834 | BOOL is_end) |
|---|
| 835 | { |
|---|
| 836 | #if 0 //BKTODO: check here |
|---|
| 837 | static struct |
|---|
| 838 | { |
|---|
| 839 | UINT8 d1; |
|---|
| 840 | UINT8 d2; |
|---|
| 841 | UINT8 field; |
|---|
| 842 | } stored[MAX_NUM_608_STORED_DATA]; |
|---|
| 843 | static int idx = 0; |
|---|
| 844 | DHL_RESULT result = DHL_OK; |
|---|
| 845 | |
|---|
| 846 | if (is_end) |
|---|
| 847 | { |
|---|
| 848 | int i; |
|---|
| 849 | |
|---|
| 850 | for (i = 0; i < idx; i++) |
|---|
| 851 | { |
|---|
| 852 | if (!stored[i].field) |
|---|
| 853 | { |
|---|
| 854 | f1_data[wrCntF1] = (stored[i].d2 << 8) | stored[i].d1; |
|---|
| 855 | |
|---|
| 856 | wrCntF1++; |
|---|
| 857 | if (MAX_NUM_608_STORED_DATA <= wrCntF1) |
|---|
| 858 | { |
|---|
| 859 | wrCntF1 = 0; |
|---|
| 860 | } |
|---|
| 861 | } |
|---|
| 862 | else |
|---|
| 863 | { |
|---|
| 864 | f2_data[wrCntF2] = (stored[i].d2 << 8) | stored[i].d1; |
|---|
| 865 | |
|---|
| 866 | wrCntF2++; |
|---|
| 867 | if (MAX_NUM_608_STORED_DATA <= wrCntF2) |
|---|
| 868 | { |
|---|
| 869 | wrCntF2 = 0; |
|---|
| 870 | } |
|---|
| 871 | } |
|---|
| 872 | } |
|---|
| 873 | |
|---|
| 874 | idx = 0; |
|---|
| 875 | } |
|---|
| 876 | else |
|---|
| 877 | { |
|---|
| 878 | static UINT32 prev_ms; |
|---|
| 879 | |
|---|
| 880 | if ((DHL_OS_GetMsCount() - prev_ms) > 1000) |
|---|
| 881 | { |
|---|
| 882 | idx = 0; |
|---|
| 883 | } |
|---|
| 884 | |
|---|
| 885 | stored[idx].d1 = data1; |
|---|
| 886 | stored[idx].d2 = data2; |
|---|
| 887 | stored[idx].field = is_even; |
|---|
| 888 | |
|---|
| 889 | idx++; |
|---|
| 890 | if (MAX_NUM_608_STORED_DATA <= idx) |
|---|
| 891 | { |
|---|
| 892 | idx = 0; |
|---|
| 893 | } |
|---|
| 894 | |
|---|
| 895 | prev_ms = DHL_OS_GetMsCount(); |
|---|
| 896 | } |
|---|
| 897 | return result; |
|---|
| 898 | #else |
|---|
| 899 | return DHL_OK; |
|---|
| 900 | #endif |
|---|
| 901 | } |
|---|
| 902 | |
|---|
| 903 | |
|---|
| 904 | #if COMMENT |
|---|
| 905 | ____Audio____(){} |
|---|
| 906 | #endif |
|---|
| 907 | |
|---|
| 908 | |
|---|
| 909 | DHL_RESULT dhl_av_audio_set_mix_type(UINT32 value) |
|---|
| 910 | { |
|---|
| 911 | DHL_RESULT result = DHL_OK; |
|---|
| 912 | //BKTODO: |
|---|
| 913 | |
|---|
| 914 | return result; |
|---|
| 915 | } |
|---|
| 916 | |
|---|
| 917 | DHL_RESULT DHL_AV_AudioStart(UINT16 aud_pid, UINT16 pcr_pid, tDHL_AudioCodingType aud_type) |
|---|
| 918 | { |
|---|
| 919 | DHL_RESULT result = DHL_OK; |
|---|
| 920 | result = dhl_av_audio_start(aud_pid, pcr_pid, aud_type); |
|---|
| 921 | if(result == DHL_OK) |
|---|
| 922 | { |
|---|
| 923 | dhl_av_audio_start_end(aud_pid, pcr_pid, TRUE); // success ÀÎÁö ¾Æ´ÑÁö ¾Ë ¼ö ¾øÀ½. success·Î °¡Á¤. |
|---|
| 924 | |
|---|
| 925 | DHL_AV_TakeMutex(); |
|---|
| 926 | |
|---|
| 927 | g_dhlav.curVideoContext=(void *)0x1; |
|---|
| 928 | g_dhlav.uAudPID = aud_pid; |
|---|
| 929 | g_aud_type = aud_type; |
|---|
| 930 | g_aud_start = TRUE; |
|---|
| 931 | g_aud_alive = TRUE; |
|---|
| 932 | g_aud_alive_chk_time = DHL_OS_GetMsCount(); |
|---|
| 933 | DHL_AV_GiveMutex(); |
|---|
| 934 | return DHL_OK; |
|---|
| 935 | } |
|---|
| 936 | else |
|---|
| 937 | { |
|---|
| 938 | g_aud_alive = FALSE; |
|---|
| 939 | dhl_av_audio_start_end(aud_pid, pcr_pid, FALSE); |
|---|
| 940 | return DHL_FAIL; |
|---|
| 941 | } |
|---|
| 942 | #if 0//khw140408 blocking. |
|---|
| 943 | // g_dhlav.curAudioContext = (void *)1; // TODO.. |
|---|
| 944 | g_dhlav.uAudPID = aud_pid; |
|---|
| 945 | |
|---|
| 946 | if (g_dhlav.uPcrPID && g_dhlav.uPcrPID != pcr_pid) { |
|---|
| 947 | printf("!! pcr pid setting mismatch! video pcr 0x%x != audio pcr 0x%x\n", |
|---|
| 948 | g_dhlav.uPcrPID, pcr_pid); |
|---|
| 949 | // ÀÌ·¸°Ô Çϱâ À§Çؼ´Â AV stopÀ» ÇÒ ¶§ ¸ðµç pid Á¤º¸¸¦ 0À¸·Î resetÀ» ÇØ¾ß ÇÑ´Ù. |
|---|
| 950 | // mismatch°¡ ¹ß»ýÇÏ¸é ¾î¶»°Ô ÇÒ °ÍÀΰ¡? |
|---|
| 951 | // --> ÀÏ´Ü ±×´ë·Î ÁøÇà.. |
|---|
| 952 | } |
|---|
| 953 | |
|---|
| 954 | return DHL_OK; |
|---|
| 955 | #endif |
|---|
| 956 | } |
|---|
| 957 | |
|---|
| 958 | |
|---|
| 959 | DHL_RESULT DHL_AV_AudioStop(void) |
|---|
| 960 | { |
|---|
| 961 | DHL_RESULT result = DHL_OK; |
|---|
| 962 | |
|---|
| 963 | // cafrii 080910 add |
|---|
| 964 | dhl_av_audio_stop(g_dhlav.uAudPID); |
|---|
| 965 | |
|---|
| 966 | g_aud_start = FALSE; |
|---|
| 967 | g_aud_alive = FALSE; |
|---|
| 968 | g_aud_alive_chk_time = 0; |
|---|
| 969 | |
|---|
| 970 | g_dhlav.uAudPID = 0; |
|---|
| 971 | if (g_dhlav.uVidPID == 0) // cafrii 070718 add. PCR pidµµ resetÀÌ ÇÊ¿ä. |
|---|
| 972 | g_dhlav.uPcrPID = 0; |
|---|
| 973 | |
|---|
| 974 | // g_dhlav.curAudioContext = 0; |
|---|
| 975 | |
|---|
| 976 | |
|---|
| 977 | return result; |
|---|
| 978 | |
|---|
| 979 | } |
|---|
| 980 | |
|---|
| 981 | |
|---|
| 982 | DHL_RESULT DHL_AV_AudioMuteControl(tDHL_AudioMutePlace mutePlace, BOOL bMute) |
|---|
| 983 | { |
|---|
| 984 | |
|---|
| 985 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 986 | |
|---|
| 987 | // we remember just for debugging. |
|---|
| 988 | // actually, this is not necessary. |
|---|
| 989 | // |
|---|
| 990 | if (bMute) |
|---|
| 991 | g_dhlav.audioMuteMap |= (1 << (int)(mutePlace)); |
|---|
| 992 | else |
|---|
| 993 | g_dhlav.audioMuteMap &= ~(1 << (int)(mutePlace)); |
|---|
| 994 | |
|---|
| 995 | dhl_av_audio_mute_control(mutePlace, bMute); |
|---|
| 996 | |
|---|
| 997 | return dhlResult; |
|---|
| 998 | |
|---|
| 999 | } |
|---|
| 1000 | |
|---|
| 1001 | |
|---|
| 1002 | DHL_RESULT DHL_AV_AudioSetUserVolumeRange(UINT32 uVolMin, UINT32 uVolMax) |
|---|
| 1003 | { |
|---|
| 1004 | DHL_RESULT result = DHL_OK; |
|---|
| 1005 | |
|---|
| 1006 | g_audVolumeMin = uVolMin; |
|---|
| 1007 | g_audVolumeMax = uVolMax; |
|---|
| 1008 | |
|---|
| 1009 | if (g_audVolumeMax < g_audVolume) |
|---|
| 1010 | { |
|---|
| 1011 | g_audVolume = g_audVolumeMax; |
|---|
| 1012 | } |
|---|
| 1013 | if (g_audVolume < g_audVolumeMin) |
|---|
| 1014 | { |
|---|
| 1015 | g_audVolume = g_audVolumeMin; |
|---|
| 1016 | } |
|---|
| 1017 | |
|---|
| 1018 | return result; |
|---|
| 1019 | } |
|---|
| 1020 | |
|---|
| 1021 | |
|---|
| 1022 | DHL_RESULT DHL_AV_AudioSetVolume(UINT16 uVolLvl) |
|---|
| 1023 | { |
|---|
| 1024 | |
|---|
| 1025 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 1026 | int logicalVol; |
|---|
| 1027 | |
|---|
| 1028 | // uVolLvl is user volume. (UserMin ~ UserMax) |
|---|
| 1029 | // realVol is logical volume. 0 ~ 100. |
|---|
| 1030 | // |
|---|
| 1031 | // device volume also may be different. it is controlled in AVCAP_Impl module. |
|---|
| 1032 | // |
|---|
| 1033 | logicalVol = uVolLvl*100/ |
|---|
| 1034 | (g_audVolumeMax-g_audVolumeMin)-g_audVolumeMin; |
|---|
| 1035 | |
|---|
| 1036 | printf("audio vol: input %d, real %d\n", uVolLvl, logicalVol); |
|---|
| 1037 | |
|---|
| 1038 | // note that if decoder mute is ON, there will be no sound. |
|---|
| 1039 | |
|---|
| 1040 | dhlResult = dhl_av_audio_set_volume(logicalVol); |
|---|
| 1041 | if (dhlResult == DHL_OK) { |
|---|
| 1042 | g_dhlav.uVolLvl = uVolLvl; // uVolLvl is user's volume settings value. |
|---|
| 1043 | g_dhlav.uLogVolLvl = logicalVol; |
|---|
| 1044 | } |
|---|
| 1045 | |
|---|
| 1046 | return dhlResult; |
|---|
| 1047 | } |
|---|
| 1048 | |
|---|
| 1049 | |
|---|
| 1050 | DHL_RESULT DHL_AV_AudioGetStatus(tDHL_AudioStatus *pStatus) |
|---|
| 1051 | { |
|---|
| 1052 | DHL_RESULT result = DHL_OK; |
|---|
| 1053 | |
|---|
| 1054 | if (pStatus == NULL) |
|---|
| 1055 | { |
|---|
| 1056 | DHL_OS_Printf("|%s| null arg(pStatus).\n", __FUNCTION__); |
|---|
| 1057 | |
|---|
| 1058 | result = DHL_FAIL_NULL_POINTER; |
|---|
| 1059 | |
|---|
| 1060 | return result; |
|---|
| 1061 | } |
|---|
| 1062 | |
|---|
| 1063 | if (g_aud_start == TRUE) |
|---|
| 1064 | { |
|---|
| 1065 | |
|---|
| 1066 | UINT32 curr_frm_cnt; |
|---|
| 1067 | |
|---|
| 1068 | curr_frm_cnt = dhl_av_audio_frame_count(); |
|---|
| 1069 | if (curr_frm_cnt == g_aud_frm_cnt) |
|---|
| 1070 | { |
|---|
| 1071 | #define AUD_ALIVE_CHK_PERIOD 2000 // ms |
|---|
| 1072 | |
|---|
| 1073 | UINT32 curr_time; |
|---|
| 1074 | |
|---|
| 1075 | curr_time = DHL_OS_GetMsCount(); |
|---|
| 1076 | if (AUD_ALIVE_CHK_PERIOD <= (curr_time - g_aud_alive_chk_time)) |
|---|
| 1077 | { |
|---|
| 1078 | g_aud_alive = FALSE; |
|---|
| 1079 | } |
|---|
| 1080 | } |
|---|
| 1081 | else |
|---|
| 1082 | { |
|---|
| 1083 | g_aud_alive = TRUE; |
|---|
| 1084 | g_aud_alive_chk_time = DHL_OS_GetMsCount(); |
|---|
| 1085 | } |
|---|
| 1086 | g_aud_frm_cnt = curr_frm_cnt; |
|---|
| 1087 | } |
|---|
| 1088 | else |
|---|
| 1089 | { |
|---|
| 1090 | g_aud_alive = FALSE; |
|---|
| 1091 | } |
|---|
| 1092 | |
|---|
| 1093 | memset(pStatus, 0, sizeof(tDHL_AudioStatus)); |
|---|
| 1094 | pStatus->bDecoding = g_aud_start; |
|---|
| 1095 | pStatus->type = g_aud_type; |
|---|
| 1096 | pStatus->bOutputExist = g_aud_alive; |
|---|
| 1097 | if (g_aud_start == TRUE) |
|---|
| 1098 | { |
|---|
| 1099 | dhl_av_audio_get_channel_info(&pStatus->bSurround, &pStatus->bStereo); |
|---|
| 1100 | } |
|---|
| 1101 | else |
|---|
| 1102 | { |
|---|
| 1103 | pStatus->bSurround = FALSE; |
|---|
| 1104 | pStatus->bStereo = FALSE; |
|---|
| 1105 | } |
|---|
| 1106 | |
|---|
| 1107 | return result; |
|---|
| 1108 | } |
|---|
| 1109 | |
|---|
| 1110 | |
|---|
| 1111 | #if COMMENT |
|---|
| 1112 | ____AV____(){} |
|---|
| 1113 | #endif |
|---|
| 1114 | |
|---|
| 1115 | |
|---|
| 1116 | //static void dhl_av_evt_task(UINT32 arg) |
|---|
| 1117 | //{ |
|---|
| 1118 | // |
|---|
| 1119 | // DHL_OS_SelfDeleteTask(); |
|---|
| 1120 | //} |
|---|
| 1121 | |
|---|
| 1122 | DHL_RESULT DHL_AV_Init(void) |
|---|
| 1123 | { |
|---|
| 1124 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 1125 | if(is_inited) return DHL_OK; |
|---|
| 1126 | |
|---|
| 1127 | // av context allocation |
|---|
| 1128 | // -> not necessary. |
|---|
| 1129 | |
|---|
| 1130 | // mutex creation |
|---|
| 1131 | g_dhlav.Mutex = DHL_OS_CreateMutexSemaphore("DHLAV"); |
|---|
| 1132 | if (g_dhlav.Mutex == 0) { |
|---|
| 1133 | printf("!! Create DHLAV mutex failed\n"); |
|---|
| 1134 | return DHL_FAIL; |
|---|
| 1135 | } |
|---|
| 1136 | |
|---|
| 1137 | dhlResult = dhl_av_init(); |
|---|
| 1138 | |
|---|
| 1139 | DHL_ASSERT(dhlResult == DHL_OK, "!! av init err"); |
|---|
| 1140 | |
|---|
| 1141 | g_dhlav.uCurVideoStatus = DHL_AV_VIDEO_STOP; |
|---|
| 1142 | g_dhlav.audioMuteMap = 0; |
|---|
| 1143 | is_inited=TRUE; |
|---|
| 1144 | |
|---|
| 1145 | return DHL_OK; |
|---|
| 1146 | |
|---|
| 1147 | } |
|---|
| 1148 | |
|---|
| 1149 | DHL_RESULT DHL_AV_Terminate(void) |
|---|
| 1150 | { |
|---|
| 1151 | DHL_RESULT result = DHL_OK; |
|---|
| 1152 | |
|---|
| 1153 | if(!is_inited) return DHL_OK; |
|---|
| 1154 | |
|---|
| 1155 | is_inited = FALSE; |
|---|
| 1156 | |
|---|
| 1157 | result = dhl_av_terminate(); |
|---|
| 1158 | |
|---|
| 1159 | |
|---|
| 1160 | |
|---|
| 1161 | return result; |
|---|
| 1162 | } |
|---|
| 1163 | |
|---|
| 1164 | |
|---|
| 1165 | DHL_RESULT DHL_AV_Query(tDHL_AVQueryType type, UINT32 *pValue) |
|---|
| 1166 | { |
|---|
| 1167 | DHL_RESULT result = DHL_OK; |
|---|
| 1168 | |
|---|
| 1169 | if (pValue == NULL) |
|---|
| 1170 | { |
|---|
| 1171 | DHL_OS_Printf("|%s| null arg(pValue).\n", __FUNCTION__); |
|---|
| 1172 | |
|---|
| 1173 | result = DHL_FAIL_NULL_POINTER; |
|---|
| 1174 | |
|---|
| 1175 | return result; |
|---|
| 1176 | } |
|---|
| 1177 | |
|---|
| 1178 | if (type == eDHL_AV_QUERY_VIDEO_CAP) |
|---|
| 1179 | { |
|---|
| 1180 | *pValue = (1 << eDHL_VIDEO_TYPE_MPEG2) | |
|---|
| 1181 | (1 << eDHL_VIDEO_TYPE_H264); |
|---|
| 1182 | } |
|---|
| 1183 | else if (type == eDHL_AV_QUERY_AUDIO_CAP) |
|---|
| 1184 | { |
|---|
| 1185 | *pValue = (1 << eDHL_AUDIO_TYPE_AC3) | |
|---|
| 1186 | (1 << eDHL_AUDIO_TYPE_AAC_ADTS) | |
|---|
| 1187 | (1 << eDHL_AUDIO_TYPE_AAC_LATM) | |
|---|
| 1188 | (1 << eDHL_AUDIO_TYPE_MPEG_1) | |
|---|
| 1189 | (1 << eDHL_AUDIO_TYPE_MPEG_2); |
|---|
| 1190 | } |
|---|
| 1191 | else if(type == eDHL_AV_QUERY_VIDEO_FMT) |
|---|
| 1192 | { |
|---|
| 1193 | *pValue=g_vid_type; |
|---|
| 1194 | } |
|---|
| 1195 | else if(type == eDHL_AV_QUERY_AUDIO_FMT) |
|---|
| 1196 | { |
|---|
| 1197 | *pValue=g_aud_type; |
|---|
| 1198 | } |
|---|
| 1199 | else |
|---|
| 1200 | { |
|---|
| 1201 | *pValue=0; |
|---|
| 1202 | |
|---|
| 1203 | DHL_OS_Printf("|%s| not implemented(type:0x%x)...\n", __FUNCTION__, |
|---|
| 1204 | type); |
|---|
| 1205 | } |
|---|
| 1206 | |
|---|
| 1207 | return result; |
|---|
| 1208 | } |
|---|
| 1209 | |
|---|
| 1210 | |
|---|
| 1211 | DHL_RESULT DHL_AV_Control(tDHL_AVControlType type, UINT32 value) |
|---|
| 1212 | { |
|---|
| 1213 | DHL_RESULT result = DHL_OK; |
|---|
| 1214 | |
|---|
| 1215 | if (type == eDHL_AV_CTL_AUDIO_MIX_TYPE) |
|---|
| 1216 | { |
|---|
| 1217 | dhl_av_audio_set_mix_type(value); |
|---|
| 1218 | |
|---|
| 1219 | g_audMixType = value; |
|---|
| 1220 | } |
|---|
| 1221 | else |
|---|
| 1222 | { |
|---|
| 1223 | DHL_OS_Printf("|%s| not implemented(type:0x%x)...\n", __FUNCTION__, |
|---|
| 1224 | type); |
|---|
| 1225 | } |
|---|
| 1226 | |
|---|
| 1227 | return result; |
|---|
| 1228 | } |
|---|
| 1229 | |
|---|
| 1230 | |
|---|
| 1231 | #if COMMENT |
|---|
| 1232 | ________________(){} |
|---|
| 1233 | #endif |
|---|
| 1234 | |
|---|
| 1235 | |
|---|
| 1236 | //DHL_RESULT DHL_AV_PresetCallback(tDHL_AVCALLBACK pCallBack, |
|---|
| 1237 | // tDHL_AVCallbackType CBType, UINT32 ClientCntx) |
|---|
| 1238 | //{ |
|---|
| 1239 | // return dhl_av_register_callback(pCallBack, CBType, ClientCntx); |
|---|
| 1240 | //} |
|---|
| 1241 | |
|---|
| 1242 | |
|---|
| 1243 | DHL_RESULT DHL_AV_SetCallback(tDHL_AVCallbackType cb_type, tDHL_AVCALLBACK cb) |
|---|
| 1244 | { |
|---|
| 1245 | DHL_RESULT result = DHL_OK; |
|---|
| 1246 | |
|---|
| 1247 | //printf("[cb_type(%d)]\n\n", cb_type); |
|---|
| 1248 | #if 0/* khw video°¡ Á×¾î¼ Àӽ÷Π¿¾î³õÀ½ */ |
|---|
| 1249 | if (cb_type == eDHL_CB_VideoSeqHdr) |
|---|
| 1250 | { |
|---|
| 1251 | g_vid_seq_hdr_cb = cb; |
|---|
| 1252 | } |
|---|
| 1253 | else if (cb_type == eDHL_CB_VideoUserData) |
|---|
| 1254 | { |
|---|
| 1255 | g_vid_usr_data_cb = cb; |
|---|
| 1256 | } |
|---|
| 1257 | else if (cb_type == eDHL_CB_FirstVideoShow) |
|---|
| 1258 | { |
|---|
| 1259 | g_vid_first_show_cb = cb; |
|---|
| 1260 | } |
|---|
| 1261 | else |
|---|
| 1262 | { |
|---|
| 1263 | result = DHL_FAIL_NOT_IMPLEMENTED; |
|---|
| 1264 | |
|---|
| 1265 | goto err; |
|---|
| 1266 | } |
|---|
| 1267 | |
|---|
| 1268 | err: |
|---|
| 1269 | #else |
|---|
| 1270 | dhl_av_register_callback(cb, cb_type); |
|---|
| 1271 | #endif |
|---|
| 1272 | return result; |
|---|
| 1273 | } |
|---|
| 1274 | |
|---|
| 1275 | |
|---|
| 1276 | #if COMMENT |
|---|
| 1277 | ____Cap____(){} |
|---|
| 1278 | #endif |
|---|
| 1279 | |
|---|
| 1280 | |
|---|
| 1281 | DHL_RESULT DHL_CAP_ChangeVideoSource(tDHL_VDID id, tDHL_CapVideoInput VideoInputSrc) |
|---|
| 1282 | { |
|---|
| 1283 | return DHL_OK; |
|---|
| 1284 | } |
|---|
| 1285 | DHL_RESULT DHL_CAP_ChangeAudioSource(tDHL_CapAudioInput AudioInputSrc) |
|---|
| 1286 | { |
|---|
| 1287 | return DHL_OK; |
|---|
| 1288 | } |
|---|
| 1289 | |
|---|
| 1290 | |
|---|
| 1291 | #if COMMENT |
|---|
| 1292 | _______Test_______(){} |
|---|
| 1293 | #endif |
|---|
| 1294 | |
|---|
| 1295 | |
|---|
| 1296 | void set_xc_disp(int cx, int cy, int cw, int ch, int dx, int dy, int dw, int dh) |
|---|
| 1297 | { |
|---|
| 1298 | |
|---|
| 1299 | } |
|---|
| 1300 | |
|---|
| 1301 | void dav_start(UINT16 vpid, UINT16 apid, BOOL b_kview) |
|---|
| 1302 | { |
|---|
| 1303 | if (b_kview == 0x0f) |
|---|
| 1304 | { |
|---|
| 1305 | DHL_AV_VideoStart(0, vpid, vpid, eDHL_VIDEO_TYPE_H264); |
|---|
| 1306 | DHL_AV_AudioStart(apid, vpid, eDHL_AUDIO_TYPE_AAC_ADTS); |
|---|
| 1307 | } |
|---|
| 1308 | else if (b_kview == 0x11) |
|---|
| 1309 | { |
|---|
| 1310 | DHL_AV_VideoStart(0, vpid, vpid, eDHL_VIDEO_TYPE_H264); |
|---|
| 1311 | DHL_AV_AudioStart(apid, vpid, eDHL_AUDIO_TYPE_AAC_LATM); |
|---|
| 1312 | } |
|---|
| 1313 | else |
|---|
| 1314 | { |
|---|
| 1315 | DHL_AV_VideoStart(0, vpid, vpid, eDHL_VIDEO_TYPE_MPEG2); |
|---|
| 1316 | DHL_AV_AudioStart(apid, vpid, eDHL_AUDIO_TYPE_AC3); |
|---|
| 1317 | } |
|---|
| 1318 | |
|---|
| 1319 | DHL_AV_AudioMuteControl(eDHL_AUDIO_MUTE_AMP, FALSE); |
|---|
| 1320 | DHL_AV_VideoHide(0, FALSE); |
|---|
| 1321 | } |
|---|
| 1322 | |
|---|
| 1323 | void dav_stop(void) |
|---|
| 1324 | { |
|---|
| 1325 | DHL_AV_VideoStop(0); |
|---|
| 1326 | DHL_AV_AudioStop(); |
|---|
| 1327 | } |
|---|
| 1328 | |
|---|
| 1329 | void get_vfrm(void) |
|---|
| 1330 | { |
|---|
| 1331 | //DHL_OS_Printf("video frame = 0x%x\n", vdec_getDecodedFrameCount()); |
|---|
| 1332 | } |
|---|
| 1333 | |
|---|
| 1334 | void get_afrm(void) |
|---|
| 1335 | { |
|---|
| 1336 | //DHL_OS_Printf("audio frame = 0x%x\n", *(UINT32 *)CMD20); |
|---|
| 1337 | } |
|---|