| 1 | /******************************************************************** |
|---|
| 2 | * |
|---|
| 3 | * Dmw_ChannelTask.c |
|---|
| 4 | * |
|---|
| 5 | * Channel decoding task, video and channel command |
|---|
| 6 | * |
|---|
| 7 | * Copyright 2002-2004 Digital STREAM Technology, Inc. |
|---|
| 8 | * All Rights Reserved |
|---|
| 9 | * |
|---|
| 10 | * Dmw_ChannelTask.c, v 1.0 2003/11/27 cafrii |
|---|
| 11 | * |
|---|
| 12 | *******************************************************************/ |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | #include "DMW_Platform.h" |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #include "DHL_SYS.h" |
|---|
| 22 | #include "DHL_AVCAP.h" |
|---|
| 23 | #include "DHL_DBG.h" |
|---|
| 24 | //#include "DHL_DEV.h" |
|---|
| 25 | |
|---|
| 26 | //#include <string.h> |
|---|
| 27 | |
|---|
| 28 | #define SETRECT(rect, xx, yy, ww, hh) { \ |
|---|
| 29 | (rect)->x = (xx); \ |
|---|
| 30 | (rect)->y = (yy); \ |
|---|
| 31 | (rect)->w = (ww); \ |
|---|
| 32 | (rect)->h = (hh); \ |
|---|
| 33 | } |
|---|
| 34 | #define outOfOSResourcesError DHL_FAIL_OUT_OF_RESOURCE |
|---|
| 35 | |
|---|
| 36 | #include "DMW_Config.h" |
|---|
| 37 | #include "DMW_DebugUtil.h" |
|---|
| 38 | #include "DMW_Status.h" |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | #define __DEFINE_DMC_STRING_FN__ |
|---|
| 42 | // ÀÌ ¼Ò½º ÆÄÀÏ¿¡¼¸¸ DMW_Channel.h¸¦ Æ÷ÇÔÇϱâ Àü¿¡ ÀÌ macro¸¦ ¼±¾ðÇÏ¸é µÈ´Ù. |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | // Middleware |
|---|
| 46 | #include "DMW_Channel.h" |
|---|
| 47 | |
|---|
| 48 | #include "dmw_channel_priv.h" |
|---|
| 49 | |
|---|
| 50 | #include "DMW_ChannelDemux.h" |
|---|
| 51 | #include "DMW_ChannelUtil.h" |
|---|
| 52 | |
|---|
| 53 | //#include "dmw_nvram_priv.h" |
|---|
| 54 | // nvram init ÀÛ¾÷ ¶§¹®¿¡ Æ÷ÇÔ. |
|---|
| 55 | |
|---|
| 56 | DHL_MODULE("$dmc", 1); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | #if COMMENT |
|---|
| 60 | ________Config________(){} |
|---|
| 61 | #endif |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | //=========================================================================== |
|---|
| 65 | // |
|---|
| 66 | // Configuration parameters |
|---|
| 67 | // |
|---|
| 68 | // °¢Á¾ ¿É¼Ç ±â´ÉÀÇ On/Off ¼³Á¤, ÄÄÆÄÀÏ·¯ ¿É¼Ç ¼³Á¤, |
|---|
| 69 | // µå¶óÀ̹ö °ü·Ã ȯ°æ ¼³Á¤ µî.. |
|---|
| 70 | // |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | // |
|---|
| 74 | // cafrii 070830 add |
|---|
| 75 | // |
|---|
| 76 | // Freeze, Hide ¿Í °°ÀÌ Tuning°ú Á÷Á¢ÀûÀÎ °ü·ÃÀÌ ¾ø´Â ETC ÇÔ¼öµéÀ» |
|---|
| 77 | // DMC task·Î defer ½ÃÄѼ µ¿ÀÛ½Ãų °ÍÀÎÁö ¼³Á¤. |
|---|
| 78 | // |
|---|
| 79 | // 1ÀÌ¸é ¸ðµç ÀÛ¾÷À» DMC task·Î À̰üÇØ¼ µ¿ÀÛÀ» Çϸç (ÀÌÀü ¹æ½Ä) |
|---|
| 80 | // 0ÀÌ¸é ±×³É ÀÓÀÇ task¿¡¼ ¹Ù·Î HAL ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù. |
|---|
| 81 | // |
|---|
| 82 | // ¾ÕÀ¸·Î´Â DMC task¿¡ synchronize ½ÃŰÁö ¾Ê°í ¹Ù·Î HAL ÇÔ¼ö¸¦ È£ÃâÇϵµ·Ï ÇÑ´Ù. |
|---|
| 83 | // |
|---|
| 84 | // |
|---|
| 85 | #define SUPPORT_ETC_API_SYNC 0 |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | // |
|---|
| 96 | // Config Param: [0 ~ ] ´ÜÀ§: millisecond |
|---|
| 97 | // |
|---|
| 98 | // °¢Á¾ Timeout limit °ª. ´ÜÀ§´Â ms. |
|---|
| 99 | // |
|---|
| 100 | int g_Timeout_SignalLock = 1900; // µðÁöÅÐ ½ÅÈ£ Lock timeout. |
|---|
| 101 | int g_Timeout_AnalogSignalLock = 200; // ¾Æ³¯·Î±× Lock timeout. cafrii 041208, 500 -> 200 |
|---|
| 102 | int g_Timeout_VctLoading = 6000; |
|---|
| 103 | int g_Timeout_PatLoading = 6000; |
|---|
| 104 | int g_Timeout_PmtLoading = 6000; |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | // |
|---|
| 112 | // Config MACRO: priority´Â ±ÇÀå°ª ±×´ë·Î. stack size´Â ÃæºÐÇϰÔ. |
|---|
| 113 | // |
|---|
| 114 | // DMC task¸¦ »ý¼ºÇÒ¶§ »ç¿ëµÇ´Â °ª |
|---|
| 115 | // |
|---|
| 116 | // Priority´Â Cougar classic exampleÀÇ VideoControlTaskÀÇ °ª°ú |
|---|
| 117 | // µ¿ÀÏÇÏ°Ô »ç¿ëÇÏ´Â°Ô ÁÁ´Ù. stack size´Â °¡²û¾¿ task info¸¦ °Ë»çÇØ¼ |
|---|
| 118 | // marginÀÌ ºÎÁ·ÇÏ¸é ´Ã·ÁÁÖµµ·Ï ÇÏÀÚ. |
|---|
| 119 | // |
|---|
| 120 | // @todo zooyouny 100629 DHL¿¡ DMC_TASK °ª°ú µ¿ÀÏÇÏ°Ô ÇÏ¿´À½ |
|---|
| 121 | // ¼ýÀÚ °ª ´ë½Å signiture »ó¼ö »ç¿ëÇÒ °Í.. |
|---|
| 122 | #define DMC_TASK_PRIORITY TASK_PRI_DMC_TASK |
|---|
| 123 | #define DMC_TASK_STACKSIZE 32768 |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | // |
|---|
| 132 | // Config MACRO: |
|---|
| 133 | // |
|---|
| 134 | // DMC Event Queue Å©±â |
|---|
| 135 | // |
|---|
| 136 | // Event QueÅ©±â °ªÀ¸·Î ºÎÁ·ÇÏÁö ¾Ê°Ô ÃæºÐÈ÷ Àâµµ·Ï ÇÏÀÚ.. |
|---|
| 137 | // |
|---|
| 138 | #define MAX_DECODE_MESSAGES 50 |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | #if COMMENT |
|---|
| 145 | ________State________(){} |
|---|
| 146 | #endif |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | //=========================================================================== |
|---|
| 150 | // |
|---|
| 151 | // DMC State Variables |
|---|
| 152 | // |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | //----------------------------------------------------------- |
|---|
| 156 | // DMC Task ¹× communication °ü·Ã |
|---|
| 157 | // |
|---|
| 158 | |
|---|
| 159 | // task, event, sema4 |
|---|
| 160 | // |
|---|
| 161 | DHL_OS_TASK_ID dmc_TaskID; // ÀÌ DMC ŽºÅ©¿¡¼ ½ÇÁ¦ÀûÀÎ video start/stop µî ¸ðµç°ÍÀ» ó¸®ÇÑ´Ù. |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | //----------------------------------------------------------- |
|---|
| 166 | |
|---|
| 167 | tDHL_TSD *dmc_tsd; |
|---|
| 168 | // ÀÌ ¸ðµâ ³»¿¡¼ globalÇÏ°Ô »ç¿ëÇϰí ÀÖ´Â TSD. |
|---|
| 169 | // |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | //----------------------------------------------------------- |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | static BOOLEAN dmc_bInitCM; |
|---|
| 176 | // TRUEÀÌ¸é ºñµð¿À ŽºÅ© °ü·Ã ¸®¼Ò½º°¡ ÃʱâȵǾúÀ½. |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | UINT32 dmc_tickStarted; // cafrii 060720 add |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | BOOL dmc_bTestNoAux; // cafrii 060728 add for test |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | //----------------------------------------------------------- |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | #define ErrorString DMW_CDB_ErrString |
|---|
| 192 | // TLÀÇ DHL_RESULT¸¦ Æ÷ÇÔÇÏ¿© DMWÀÇ STATUS±îÁö ¿¡·¯¸¦ ¹®ÀÚ¿·Î º¯È¯ÇÏ´Â ÇÔ¼ö ġȯ. |
|---|
| 193 | // DMW_CDB_ErrStringÀº TLÀÇ error »ó¼ö°ª±îÁö ¸ðµÎ string 󸮸¦ ÇÒ ¼ö ÀÖ´Ù. |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | #if COMMENT |
|---|
| 201 | ________Config________(){} |
|---|
| 202 | #endif |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | // AudioChange ÇÒ¶§ »ç¿ëµÇ´Â command parameter block |
|---|
| 207 | typedef struct |
|---|
| 208 | { |
|---|
| 209 | UINT32 audioPID; |
|---|
| 210 | UINT32 pcrPID; |
|---|
| 211 | UINT32 audioType; |
|---|
| 212 | |
|---|
| 213 | } CmdParam_ChangeAudio; |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | // ChangeDislay¿¡¼ »ç¿ëµÇ´Â command parameter block |
|---|
| 217 | typedef struct |
|---|
| 218 | { |
|---|
| 219 | VOUT_COLOR color; |
|---|
| 220 | VOUT_FORMAT format; |
|---|
| 221 | VOUT_RATIO ratio; |
|---|
| 222 | |
|---|
| 223 | tDHL_DispARC adj; |
|---|
| 224 | AuxVideoSetting aux; |
|---|
| 225 | |
|---|
| 226 | } CmdParam_ChangeDisplay; |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | // cafrii 060519 add |
|---|
| 230 | // VideoResize¿¡¼ »ç¿ëµÇ´Â command parameter block |
|---|
| 231 | typedef struct |
|---|
| 232 | { |
|---|
| 233 | UINT16 x; |
|---|
| 234 | UINT16 y; |
|---|
| 235 | UINT16 w; |
|---|
| 236 | UINT16 h; |
|---|
| 237 | |
|---|
| 238 | } CmdParam_VideoResize; |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | // cafrii 060928 add |
|---|
| 242 | // |
|---|
| 243 | typedef struct |
|---|
| 244 | { |
|---|
| 245 | tDHL_DispARC adj; |
|---|
| 246 | UINT16 x, y, w, h; |
|---|
| 247 | |
|---|
| 248 | } CmdParam_AdjustScreen; |
|---|
| 249 | |
|---|
| 250 | |
|---|
| 251 | typedef struct |
|---|
| 252 | { |
|---|
| 253 | DMC_FN_DPC dpcfn; |
|---|
| 254 | UINT32 param1; |
|---|
| 255 | UINT32 param2; |
|---|
| 256 | UINT32 param3; |
|---|
| 257 | UINT32 param4; |
|---|
| 258 | // cafrii 070412, add 3 more params. total 4. |
|---|
| 259 | |
|---|
| 260 | } CmdParam_DPC; |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | //--------------------------------------------------------------- |
|---|
| 264 | // |
|---|
| 265 | // Forward Declarations here.. |
|---|
| 266 | // |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | #if COMMENT |
|---|
| 275 | ________Comm________(){} |
|---|
| 276 | #endif |
|---|
| 277 | |
|---|
| 278 | |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | //----------------------------------------------------------- |
|---|
| 282 | // Dmc_SendCommandEx |
|---|
| 283 | // ºñµð¿À ŽºÅ© (DmcTask)·Î command¸¦ º¸³½´Ù. |
|---|
| 284 | // ÇÊ¿äÇϸé response waitµµ ÇÑ´Ù. (bWaitForComplete°¡ TRUEÀ϶§) |
|---|
| 285 | // bCancelPrevCommand°¡ TRUEÀ̸é ÀÌÀü¿¡ º¸³½ ¸ðµç command¸¦ cancel½Ã۵µ·Ï |
|---|
| 286 | // cancel msg¸¦ ¸ÕÀú º¸³½´Ù. |
|---|
| 287 | // |
|---|
| 288 | |
|---|
| 289 | STATUS Dmc_SendCommandEx(DmcMsgType cmd, UINT32 param, |
|---|
| 290 | DMC_FN_CANCELFREE pfnFree, |
|---|
| 291 | BOOL bWaitForComplete, |
|---|
| 292 | DMC_FN_COMPLETED pfnCompleted, UINT32 userparam, |
|---|
| 293 | BOOL bCancelPrevCommand) |
|---|
| 294 | { |
|---|
| 295 | DmcMessage msg; |
|---|
| 296 | BOOL bUrgent = FALSE; |
|---|
| 297 | UINT32 cancelId1=0, cancelId2; // cafrii 040910 add |
|---|
| 298 | STATUS status = statusOK; |
|---|
| 299 | DHL_OS_SEMA_ID waitSem = 0; |
|---|
| 300 | |
|---|
| 301 | if (Dmc_IsDmcTask()) { |
|---|
| 302 | dprint(0, "!! Send dmc command from dmc task!\n"); |
|---|
| 303 | if (pfnFree && param) |
|---|
| 304 | (*pfnFree)(param); |
|---|
| 305 | return statusInvalidState; |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | memset(&msg, 0, sizeof(msg)); |
|---|
| 309 | |
|---|
| 310 | if (bCancelPrevCommand) |
|---|
| 311 | { |
|---|
| 312 | // ÀÌ Àü¿¡ º¸³½ ¸ðµç command¸¦ Ãë¼ÒÇϱâ À§Çؼ ¸ÕÀú cancel msg¸¦ º¸³½´Ù. |
|---|
| 313 | // |
|---|
| 314 | cancelId1 = doDmc_GetNewMultipleCancelIds(2); // 2°³ÀÇ ¿¬¼ÓµÈ cancel ID¸¦ ¾ò¾î¿Â´Ù. |
|---|
| 315 | // cancelId1ÀÌ Ã¹¹øÂ° cancel IDÀÌ´Ù. |
|---|
| 316 | |
|---|
| 317 | Dmc_SendCancelCommand(cancelId1); |
|---|
| 318 | |
|---|
| 319 | cancelId2 = doDmc_GetNextCancelId(cancelId1, 1); // ±× ´ÙÀ½ cancel ID¸¦ »ç¿ëÇÑ´Ù. |
|---|
| 320 | } |
|---|
| 321 | else { |
|---|
| 322 | cancelId2 = doDmc_GetNewCancelId(); |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | if (!Dmc_IsCommand(cmd)) { |
|---|
| 326 | #if DEVELOPMENT_BUILD |
|---|
| 327 | DHL_ASSERT(bWaitForComplete == FALSE, "event msg cannot be synchronous"); |
|---|
| 328 | #else |
|---|
| 329 | // event ÀÌ¸é¼ synchronous ¹æ½ÄÀ¸·Î È£ÃâÀÌ µÈ °æ¿ìÀÌ´Ù. |
|---|
| 330 | // À߸ø »ç¿ëµÈ ¿¹Àε¥, ±×³É ¿¡·¯ ¸®ÅÏÀ» ÇÒ ¼öµµ Àִµ¥, |
|---|
| 331 | // ±×³É wait_for_complete¸¦ ¹«½ÃÇϰí async 󸮸¦ Çϵµ·Ï ÇÏÀÚ. |
|---|
| 332 | // |
|---|
| 333 | // cafrii 080910 fix. |
|---|
| 334 | if (bWaitForComplete) { |
|---|
| 335 | dprint(0, "!! event sent in synchronous mode! act in async mode\n"); |
|---|
| 336 | |
|---|
| 337 | bWaitForComplete = FALSE; |
|---|
| 338 | } |
|---|
| 339 | #endif |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | if (bWaitForComplete) { |
|---|
| 343 | #if 0 // zooyouny 100629 : resuable semaphore »ç¿ë ¾ÈÇϵµ·Ï DHL¿¡¼ Áö¿ø ¾ÈÇÔ |
|---|
| 344 | // cafrii 070416 use reusable semaphore |
|---|
| 345 | waitSem = OS_CreateReuseSemaphore("", OS_SEM_FIFO, FALSE); |
|---|
| 346 | #else |
|---|
| 347 | waitSem = DHL_OS_CreateBinarySemaphore("", OS_SEM_FIFO, FALSE); |
|---|
| 348 | #endif |
|---|
| 349 | if (waitSem == 0) { |
|---|
| 350 | dprint(0, "!! wait sema4 create err\n"); |
|---|
| 351 | if (pfnFree && param) |
|---|
| 352 | (*pfnFree)(param); |
|---|
| 353 | return statusOutOfResource; |
|---|
| 354 | } |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | msg.type = cmd; |
|---|
| 358 | msg.param = param; // command parameter |
|---|
| 359 | msg.pfnResourceFree = pfnFree; |
|---|
| 360 | |
|---|
| 361 | msg.pfnCompleted = pfnCompleted; |
|---|
| 362 | msg.userParam = userparam; |
|---|
| 363 | |
|---|
| 364 | msg.bWaitForComplete = bWaitForComplete; |
|---|
| 365 | msg.cancelId = cancelId2; |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | if (bWaitForComplete) { |
|---|
| 369 | msg.pStatus = (UINT32 *)&status; |
|---|
| 370 | msg.waitSem = waitSem; |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | if (bCancelPrevCommand) |
|---|
| 374 | dprint(3, " send cancel cmd cid %d, send cmd '%d' cid %d\n", |
|---|
| 375 | cancelId1, cmd, cancelId2); |
|---|
| 376 | else |
|---|
| 377 | dprint(3, " send cmd '%d' cid %d\n", cmd, cancelId2); |
|---|
| 378 | |
|---|
| 379 | // todo |
|---|
| 380 | // urgent event/command¸¦ º¸³»´Â ¹æ¹ýÀ» Á¦°øÇÒ Çʿ䰡 Àִ°¡? |
|---|
| 381 | // -> cancel ±â´ÉÀ» Á¦°øÇϱ⠶§¹®¿¡ ±×·² ÇÊ¿ä´Â ¾øÀ½. |
|---|
| 382 | status = doDmc_AddUserMsg(&msg); |
|---|
| 383 | |
|---|
| 384 | if (status) { |
|---|
| 385 | dprint(0, "!! Send%sMessage error %d\n", bUrgent ? "Urgent" : "", status); |
|---|
| 386 | if (pfnFree && param) |
|---|
| 387 | (*pfnFree)(param); |
|---|
| 388 | return statusQueueFull; |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | // queue¿¡ Á¦´ë·Î add µÇ¾ú´Ù¸é ÀÌÁ¦ param ÈÄ󸮴 ´õÀÌ»ó À̰÷¿¡¼ Ã¥ÀÓÁöÁö ¾Ê´Â´Ù. |
|---|
| 392 | // |
|---|
| 393 | if (bWaitForComplete) { |
|---|
| 394 | |
|---|
| 395 | DHL_OS_TakeSemaphore(waitSem, DHL_TIMEOUT_FOREVER); |
|---|
| 396 | |
|---|
| 397 | dprint(2, ".. send_cmd end. result %d\n", status); |
|---|
| 398 | |
|---|
| 399 | #if 0 // zooyouny 100629: reusable semaphore DHL¿¡¼ Áö¿ø ¾ÈÇÔ |
|---|
| 400 | // cafrii 070416 use reusable semaphore |
|---|
| 401 | OS_DeleteReuseSemaphore(waitSem); |
|---|
| 402 | #else |
|---|
| 403 | DHL_OS_DeleteSemaphore(waitSem); |
|---|
| 404 | #endif |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | return status; |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | /* |
|---|
| 412 | Dmc_SendCommandExÀÇ °£¼ÒÈ ¹öÀü. |
|---|
| 413 | */ |
|---|
| 414 | STATUS Dmc_SendCommand(DmcMsgType cmd, UINT32 param, BOOL bCancelPrevCommand) |
|---|
| 415 | { |
|---|
| 416 | return Dmc_SendCommandEx(cmd, param, NULL, |
|---|
| 417 | TRUE, // wait mode |
|---|
| 418 | NULL, 0, // no user callback |
|---|
| 419 | bCancelPrevCommand); |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | /* |
|---|
| 424 | ÁÖ·Î Driver callback, ISR µî¿¡¼ DMC task·Î À̺¥Æ®¸¦ Àü´ÞÇÒ ¶§ |
|---|
| 425 | »ç¿ëÇÏ´Â API. |
|---|
| 426 | */ |
|---|
| 427 | STATUS Dmc_DeferEvent(DmcMsgType event, UINT32 param, |
|---|
| 428 | DMC_FN_CANCELFREE pfnFree, |
|---|
| 429 | DMC_FN_COMPLETED pfnDpc, UINT32 userParam) |
|---|
| 430 | { |
|---|
| 431 | if (Dmc_IsCommand(event)) |
|---|
| 432 | return statusInvalidArgument; |
|---|
| 433 | |
|---|
| 434 | return Dmc_SendCommandEx(event, param, pfnFree, |
|---|
| 435 | FALSE, // no wait mode.. event should not be synchronous!! |
|---|
| 436 | pfnDpc, userParam, |
|---|
| 437 | FALSE); // do not cancel prev event.. |
|---|
| 438 | } |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | // cafrii 060831 add |
|---|
| 442 | // cafrii 090120, this function is called with int disabled. so removing printf encouraged. |
|---|
| 443 | void Dmc_DeleteDmcMessage(DmcMessage *pmsg, STATUS result) |
|---|
| 444 | { |
|---|
| 445 | if (Dmc_IsCommand(pmsg->type) && pmsg->pfnCompleted) { |
|---|
| 446 | (pmsg->pfnCompleted)(result, pmsg->userParam, NULL); |
|---|
| 447 | // Äݹé ÀÎÀÚ¸¦ ÅëÇÑ ¿¡·¯ ¸®ÅÏ.. |
|---|
| 448 | } |
|---|
| 449 | |
|---|
| 450 | if (pmsg->pfnResourceFree) { |
|---|
| 451 | //dprint(3, " free parameter 0x%x\n", pmsg->param); |
|---|
| 452 | pmsg->pfnResourceFree(pmsg->param); |
|---|
| 453 | } |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | //----------------------------------------------------------- |
|---|
| 457 | // Dmc_CheckCancel |
|---|
| 458 | // |
|---|
| 459 | // ÀÌ ÇÔ¼ö´Â ¹Ýµå½Ã Dmc task¿¡¼¸¸ ºÒ·Á¾ß ÇÑ´Ù. |
|---|
| 460 | // ±×·¯³ª staticÀÎ doDmc_CheckCancel°ú ´Þ¸® ¿ÜºÎ¿¡¼ ºÎ¸¦ ¼ö ÀÖµµ·Ï extern µÇ´Â public APIÀÌ´Ù. |
|---|
| 461 | // ÀÌ ÇÔ¼öÀÇ ¿ëµµ´Â DMC Task¿¡¼ °¢Á¾ applicationÀ¸·ÎÀÇ callback ·çƾ¿¡¼ »ç¿ëÇÑ´Ù. |
|---|
| 462 | // |
|---|
| 463 | BOOL Dmc_CheckCancel() |
|---|
| 464 | { |
|---|
| 465 | // This function should be called in DMC task. |
|---|
| 466 | // Application can use this function to check whether current msg is cancelled or not. |
|---|
| 467 | // DMC routines can use doDmc_CheckCancel() directly. |
|---|
| 468 | // |
|---|
| 469 | if (dmc_TaskID != Dmc_GetCurrentTaskID()) { |
|---|
| 470 | dprint(0, "!! Dmc_CheckCancel() should be called only in DmcTask.\n"); |
|---|
| 471 | return FALSE; // return NOT_CANCELLED; |
|---|
| 472 | } |
|---|
| 473 | |
|---|
| 474 | return doDmc_CheckCancel(); |
|---|
| 475 | } |
|---|
| 476 | |
|---|
| 477 | |
|---|
| 478 | |
|---|
| 479 | tDHL_TSD *Dmc_GetCurrentTsd() |
|---|
| 480 | { |
|---|
| 481 | return dmc_tsd; |
|---|
| 482 | } |
|---|
| 483 | |
|---|
| 484 | |
|---|
| 485 | |
|---|
| 486 | // Dmc_GetCurrentTaskID |
|---|
| 487 | // ÇöÀç Task ID¸¦ ¸®ÅÏÇÑ´Ù. |
|---|
| 488 | // |
|---|
| 489 | DHL_OS_TASK_ID Dmc_GetCurrentTaskID() |
|---|
| 490 | { |
|---|
| 491 | return DHL_OS_GetTaskID(); |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | // Dmc_IsDmcTask |
|---|
| 496 | // ÇöÀç task °¡ DMC task À̸é TRUE¸¦ ¸®ÅÏÇÑ´Ù. |
|---|
| 497 | // |
|---|
| 498 | BOOL Dmc_IsDmcTask() |
|---|
| 499 | { |
|---|
| 500 | return (Dmc_GetCurrentTaskID() == dmc_TaskID) ? TRUE : FALSE; |
|---|
| 501 | } |
|---|
| 502 | |
|---|
| 503 | |
|---|
| 504 | #if !SUPPORT_ETC_API_SYNC |
|---|
| 505 | |
|---|
| 506 | /* |
|---|
| 507 | Dmc_SendCommand ¿Í ´Þ¸® DMC task·Î defer ½ÃŰÁö ¾Ê°í |
|---|
| 508 | Á÷Á¢ È£ÃâÇÒ ¶§ »ç¿ëÇÏ´Â API. |
|---|
| 509 | |
|---|
| 510 | ÀϹÝÀûÀ¸·Î ±âÁ¸¿¡ SendCommand¸¦ wait mode·Î cancel ¾øÀÌ µ¿ÀÛÇÏ´Â °æ¿ì¿´´Ù¸é |
|---|
| 511 | ÇöÀçÀÇ task¿¡¼ Á÷Á¢ ½ÇÇàÀÌ °¡´ÉÇÏ´Ù. |
|---|
| 512 | |
|---|
| 513 | */ |
|---|
| 514 | STATUS Dmc_ExecuteCommand(DmcMsgType cmd, UINT32 param, STATUS (*fn)(DmcMessage *)) |
|---|
| 515 | { |
|---|
| 516 | DmcMessage msg; |
|---|
| 517 | STATUS status = statusInvalidArgument; |
|---|
| 518 | |
|---|
| 519 | memset(&msg, 0, sizeof(msg)); |
|---|
| 520 | |
|---|
| 521 | msg.type = cmdChangeDisplay; |
|---|
| 522 | msg.param = param; // command parameter |
|---|
| 523 | msg.cancelId = 0; // cancelÇÒ¶§ »ç¿ëµÇ´Â ÀϷùøÈ£. |
|---|
| 524 | msg.bWaitForComplete = TRUE; |
|---|
| 525 | |
|---|
| 526 | if (fn) |
|---|
| 527 | status = (*fn)(&msg); |
|---|
| 528 | |
|---|
| 529 | return status; |
|---|
| 530 | } |
|---|
| 531 | |
|---|
| 532 | |
|---|
| 533 | #endif // !SUPPORT_ETC_API_SYNC |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | #if COMMENT |
|---|
| 538 | _______SubAPI_1_______(){} |
|---|
| 539 | #endif |
|---|
| 540 | |
|---|
| 541 | |
|---|
| 542 | |
|---|
| 543 | static STATUS doDmc_CmdExtInputCapture(DmcMessage *pmsg) |
|---|
| 544 | { |
|---|
| 545 | STATUS status; |
|---|
| 546 | CaptureParam *pCapParam; |
|---|
| 547 | |
|---|
| 548 | dprint(1, "cmdExtInputCapture: cid %d\n", pmsg->cancelId); |
|---|
| 549 | |
|---|
| 550 | pCapParam = (CaptureParam *) pmsg->param; |
|---|
| 551 | if (!pCapParam) { |
|---|
| 552 | dprint(0, " !! capParam NULL! stop!\n"); |
|---|
| 553 | status = statusInvalidArgument; |
|---|
| 554 | goto label_end_tune; |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | // ±âÁ¸ ºñµð¿À°¡ µ¿ÀÛÁßÀÌ¸é ´Ý´Â´Ù. |
|---|
| 558 | doDmc_Stop(); |
|---|
| 559 | |
|---|
| 560 | if (doDmc_CheckCancel()) goto label_cancelled; |
|---|
| 561 | |
|---|
| 562 | |
|---|
| 563 | dprint(2, "\tstart analog video..\n"); |
|---|
| 564 | |
|---|
| 565 | // arzhna, 100203 |
|---|
| 566 | // CA PMT¸¦ Àü´ÞÇϱâ À§ÇÑ callback È£Ãâ |
|---|
| 567 | doDmc_Notify(DMC_NOTIFY_CaPmt, (UINT32)NULL); |
|---|
| 568 | |
|---|
| 569 | status = doDmc_StartAnalog(pCapParam); |
|---|
| 570 | if (status) { |
|---|
| 571 | dprint(0, "!! err in start analog, err %d. stop!\n", status); |
|---|
| 572 | } |
|---|
| 573 | else { |
|---|
| 574 | doDmc_UpdateProgramInfoAnalog(0, |
|---|
| 575 | pCapParam->input_video, pCapParam->input_audio); |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | goto label_end_tune; |
|---|
| 579 | |
|---|
| 580 | |
|---|
| 581 | label_cancelled: |
|---|
| 582 | status = statusCancelled; |
|---|
| 583 | goto label_end_tune; |
|---|
| 584 | |
|---|
| 585 | |
|---|
| 586 | label_end_tune: //------------------------------------------------------------ |
|---|
| 587 | |
|---|
| 588 | if (pCapParam) |
|---|
| 589 | DHL_OS_Free((void**)&pCapParam); // caller task¿¡¼ AllocÇÑ ¸Þ¸ð¸®ÀÌ´Ù. "¹Ýµå½Ã" free ½ÃŰÀÚ. |
|---|
| 590 | |
|---|
| 591 | return status; |
|---|
| 592 | } |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | |
|---|
| 597 | static STATUS doDmc_CmdStop(DmcMessage *pmsg) |
|---|
| 598 | { |
|---|
| 599 | dprint(1, "cmdVideoStop: cid %d\n", pmsg->cancelId); |
|---|
| 600 | |
|---|
| 601 | doDmc_Stop(); |
|---|
| 602 | // analog/digital °ø¿ë ÇÔ¼ö |
|---|
| 603 | |
|---|
| 604 | return statusOK; |
|---|
| 605 | } |
|---|
| 606 | |
|---|
| 607 | |
|---|
| 608 | static STATUS doDmc_CmdRestartVideo(DmcMessage *pmsg) |
|---|
| 609 | { |
|---|
| 610 | STATUS status; |
|---|
| 611 | ProgramAVInfo *av; |
|---|
| 612 | |
|---|
| 613 | if (pmsg == NULL) |
|---|
| 614 | dprint(1, "cmdRestartVideo: called from DMC context..\n"); |
|---|
| 615 | else |
|---|
| 616 | dprint(1, "cmdRestartVideo: cid %d\n", pmsg->cancelId); |
|---|
| 617 | |
|---|
| 618 | av = Dmc_LockAVMutex(); |
|---|
| 619 | |
|---|
| 620 | if (dmc_TaskID != Dmc_GetCurrentTaskID()) { |
|---|
| 621 | dprint(0, "!! doDmc_CmdRestartVideo should be called only in DmcTask.\n"); |
|---|
| 622 | status = statusError; |
|---|
| 623 | goto label_end_tune; |
|---|
| 624 | } |
|---|
| 625 | |
|---|
| 626 | if (av->active == FALSE) { |
|---|
| 627 | dprint(0, "!! cannot restart video. currently no program\n"); |
|---|
| 628 | status = statusError; |
|---|
| 629 | goto label_end_tune; |
|---|
| 630 | } |
|---|
| 631 | |
|---|
| 632 | if (doDmc_CheckCancel()) goto label_cancelled; |
|---|
| 633 | //---------------- |
|---|
| 634 | |
|---|
| 635 | if (av->analog) // NTSC, or DV |
|---|
| 636 | { |
|---|
| 637 | int prev_rf; |
|---|
| 638 | CaptureParam capParam; |
|---|
| 639 | |
|---|
| 640 | // StopÀ» ½Ã۸é pav Á¤º¸°¡ ¼Ò½ÇµÉ ¼ö ÀÖÀ¸¹Ç·Î ÇÊ¿äÇÑ Á¤º¸´Â |
|---|
| 641 | // ¹Ì¸® backupÀ» ÇØ µÎ¾î¾ß ÇÒ °ÍÀÌ´Ù. |
|---|
| 642 | |
|---|
| 643 | memset(&capParam, 0, sizeof(capParam)); |
|---|
| 644 | |
|---|
| 645 | prev_rf = av->rf; |
|---|
| 646 | |
|---|
| 647 | capParam.input_video = av->input_video; |
|---|
| 648 | capParam.input_audio = av->input_audio; |
|---|
| 649 | |
|---|
| 650 | doDmc_Stop(); |
|---|
| 651 | |
|---|
| 652 | dprint(2, "\trestart analog video..\n"); |
|---|
| 653 | |
|---|
| 654 | status = doDmc_StartAnalog(&capParam); |
|---|
| 655 | if (status) { |
|---|
| 656 | status = statusAnalogError; |
|---|
| 657 | dprint(0, "!! err in start analog, err %d. stop!\n", status); |
|---|
| 658 | } |
|---|
| 659 | else { |
|---|
| 660 | doDmc_UpdateProgramInfoAnalog(prev_rf, |
|---|
| 661 | capParam.input_video, capParam.input_audio); |
|---|
| 662 | } |
|---|
| 663 | |
|---|
| 664 | goto label_end_tune; // ¾Æ³¯·Î±× ä³ÎÀº À̰ÍÀ¸·Î ¸ðµç ÀÛ¾÷ÀÌ ³¡³´Ù. |
|---|
| 665 | } |
|---|
| 666 | else |
|---|
| 667 | { |
|---|
| 668 | ProgramAVInfo pgm_backup, *pgm = &pgm_backup; |
|---|
| 669 | *pgm = *av; |
|---|
| 670 | |
|---|
| 671 | doDmc_StopDigital(FALSE, FALSE); // do not cancel monitors |
|---|
| 672 | // PsiControlµµ »èÁ¦ÇÏÁö ¾Ê°í, dmc_pat/pmtµµ »èÁ¦ÇÏÁö ¾Ê´Â´Ù. |
|---|
| 673 | // ±×³É VideoContext¸¸ ³»¸°´Ù. |
|---|
| 674 | |
|---|
| 675 | // important change/major change À̺¥Æ®°¡ ¿Ã¶§ restart video ¸í·ÉÀ» »ç¿ëÇÏ´Â |
|---|
| 676 | // °æ¿ì°¡ ¸¹´Ù. |
|---|
| 677 | // ±×·¯¹Ç·Î ÀÌ ½ÃÁ¡¿¡¼ queue¿¡ ¿©·¯°³ ½×¿© ÀÖ´Â important change, major change µîÀÇ |
|---|
| 678 | // event´Â ¾ø¾Ö¹ö¸®´Â°Ô ÁÁ´Ù. |
|---|
| 679 | // ±×·¡¾ß restart ÈÄ¿¡ ´Ù½Ã ÀÌ·± À̺¥Æ®µé¿¡ ÀÇÇØ ´Ù½Ã restartµÉ ÀÏÀÌ ¾ø±â ¶§¹®. |
|---|
| 680 | // ´Ü cidÀÇ º¯°æ¿¡ µû¸¥ cancel IDÀÇ º¯°æ, ÀÌ·Î ÀÎÇÑ CheckCancel ÇÔ¼öÀÇ µ¿ÀÛ¿¡ |
|---|
| 681 | // ¿µÇâÀº ¾ø´ÂÁö Ã¼Å©ÇØ ºÁ¾ß ÇÑ´Ù. |
|---|
| 682 | // |
|---|
| 683 | if (1) { |
|---|
| 684 | //dprint(2, "\t Delete some event message..\n"); |
|---|
| 685 | doDmc_DeleteMsg(evtVideoImportantChange); |
|---|
| 686 | doDmc_DeleteMsg(evtVideoMajorChange); |
|---|
| 687 | } |
|---|
| 688 | |
|---|
| 689 | status = doDmc_StartDigital(pgm->video_pid, pgm->audio_pid, pgm->pcr_pid, (DMC_VIDEO_CACHE)0, pgm->video_type, pgm->audio_type); |
|---|
| 690 | |
|---|
| 691 | if (status == statusOK) |
|---|
| 692 | { |
|---|
| 693 | doDmc_UpdateProgramInfoDigital(pgm->rf, pgm->mod, pgm->method, |
|---|
| 694 | pgm->major, pgm->minor, pgm->program_number, |
|---|
| 695 | pgm->video_pid, pgm->audio_pid, pgm->pcr_pid, pgm->video_type, pgm->audio_type); |
|---|
| 696 | |
|---|
| 697 | goto label_digital_success; |
|---|
| 698 | } |
|---|
| 699 | else { |
|---|
| 700 | doDmc_ClearProgramInfo(); |
|---|
| 701 | } |
|---|
| 702 | } |
|---|
| 703 | |
|---|
| 704 | |
|---|
| 705 | label_digital_success: //------------------------------------------------------------ |
|---|
| 706 | |
|---|
| 707 | if (doDmc_CheckCancel()) goto label_cancelled; |
|---|
| 708 | |
|---|
| 709 | // ¾Õ¿¡¼ MonitorµéÀ» free½ÃŰÁö ¾Ê¾Ò´Ù¸é ¿©±â¿¡¼ ÇÒ ´Ù½Ã ÇÒ ÇÊ¿ä´Â ¾ø´Ù. |
|---|
| 710 | // ±âÁ¸ÀÇ monitorµéÀ» °¡´ÉÇϸé Àç»ç¿ëÇÑ´Ù. |
|---|
| 711 | // |
|---|
| 712 | doDmc_StartFinalPsiMonitor(FALSE); |
|---|
| 713 | goto label_end_tune; |
|---|
| 714 | |
|---|
| 715 | label_cancelled: |
|---|
| 716 | status = statusCancelled; |
|---|
| 717 | goto label_end_tune; |
|---|
| 718 | |
|---|
| 719 | label_end_tune: |
|---|
| 720 | |
|---|
| 721 | Dmc_UnlockAVMutex(); |
|---|
| 722 | |
|---|
| 723 | return status; |
|---|
| 724 | } |
|---|
| 725 | |
|---|
| 726 | |
|---|
| 727 | static STATUS doDmc_CmdEnqueueDPC(DmcMessage *pmsg) |
|---|
| 728 | { |
|---|
| 729 | UINT32 *cmdParam = (UINT32 *)pmsg->param; |
|---|
| 730 | DMC_FN_DPC dpcfn; |
|---|
| 731 | UINT32 arg1, arg2, arg3, arg4; |
|---|
| 732 | |
|---|
| 733 | dprint(1, "cmdEnqueuDPC: cid %d\n", pmsg->cancelId); |
|---|
| 734 | |
|---|
| 735 | dprint(2, "\t param: %x, callback fn %x\n", pmsg->param, pmsg->pfnCompleted); |
|---|
| 736 | |
|---|
| 737 | dpcfn = (DMC_FN_DPC) cmdParam[0]; |
|---|
| 738 | arg1 = cmdParam[1]; |
|---|
| 739 | arg2 = cmdParam[2]; |
|---|
| 740 | arg3 = cmdParam[3]; |
|---|
| 741 | arg4 = cmdParam[4]; |
|---|
| 742 | |
|---|
| 743 | dprint(3, "\t free paramblk %x\n", cmdParam); |
|---|
| 744 | DHL_OS_Free((void**)&cmdParam); |
|---|
| 745 | //Á¦´ë·Î ÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ.. |
|---|
| 746 | //if (pmsg->pfnResourceFree) |
|---|
| 747 | // (pmsg->pfnResourceFree)((UINT32)cmdParam); |
|---|
| 748 | |
|---|
| 749 | dprint(2, "\t DPC function %x, arg %x %x %x %x\n", dpcfn, arg1, arg2, arg3, arg4); |
|---|
| 750 | if (dpcfn) |
|---|
| 751 | dpcfn(arg1, arg2, arg3, arg4); |
|---|
| 752 | |
|---|
| 753 | // tune callbackÀº tuning°ü·Ã command¿¡¼¸¸ error¸¦ ¸®ÅÏÇÏ´Â °ÍÀÓ. |
|---|
| 754 | // ÀÏ¹Ý command¿¡´Â ÇØ´çµÇÁö ¾Ê´Â´Ù. |
|---|
| 755 | //doDmc_ReturnTuneResult(event->fn, statusOK, (UINT32)event->param, event->userParam); |
|---|
| 756 | |
|---|
| 757 | return statusOK; |
|---|
| 758 | } |
|---|
| 759 | |
|---|
| 760 | |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | #if COMMENT |
|---|
| 764 | _______SubAPI_2_______(){} |
|---|
| 765 | #endif |
|---|
| 766 | |
|---|
| 767 | |
|---|
| 768 | // À̰÷ÀÇ ÇÔ¼öµéÀº ±âÁ¸¿¡´Â DMC task¿¡¼ ½ÇÇàµÇ¾úÀ¸³ª |
|---|
| 769 | // HAL ±¸Á¶·Î º¯°æµÇ¸é¼ Á÷Á¢ client task¿¡¼ ½ÇÇàµÈ´Ù. |
|---|
| 770 | // |
|---|
| 771 | // |
|---|
| 772 | |
|---|
| 773 | |
|---|
| 774 | /* |
|---|
| 775 | Dmc_ChangeDisplayÀÇ sub ½ÇÇà ÇÔ¼ö. |
|---|
| 776 | */ |
|---|
| 777 | static STATUS doDmc_CmdChangeDisplay(DmcMessage *pmsg) |
|---|
| 778 | { |
|---|
| 779 | DHL_RESULT dhlResult; |
|---|
| 780 | |
|---|
| 781 | tDHL_DispColorSpace videoOutputColor; //video output |
|---|
| 782 | tDHL_DispFormat displayFormat; //video output format |
|---|
| 783 | // tDHL_DispAspectRatio AspectRatio; //display aspect ration |
|---|
| 784 | // tDHL_DispARC Adjustment; |
|---|
| 785 | // DHL_DISP_AUXSETTING AuxSetting; |
|---|
| 786 | |
|---|
| 787 | CmdParam_ChangeDisplay *arg = (CmdParam_ChangeDisplay *)pmsg->param; |
|---|
| 788 | |
|---|
| 789 | dprint(1, "cmdChangeDisplay: cid %d\n", pmsg->cancelId); |
|---|
| 790 | |
|---|
| 791 | videoOutputColor = arg->color == VOUT_YPBPR ? eDHL_DISP_CS_YCBCR : eDHL_DISP_CS_RGB; |
|---|
| 792 | displayFormat = arg->format == VOUT_480I ? eDHL_DISP_720x480i : |
|---|
| 793 | arg->format == VOUT_480P ? eDHL_DISP_720x480p : |
|---|
| 794 | arg->format == VOUT_720P ? eDHL_DISP_1280x720p : |
|---|
| 795 | arg->format == VOUT_1080I ? eDHL_DISP_1920x1080i : eDHL_DISP_1920x1080i; |
|---|
| 796 | |
|---|
| 797 | // AspectRatio = arg->ratio == VOUT_NARROW ? eDHL_DISP_ASPECT_4_3 : eDHL_DISP_ASPECT_16_9; |
|---|
| 798 | |
|---|
| 799 | // Adjustment = (tDHL_DispARC) arg->adj; |
|---|
| 800 | // AuxSetting = (DHL_DISP_AUXSETTING) arg->aux; |
|---|
| 801 | |
|---|
| 802 | // cafrii 060728 test |
|---|
| 803 | if (dmc_bTestNoAux) { |
|---|
| 804 | dprint(0, "!! no aux test mode\n"); |
|---|
| 805 | // AuxSetting = noAuxVideo; |
|---|
| 806 | } |
|---|
| 807 | |
|---|
| 808 | // todo.. check point. |
|---|
| 809 | // ¾Æ³¯·Î±×ÀÏ °æ¿ì.. |
|---|
| 810 | // audio only serviceÀÎ °æ¿ì.. |
|---|
| 811 | // |
|---|
| 812 | // video°¡ stop µÇ¾î ÀÖ´Â °æ¿ì.. --> SetSingle.. Àº ³ªÁß¿¡ ÁøÂ¥ ½ÃÀÛÇÒ¶§·Î ¹Ì·ïÁø´Ù. |
|---|
| 813 | // |
|---|
| 814 | |
|---|
| 815 | // cafrii 060831 add comment |
|---|
| 816 | // ÀϹÝÀûÀ¸·Î change display´Â wait mode·Î È£ÃâµÇ±â ¶§¹®¿¡ |
|---|
| 817 | // pfnResourceFree¸¦ »ç¿ëÇÏÁö´Â ¾Ê´Â´Ù. |
|---|
| 818 | // ¸¸¾à¿¡ ³ªÁß¿¡ no-wait ¸ðµå·Î »ç¿ëÇÒ °æ¿ì¸¦ ´ëºñÇØ¼ |
|---|
| 819 | // freeÇÏ´Â Äڵ带 È£ÃâÇØÁØ´Ù. |
|---|
| 820 | // |
|---|
| 821 | if (pmsg->pfnResourceFree) |
|---|
| 822 | (pmsg->pfnResourceFree)((UINT32)arg); |
|---|
| 823 | |
|---|
| 824 | #if 0 |
|---|
| 825 | // cafrii 060718 delete, ChangeVideoFormat¿¡¼ ¸ðµÎ ó¸®. |
|---|
| 826 | |
|---|
| 827 | // »ç¿ëÀÚÀÇ ¿ä±¸´ë·Î display¸¦ ¼³Á¤ÇÏ´Â °ÍÀ̱⠶§¹®¿¡ |
|---|
| 828 | // ´Ù½Ã callbackÀ¸·Î È®ÀÎÇÒ Çʿ䰡 ¾ø´Ù. |
|---|
| 829 | // |
|---|
| 830 | //doDmc_ProcessScreenAdjustment(); |
|---|
| 831 | DHL_AV_SetScreenAdjustment(Adjustment, NULL); |
|---|
| 832 | #endif |
|---|
| 833 | |
|---|
| 834 | #if 1 |
|---|
| 835 | dhlResult = DHL_AV_DispSetFormat(eDHL_DISP_PORT_COMPONENT, displayFormat, videoOutputColor); |
|---|
| 836 | |
|---|
| 837 | #else |
|---|
| 838 | dhlResult = DHL_AV_ChangeVideoFormat(VideoOutput, VidOutFormat, |
|---|
| 839 | AspectRatio); |
|---|
| 840 | |
|---|
| 841 | // if error occurs, there is NO CHANGE in display setting since last good setting. |
|---|
| 842 | // (last successful display setting is kept) |
|---|
| 843 | // caller should check this err value and do some treatment. (retry or give-up) |
|---|
| 844 | #endif |
|---|
| 845 | |
|---|
| 846 | return dhlResult ? statusError : statusOK; |
|---|
| 847 | } |
|---|
| 848 | |
|---|
| 849 | /* |
|---|
| 850 | Dmc_ChangeVideoAdjustment ÀÇ sub ½ÇÇà ÇÔ¼ö. |
|---|
| 851 | */ |
|---|
| 852 | static STATUS doDmc_CmdChangeVideoAdjustment(DmcMessage *pmsg) |
|---|
| 853 | { |
|---|
| 854 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 855 | tDHL_DispARC adj_hd = (tDHL_DispARC) (pmsg->param & 0xffff); |
|---|
| 856 | tDHL_DispARC adj_sd = (tDHL_DispARC) ((pmsg->param >> 16) & 0xffff); |
|---|
| 857 | |
|---|
| 858 | dprint(1, "cmdVideoAdjustment: cid %d, adj_hd %d, adj_sd %d\n", pmsg->cancelId, adj_hd, adj_sd); |
|---|
| 859 | |
|---|
| 860 | #if 1 |
|---|
| 861 | DHL_AV_VideoSetARC(adj_hd, adj_sd); |
|---|
| 862 | #else |
|---|
| 863 | // chjeon 091222 |
|---|
| 864 | // ARC Àû¿ëÀ» SD¿Í HD Ãâ·Â¿¡ µ¿½Ã¿¡ Àû¿ëÇÑ´Ù. |
|---|
| 865 | dhlResult = DHL_AV_ChangeVideoAdjustment(eDHL_DISP_TYPE_HD, adj_hd, NULL); |
|---|
| 866 | dhlResult = DHL_AV_ChangeVideoAdjustment(eDHL_DISP_TYPE_SD, adj_sd, NULL); |
|---|
| 867 | #endif |
|---|
| 868 | return dhlResult ? statusError : statusOK; |
|---|
| 869 | } |
|---|
| 870 | |
|---|
| 871 | /* |
|---|
| 872 | Dmc_AdjustVideoScreen ÀÇ sub ½ÇÇà ÇÔ¼ö. |
|---|
| 873 | */ |
|---|
| 874 | static STATUS doDmc_CmdAdjustScreen(DmcMessage *pmsg) |
|---|
| 875 | { |
|---|
| 876 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 877 | CmdParam_AdjustScreen *arg = (CmdParam_AdjustScreen *) pmsg->param; |
|---|
| 878 | DHL_Rect rect; |
|---|
| 879 | |
|---|
| 880 | dprint(1, "cmdAdjustScreen: cid %d\n", pmsg->cancelId); |
|---|
| 881 | |
|---|
| 882 | #if 0 |
|---|
| 883 | SETRECT(&rect, arg->x, arg->y, arg->w, arg->h); |
|---|
| 884 | dhlResult = DHL_AV_ChangeVideoAdjustment(eDHL_DISP_TYPE_HD, arg->adj, &rect); |
|---|
| 885 | #else |
|---|
| 886 | dhlResult = DHL_AV_VideoResize(0, arg->x, arg->y, arg->w, arg->h); |
|---|
| 887 | #endif |
|---|
| 888 | return dhlResult ? statusError : statusOK; |
|---|
| 889 | } |
|---|
| 890 | |
|---|
| 891 | |
|---|
| 892 | /* |
|---|
| 893 | Dmc_ResizeVideo ÀÇ sub ½ÇÇà ÇÔ¼ö. |
|---|
| 894 | */ |
|---|
| 895 | static STATUS doDmc_CmdVideoResize(DmcMessage *pmsg) |
|---|
| 896 | { |
|---|
| 897 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 898 | CmdParam_VideoResize *arg = (CmdParam_VideoResize *) pmsg->param; |
|---|
| 899 | |
|---|
| 900 | dprint(1, "cmdVideoResize: cid %d\n", pmsg->cancelId); |
|---|
| 901 | |
|---|
| 902 | dhlResult = DHL_AV_VideoResize(0, arg->x, arg->y, arg->w, arg->h); |
|---|
| 903 | |
|---|
| 904 | return dhlResult ? statusError : statusOK; |
|---|
| 905 | } |
|---|
| 906 | |
|---|
| 907 | |
|---|
| 908 | |
|---|
| 909 | #if COMMENT |
|---|
| 910 | ________Task____________(){} |
|---|
| 911 | #endif |
|---|
| 912 | |
|---|
| 913 | void tDmc_Task(INT32 arg) |
|---|
| 914 | { |
|---|
| 915 | DmcMessage msg; |
|---|
| 916 | STATUS status; |
|---|
| 917 | |
|---|
| 918 | while(1) |
|---|
| 919 | { |
|---|
| 920 | status = statusOK; |
|---|
| 921 | |
|---|
| 922 | //------------------------- User Message ó¸® ÄÚµå -------------------------------- |
|---|
| 923 | // |
|---|
| 924 | // ÇöÀç »óÅ¿¡¼ ¸ðµç DmcQMsg°¡ UserMsgQ·Î À̵¿µÇ¾ú´Ù. |
|---|
| 925 | // |
|---|
| 926 | //doDmc_PrintUserMsgs(); |
|---|
| 927 | // cafrii 040910 add, UserMsgQÀÇ ¸ðµç msg¿¡ ´ëÇØ cid Á¤º¸¸¦ Ç¥½ÃÇÑ´Ù. |
|---|
| 928 | |
|---|
| 929 | if (SCN_ScanRunning()) |
|---|
| 930 | { |
|---|
| 931 | status = doDmc_GetUserMsg(&msg, 50); |
|---|
| 932 | if (status != statusOK) { |
|---|
| 933 | SCN_ScanTask(); |
|---|
| 934 | continue; |
|---|
| 935 | } |
|---|
| 936 | } |
|---|
| 937 | else |
|---|
| 938 | { |
|---|
| 939 | // º°µµÀÇ background idle ÀÛ¾÷ÀÌ ¾øÀ» °æ¿ì¿£ wait foreverÇÑ´Ù. |
|---|
| 940 | status = doDmc_GetUserMsg(&msg, 0xFFFFFFFF); // wait forever.. |
|---|
| 941 | if (status) { |
|---|
| 942 | dprint(0, "!! No message in UserMsgQueue ??\n"); |
|---|
| 943 | DHL_OS_Delay(100); |
|---|
| 944 | continue; // no message. |
|---|
| 945 | } |
|---|
| 946 | } |
|---|
| 947 | |
|---|
| 948 | if (doDmc_RefreshCancelQue()) // °¡Àå ¸¶Áö¸·À¸·Î µé¾î¿Â cancel request ID¸¦ ¾ò´Â´Ù. |
|---|
| 949 | { |
|---|
| 950 | // cancel command°¡ ¿À¸é ÇöÀç ÁøÇà ÁßÀÎ scanµµ ÁßÁöÇÑ´Ù. |
|---|
| 951 | if (SCN_ScanRunning()) { |
|---|
| 952 | DmcMessage msg; |
|---|
| 953 | memset(&msg, 0, sizeof(DmcMessage)); |
|---|
| 954 | msg.param = TRUE; // bUpdate |
|---|
| 955 | dprint(2, "\t new cancel %d. stop scan.\n", doDmc_GetLastCancelId()); |
|---|
| 956 | status = SCN_ScanStop(&msg); |
|---|
| 957 | // ignore status value because this is cancel. |
|---|
| 958 | } |
|---|
| 959 | } |
|---|
| 960 | |
|---|
| 961 | dprint(2, "\t %s (%d) cid %d (last %d)\n", Dmc_MsgString(msg.type), msg.type, |
|---|
| 962 | msg.cancelId, doDmc_GetLastCancelId()); |
|---|
| 963 | |
|---|
| 964 | if (doDmc_IsCancelledMsg(msg.cancelId)) |
|---|
| 965 | { |
|---|
| 966 | dprint(1, "!! %s %s cid %d canceled by cid %d\n", |
|---|
| 967 | Dmc_IsCommand(msg.type) ? "command" : "event", Dmc_MsgString(msg.type), |
|---|
| 968 | msg.cancelId, doDmc_GetLastCancelId()); |
|---|
| 969 | |
|---|
| 970 | // command°¡ ¾Æ´Ñ eventÀÇ °æ¿ì¿¡´Â event.fn °ªÀÌ NULLÀϰÍÀÌ´Ù. |
|---|
| 971 | // ÀÌ °æ¿ì¿¡´Â callback¸¦ ºÎ¸£Áö ¾Ê´Â´Ù. |
|---|
| 972 | |
|---|
| 973 | // cafrii 091222 comment |
|---|
| 974 | // ÇöÀç ¾î¶² commandÀÎÁö ±¸ºÐÇÏÁö ¾ÊÀº »óÅÂÀ̹ǷΠ¸¶Áö¸· ÀÎÀÚ¸¦ NULL·Î ÁÙ ¼ö ¹Û¿¡ ¾øÀ½. |
|---|
| 975 | // °¢ complete callback ÇÔ¼ö ³»¿¡¼ null üũ ÇÊ¿äÇÔ. |
|---|
| 976 | if (Dmc_IsCommand(msg.type) && msg.pfnCompleted) { |
|---|
| 977 | (msg.pfnCompleted)(statusCancelled, msg.userParam, NULL); |
|---|
| 978 | // Äݹé ÀÎÀÚ¸¦ ÅëÇÑ ¿¡·¯ ¸®ÅÏ.. |
|---|
| 979 | } |
|---|
| 980 | |
|---|
| 981 | if (msg.pfnResourceFree) { |
|---|
| 982 | dprint(3, " free parameter 0x%x\n", msg.param); |
|---|
| 983 | msg.pfnResourceFree(msg.param); |
|---|
| 984 | } |
|---|
| 985 | |
|---|
| 986 | // cancelÀÌ µÈ command¶óµµ ack¸¦ º¸³»Áà¾ß ÇÑ´Ù. |
|---|
| 987 | // |
|---|
| 988 | status = statusCancelled; |
|---|
| 989 | |
|---|
| 990 | goto label_wait_for_complete; |
|---|
| 991 | |
|---|
| 992 | } |
|---|
| 993 | |
|---|
| 994 | switch (msg.type) |
|---|
| 995 | { |
|---|
| 996 | |
|---|
| 997 | case evtPatChange: |
|---|
| 998 | doDmc_HandlePatChange(&msg); // new PAT |
|---|
| 999 | break; |
|---|
| 1000 | |
|---|
| 1001 | case evtPmtChange: |
|---|
| 1002 | doDmc_HandlePmtChange(&msg); // new PMT |
|---|
| 1003 | break; |
|---|
| 1004 | |
|---|
| 1005 | case evtVideoImportantChange: |
|---|
| 1006 | doDmc_HandleImportantVideoChange(&msg); |
|---|
| 1007 | break; |
|---|
| 1008 | |
|---|
| 1009 | case evtVideoUserChange : |
|---|
| 1010 | doDmc_HandleUserChange(&msg); |
|---|
| 1011 | break; |
|---|
| 1012 | |
|---|
| 1013 | case evtVideoMajorChange: |
|---|
| 1014 | doDmc_HandleMajorVideoChange(&msg); |
|---|
| 1015 | break; |
|---|
| 1016 | |
|---|
| 1017 | case evtVideoFatalError: |
|---|
| 1018 | dprint(0, "!! evtVideoFatalError: cid %d\n", msg.cancelId); |
|---|
| 1019 | doDmc_HandleMajorVideoChange(&msg); |
|---|
| 1020 | break; |
|---|
| 1021 | |
|---|
| 1022 | case evtFreezeVideoEnd: |
|---|
| 1023 | doDmc_HandleFreezeVideoEnd(&msg); |
|---|
| 1024 | break; |
|---|
| 1025 | |
|---|
| 1026 | case evtVideoScrambled: |
|---|
| 1027 | doDmc_HandleVideoScrambled(&msg); |
|---|
| 1028 | break; |
|---|
| 1029 | |
|---|
| 1030 | //--------------------------------------------- |
|---|
| 1031 | |
|---|
| 1032 | case cmdRfTune: |
|---|
| 1033 | status = doDmc_CmdRfTune(&msg); |
|---|
| 1034 | break; |
|---|
| 1035 | |
|---|
| 1036 | case cmdExtInputCapture: |
|---|
| 1037 | status = doDmc_CmdExtInputCapture(&msg); |
|---|
| 1038 | break; |
|---|
| 1039 | |
|---|
| 1040 | case cmdVideoStop: |
|---|
| 1041 | status = doDmc_CmdStop(&msg); |
|---|
| 1042 | break; |
|---|
| 1043 | |
|---|
| 1044 | case cmdRestartVideo: |
|---|
| 1045 | status = doDmc_CmdRestartVideo(&msg); |
|---|
| 1046 | break; |
|---|
| 1047 | |
|---|
| 1048 | case cmdChangeDisplay: |
|---|
| 1049 | status = doDmc_CmdChangeDisplay(&msg); |
|---|
| 1050 | break; |
|---|
| 1051 | |
|---|
| 1052 | case cmdChangeVideoAdjustment: |
|---|
| 1053 | status = doDmc_CmdChangeVideoAdjustment(&msg); |
|---|
| 1054 | break; |
|---|
| 1055 | |
|---|
| 1056 | case cmdAdjustScreen: // cafrii 060928 add |
|---|
| 1057 | status = doDmc_CmdAdjustScreen(&msg); |
|---|
| 1058 | break; |
|---|
| 1059 | |
|---|
| 1060 | case cmdVideoResize: // cafrii 060519 add |
|---|
| 1061 | status = doDmc_CmdVideoResize(&msg); |
|---|
| 1062 | break; |
|---|
| 1063 | |
|---|
| 1064 | case cmdEnqueueDPC: |
|---|
| 1065 | status = doDmc_CmdEnqueueDPC(&msg); |
|---|
| 1066 | break; |
|---|
| 1067 | |
|---|
| 1068 | //--------------------------------------------- |
|---|
| 1069 | // ¾Æ·¡ ¼¼ ÇÔ¼ö´Â Autoscan ±â´ÉÀ» DMC task¸¦ ÀÌ¿ëÇØ¼ ¼öÇàÇϱâ À§ÇØ ÀÛ¼ºµÇ¾úÀ½. |
|---|
| 1070 | // |
|---|
| 1071 | // ÀÌ ÇÔ¼öµéÀº º°µµ·Î parameter ³»ºÎ¿¡ AutoScan Callback ÇÔ¼ö°¡ ÀÖ¾î¼ |
|---|
| 1072 | // ±× callbackÀ» ÀÌ¿ëÇÏ¿© ´ëºÎºÐÀÇ communicationÀ» ¼öÇàÇÑ´Ù. |
|---|
| 1073 | // |
|---|
| 1074 | case cmdScanStart: |
|---|
| 1075 | status = SCN_ScanStart(&msg); |
|---|
| 1076 | break; |
|---|
| 1077 | |
|---|
| 1078 | case cmdScanStop: |
|---|
| 1079 | status = SCN_ScanStop(&msg); |
|---|
| 1080 | break; |
|---|
| 1081 | |
|---|
| 1082 | case cmdScanChannel: |
|---|
| 1083 | status = SCN_ScanOneChannel(&msg); |
|---|
| 1084 | break; |
|---|
| 1085 | |
|---|
| 1086 | //--------------------------------------------- |
|---|
| 1087 | case cmdVideoSelfDelete: |
|---|
| 1088 | dprint(1, "cmdVideoSelfDelete: cid %d\n", msg.cancelId); |
|---|
| 1089 | |
|---|
| 1090 | doDmc_Stop(); |
|---|
| 1091 | |
|---|
| 1092 | Dmc_DeleteCancelQue(); |
|---|
| 1093 | doDmc_DeleteUserMsgQue(); |
|---|
| 1094 | |
|---|
| 1095 | dmc_bInitCM = FALSE; |
|---|
| 1096 | dmc_TaskID = 0; |
|---|
| 1097 | |
|---|
| 1098 | if (msg.waitSem) |
|---|
| 1099 | DHL_OS_GiveSemaphore(msg.waitSem); |
|---|
| 1100 | |
|---|
| 1101 | DHL_OS_SelfDeleteTask(); |
|---|
| 1102 | break; |
|---|
| 1103 | |
|---|
| 1104 | default: |
|---|
| 1105 | #if DEVELOPMENT_BUILD |
|---|
| 1106 | DHL_ASSERT(0,"Dmc_Task: bad event. check event type constant."); |
|---|
| 1107 | #else |
|---|
| 1108 | dprint(0, "!! %s: bad event %d\n", __FUNCTION__, msg.type); |
|---|
| 1109 | break; |
|---|
| 1110 | #endif |
|---|
| 1111 | |
|---|
| 1112 | } // switch (event.type) |
|---|
| 1113 | |
|---|
| 1114 | label_wait_for_complete: |
|---|
| 1115 | |
|---|
| 1116 | if (msg.bWaitForComplete) { |
|---|
| 1117 | // synchronous mode·Î È£ÃâµÈ APIÀÇ °æ¿ì |
|---|
| 1118 | // ½ÇÇàÈÄÀÇ °á°ú°ªÀ» ¸®ÅÏÇØÁÙ ¼ö ÀÖ´Ù. |
|---|
| 1119 | dprint(2, "dmc command complete.. result %d\n", status); |
|---|
| 1120 | |
|---|
| 1121 | if (msg.pStatus) |
|---|
| 1122 | *(msg.pStatus) = status; |
|---|
| 1123 | |
|---|
| 1124 | if (msg.waitSem) |
|---|
| 1125 | DHL_OS_GiveSemaphore(msg.waitSem); |
|---|
| 1126 | else |
|---|
| 1127 | dprint(0, "!! wait mode, but no waitSem!!\n"); |
|---|
| 1128 | } |
|---|
| 1129 | |
|---|
| 1130 | } // while (1) |
|---|
| 1131 | DHL_OS_SelfDeleteTask(); |
|---|
| 1132 | } |
|---|
| 1133 | |
|---|
| 1134 | |
|---|
| 1135 | |
|---|
| 1136 | |
|---|
| 1137 | #if COMMENT |
|---|
| 1138 | _____API_________________(){} |
|---|
| 1139 | #endif |
|---|
| 1140 | |
|---|
| 1141 | |
|---|
| 1142 | //----------------------------------------------------------- |
|---|
| 1143 | // Dmc_InitChannelTask |
|---|
| 1144 | // ½Ã½ºÅÛÀ» ÃʱâÈ Çϰí, ºñµð¿À Å×½ºÅ©¸¦ »ý¼ºÇÑ´Ù. |
|---|
| 1145 | // ÀÌ ÇÔ¼ö´Â ÀÓÀÇÀÇ Å½ºÅ©¿¡¼ ºÒ¸°´Ù. |
|---|
| 1146 | // |
|---|
| 1147 | STATUS Dmc_InitChannelTask() |
|---|
| 1148 | { |
|---|
| 1149 | DHL_OS_TASK_ID tid; |
|---|
| 1150 | STATUS status; |
|---|
| 1151 | |
|---|
| 1152 | //--------- DMC component ÃʱâÈ ------------ |
|---|
| 1153 | |
|---|
| 1154 | if (dmc_bInitCM) { |
|---|
| 1155 | dprint(0, "!! dmc already inited. skip..\n"); |
|---|
| 1156 | return statusOK; |
|---|
| 1157 | } |
|---|
| 1158 | |
|---|
| 1159 | status = Dmc_InitAVResources(); |
|---|
| 1160 | if (status) { |
|---|
| 1161 | dprint(0, "!! AV resource init err %d\n", status); |
|---|
| 1162 | return status; |
|---|
| 1163 | } |
|---|
| 1164 | |
|---|
| 1165 | SCN_ScanInit(); |
|---|
| 1166 | |
|---|
| 1167 | |
|---|
| 1168 | //--------- DMC ÃʱâÈ ------------ |
|---|
| 1169 | |
|---|
| 1170 | status = doDmc_InitUserMsgQue(sizeof(DmcMessage), MAX_DECODE_MESSAGES); |
|---|
| 1171 | if (status) { |
|---|
| 1172 | dprint(0, "!! init dmc MsgQ err %d\n", status); |
|---|
| 1173 | return status; |
|---|
| 1174 | } |
|---|
| 1175 | |
|---|
| 1176 | if (Dmc_InitCancelQue(MAX_DECODE_MESSAGES)) |
|---|
| 1177 | return statusOutOfResource; |
|---|
| 1178 | |
|---|
| 1179 | tid = DHL_OS_CreateTask((DHL_OS_TASKFUNCTION)tDmc_Task, "tDmc", DMC_TASK_PRIORITY, DMC_TASK_STACKSIZE, 0); |
|---|
| 1180 | // reference |
|---|
| 1181 | // VIDEOCONTROL_TASK_PRIORITY, VIDEOCONTROL_TASK_STACKSIZE |
|---|
| 1182 | |
|---|
| 1183 | if (tid == (DHL_OS_TASK_ID)0) { |
|---|
| 1184 | dprint(0, "!!! DHL_OS_CreateTask error! dmc_TaskID %x\n", tid); |
|---|
| 1185 | return statusOutOfResource; |
|---|
| 1186 | } |
|---|
| 1187 | dmc_TaskID = tid; |
|---|
| 1188 | |
|---|
| 1189 | dmc_tsd = DHL_DMX_GetTsd(); |
|---|
| 1190 | |
|---|
| 1191 | dmc_tickStarted = DHL_OS_GetMsCount(); // cafrii 060720 add |
|---|
| 1192 | |
|---|
| 1193 | dmc_bInitCM = TRUE; |
|---|
| 1194 | |
|---|
| 1195 | return statusOK; |
|---|
| 1196 | } |
|---|
| 1197 | |
|---|
| 1198 | //----------------------------------------------------------- |
|---|
| 1199 | // Dmc_Terminate |
|---|
| 1200 | // Call this function to undo everything we did above |
|---|
| 1201 | // »ç½Ç ÀÌ ÇÔ¼ö¸¦ ºÎ¸¦ ÀÏÀº °ÅÀÇ ¾ø´Ù. |
|---|
| 1202 | // |
|---|
| 1203 | void Dmc_EndChannelTask(void) |
|---|
| 1204 | { |
|---|
| 1205 | STATUS status; |
|---|
| 1206 | |
|---|
| 1207 | dprint(1, "Dmc_EndChannelTask()\n"); |
|---|
| 1208 | |
|---|
| 1209 | if (dmc_TaskID) |
|---|
| 1210 | { |
|---|
| 1211 | status = Dmc_SendCommandEx(cmdVideoSelfDelete, 0, NULL, |
|---|
| 1212 | TRUE, // no wait |
|---|
| 1213 | NULL, 0, // no callback |
|---|
| 1214 | TRUE); // cancel prev cmds |
|---|
| 1215 | |
|---|
| 1216 | if (status) { |
|---|
| 1217 | DHL_OS_Delay(1000); |
|---|
| 1218 | dprint(0, "!! Dmc_Task would not die\n"); |
|---|
| 1219 | //DHL_OS_DeleteTask(dmc_TaskID); |
|---|
| 1220 | dmc_TaskID = 0; |
|---|
| 1221 | } |
|---|
| 1222 | dprint(2, "Dmc_Task deleted.\n"); |
|---|
| 1223 | } |
|---|
| 1224 | |
|---|
| 1225 | // dmc_eventQ´Â dmc_Task¿¡¼ »èÁ¦¸¦ Çϰí self-die¸¦ Çϵµ·Ï µÇ¾î ÀÖÁö¸¸, |
|---|
| 1226 | // °Á¦ delete µÈ °æ¿ì¶ó¸é eventQ°¡ »ì¾Æ ÀÖÀ» °ÍÀÓ.. |
|---|
| 1227 | // ±×·¡¼ ¿©±â¼ ´Ù½Ã Çѹø È®ÀÎÇÏ°í »èÁ¦ÇÑ´Ù. |
|---|
| 1228 | // |
|---|
| 1229 | doDmc_DeleteUserMsgQue(); |
|---|
| 1230 | |
|---|
| 1231 | Dmc_DeleteCancelQue(); |
|---|
| 1232 | |
|---|
| 1233 | dmc_bInitCM = FALSE; // DmcTask¿¡¼ FALSE·Î settingÇÏÁö¸¸ Çѹø ´õ È®ÀÎ. |
|---|
| 1234 | |
|---|
| 1235 | } |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | |
|---|
| 1239 | //----------------------------------------------------------- |
|---|
| 1240 | // Dmc_GetSystemRunningTime |
|---|
| 1241 | // |
|---|
| 1242 | // return runnig time in seconds |
|---|
| 1243 | // |
|---|
| 1244 | UINT32 Dmc_GetSystemRunningTime(void) |
|---|
| 1245 | { |
|---|
| 1246 | return (DHL_OS_GetMsCount() - dmc_tickStarted)/1000; |
|---|
| 1247 | } |
|---|
| 1248 | |
|---|
| 1249 | |
|---|
| 1250 | |
|---|
| 1251 | |
|---|
| 1252 | //----------------------------------------------------------- |
|---|
| 1253 | // Dmc_StopVideo |
|---|
| 1254 | // |
|---|
| 1255 | // ¸ðµç Á¾·ùÀÇ Audio/Video¸¦ ¸ðµÎ stop ½ÃŲ´Ù. |
|---|
| 1256 | // Analog/Digital, Air/Cable, RF/1394/DV °ü°è¾øÀÌ ÇöÀç µ¿ÀÛÁßÀÎ ÀÛ¾÷À» ¸ðµÎ Stop½ÃŲ´Ù. |
|---|
| 1257 | // |
|---|
| 1258 | STATUS Dmc_StopVideo() |
|---|
| 1259 | { |
|---|
| 1260 | dprint(1, "Dmc_StopVideo()\n"); |
|---|
| 1261 | return Dmc_SendCommand(cmdVideoStop, 0, TRUE); |
|---|
| 1262 | // cancel prev-cmds. |
|---|
| 1263 | // jump to doDmc_Stop(); |
|---|
| 1264 | } |
|---|
| 1265 | |
|---|
| 1266 | |
|---|
| 1267 | STATUS Dmc_RestartVideo(void) |
|---|
| 1268 | { |
|---|
| 1269 | // DMC task¿¡¼ ºÒ·È´Ù¸é send command¸¦ ÇÒ Çʿ䵵 ¾øÀÌ ¹Ù·Î ÀÛ¾÷ ¼öÇà.. |
|---|
| 1270 | // ÀÌ °æ¿ì Ç×»ó wait for completion ¸ðµå·Î µ¿ÀÛÇÏ°Ô µÈ´Ù. |
|---|
| 1271 | // |
|---|
| 1272 | if (Dmc_GetCurrentTaskID() == dmc_TaskID) { |
|---|
| 1273 | return doDmc_CmdRestartVideo(NULL); |
|---|
| 1274 | } |
|---|
| 1275 | else { |
|---|
| 1276 | return Dmc_SendCommand(cmdRestartVideo, 0, TRUE); |
|---|
| 1277 | // jump to doDmc_CmdRestartVideo .. |
|---|
| 1278 | } |
|---|
| 1279 | } |
|---|
| 1280 | |
|---|
| 1281 | |
|---|
| 1282 | |
|---|
| 1283 | |
|---|
| 1284 | #if COMMENT |
|---|
| 1285 | _____Enque_API__________(){} |
|---|
| 1286 | #endif |
|---|
| 1287 | |
|---|
| 1288 | |
|---|
| 1289 | void *Dmc_ParamHeapAllocator(UINT32 size) |
|---|
| 1290 | { |
|---|
| 1291 | void* ptr; |
|---|
| 1292 | ptr = DHL_OS_Malloc(size); |
|---|
| 1293 | memset(ptr, 0, size); |
|---|
| 1294 | return ptr; |
|---|
| 1295 | } |
|---|
| 1296 | |
|---|
| 1297 | void Dmc_ParamHeapDeallocator(UINT32 param) |
|---|
| 1298 | { |
|---|
| 1299 | // ½ÇÁ¦·Î arg´Â ¾î¶² ¸Þ¸ð¸®ÀÇ pointerÀÏ °ÍÀÓ. |
|---|
| 1300 | void *ptr = (void *)param; |
|---|
| 1301 | DHL_OS_Free((void**)&ptr); |
|---|
| 1302 | } |
|---|
| 1303 | |
|---|
| 1304 | |
|---|
| 1305 | //----------------- |
|---|
| 1306 | // Dmc_EnqueueDPC |
|---|
| 1307 | // |
|---|
| 1308 | // ƯÁ¤ ÀÛ¾÷À» DMC task¿¡ defer½ÃÄѼ ó¸®ÇÏ°í ½ÍÀ»¶§ »ç¿ëÇÏ´Â ÇÔ¼ö |
|---|
| 1309 | // param¿¡ memory block°ú °°Àº ¸®¼Ò½º ¸µÅ©¸¦ »ç¿ëÇÑ °æ¿ì |
|---|
| 1310 | // ¸®ÅϰªÀÌ DmcQFull ÀÌ µÉ °æ¿ì¸¦ ²À Ã¼Å©ÇØ¼ ÇÊ¿äÇÒ °æ¿ì ¸®¼Ò½º¸¦ ÇØÁ¦½ÃÄÑ¾ß ÇÑ´Ù. |
|---|
| 1311 | // |
|---|
| 1312 | // cafrii 070412 add more params. |
|---|
| 1313 | // ÇϳªÀÇ paramÀ¸·Î´Â DPC·Î »ç¿ë°¡´ÉÇÑ ÇÔ¼ö°¡ ³Ê¹« Á¦¾àÀûÀÌ´Ù. |
|---|
| 1314 | // |
|---|
| 1315 | STATUS Dmc_EnqueueDPC(DMC_FN_DPC dpcfn, UINT32 param1, UINT32 param2, |
|---|
| 1316 | UINT32 param3, UINT32 param4, BOOL bWaitComplete) |
|---|
| 1317 | { |
|---|
| 1318 | CmdParam_DPC *paramblk; |
|---|
| 1319 | STATUS status; |
|---|
| 1320 | |
|---|
| 1321 | if (dpcfn == NULL) // ÀÌ ÀÎÀÚ´Â ¹Ýµå½Ã ÇÊ¿äÇÏ´Ù. ÀÌ APIÀÇ ¸ñÀûÀ̱⠶§¹®.. |
|---|
| 1322 | return statusInvalidArgument; |
|---|
| 1323 | |
|---|
| 1324 | paramblk = Dmc_ParamHeapAllocator(sizeof(CmdParam_DPC)); |
|---|
| 1325 | |
|---|
| 1326 | if (paramblk == NULL) |
|---|
| 1327 | return statusOutOfMemory; |
|---|
| 1328 | |
|---|
| 1329 | dprint(1, "Dmc_EnqueueDPC(%x, %x %x %x %x): paramblk %x\n", |
|---|
| 1330 | dpcfn, param1, param2, param3, param4, paramblk); |
|---|
| 1331 | |
|---|
| 1332 | paramblk->dpcfn = dpcfn; |
|---|
| 1333 | paramblk->param1 = param1; |
|---|
| 1334 | paramblk->param2 = param2; |
|---|
| 1335 | paramblk->param3 = param3; |
|---|
| 1336 | paramblk->param4 = param4; |
|---|
| 1337 | |
|---|
| 1338 | status = Dmc_SendCommandEx(cmdEnqueueDPC, |
|---|
| 1339 | (UINT32)paramblk, |
|---|
| 1340 | Dmc_ParamHeapDeallocator, |
|---|
| 1341 | bWaitComplete, // wait for complete |
|---|
| 1342 | NULL, 0, // user callback¶m |
|---|
| 1343 | FALSE); // do not cancel previous command |
|---|
| 1344 | // jump to doDmc_CmdEnqueueDPC |
|---|
| 1345 | |
|---|
| 1346 | // cafrii 060529 delete. codes are inside SendCommandEx. |
|---|
| 1347 | //if (status) { |
|---|
| 1348 | // Dmc_ParamHeapDeallocator((UINT32)param); |
|---|
| 1349 | //} |
|---|
| 1350 | |
|---|
| 1351 | return status; |
|---|
| 1352 | } |
|---|
| 1353 | |
|---|
| 1354 | |
|---|
| 1355 | |
|---|
| 1356 | #if COMMENT |
|---|
| 1357 | ______Tuning_API_______(){} |
|---|
| 1358 | #endif |
|---|
| 1359 | |
|---|
| 1360 | //----------------------------------------------------------- |
|---|
| 1361 | // |
|---|
| 1362 | |
|---|
| 1363 | STATUS Dmc_ChangeRfChannelByTuneParam(TuneParam *param, BOOL bWaitForCompletion, |
|---|
| 1364 | void *pfnCallback, UINT32 userparam) |
|---|
| 1365 | { |
|---|
| 1366 | TuneParam *tuneParam; |
|---|
| 1367 | STATUS status; |
|---|
| 1368 | char flagstring[50]; |
|---|
| 1369 | |
|---|
| 1370 | dprint(1, "Dmc_ChangeRfChannelTuneParam(%s)\n", bWaitForCompletion ? "wait" : "NoWait"); |
|---|
| 1371 | |
|---|
| 1372 | // Note, 030614 |
|---|
| 1373 | // bWaitForCompletion ¿É¼ÇÀ» »ç¿ëÇÒ ¼ö ÀÖ°Ô ÇÏ·Á¸é TuneParam ±¸Á¶Ã¼ Æ÷ÀÎÅ͸¦ ¹Ù·Î DMC task¿¡ |
|---|
| 1374 | // ³Ñ±â¸é ¾ÈµÇ°í º¹»ç¸¦ ÇØ¾ß ÇÑ´Ù. |
|---|
| 1375 | // ¹®Á¦´Â TuneParam ³»ºÎÀÇ VideoStreamDescriptor ¸Þ¸ð¸® ¿µ¿ª±îÁö º¹»ç¸¦ ÇØ¾ß ÇÑ´Ù´Â Á¡ÀÌ´Ù. |
|---|
| 1376 | // µû¶ó¼ ÇöÀç´Â vidDesc Æ÷ÀÎÅÍ ºÎºÐÀº º¹»çÇÏÁö ¾Ê°í NULL·Î ¼¼ÆÃÇÑ´Ù. |
|---|
| 1377 | |
|---|
| 1378 | tuneParam = Dmc_ParamHeapAllocator(sizeof(TuneParam)); |
|---|
| 1379 | if (tuneParam == NULL) { |
|---|
| 1380 | dprint(0, "!! ChangeRfChannel: out of memory for TuneParam\n"); |
|---|
| 1381 | return statusOutOfResource; //outOfOSResourcesError; |
|---|
| 1382 | } |
|---|
| 1383 | |
|---|
| 1384 | memcpy(tuneParam, param, sizeof(TuneParam)); |
|---|
| 1385 | |
|---|
| 1386 | // cafrii 060630 add.. ³»ºÎ¿¡¼ ¾Ë¾Æ¼ ÇÏÁö¸¸ ¸í½ÃÀûÀ¸·Î ÁöÁ¤.. |
|---|
| 1387 | if (tuneParam->vidPid == 0 && |
|---|
| 1388 | tuneParam->audPid == 0 && |
|---|
| 1389 | tuneParam->pcrPid == 0) |
|---|
| 1390 | tuneParam->flag |= CTF_SkipPrescanPidInfo; |
|---|
| 1391 | |
|---|
| 1392 | //neverdai add. 100802 after autoscan, at the first time of tuning, audio type and video type are 0. |
|---|
| 1393 | if(tuneParam->vidType == eDHL_VIDEO_TYPE_UNKNOWN && tuneParam->audType == eDHL_VIDEO_TYPE_UNKNOWN) |
|---|
| 1394 | tuneParam->flag |= CTF_SkipPrescanPidInfo; |
|---|
| 1395 | |
|---|
| 1396 | // cafrii 031205 add |
|---|
| 1397 | if ((tuneParam->flag & CTF_Mask_Tuning) == CTF_VCTOnly) { |
|---|
| 1398 | sprintf(flagstring, "0x%x: %sVCT%s%s", tuneParam->flag, |
|---|
| 1399 | tuneParam->flag & CTF_RetryAnalogIfSignalUnlock ? "[+NTSC] " : "", |
|---|
| 1400 | tuneParam->flag & CTF_RetryOtherChannel ? "+" : "", |
|---|
| 1401 | tuneParam->flag & CTF_RetryMainChannel ? "*" : ""); |
|---|
| 1402 | } |
|---|
| 1403 | else if ((tuneParam->flag & CTF_Mask_Tuning) == CTF_PSIOnly) { |
|---|
| 1404 | sprintf(flagstring, "0x%x: PSI%s", tuneParam->flag, tuneParam->flag & CTF_RetryOtherProgram ? "+" : ""); |
|---|
| 1405 | } |
|---|
| 1406 | else { |
|---|
| 1407 | sprintf(flagstring, "0x%x: %sVCT%s%s/PSI%s", tuneParam->flag, |
|---|
| 1408 | tuneParam->flag & CTF_RetryAnalogIfSignalUnlock ? "[+NTSC] " : "", |
|---|
| 1409 | tuneParam->flag & CTF_RetryOtherChannel ? "+" : "", |
|---|
| 1410 | tuneParam->flag & CTF_RetryMainChannel ? "*" : "", |
|---|
| 1411 | tuneParam->flag & CTF_RetryOtherProgram ? "+" : ""); |
|---|
| 1412 | } |
|---|
| 1413 | |
|---|
| 1414 | dprint(2, "\tParam: rf %d, type %d, p%d v%d a%d, %d-%d #%d\n" |
|---|
| 1415 | "\t flag %s\n", |
|---|
| 1416 | //tuneParam->tuneRequired ? "" : "prev", // cafrii 060630 delete |
|---|
| 1417 | tuneParam->rf, tuneParam->type, |
|---|
| 1418 | tuneParam->pcrPid, tuneParam->vidPid, tuneParam->audPid, |
|---|
| 1419 | tuneParam->major, tuneParam->minor, |
|---|
| 1420 | tuneParam->progNumber, |
|---|
| 1421 | flagstring ); |
|---|
| 1422 | |
|---|
| 1423 | status = Dmc_SendCommandEx(cmdRfTune, |
|---|
| 1424 | (UINT32)tuneParam, |
|---|
| 1425 | Dmc_ParamHeapDeallocator, |
|---|
| 1426 | bWaitForCompletion, |
|---|
| 1427 | (DMC_FN_COMPLETED)pfnCallback, userparam, |
|---|
| 1428 | TRUE); |
|---|
| 1429 | // jump to doDmc_CmdRfTune |
|---|
| 1430 | // previous command´Â ¸ðµÎ cancel ½ÃŲ´Ù. |
|---|
| 1431 | |
|---|
| 1432 | // cafrii 060529 delete. codes are inside SendCommandEx. |
|---|
| 1433 | //if (status) { // cafrii 040528 add err handle code |
|---|
| 1434 | // // send command¿¡ ¿¡·¯°¡ ¹ß»ýÇϸé ÀÌ command´Â °¨Âʰ°ÀÌ »ç¶óÁ® ¹ö¸° °ÍÀ̹ǷΠ|
|---|
| 1435 | // // allocationÇÑ ¸Þ¸ð¸®´Â ÇØÁ¦ÇÑ ´ÙÀ½ ¸®ÅÏÀ» ÇØ¾ß ÇÑ´Ù. |
|---|
| 1436 | // Dmc_ParamHeapDeallocator((UINT32)tuneParam); |
|---|
| 1437 | //} |
|---|
| 1438 | |
|---|
| 1439 | return status; |
|---|
| 1440 | } |
|---|
| 1441 | |
|---|
| 1442 | |
|---|
| 1443 | |
|---|
| 1444 | STATUS Dmc_ChangeRfChannel(int rf, ModulationType type, BOOL bWaitForCompletion, |
|---|
| 1445 | void *fn, UINT32 userparam) |
|---|
| 1446 | { |
|---|
| 1447 | // RF·Î ¹Ù·Î Æ©´×ÇØ¼ ä³Î º¯°æÀ» ÇÏ´Â ÇÔ¼öÀÌ´Ù. |
|---|
| 1448 | // |
|---|
| 1449 | TuneParam param, *tuneParam = ¶m; |
|---|
| 1450 | |
|---|
| 1451 | dprint(1, "Dmc_ChangeRfChannel(rf%d type %d)\n", rf, type); |
|---|
| 1452 | |
|---|
| 1453 | memset(tuneParam, 0, sizeof(TuneParam)); |
|---|
| 1454 | |
|---|
| 1455 | if (rf == 0) |
|---|
| 1456 | { |
|---|
| 1457 | ProgramAVInfo *av = Dmc_LockAVMutex(); |
|---|
| 1458 | |
|---|
| 1459 | //tuneParam->tuneRequired = FALSE; // cafrii 060630 delete |
|---|
| 1460 | tuneParam->rf = av->rf; |
|---|
| 1461 | tuneParam->type = av->mod; |
|---|
| 1462 | // |
|---|
| 1463 | // tuneRequired ¶ó°í ÇØµµ ¹Ýµå½Ã rf¿¡´Â ¿Ã¹Ù¸¥ rf ¹øÈ£¸¦ ³Ñ°ÜÁà¾ß ÇÑ´Ù. |
|---|
| 1464 | // modulation typeÀº ³»ºÎ¿¡¼ retry code°¡ ÀÖÀ¸¹Ç·Î |
|---|
| 1465 | // digital/analog ±¸ºÐ¸¸ ÇØµµ µÈ´Ù. |
|---|
| 1466 | |
|---|
| 1467 | Dmc_UnlockAVMutex(); |
|---|
| 1468 | |
|---|
| 1469 | dprint(2, "\tNo tunet set. previous rf %d, type %d used.\n", tuneParam->rf, tuneParam->type); |
|---|
| 1470 | } |
|---|
| 1471 | else |
|---|
| 1472 | { |
|---|
| 1473 | tuneParam->rf = rf; |
|---|
| 1474 | //tuneParam->tuneRequired = TRUE; // cafrii 060630 delete |
|---|
| 1475 | |
|---|
| 1476 | // ¹æ¹ý 1: »ç¿ëÀÚ°¡ ÁöÁ¤ÇÑ °ªÀÌ ±×´ë·Î µé¾î°£´Ù. |
|---|
| 1477 | //tuneParam->type = type; |
|---|
| 1478 | |
|---|
| 1479 | // ¹æ¹ý 2: Digital Cable ÀÎ °æ¿ì´Â Auto detect ·Î ¼öÇàÇÑ´Ù. |
|---|
| 1480 | tuneParam->type = |
|---|
| 1481 | type == 0 ? Modulation_NTSC : |
|---|
| 1482 | g_CurChannelType == ChannelType_Air ? Modulation_8VSB : Modulation_CableAuto; |
|---|
| 1483 | } |
|---|
| 1484 | |
|---|
| 1485 | tuneParam->major = tuneParam->minor = 0; |
|---|
| 1486 | tuneParam->progNumber = 0; |
|---|
| 1487 | tuneParam->flag = CTF_Automatic | CTF_RetryOtherChannel | |
|---|
| 1488 | CTF_RetryOtherProgram | CTF_DontRetryTVCTOnCable | |
|---|
| 1489 | CTF_SkipPrescanPidInfo; |
|---|
| 1490 | |
|---|
| 1491 | return Dmc_ChangeRfChannelByTuneParam(tuneParam, bWaitForCompletion, fn, userparam); |
|---|
| 1492 | } |
|---|
| 1493 | |
|---|
| 1494 | STATUS Dmc_ChangeRfChannel2(int rf, ModulationType type, int pPid, int vPid, int aPid, |
|---|
| 1495 | int major, int minor, int progNumber, BOOL bWaitForCompletion, void *fn, UINT32 userparam) |
|---|
| 1496 | { |
|---|
| 1497 | // |
|---|
| 1498 | // if you don't want to use prescan PIDs, set PIDs to all zero. |
|---|
| 1499 | // if one of these three is non-zero, |
|---|
| 1500 | // 'pPid' should be non-zero. |
|---|
| 1501 | // 'vPid' or 'aPid' either should be non-zero. |
|---|
| 1502 | // |
|---|
| 1503 | // ex: |
|---|
| 1504 | // 6-1, #3 : try VCT 6-1 first -> try #3 PMT program. |
|---|
| 1505 | // 9-1, #0 : try VCT 9-1 first -> try any program. |
|---|
| 1506 | // 0-0, #2 : try any VCT channel -> try #2 PMT program. |
|---|
| 1507 | // 9-1, #-1 : try VCT 9-1. do not use PSI info. |
|---|
| 1508 | // 0-0, #0 : try any VCT channel -> try any program. |
|---|
| 1509 | // -1-?, #2 : try #2 PMT program. do not use VCT info. |
|---|
| 1510 | // -1-?, #0 : try any PMT program. do not use VCT info. |
|---|
| 1511 | // -1-?, #-1 : error. |
|---|
| 1512 | |
|---|
| 1513 | TuneParam param_0, *param = ¶m_0; |
|---|
| 1514 | |
|---|
| 1515 | dprint(1, "Dmc_ChangeRfChannel2(rf%d type %d)\n", rf, type); |
|---|
| 1516 | |
|---|
| 1517 | // cafrii, for safety, reset first.. |
|---|
| 1518 | memset(param, 0, sizeof(TuneParam)); |
|---|
| 1519 | |
|---|
| 1520 | // if 'rf' is zero, we do not set tuner. use last tuned frequency. |
|---|
| 1521 | if (rf == 0) { |
|---|
| 1522 | ProgramAVInfo *av = Dmc_LockAVMutex(); |
|---|
| 1523 | param->rf = av->rf; |
|---|
| 1524 | param->type = av->mod; |
|---|
| 1525 | //param->tuneRequired = FALSE; // cafrii 060630 delete |
|---|
| 1526 | Dmc_UnlockAVMutex(); |
|---|
| 1527 | |
|---|
| 1528 | dprint(2, "\tNo tunet set. previous rf %d, type %d used.\n", param->rf, param->type); |
|---|
| 1529 | } |
|---|
| 1530 | else { |
|---|
| 1531 | param->rf = rf; |
|---|
| 1532 | //param->tuneRequired = TRUE; // cafrii 060630 delete |
|---|
| 1533 | param->type = type; |
|---|
| 1534 | } |
|---|
| 1535 | |
|---|
| 1536 | // if PID values are zero, we will ignore this pre-scan PID values. |
|---|
| 1537 | if (pPid == 0 && vPid == 0 && aPid == 0) { |
|---|
| 1538 | param->flag |= CTF_SkipPrescanPidInfo; |
|---|
| 1539 | } |
|---|
| 1540 | else { |
|---|
| 1541 | param->pcrPid = pPid; |
|---|
| 1542 | param->vidPid = vPid; |
|---|
| 1543 | param->audPid = aPid; |
|---|
| 1544 | } |
|---|
| 1545 | |
|---|
| 1546 | // if 'major' is zero, we will tune first (lowest) channels and repeat next channel if error. |
|---|
| 1547 | // if 'major' is non-zero, we try only that major-minor channel, not others. |
|---|
| 1548 | param->major = major; |
|---|
| 1549 | param->minor = minor; |
|---|
| 1550 | |
|---|
| 1551 | //leon 2003.10.30 audio is mute bug at ATSC |
|---|
| 1552 | // if audio type is AC-3, mute bug. |
|---|
| 1553 | |
|---|
| 1554 | //param->audType = (tDHL_AudioCodingType) 0; |
|---|
| 1555 | |
|---|
| 1556 | if (major == 0) |
|---|
| 1557 | param->flag |= CTF_RetryOtherChannel; |
|---|
| 1558 | else if (major < 0) |
|---|
| 1559 | param->flag = ((param->flag & ~CTF_Mask_Tuning) | CTF_PSIOnly); // do not use VCT info. |
|---|
| 1560 | |
|---|
| 1561 | // if 'progNumber' is non-zero, do not use VCT info. PSI only mode. |
|---|
| 1562 | param->progNumber = progNumber; |
|---|
| 1563 | |
|---|
| 1564 | if (progNumber == 0) |
|---|
| 1565 | param->flag |= CTF_RetryOtherProgram; |
|---|
| 1566 | else if (progNumber < 0) |
|---|
| 1567 | param->flag = ((param->flag & ~CTF_Mask_Tuning) | CTF_VCTOnly); // do not use PSI info. |
|---|
| 1568 | |
|---|
| 1569 | //param->flag |= CTF_DontRetryTVCTOnCable; // for PCE, this flag also available. |
|---|
| 1570 | |
|---|
| 1571 | return Dmc_ChangeRfChannelByTuneParam(param, bWaitForCompletion, fn, userparam); |
|---|
| 1572 | // param ±¸Á¶Ã¼´Â Dmc_ChangeRfChannelByTuneParam() ÇÔ¼ö ¾È¿¡¼ |
|---|
| 1573 | // ´Ù½Ã allocateÇϹǷΠ¿©±â¼´Â °£´ÜÇÏ°Ô stackÀ» ÀÌ¿ëÇØµµ µÈ´Ù. |
|---|
| 1574 | } |
|---|
| 1575 | |
|---|
| 1576 | |
|---|
| 1577 | |
|---|
| 1578 | |
|---|
| 1579 | //---------------------- |
|---|
| 1580 | // Dmc_ChangeExtInput |
|---|
| 1581 | // |
|---|
| 1582 | // |
|---|
| 1583 | // |
|---|
| 1584 | // |
|---|
| 1585 | STATUS Dmc_ChangeExtInput(tDHL_CapVideoInput video, tDHL_CapAudioInput audio, |
|---|
| 1586 | BOOL bWaitForCompletion) |
|---|
| 1587 | { |
|---|
| 1588 | // Áö±ÝÀº callbackÀ» Áö¿øÇÏÁö´Â ¾Ê´Â´Ù. |
|---|
| 1589 | // video¿Í audio inputÀº ¼·Î ÀÏÄ¡Çϵµ·Ï ÁöÁ¤ÇØÁà¾ß ÇÑ´Ù. |
|---|
| 1590 | |
|---|
| 1591 | STATUS status; |
|---|
| 1592 | CaptureParam *pCapParam; |
|---|
| 1593 | |
|---|
| 1594 | dprint(1, "Dmc_ChangeExtInput(video %d, audio %d, %s)\n", |
|---|
| 1595 | video, audio, |
|---|
| 1596 | bWaitForCompletion ? "wait" : "NoWait"); |
|---|
| 1597 | |
|---|
| 1598 | |
|---|
| 1599 | pCapParam = Dmc_ParamHeapAllocator(sizeof(CaptureParam)); |
|---|
| 1600 | if (pCapParam == NULL) { |
|---|
| 1601 | dprint(0, "!! Dmc_ChangeExtInput: out of memory for CaptureParam\n"); |
|---|
| 1602 | return statusOutOfMemory; |
|---|
| 1603 | } |
|---|
| 1604 | |
|---|
| 1605 | pCapParam->input_video = video; |
|---|
| 1606 | pCapParam->input_audio = audio; |
|---|
| 1607 | |
|---|
| 1608 | status = Dmc_SendCommandEx(cmdExtInputCapture, |
|---|
| 1609 | (UINT32)pCapParam, |
|---|
| 1610 | Dmc_ParamHeapDeallocator, |
|---|
| 1611 | TRUE, // wait for complete |
|---|
| 1612 | NULL, 0, // user callback¶m |
|---|
| 1613 | TRUE); // cancel prev commands |
|---|
| 1614 | // jump to doDmc_CmdExtInputCapture |
|---|
| 1615 | |
|---|
| 1616 | // cafrii 060529 delete. codes are inside SendCommandEx. |
|---|
| 1617 | //if (status) { |
|---|
| 1618 | // // send command¿¡ ¿¡·¯°¡ ¹ß»ýÇϸé ÀÌ command´Â °¨Âʰ°ÀÌ »ç¶óÁ® ¹ö¸° °ÍÀ̹ǷΠ|
|---|
| 1619 | // // allocationÇÑ ¸Þ¸ð¸®´Â ÇØÁ¦ÇÑ ´ÙÀ½ ¸®ÅÏÀ» ÇØ¾ß ÇÑ´Ù. |
|---|
| 1620 | // // |
|---|
| 1621 | // Dmc_ParamHeapDeallocator((UINT32)pCapParam); |
|---|
| 1622 | //} |
|---|
| 1623 | |
|---|
| 1624 | return status; |
|---|
| 1625 | } |
|---|
| 1626 | |
|---|
| 1627 | |
|---|
| 1628 | |
|---|
| 1629 | |
|---|
| 1630 | //---------------------- |
|---|
| 1631 | // Dmc_ChangeProgram |
|---|
| 1632 | // |
|---|
| 1633 | // Digital TS playback ÀÏ °æ¿ì ´Ù¸¥ programÀ» playÇÑ´Ù. |
|---|
| 1634 | // playÇÏ°í ½ÍÀº program number¸¦ ÁöÁ¤ÇÑ´Ù. |
|---|
| 1635 | // invalidµÈ program_number¸¦ ÁöÁ¤Çϸé next programÀ» ¼±ÅÃ. |
|---|
| 1636 | // ¸¸¾à 1 program ¸¸ ÀÖ´Â °æ¿ì¶ó¸é no action.. |
|---|
| 1637 | // |
|---|
| 1638 | STATUS Dmc_ChangeProgram(int program_number, BOOL bWaitForCompletion) |
|---|
| 1639 | { |
|---|
| 1640 | int i; |
|---|
| 1641 | STATUS status; |
|---|
| 1642 | ProgramAVInfo *av; |
|---|
| 1643 | |
|---|
| 1644 | dprint(1, "Dmc_ChangeProgram(prog num %d, wait %d)\n", program_number, bWaitForCompletion); |
|---|
| 1645 | |
|---|
| 1646 | // AVInfo mutex¿Í PSI mutex µÎ°³°¡ µ¿½Ã¿¡ ÇÊ¿äÇѵ¥, |
|---|
| 1647 | // dead-lockÀÇ À§ÇèÀ» ÇÇÇϱâ À§Çؼ aVInfo´Â º¹»çÇØ¼ »ç¿ëÇϰí |
|---|
| 1648 | // psi mutex¸¸ »ç¿ëÇϱâ·Î ÇÑ´Ù. |
|---|
| 1649 | |
|---|
| 1650 | av = Dmc_LockAVMutex(); |
|---|
| 1651 | |
|---|
| 1652 | if (av->active == 0 || av->analog) { |
|---|
| 1653 | dprint(0, "!! ChangeAudio: invalid state! active %d, analog %d\n", |
|---|
| 1654 | av->active, av->analog); |
|---|
| 1655 | |
|---|
| 1656 | status = statusInvalidState; |
|---|
| 1657 | goto label_exit; |
|---|
| 1658 | } |
|---|
| 1659 | |
|---|
| 1660 | // PMT¸¦ ã¾Æ¼ »õ ÇÁ·Î±×·¥ÀÇ program_number¸¸ °Ç³×ÁØ´Ù. |
|---|
| 1661 | |
|---|
| 1662 | if (program_number <= 0) |
|---|
| 1663 | { |
|---|
| 1664 | // next program mode.. |
|---|
| 1665 | |
|---|
| 1666 | for (i=0; i<av->pat->numPrograms; i++) { |
|---|
| 1667 | if (av->pat->programs[i].program_number == av->program_number) |
|---|
| 1668 | break; |
|---|
| 1669 | } |
|---|
| 1670 | if (i >= av->pat->numPrograms) { |
|---|
| 1671 | dprint(0, "!! ChangeProgram: cannot find current program !\n"); |
|---|
| 1672 | status = statusInvalidPSI; |
|---|
| 1673 | goto label_exit; |
|---|
| 1674 | } |
|---|
| 1675 | if (av->pat->numPrograms < 2) { |
|---|
| 1676 | dprint(0, "\tonly one program exist. no other program !\n"); |
|---|
| 1677 | status = statusNotFound; |
|---|
| 1678 | goto label_exit; |
|---|
| 1679 | } |
|---|
| 1680 | // ´ÙÀ½ ÇÁ·Î±×·¥À» ¼±ÅÃÇÑ´Ù. ¸¶Áö¸·À̸é wrap-around µÈ´Ù. |
|---|
| 1681 | program_number = av->pat->programs[(i+1)%av->pat->numPrograms].program_number; |
|---|
| 1682 | } |
|---|
| 1683 | |
|---|
| 1684 | if (1) |
|---|
| 1685 | { // NIM mode |
|---|
| 1686 | TuneParam param; |
|---|
| 1687 | memset(¶m, 0, sizeof(TuneParam)); |
|---|
| 1688 | |
|---|
| 1689 | param.rf = av->rf; |
|---|
| 1690 | param.type = av->mod; |
|---|
| 1691 | //param.tuneRequired = FALSE; // cafrii 060630 delete |
|---|
| 1692 | |
|---|
| 1693 | param.flag = CTF_PSIOnly; |
|---|
| 1694 | param.progNumber = program_number; |
|---|
| 1695 | |
|---|
| 1696 | dprint(2, " program number %d selected (rf %d, type %d)\n", |
|---|
| 1697 | program_number, param.rf, param.type); |
|---|
| 1698 | |
|---|
| 1699 | // ¹Ø¿¡¼ tuning ÇÔ¼ö°¡ synchronous modeÀÏ ¼ö Àֱ⠶§¹®¿¡ |
|---|
| 1700 | // lockÀ» Ç®¾îÁà¾ß¸¸ ÇÑ´Ù. |
|---|
| 1701 | // |
|---|
| 1702 | Dmc_UnlockAVMutex(); |
|---|
| 1703 | |
|---|
| 1704 | status = Dmc_ChangeRfChannelByTuneParam(¶m, bWaitForCompletion, NULL, 0); |
|---|
| 1705 | return status; |
|---|
| 1706 | } |
|---|
| 1707 | |
|---|
| 1708 | label_exit: |
|---|
| 1709 | Dmc_UnlockAVMutex(); |
|---|
| 1710 | |
|---|
| 1711 | return status; |
|---|
| 1712 | } |
|---|
| 1713 | |
|---|
| 1714 | |
|---|
| 1715 | |
|---|
| 1716 | |
|---|
| 1717 | |
|---|
| 1718 | #if COMMENT |
|---|
| 1719 | ______ETC_API_______(){} |
|---|
| 1720 | #endif |
|---|
| 1721 | |
|---|
| 1722 | |
|---|
| 1723 | #if 0 |
|---|
| 1724 | STATUS dmc_change_audio_stream(UINT32 param1, UINT32 param2, UINT32 param3) |
|---|
| 1725 | { |
|---|
| 1726 | // this function should be called in DMC task!! |
|---|
| 1727 | // |
|---|
| 1728 | DHL_RESULT dhlResult; |
|---|
| 1729 | STATUS status; |
|---|
| 1730 | |
|---|
| 1731 | // cafrii 070412 change »õ·Ó°Ô º¯°æµÈ DPC ±¸Á¶¿¡ ¸ÂÃã. |
|---|
| 1732 | // |
|---|
| 1733 | UINT32 audioPID = param1; |
|---|
| 1734 | UINT32 pcrPID = param2; |
|---|
| 1735 | tDHL_AudioCodingType audioType = (tDHL_AudioCodingType) param3; |
|---|
| 1736 | |
|---|
| 1737 | DHL_AUD_STREAMTYPE streamType; |
|---|
| 1738 | ProgramAVInfo *av; |
|---|
| 1739 | |
|---|
| 1740 | av = Dmc_LockAVMutex(); |
|---|
| 1741 | |
|---|
| 1742 | if (av->active == 0 || av->analog) { |
|---|
| 1743 | dprint(0, "!! ChangeAudio: invalid state! active %d, analog %d\n", |
|---|
| 1744 | av->active, av->analog); |
|---|
| 1745 | status = statusInvalidState; |
|---|
| 1746 | goto label_end; |
|---|
| 1747 | } |
|---|
| 1748 | |
|---|
| 1749 | streamType = |
|---|
| 1750 | audioType == tDHL_AudioCodingType_AC3 ? DHL_STREAM_AUDIO_AC3 : |
|---|
| 1751 | audioType == tDHL_AudioCodingType_MPEG_2 ? DHL_STREAM_AUDIO_MPEG2 : |
|---|
| 1752 | audioType == tDHL_AudioCodingType_AAC ? DHL_STREAM_AUDIO_AAC : |
|---|
| 1753 | DHL_STREAM_AUDIO_AC3; // default.. |
|---|
| 1754 | |
|---|
| 1755 | if (pcrPID == 0) { |
|---|
| 1756 | dprint(2, " pcrPID 0.. use current pcr %d\n", av->pcr_pid); |
|---|
| 1757 | pcrPID = av->pcr_pid; |
|---|
| 1758 | } |
|---|
| 1759 | |
|---|
| 1760 | dprint(2, " stop current audio..\n"); |
|---|
| 1761 | dhlResult = DHL_AV_AudioStop(); |
|---|
| 1762 | // just continue without error check |
|---|
| 1763 | |
|---|
| 1764 | dprint(2, " restart new audio (%d, %d, 0x%x)..\n", audioPID, pcrPID, streamType); |
|---|
| 1765 | dhlResult = DHL_AV_AudioStart(audioPID, pcrPID, streamType); |
|---|
| 1766 | |
|---|
| 1767 | status = dhlResult ? statusError : statusOK; |
|---|
| 1768 | av->audio_pid = audioPID; // ¿¡·¯°¡ ¹ß»ýÇ߾ pid´Â update¸¦ ÇØÁÖÀÚ.. |
|---|
| 1769 | |
|---|
| 1770 | label_end: |
|---|
| 1771 | Dmc_UnlockAVMutex(); |
|---|
| 1772 | |
|---|
| 1773 | return status; |
|---|
| 1774 | } |
|---|
| 1775 | |
|---|
| 1776 | #else |
|---|
| 1777 | |
|---|
| 1778 | STATUS dmc_change_audio_stream(UINT32 audioPID, UINT32 pcrPID, tDHL_AudioCodingType audioType) |
|---|
| 1779 | { |
|---|
| 1780 | ProgramAVInfo *av; |
|---|
| 1781 | STATUS status; |
|---|
| 1782 | |
|---|
| 1783 | dprint(1, "%s (0x%x 0x%x)\n", __FUNCTION__, audioPID, pcrPID); |
|---|
| 1784 | |
|---|
| 1785 | if (pcrPID == 0) { |
|---|
| 1786 | av = Dmc_LockAVMutex(); |
|---|
| 1787 | dprint(2, " pcrPID 0.. use current pcr %d\n", av->pcr_pid); |
|---|
| 1788 | pcrPID = av->pcr_pid; |
|---|
| 1789 | Dmc_UnlockAVMutex(); |
|---|
| 1790 | } |
|---|
| 1791 | |
|---|
| 1792 | // audio ¸¸ stopÀ» ÇÑ´Ù. video´Â °Çµå¸®¸é ¾ÈµÊ. |
|---|
| 1793 | doDmc_StopDigitalAudio(); |
|---|
| 1794 | |
|---|
| 1795 | // video´Â »©°í audio¸¸ start¸¦ ÇÑ´Ù. |
|---|
| 1796 | status = doDmc_StartDigital(0, /* uVidPID */ |
|---|
| 1797 | audioPID, pcrPID, |
|---|
| 1798 | (DMC_VIDEO_CACHE)0, /* DMC_VIDEO_CACHE vcache */ |
|---|
| 1799 | (tDHL_VideoCodingType)0, |
|---|
| 1800 | audioType); |
|---|
| 1801 | |
|---|
| 1802 | av = Dmc_LockAVMutex(); |
|---|
| 1803 | |
|---|
| 1804 | if (status) { |
|---|
| 1805 | av->audio_pid = 0; |
|---|
| 1806 | } |
|---|
| 1807 | else { |
|---|
| 1808 | av->audio_pid = audioPID; |
|---|
| 1809 | av->audio_type = audioType; |
|---|
| 1810 | av->pcr_pid = pcrPID; |
|---|
| 1811 | } |
|---|
| 1812 | |
|---|
| 1813 | label_end: |
|---|
| 1814 | Dmc_UnlockAVMutex(); |
|---|
| 1815 | |
|---|
| 1816 | return status; |
|---|
| 1817 | } |
|---|
| 1818 | |
|---|
| 1819 | #endif |
|---|
| 1820 | |
|---|
| 1821 | STATUS dmc_change_video_stream(UINT32 videoPID, UINT32 pcrPID, tDHL_VideoCodingType videoType) |
|---|
| 1822 | { |
|---|
| 1823 | ProgramAVInfo *av; |
|---|
| 1824 | STATUS status; |
|---|
| 1825 | |
|---|
| 1826 | dprint(1, "%s (0x%x 0x%x)\n", __FUNCTION__, videoPID, pcrPID); |
|---|
| 1827 | |
|---|
| 1828 | if (pcrPID == 0) { |
|---|
| 1829 | av = Dmc_LockAVMutex(); |
|---|
| 1830 | dprint(2, " pcrPID 0.. use current pcr %d\n", av->pcr_pid); |
|---|
| 1831 | pcrPID = av->pcr_pid; |
|---|
| 1832 | Dmc_UnlockAVMutex(); |
|---|
| 1833 | } |
|---|
| 1834 | |
|---|
| 1835 | // video ¸¸ stopÀ» ÇÑ´Ù. |
|---|
| 1836 | doDmc_StopDigitalVideo(FALSE); // cache¿¡ ÀúÀå ÇÏÁö ¾ÊÀ½.. |
|---|
| 1837 | |
|---|
| 1838 | // video¸¸ start¸¦ ÇÑ´Ù. |
|---|
| 1839 | status = doDmc_StartDigital(videoPID, |
|---|
| 1840 | 0, /* uAudPID */ |
|---|
| 1841 | pcrPID, |
|---|
| 1842 | (DMC_VIDEO_CACHE)0, /* DMC_VIDEO_CACHE vcache */ |
|---|
| 1843 | videoType, |
|---|
| 1844 | (tDHL_AudioCodingType)0 /* tDHL_AudioCodingType */ ); |
|---|
| 1845 | |
|---|
| 1846 | av = Dmc_LockAVMutex(); |
|---|
| 1847 | |
|---|
| 1848 | if (status) { |
|---|
| 1849 | av->video_pid = 0; |
|---|
| 1850 | } |
|---|
| 1851 | else { |
|---|
| 1852 | av->video_pid = videoPID; |
|---|
| 1853 | av->video_type=videoType; |
|---|
| 1854 | av->pcr_pid = pcrPID; |
|---|
| 1855 | } |
|---|
| 1856 | |
|---|
| 1857 | Dmc_UnlockAVMutex(); |
|---|
| 1858 | |
|---|
| 1859 | return status; |
|---|
| 1860 | } |
|---|
| 1861 | |
|---|
| 1862 | |
|---|
| 1863 | |
|---|
| 1864 | |
|---|
| 1865 | STATUS Dmc_ChangeAudioStream(UINT32 audioPID, UINT32 pcrPID, tDHL_AudioCodingType audioType) |
|---|
| 1866 | { |
|---|
| 1867 | // Audio¸¸ ´Ù½Ã ¼±ÅÃÇÏ¿© Àç»ýÇÑ´Ù. |
|---|
| 1868 | // Á÷Á¢ Dmc_Audio API¸¦ ÀÌ¿ëÇØµµ µÇÁö¸¸, ChannelTask¿¡¼ warpper API¸¦ º°µµ·Î Á¦°øÇÑ´Ù. |
|---|
| 1869 | // |
|---|
| 1870 | // ÀÌ¹Ì digital TS°¡ °¡µ¿ÁßÀ̾î¾ß ÇÑ´Ù. (from NIMÀ̵ç, from 1394µç ±¸º°ÇÏÁö ¾ÊÀ½) |
|---|
| 1871 | // |
|---|
| 1872 | // DmcAudioAPI´Â dmc_tsd ¸¦ ÀÔ·ÂÀ¸·Î Çϴµ¥, dmc_tsd´Â ¸¶Áö¸· tuning API¿¡¼ |
|---|
| 1873 | // ¼³Á¤µÈ °ÍÀ» ±×´ë·Î »ç¿ëÇÑ´Ù. |
|---|
| 1874 | // PCR PID¸¦ 0À¸·Î ÁöÁ¤ÇÏ¸é ±âÁ¸ PCR PID¸¦ ±×´ë·Î »ç¿ëÇÑ´Ù. (ÀϹÝÀûÀÎ »óȲÀÓ) |
|---|
| 1875 | // audioType Àº ÀϹÝÀûÀ¸·Î AC3 (2)ÀÇ °ªÀ» °¡Áú °ÍÀÌ´Ù. |
|---|
| 1876 | // |
|---|
| 1877 | STATUS status; |
|---|
| 1878 | |
|---|
| 1879 | if (audioPID == 0) |
|---|
| 1880 | return statusInvalidArgument; |
|---|
| 1881 | |
|---|
| 1882 | // Updated by Chjeon 2007.09.07 |
|---|
| 1883 | if (Dmc_IsDmcTask()) |
|---|
| 1884 | { |
|---|
| 1885 | // Caller is DmcTask (Direct Call) |
|---|
| 1886 | status = dmc_change_audio_stream(audioPID, pcrPID, audioType); |
|---|
| 1887 | } |
|---|
| 1888 | else |
|---|
| 1889 | { |
|---|
| 1890 | // Caller is not DmcTask (Deffered Call) |
|---|
| 1891 | status = Dmc_EnqueueDPC((DMC_FN_DPC)dmc_change_audio_stream, audioPID, pcrPID, audioType, 0, FALSE); |
|---|
| 1892 | } |
|---|
| 1893 | |
|---|
| 1894 | return status; |
|---|
| 1895 | } |
|---|
| 1896 | |
|---|
| 1897 | |
|---|
| 1898 | STATUS Dmc_ChangeVideoStream(UINT32 videoPID, UINT32 pcrPID, tDHL_VideoCodingType videoType) |
|---|
| 1899 | { |
|---|
| 1900 | STATUS status; |
|---|
| 1901 | |
|---|
| 1902 | if (videoPID == 0) |
|---|
| 1903 | return statusInvalidArgument; |
|---|
| 1904 | |
|---|
| 1905 | // Updated by Chjeon 2007.09.07 |
|---|
| 1906 | if (Dmc_IsDmcTask()) |
|---|
| 1907 | { |
|---|
| 1908 | // Caller is DmcTask (Direct Call) |
|---|
| 1909 | status = dmc_change_video_stream(videoPID, pcrPID, videoType); |
|---|
| 1910 | } |
|---|
| 1911 | else |
|---|
| 1912 | { |
|---|
| 1913 | // Caller is not DmcTask (Deffered Call) |
|---|
| 1914 | status = Dmc_EnqueueDPC((DMC_FN_DPC)dmc_change_video_stream, videoPID, pcrPID, videoType, 0, FALSE); // Wait Option Ãß°¡ FALSE ±â´Ù¸®Áö ¾Ê´Â´Ù . |
|---|
| 1915 | } |
|---|
| 1916 | |
|---|
| 1917 | return status; |
|---|
| 1918 | } |
|---|
| 1919 | |
|---|
| 1920 | |
|---|
| 1921 | |
|---|
| 1922 | |
|---|
| 1923 | #if COMMENT |
|---|
| 1924 | ______Wrapper_API_______(){} |
|---|
| 1925 | #endif |
|---|
| 1926 | |
|---|
| 1927 | // cafrii 070830 comment |
|---|
| 1928 | // |
|---|
| 1929 | // ÀÌ ÇÔ¼öµéÀº »ç½Ç»ó Channel Tuning ÀÛ¾÷°ú Å« °ü·ÃÀÌ ¾ø´Â ÀÛ¾÷ µéÀÌ´Ù. |
|---|
| 1930 | // |
|---|
| 1931 | // ÀÌ·± ÇÔ¼öÀÇ È£ÃâÀº cancel µ¿ÀÛ¿¡ ¾Ö¸ÅÇÔ¸¸ °¡Áß½Ã۱⠶§¹®¿¡ |
|---|
| 1932 | // °¡´ÉÇϸé HAL ÇÔ¼ö¸¦ Á÷Á¢ »ç¿ëÇϵµ·Ï º¯°æÇÏ´Â °Ô ³´´Ù. |
|---|
| 1933 | // |
|---|
| 1934 | // Channel Tuning Task´Â ¿À·ÎÁö ½Ã°£ÀÌ ¸¹ÀÌ ¼Ò¿äµÇ´Â Channel Tuning ÀÛ¾÷¸¸ Àü´ãÇϵµ·Ï ÇÑ´Ù. |
|---|
| 1935 | // |
|---|
| 1936 | |
|---|
| 1937 | |
|---|
| 1938 | |
|---|
| 1939 | /* |
|---|
| 1940 | Ãâ·Â timing ¼³Á¤ÇÏ´Â API. |
|---|
| 1941 | |
|---|
| 1942 | */ |
|---|
| 1943 | STATUS Dmc_ChangeDisplay(VOUT_COLOR color, VOUT_FORMAT format, VOUT_RATIO ratio, |
|---|
| 1944 | tDHL_DispARC ScrAdj, AuxVideoSetting AuxType) |
|---|
| 1945 | { |
|---|
| 1946 | CmdParam_ChangeDisplay param; |
|---|
| 1947 | STATUS status; |
|---|
| 1948 | |
|---|
| 1949 | param.color = color; |
|---|
| 1950 | param.format = format; |
|---|
| 1951 | param.ratio = ratio; |
|---|
| 1952 | param.adj = ScrAdj; |
|---|
| 1953 | param.aux = AuxType; |
|---|
| 1954 | |
|---|
| 1955 | #if SUPPORT_ETC_API_SYNC |
|---|
| 1956 | status = Dmc_SendCommand(cmdChangeDisplay, (UINT32)¶m, FALSE); |
|---|
| 1957 | // jump to doDmc_CmdChangeDisplay |
|---|
| 1958 | |
|---|
| 1959 | #else |
|---|
| 1960 | // ÇöÀçÀÇ task¿¡¼ Á÷Á¢ È£Ãâ. |
|---|
| 1961 | status = Dmc_ExecuteCommand(cmdChangeDisplay, (UINT32)¶m, |
|---|
| 1962 | doDmc_CmdChangeDisplay); |
|---|
| 1963 | |
|---|
| 1964 | #endif |
|---|
| 1965 | |
|---|
| 1966 | return status; |
|---|
| 1967 | } |
|---|
| 1968 | |
|---|
| 1969 | |
|---|
| 1970 | /* |
|---|
| 1971 | Ãâ·Â Aspect Ration Adjustment ¼³Á¤/º¯°æ ÇÏ´Â API. |
|---|
| 1972 | |
|---|
| 1973 | ¹Ì¸® Ãâ·Â timing ¼³Á¤ÀÌ µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù. |
|---|
| 1974 | */ |
|---|
| 1975 | STATUS Dmc_ChangeVideoAdjustment(tDHL_DispARC adj_hd, tDHL_DispARC adj_sd) |
|---|
| 1976 | { |
|---|
| 1977 | STATUS status; |
|---|
| 1978 | UINT32 param; |
|---|
| 1979 | |
|---|
| 1980 | dprint(1, "Dmc_VideoAspectRatioAdjustment(%d, %d)\n", adj_hd, adj_sd); |
|---|
| 1981 | |
|---|
| 1982 | param = ((UINT32)adj_sd << 16) | ((UINT32)adj_hd & 0xffff); |
|---|
| 1983 | |
|---|
| 1984 | #if SUPPORT_ETC_API_SYNC |
|---|
| 1985 | // send command with wait mode, not cancel prev commands.. |
|---|
| 1986 | status = Dmc_SendCommand(cmdChangeVideoAdjustment, param, FALSE); |
|---|
| 1987 | // jumpt doDmc_CmdChangeVideoAdjustment |
|---|
| 1988 | |
|---|
| 1989 | #else |
|---|
| 1990 | // ÇöÀçÀÇ task¿¡¼ Á÷Á¢ È£Ãâ. |
|---|
| 1991 | status = Dmc_ExecuteCommand(cmdChangeVideoAdjustment, param, |
|---|
| 1992 | doDmc_CmdChangeVideoAdjustment); |
|---|
| 1993 | |
|---|
| 1994 | #endif |
|---|
| 1995 | |
|---|
| 1996 | return status; |
|---|
| 1997 | } |
|---|
| 1998 | |
|---|
| 1999 | |
|---|
| 2000 | /* |
|---|
| 2001 | ºñµð¿ÀÀÇ Ãâ·Â È¸é ¼³Á¤ÇÏ´Â API. |
|---|
| 2002 | |
|---|
| 2003 | Dmc_ChangeVideoAdjustmentÀÇ super set ±â´É. |
|---|
| 2004 | */ |
|---|
| 2005 | STATUS Dmc_AdjustVideoScreen(tDHL_DispARC adj, INT32 x, INT32 y, INT32 w, INT32 h) |
|---|
| 2006 | { |
|---|
| 2007 | STATUS status; |
|---|
| 2008 | CmdParam_AdjustScreen param; |
|---|
| 2009 | |
|---|
| 2010 | dprint(1, "Dmc_AdjustVideoScreen(%d, %d)\n", adj); |
|---|
| 2011 | |
|---|
| 2012 | param.adj = adj; |
|---|
| 2013 | param.x = x; |
|---|
| 2014 | param.y = y; |
|---|
| 2015 | param.w = w; |
|---|
| 2016 | param.h = h; |
|---|
| 2017 | |
|---|
| 2018 | #if SUPPORT_ETC_API_SYNC |
|---|
| 2019 | // send command with wait mode, not cancel prev commands.. |
|---|
| 2020 | status = Dmc_SendCommand(cmdAdjustScreen, (UINT32)¶m, FALSE); |
|---|
| 2021 | // jumpt doDmc_CmdAdjustScreen |
|---|
| 2022 | |
|---|
| 2023 | #else |
|---|
| 2024 | // ÇöÀçÀÇ task¿¡¼ Á÷Á¢ È£Ãâ. |
|---|
| 2025 | status = Dmc_ExecuteCommand(cmdAdjustScreen, (UINT32)¶m, |
|---|
| 2026 | doDmc_CmdAdjustScreen); |
|---|
| 2027 | |
|---|
| 2028 | #endif |
|---|
| 2029 | |
|---|
| 2030 | return status; |
|---|
| 2031 | } |
|---|
| 2032 | |
|---|
| 2033 | |
|---|
| 2034 | /* |
|---|
| 2035 | ºñµð¿À ȸéÀÌ ³ª¿À´Â window Å©±â¸¦ º¯°æÇÏ´Â ÇÔ¼ö. |
|---|
| 2036 | |
|---|
| 2037 | */ |
|---|
| 2038 | STATUS Dmc_ResizeVideo(INT32 x, INT32 y, UINT32 w, UINT32 h) |
|---|
| 2039 | { |
|---|
| 2040 | // cafrii 060519 add |
|---|
| 2041 | |
|---|
| 2042 | CmdParam_VideoResize param; |
|---|
| 2043 | STATUS status; |
|---|
| 2044 | |
|---|
| 2045 | param.x = x; |
|---|
| 2046 | param.y = y; |
|---|
| 2047 | param.w = w; |
|---|
| 2048 | param.h = h; |
|---|
| 2049 | |
|---|
| 2050 | #if SUPPORT_ETC_API_SYNC |
|---|
| 2051 | // send command with wait mode, not cancel prev commands.. |
|---|
| 2052 | status = Dmc_SendCommand(cmdVideoResize, (UINT32)¶m, FALSE); |
|---|
| 2053 | // jump to doDmc_CmdVideoResize |
|---|
| 2054 | |
|---|
| 2055 | #else |
|---|
| 2056 | // ÇöÀçÀÇ task¿¡¼ Á÷Á¢ È£Ãâ. |
|---|
| 2057 | status = Dmc_ExecuteCommand(cmdVideoResize, (UINT32)¶m, |
|---|
| 2058 | doDmc_CmdVideoResize); |
|---|
| 2059 | |
|---|
| 2060 | #endif |
|---|
| 2061 | |
|---|
| 2062 | return status; |
|---|
| 2063 | } |
|---|
| 2064 | |
|---|
| 2065 | |
|---|
| 2066 | |
|---|
| 2067 | |
|---|
| 2068 | |
|---|
| 2069 | STATUS Dmc_FreezeVideo(UINT32 bFreeze, BOOL bWaitComplete) |
|---|
| 2070 | { |
|---|
| 2071 | #if SUPPORT_ETC_API_SYNC |
|---|
| 2072 | // cafrii 070830 do not synchronize dmc task |
|---|
| 2073 | |
|---|
| 2074 | // cafrii 070412 add 'bWaitComplete' arg. |
|---|
| 2075 | // app may want to call hide/show command without pending. |
|---|
| 2076 | // but app should care all possible side-effects when 'No Wait' mode is used. |
|---|
| 2077 | // |
|---|
| 2078 | if (bWaitComplete && !Dmc_IsDmcTask()) |
|---|
| 2079 | { |
|---|
| 2080 | dprint(1, "Dmc_FreezeVideo(%d)\n", bFreeze); |
|---|
| 2081 | |
|---|
| 2082 | return Dmc_EnqueueDPC((DMC_FN_DPC)Dmc_FreezeVideo, (UINT32)bFreeze, FALSE, 0, 0, TRUE); |
|---|
| 2083 | } |
|---|
| 2084 | #endif // SUPPORT_ETC_API_SYNC |
|---|
| 2085 | |
|---|
| 2086 | { |
|---|
| 2087 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 2088 | |
|---|
| 2089 | dprint(1, "cmdVideoFreeze(%d):\n", bFreeze); |
|---|
| 2090 | |
|---|
| 2091 | dhlResult = DHL_AV_VideoFreeze(0, bFreeze ? TRUE : FALSE); |
|---|
| 2092 | |
|---|
| 2093 | return dhlResult ? statusError : statusOK; |
|---|
| 2094 | } |
|---|
| 2095 | } |
|---|
| 2096 | |
|---|
| 2097 | |
|---|
| 2098 | STATUS Dmc_HideVideo(UINT32 bHide, BOOL bWaitComplete) |
|---|
| 2099 | { |
|---|
| 2100 | #if SUPPORT_ETC_API_SYNC |
|---|
| 2101 | // cafrii 070830 do not synchronize dmc task |
|---|
| 2102 | |
|---|
| 2103 | // cafrii 070412 add 'bWaitComplete' arg. |
|---|
| 2104 | // app may want to call hide/show command without pending. |
|---|
| 2105 | // but app should care all possible side-effects when 'No Wait' mode is used. |
|---|
| 2106 | // |
|---|
| 2107 | if (bWaitComplete && !Dmc_IsDmcTask()) |
|---|
| 2108 | { |
|---|
| 2109 | dprint(1, "Dmc_HideVideo(%d)\n", bHide); |
|---|
| 2110 | |
|---|
| 2111 | return Dmc_EnqueueDPC((DMC_FN_DPC)Dmc_HideVideo, (UINT32)bHide, FALSE, 0, 0, TRUE); |
|---|
| 2112 | } |
|---|
| 2113 | #endif // SUPPORT_ETC_API_SYNC |
|---|
| 2114 | |
|---|
| 2115 | { |
|---|
| 2116 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 2117 | |
|---|
| 2118 | dprint(1, "cmdVideoHide(%d):\n", bHide); |
|---|
| 2119 | |
|---|
| 2120 | if (bHide) |
|---|
| 2121 | dmc_bRequestVideoHide |= DMC_VIDEO_HIDE_USER; |
|---|
| 2122 | else |
|---|
| 2123 | dmc_bRequestVideoHide &= ~DMC_VIDEO_HIDE_USER; |
|---|
| 2124 | |
|---|
| 2125 | if (1) { |
|---|
| 2126 | ProgramAVInfo *av = Dmc_LockAVMutex(); |
|---|
| 2127 | av->video_hidden = (dmc_bRequestVideoHide & DMC_VIDEO_HIDE_USER) ? TRUE : FALSE; |
|---|
| 2128 | Dmc_UnlockAVMutex(); |
|---|
| 2129 | } |
|---|
| 2130 | |
|---|
| 2131 | dhlResult = DHL_AV_VideoHide(0, dmc_bRequestVideoHide ? TRUE : FALSE); |
|---|
| 2132 | |
|---|
| 2133 | return dhlResult ? statusError : statusOK; |
|---|
| 2134 | } |
|---|
| 2135 | } |
|---|
| 2136 | |
|---|
| 2137 | |
|---|
| 2138 | |
|---|
| 2139 | |
|---|
| 2140 | #if COMMENT |
|---|
| 2141 | ________(){} |
|---|
| 2142 | #endif |
|---|
| 2143 | |
|---|
| 2144 | #if DMW_REGISTER_DEBUG_SYMBOL |
|---|
| 2145 | |
|---|
| 2146 | static DHL_SymbolTable ChannelSymbols[] = |
|---|
| 2147 | { |
|---|
| 2148 | //---- functions |
|---|
| 2149 | |
|---|
| 2150 | DHL_FNC_SYM_ENTRY(Dmc_StopVideo), |
|---|
| 2151 | DHL_FNC_SYM_ENTRY(Dmc_FreezeVideo), |
|---|
| 2152 | DHL_FNC_SYM_ENTRY(Dmc_RestartVideo), |
|---|
| 2153 | DHL_FNC_SYM_ENTRY(Dmc_HideVideo), |
|---|
| 2154 | DHL_FNC_SYM_ENTRY(Dmc_ChangeDisplay), |
|---|
| 2155 | DHL_FNC_SYM_ENTRY(Dmc_ChangeVideoAdjustment), |
|---|
| 2156 | DHL_FNC_SYM_ENTRY(Dmc_ResizeVideo), |
|---|
| 2157 | |
|---|
| 2158 | DHL_FNC_SYM_ENTRY(Dmc_ChangeRfChannelByTuneParam), |
|---|
| 2159 | DHL_FNC_SYM_ENTRY(Dmc_ChangeRfChannel), |
|---|
| 2160 | DHL_FNC_SYM_ENTRY(Dmc_ChangeRfChannel2), |
|---|
| 2161 | DHL_FNC_SYM_ENTRY(Dmc_ChangeExtInput), |
|---|
| 2162 | DHL_FNC_SYM_ENTRY(Dmc_ChangeProgram), |
|---|
| 2163 | DHL_FNC_SYM_ENTRY(Dmc_ChangeAudioStream), |
|---|
| 2164 | |
|---|
| 2165 | //---- variables |
|---|
| 2166 | |
|---|
| 2167 | DHL_VAR_SYM_ENTRY(g_Timeout_SignalLock), |
|---|
| 2168 | DHL_VAR_SYM_ENTRY(g_Timeout_AnalogSignalLock), |
|---|
| 2169 | DHL_VAR_SYM_ENTRY(g_Timeout_VctLoading), |
|---|
| 2170 | DHL_VAR_SYM_ENTRY(g_Timeout_PatLoading), |
|---|
| 2171 | DHL_VAR_SYM_ENTRY(g_Timeout_PmtLoading), |
|---|
| 2172 | |
|---|
| 2173 | //DHL_VAR_SYM_ENTRY(g_Trace_DmcMain), |
|---|
| 2174 | |
|---|
| 2175 | DHL_VAR_SYM_ENTRY(dmc_bTestNoAux), |
|---|
| 2176 | }; |
|---|
| 2177 | |
|---|
| 2178 | #endif // DMW_REGISTER_DEBUG_SYMBOL |
|---|
| 2179 | |
|---|
| 2180 | |
|---|
| 2181 | void Dmc_RegisterChannelSymbols() |
|---|
| 2182 | { |
|---|
| 2183 | |
|---|
| 2184 | #if DMW_REGISTER_DEBUG_SYMBOL |
|---|
| 2185 | DHL_DBG_RegisterSymbols(ChannelSymbols, DHL_NUMSYMBOLS(ChannelSymbols)); |
|---|
| 2186 | |
|---|
| 2187 | RegisterChannelAVSymbols(); |
|---|
| 2188 | RegisterChannelTuneSymbols(); |
|---|
| 2189 | RegisterChannelUtilSymbols(); |
|---|
| 2190 | RegisterChannelScanSymbols(); |
|---|
| 2191 | |
|---|
| 2192 | #endif |
|---|
| 2193 | |
|---|
| 2194 | } |
|---|
| 2195 | |
|---|
| 2196 | |
|---|
| 2197 | |
|---|
| 2198 | /************************************************************************** |
|---|
| 2199 | |
|---|
| 2200 | 2.26 2005/4/4 Dmc_Init¿¡¼ Demux start Ãß°¡ |
|---|
| 2201 | |
|---|
| 2202 | 2.25 2005/3/22 Dmc_IsDmcTask Ãß°¡ |
|---|
| 2203 | dmc_TaskID ÀÇ const specifier »èÁ¦ |
|---|
| 2204 | 2.24 2005/3/15 ParseXXX API »ç¿ë ÈÄ ¿¡·¯ ¸®ÅÏÇÏ¸é ¹Ýµå½Ã pointer NULL ¼³Á¤Çϵµ·Ï ¼öÁ¤ |
|---|
| 2205 | MonitorPMTÀÇ pid°ª validity üũ |
|---|
| 2206 | NtscFreqOffset->freqOffset À̸§ º¯°æ |
|---|
| 2207 | |
|---|
| 2208 | 2.23 2005/2/21 ProcessTimingChange ¿¡¼ source/display wide¸¦ ±¸ºÐÇØ¼ Àû¿ë |
|---|
| 2209 | 2.22 2005/1/26 DigitalCable Æ©´×½Ã ¸ðµç modulation¿¡ g_Timeout_SignalLock Àû¿ë |
|---|
| 2210 | 2.21 2005/1/24 ReportCaPmt in NTSC, |
|---|
| 2211 | dmc_bRequestVideoWidthReduction °ü·Ã ÃʱⰪ ÁöÁ¤ |
|---|
| 2212 | 2.20 2005/01/19 Tning½Ã Modulation ÀÚµ¿ °Ë»ö ±â´É Ãß°¡ |
|---|
| 2213 | 2.19 2004/12/01 PmtChange ¿¡µµ DHL_AV_ReportPmtChange Ãß°¡ |
|---|
| 2214 | ´Ü PodActiveMode ¿¡¼¸¸ È£ÃâÇϵµ·Ï ÇÔ. |
|---|
| 2215 | tuner set ÈÄ ¼º°øÀ̸é DHL_AV_ReportTunerStatus Àü¼Û |
|---|
| 2216 | Pod ¸ðµå¿¡¼ PSI·Î¸¸ Æ©´×Çϵµ·Ï ¼öÁ¤ |
|---|
| 2217 | CTF_SkipPrescanPidInfo Á¶°Ç Ãß°¡ |
|---|
| 2218 | doDmc_MakeAppBannerPararm ¿¡ program_number Ãß°¡ |
|---|
| 2219 | |
|---|
| 2220 | 2.18 2004/11/11 AppBannerParam ¿¡¼ type field Ãß°¡ |
|---|
| 2221 | 2.17 2004/11/10 PID tuning¿¡¼ StartDigitalÀÌ cancel µÈ °æ¿ì ó¸® Ãß°¡ |
|---|
| 2222 | 2.16 2004/11/5 Dmc_PrintVideoFormat debug level Ãß°¡ |
|---|
| 2223 | 2.15 2004/11/4 Dmc_ChangeRfChannel ¿¡¼ digital cableÀ̸é modulation autodetect ¸ðµå |
|---|
| 2224 | analog RfTune/video restart ¿¡¼ freeze Àû¿ë |
|---|
| 2225 | 2.14 2004/11/3 audio only ä³Î¿¡¼ AddProgramFlattenInfo ÇÏÁö ¾ÊÀ½, pcr pid update |
|---|
| 2226 | Dmc_PrintProgramInfo ¿¡¼ dbg level Àμö Ãß°¡ |
|---|
| 2227 | |
|---|
| 2228 | 2.13 2004/9/20 DMW_Config µµÀÔ, config »çÇ× À̵¿ |
|---|
| 2229 | 2.12 2004/9/10 cancel id °ü·Ã µð¹ö±× ¸Þ½ÃÁö¸¦ Ãß°¡ |
|---|
| 2230 | Dmc_RegisterPodActivityReporter Ãß°¡ |
|---|
| 2231 | |
|---|
| 2232 | 2.11 2004/9/03 Video width reduction ÇÔ¼ö/º¯¼ö Ãß°¡ |
|---|
| 2233 | IsWideDisplay api Ãß°¡ |
|---|
| 2234 | ChangeDisplayEx ¿¡¼ wide ÀÎÀÚ »ç¿ëÇÏÁö ¾ÊÀ½ |
|---|
| 2235 | |
|---|
| 2236 | 2.10 2004/8/30 ChannelAPI Çì´õ ºÐ¸®, Channel.h ¿¡ HAL, ChannelType µîÀÇ º¯¼ö Ãß°¡ |
|---|
| 2237 | 2.09 2004/7/26 send_command¿¡¼ OS_LockTask/OS_UnlockTask Ãß°¡ |
|---|
| 2238 | 2.08 2004/7/23 debug print categorization |
|---|
| 2239 | 2.07 2004/7/21 comment update, restructuring of CmdParam_xxx |
|---|
| 2240 | 2.06 2004/7/8 smart video freeze, selective audio play bugfix |
|---|
| 2241 | deferred video adjustment |
|---|
| 2242 | 2.05 2004/6/16 xVCT,PSI¿¡¼ selectAudioStream¿¡ audio type Ãß°¡, audType display bugfix |
|---|
| 2243 | ChangeAudioStream, PlayNextAudio Ãß°¡ |
|---|
| 2244 | _Dmc_DecodeStopCallback ±¸ÇöÇϰí StopDigitalVideoCtx¿¡¼ À̸¦ ºÒ·¯ÁÜ |
|---|
| 2245 | 2.04 2004/06/04 tuningÇÒ¶§ selectAudioStream ÀÌÈÄ pid°¡ À¯È¿ÇÑÁö üũÇÑ ÈÄ ¿¡·¯Ã³¸® |
|---|
| 2246 | 2.03 2004/06/03 _dmc_PatEventProc¿¡¼ dmc_pmtPsiCtl üũ |
|---|
| 2247 | 2.02 2004/06/01 Dmc_EnqueueDPC API Ãß°¡ |
|---|
| 2248 | 2.01 2004/05/31 statusDmcQFull üũ Ãß°¡ |
|---|
| 2249 | 2.0 2004/05/28 send_command ½ÇÆÐÇÒ °æ¿ì ¸®¼Ò½º ´©¼ö ¹®Á¦ ¼öÁ¤ |
|---|
| 2250 | tunecallback¿¡ userparam Ãß°¡ |
|---|
| 2251 | 1.4 2004/01/12 SLD ¾ø´Â VCTÀÏ °æ¿ì PSI ¿ìȸ ó¸® ±â´É Ãß°¡ , #SupportVCTWithoutSLD |
|---|
| 2252 | 1.3 2003/12/31 AppBannerÁö¿ø, CTF_SemiAutomatic Ãß°¡ |
|---|
| 2253 | 1.2 2003/12/30 »õ·Î¿î PCE Tuning PolicyÀû¿ë. CTF_RetryMainChannel Ãß°¡ |
|---|
| 2254 | 1.1 2003/12/05 ¿¡·¯ ¹ß»ý½Ã retry¸¦ ÇÒ ¼ö ÀÖµµ·Ï Ç÷¡±× Ãß°¡ |
|---|
| 2255 | 1.0 2003/11/27 remove all VideoFlatten feature (do not use anymore) |
|---|
| 2256 | support 1394 by default (remove SUPPORT_1394_INPUT) |
|---|
| 2257 | * |
|---|
| 2258 | **************************************************************************/ |
|---|