| 1 | /******************************************************************** |
|---|
| 2 | * |
|---|
| 3 | * DMW_EIA608B.c |
|---|
| 4 | * |
|---|
| 5 | * Copyright 2002-2004 Digital STREAM Technology, Inc. |
|---|
| 6 | * All Rights Reserved |
|---|
| 7 | * |
|---|
| 8 | * $Id: DMW_EIA608B.c,v 1.7 2005/09/06 00:47:51 jina Exp $ |
|---|
| 9 | *******************************************************************/ |
|---|
| 10 | |
|---|
| 11 | #include "TLCommon.h" |
|---|
| 12 | |
|---|
| 13 | #include "DMW_Status.h" |
|---|
| 14 | |
|---|
| 15 | //#include "MW_Common.h" |
|---|
| 16 | #include "DMW_EIA608B.h" |
|---|
| 17 | #include "DMW_CC.h" |
|---|
| 18 | |
|---|
| 19 | /*** |
|---|
| 20 | porting guide |
|---|
| 21 | |
|---|
| 22 | OS_Dbgprintf --> epgPrintf |
|---|
| 23 | **/ |
|---|
| 24 | //#define epgPrintf core_printf |
|---|
| 25 | //#define eia608B_DEBUG |
|---|
| 26 | |
|---|
| 27 | #define NTSC_RATING_TIMEOUT_DEFAULT 5000 |
|---|
| 28 | |
|---|
| 29 | // cafrii 070201, import from DMW_EpgStructDef.h |
|---|
| 30 | #define evtEpgNtscVersionChange 0x100 |
|---|
| 31 | typedef int EpgUpdateEventType; |
|---|
| 32 | typedef STATUS (*EpgUpdateCallbackFn) (EpgUpdateEventType evt, UINT32 param1, UINT32 param2); |
|---|
| 33 | |
|---|
| 34 | #define MW_CAlloc OS_Calloc |
|---|
| 35 | #define MW_Free OS_Free |
|---|
| 36 | |
|---|
| 37 | #define epgPrintf OS_DbgPrintf |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | /*2003.12.17. for monitoring ntsc epg change. added by jina*/ |
|---|
| 43 | EpgUpdateCallbackFn gNtscAsynchProcedure = 0; |
|---|
| 44 | //extern EpgUpdateCallbackFn gNtscAsynchProcedure; |
|---|
| 45 | |
|---|
| 46 | static NtscEpgInfoHeader g_ntscProgramInfoHeader; |
|---|
| 47 | |
|---|
| 48 | static DHL_OS_SEMA_ID g_ntscProgramInfoUpdateSema4= 0; |
|---|
| 49 | static DHL_OS_SEMA_ID g_ntscRatingUpdateSema4 = 0; |
|---|
| 50 | static DHL_OS_SEMA_ID g_ntscTimeInfoSema4 = 0; |
|---|
| 51 | static DHL_OS_SEMA_ID g_ntscChannelInfoSema4 = 0; |
|---|
| 52 | |
|---|
| 53 | int g_Tiemout_NtscUpdate = 1000; /*1 seconds*/ |
|---|
| 54 | UINT32 g_Timeout_RatingUpdate = NTSC_RATING_TIMEOUT_DEFAULT; |
|---|
| 55 | |
|---|
| 56 | BOOLEAN g_bOnlyCurrentMode = TRUE; |
|---|
| 57 | |
|---|
| 58 | /*ÁøÇàÇüÀ¸·Î °è¼Ó updateÁßÀÎ epg data µé...*/ |
|---|
| 59 | NtscBasicEpgInfo g_ntscBasicEpgInfo; |
|---|
| 60 | NtscCaptionInfo g_ntscCaptionInfo; |
|---|
| 61 | NtscAudioInfo g_ntscAudioInfo; |
|---|
| 62 | NtscCGMSA g_ntscCGMSA; |
|---|
| 63 | NtscAspectRatioInfo g_ntscAspectRatioInfo; |
|---|
| 64 | NtscTimeInfo g_ntscTimeInfo; |
|---|
| 65 | NtscProgramDescription g_ntscProgramDescription; |
|---|
| 66 | NtscChannelInfo g_ntscChannelInfo; |
|---|
| 67 | |
|---|
| 68 | // old epg¸¦ »ç¿ëÇÏÁö ¾Ê±â ¶§¹®¿¡ °ü·Ã structure°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù. |
|---|
| 69 | // »õ·Ó°Ô ´Ù¸¥ °ÍÀ¸·Î ´ëüÇÑ´Ù. |
|---|
| 70 | //DMW_Rating g_ntscRatingInfo; |
|---|
| 71 | NtscRatingInfo g_ntscRatingInfo; |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | /*2004.01.17. added by jina. RatingÁ¤º¸¸¦ ¹öÀü ºñ±³ ÇÒ¶§ ParsingÇϱâ Àü¿¡ ºñ±³ |
|---|
| 75 | Çϱâ À§ÇØ raw data 2 byte¸¦ ±â¾ï ÇÑ´Ù.*/ |
|---|
| 76 | UINT8 g_ntscRatingInfoRaw[2]; |
|---|
| 77 | int g_ntscRatingCaptureTicks = 0; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | void DMW_608B_SetCurrentOnlyMode( BOOLEAN bFlag ) |
|---|
| 81 | { |
|---|
| 82 | g_bOnlyCurrentMode = bFlag; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | BOOLEAN DMW_608B_IsCurrentOnlyMode() |
|---|
| 86 | { |
|---|
| 87 | return g_bOnlyCurrentMode; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | NtscBasicEpgInfo * allocNtscBasicEpgInformation() |
|---|
| 91 | { |
|---|
| 92 | return ( (NtscBasicEpgInfo *)MW_CAlloc( sizeof(NtscBasicEpgInfo) , 1) ); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | void copyNtscBasicEpgInformation( NtscBasicEpgInfo *pSource , NtscBasicEpgInfo *pDest ) |
|---|
| 96 | { |
|---|
| 97 | |
|---|
| 98 | #ifdef eia608B_DEBUG |
|---|
| 99 | // epgPrintf("copyNtscBasicEpgInformation : source = 0x%x , destination = 0x%x\n" , pSource ,pDest ); |
|---|
| 100 | // epgPrintf("copyNtscBasicEpgInformation : source->programLength = %d , destination->programLength = 0x%d\n" , pSource->programNameLength ,pDest->programNameLength ); |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | memcpy( pDest ,pSource , sizeof(NtscBasicEpgInfo) ); |
|---|
| 104 | |
|---|
| 105 | /*°ü¸®¿ë parameterµé*/ |
|---|
| 106 | pDest->pNext = NULL; |
|---|
| 107 | pDest->receiveStatus = 0; |
|---|
| 108 | |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | void printBasicEpgInformation() |
|---|
| 112 | { |
|---|
| 113 | #ifdef eia608B_DEBUG |
|---|
| 114 | NtscBasicEpgInfo *pEpgInfo = NULL; |
|---|
| 115 | int i = 0; |
|---|
| 116 | |
|---|
| 117 | pEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 118 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 119 | { |
|---|
| 120 | if(pEpgInfo) |
|---|
| 121 | { |
|---|
| 122 | epgPrintf("-----------------%d-----------------\n" , i); |
|---|
| 123 | epgPrintf("startMinute = %d\n", pEpgInfo->startMinute); |
|---|
| 124 | epgPrintf("startHour = %d\n", pEpgInfo->startHour); |
|---|
| 125 | epgPrintf("startDate = %d\n", pEpgInfo->startDate); |
|---|
| 126 | epgPrintf("startMonth = %d\n", pEpgInfo->startMonth); |
|---|
| 127 | epgPrintf("bTapeDelay = %d\n", pEpgInfo->bTapeDelay); |
|---|
| 128 | epgPrintf("minLength = %d\n", pEpgInfo->minLength); |
|---|
| 129 | epgPrintf("hourLength = %d\n", pEpgInfo->hourLength); |
|---|
| 130 | epgPrintf("minElapsed = %d\n", pEpgInfo->minElapsed); |
|---|
| 131 | epgPrintf("hourElapsed = %d\n", pEpgInfo->hourElapsed); |
|---|
| 132 | epgPrintf("secElapsed = %d\n", pEpgInfo->secElapsed); |
|---|
| 133 | epgPrintf("programNameLength = %d\n", pEpgInfo->programNameLength); |
|---|
| 134 | epgPrintf("programName = %s\n", pEpgInfo->programName); |
|---|
| 135 | epgPrintf("programType = 0x%x\n", (int)pEpgInfo->programType); |
|---|
| 136 | epgPrintf("\n"); |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | pEpgInfo = pEpgInfo->pNext; |
|---|
| 140 | } |
|---|
| 141 | #endif |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | void freeNtscBasicEpgInformation( NtscBasicEpgInfo *pEpgInfoToDelete ) |
|---|
| 145 | { |
|---|
| 146 | if(pEpgInfoToDelete) |
|---|
| 147 | MW_Free((void **)&pEpgInfoToDelete ); |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | void programListVersionUp() |
|---|
| 151 | { |
|---|
| 152 | |
|---|
| 153 | ++(g_ntscProgramInfoHeader.iInternalVersion); |
|---|
| 154 | g_ntscProgramInfoHeader.iInternalVersion %= 32; /*5bits¸¸ »ç¿ëÇÏÀÚ.*/ |
|---|
| 155 | |
|---|
| 156 | #ifdef eia608B_DEBUG |
|---|
| 157 | epgPrintf("programListVersionUp : iInternalVersion is %d\n" ,g_ntscProgramInfoHeader.iInternalVersion ); |
|---|
| 158 | #endif |
|---|
| 159 | |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | STATUS addToEpgInfoList( NtscBasicEpgInfo *pEpgInfoElem ) |
|---|
| 163 | { |
|---|
| 164 | int semErr; |
|---|
| 165 | |
|---|
| 166 | #ifdef eia608B_DEBUG |
|---|
| 167 | epgPrintf("in the addToEpgInfoList() : try to add one programElement\n"); |
|---|
| 168 | #endif |
|---|
| 169 | semErr = DHL_OS_TakeSemaphore(g_ntscProgramInfoUpdateSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 170 | |
|---|
| 171 | if(semErr) |
|---|
| 172 | { |
|---|
| 173 | #ifdef eia608B_DEBUG |
|---|
| 174 | epgPrintf("addToEpgInfoList() : g_ntscProgramInfoUpdateSema4 is timeout\n"); |
|---|
| 175 | #endif |
|---|
| 176 | return statusTimeout; /*maybe timeout*/ |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | #ifdef eia608B_DEBUG |
|---|
| 180 | epgPrintf("addToEpgInfoList() : g_ntscProgramInfoHeader.pNext is 0x%x\n" ,g_ntscProgramInfoHeader.pNext); |
|---|
| 181 | #endif |
|---|
| 182 | pEpgInfoElem->pNext = g_ntscProgramInfoHeader.pNext; |
|---|
| 183 | g_ntscProgramInfoHeader.pNext = pEpgInfoElem; /*header ¹Ù·Î µÚ¿¡ »õ·Î¿î elementÃß°¡.*/ |
|---|
| 184 | g_ntscProgramInfoHeader.iElemCount++; |
|---|
| 185 | |
|---|
| 186 | #ifdef eia608B_DEBUG |
|---|
| 187 | epgPrintf("addToEpgInfoList() : g_ntscProgramInfoHeader.pNext is 0x%x\n" ,g_ntscProgramInfoHeader.pNext); |
|---|
| 188 | epgPrintf("addToEpgInfoList() : one program is added to the list...element count : %d\n", g_ntscProgramInfoHeader.iElemCount); |
|---|
| 189 | #endif |
|---|
| 190 | |
|---|
| 191 | OS_GiveSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 192 | |
|---|
| 193 | return statusOK; |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | /*Áö±Ý updateÁßÀÎ program informationÀ» °¡Á® ¿Â´Ù.*/ |
|---|
| 197 | /*¸ðµç Á¤º¸°¡ ¸¸Á·ÇÒ ¼öÁØÀ¸·Î ¿ÀÁö ¾Ê´Â °æ¿ì°¡ ¹ß»ýÇÏ¿© program list¿¡ Æ÷ÇÔµÇÁö´Â ¸øÇßÁö¸¸, |
|---|
| 198 | ÇöÀç °è¼Ó udpateÁßÀÎ °ÍÀÌ ÀÖ´Ù¸é ±× Á¤º¸¶óµµ °¡Á® °¡µµ·Ï Çϱâ À§ÇØ Ãß°¡ ÇÑ´Ù.*/ |
|---|
| 199 | STATUS DMW_608B_GetProgramInfo_Forced( NtscBasicEpgInfo **aNtscProgramInfo , int *iNtscProgramInfoCount , int iTimeOut /*tick counts*/ ) |
|---|
| 200 | { |
|---|
| 201 | STATUS st; |
|---|
| 202 | extern STATUS addNewElementForced(); |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | /*¾Æ¹«¸® ¸ø ¹Þ¾Ò¾îµµ µÑ Áß¿¡ Çϳª´Â ¹Þ¾Æ¾ß...*/ |
|---|
| 206 | |
|---|
| 207 | #ifdef eia608B_DEBUG |
|---|
| 208 | epgPrintf("DMW_608B_GetProgramInfo_Forced() : g_ntscBasicEpgInfo.receiveStatus = %d\n" , g_ntscBasicEpgInfo.receiveStatus); |
|---|
| 209 | #endif |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | if ( ( (g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk ) == programIdReceiveOk ) || |
|---|
| 213 | ( (g_ntscBasicEpgInfo.receiveStatus & programNameReceiveOk) == programNameReceiveOk ) ) |
|---|
| 214 | { |
|---|
| 215 | st = addNewElementForced(); |
|---|
| 216 | if( st != statusOK ) return st; |
|---|
| 217 | st = DMW_608B_GetProgramInfo( aNtscProgramInfo , iNtscProgramInfoCount , iTimeOut ); |
|---|
| 218 | return st; |
|---|
| 219 | } |
|---|
| 220 | else |
|---|
| 221 | { |
|---|
| 222 | *aNtscProgramInfo = 0; |
|---|
| 223 | *iNtscProgramInfoCount = 0; |
|---|
| 224 | return statusNotFound; |
|---|
| 225 | } |
|---|
| 226 | } |
|---|
| 227 | |
|---|
| 228 | int DMW_608B_GetCurrentVersion() |
|---|
| 229 | { |
|---|
| 230 | int iversion = -1; |
|---|
| 231 | OS_TakeSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 232 | iversion = g_ntscProgramInfoHeader.iInternalVersion; |
|---|
| 233 | OS_GiveSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 234 | |
|---|
| 235 | return iversion; |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | STATUS DMW_608B_GetProgramInfo ( NtscBasicEpgInfo **aNtscProgramInfo , int *iNtscProgramInfoCount , int iTimeOut /*tick counts*/ ) |
|---|
| 239 | { |
|---|
| 240 | NtscBasicEpgInfo *pCurrEpgInfo = NULL; |
|---|
| 241 | NtscBasicEpgInfo *pNewEpgInfo = NULL; |
|---|
| 242 | int i = 0; |
|---|
| 243 | int startTime = 0; |
|---|
| 244 | BOOLEAN bFound = FALSE; |
|---|
| 245 | STATUS st; |
|---|
| 246 | int semErr; |
|---|
| 247 | |
|---|
| 248 | *iNtscProgramInfoCount = 0; |
|---|
| 249 | *aNtscProgramInfo = NULL; |
|---|
| 250 | |
|---|
| 251 | startTime = OS_GetTickCount(); |
|---|
| 252 | st = statusNotFound; |
|---|
| 253 | |
|---|
| 254 | #ifdef eia608B_DEBUG |
|---|
| 255 | epgPrintf("DMW_608B_GetProgramInfo : g_ntscBasicEpgInfo.receiveStatus = %d\n" , g_ntscBasicEpgInfo.receiveStatus); |
|---|
| 256 | #endif |
|---|
| 257 | |
|---|
| 258 | while(bFound == FALSE) |
|---|
| 259 | { |
|---|
| 260 | OS_Delay(2); |
|---|
| 261 | if( ( iTimeOut > 0 ) && ( (OS_GetTickCount() - startTime) > iTimeOut ) ) |
|---|
| 262 | { |
|---|
| 263 | st = statusTimeout; |
|---|
| 264 | break; |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | if (iTimeOut == 0) iTimeOut = g_Tiemout_NtscUpdate/4; |
|---|
| 268 | |
|---|
| 269 | semErr = DHL_OS_TakeSemaphore(g_ntscProgramInfoUpdateSema4, iTimeOut); |
|---|
| 270 | |
|---|
| 271 | if(semErr) |
|---|
| 272 | { |
|---|
| 273 | #ifdef eia608B_DEBUG |
|---|
| 274 | // epgPrintf("DMW_608B_GetProgramInfo() : g_ntscProgramInfoUpdateSema4 is (1/4 secs)timeout\n"); |
|---|
| 275 | #endif |
|---|
| 276 | continue; /*maybe timeout*/ |
|---|
| 277 | } |
|---|
| 278 | #ifdef eia608B_DEBUG |
|---|
| 279 | // epgPrintf("DMW_608B_GetProgramInfo() : sizeof(NtscBasicEpgInfo) = %d , g_ntscProgramInfoHeader.iElemCount : %d \n", sizeof(NtscBasicEpgInfo) , g_ntscProgramInfoHeader.iElemCount); |
|---|
| 280 | #endif |
|---|
| 281 | if(g_ntscProgramInfoHeader.iElemCount > 0) |
|---|
| 282 | { |
|---|
| 283 | |
|---|
| 284 | pNewEpgInfo = (NtscBasicEpgInfo *)MW_CAlloc( sizeof(NtscBasicEpgInfo) , (g_ntscProgramInfoHeader.iElemCount) ); |
|---|
| 285 | |
|---|
| 286 | if(!pNewEpgInfo) /*memory°¡ ¾ø´Ù..*/ |
|---|
| 287 | { |
|---|
| 288 | OS_GiveSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 289 | return statusOutOfMemory; |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 293 | #ifdef eia608B_DEBUG |
|---|
| 294 | // epgPrintf(" DMW_608B_GetProgramInfo() : g_ntscProgramInfoHeader.pNext : 0x%x \n", g_ntscProgramInfoHeader.pNext ); |
|---|
| 295 | #endif |
|---|
| 296 | |
|---|
| 297 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 298 | { |
|---|
| 299 | if(pCurrEpgInfo) |
|---|
| 300 | { |
|---|
| 301 | #ifdef eia608B_DEBUG |
|---|
| 302 | epgPrintf("DMW_608B_GetProgramInfo() before copy : programLength = %d, programName = %s\n", pCurrEpgInfo->programNameLength ,pCurrEpgInfo->programName ); |
|---|
| 303 | #endif |
|---|
| 304 | copyNtscBasicEpgInformation( pCurrEpgInfo/*source*/ , &(pNewEpgInfo[i])/*destination*/ ); |
|---|
| 305 | pCurrEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 306 | } |
|---|
| 307 | } /*for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++)*/ |
|---|
| 308 | |
|---|
| 309 | *iNtscProgramInfoCount = g_ntscProgramInfoHeader.iElemCount; |
|---|
| 310 | *aNtscProgramInfo = pNewEpgInfo; |
|---|
| 311 | |
|---|
| 312 | bFound = TRUE; /*loop ºüÁ® ³ª°¡ÀÚ*/ |
|---|
| 313 | } /*if(g_ntscProgramInfoHeader.iElemCount > 0)*/ |
|---|
| 314 | |
|---|
| 315 | OS_GiveSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 316 | |
|---|
| 317 | } /*while(bFound == FALSE)*/ |
|---|
| 318 | |
|---|
| 319 | if( bFound == TRUE ) |
|---|
| 320 | st = statusOK; |
|---|
| 321 | |
|---|
| 322 | #ifdef eia608B_DEBUG |
|---|
| 323 | // epgPrintf("DMW_608B_GetProgramInfo() : return st(%d)\n", st); |
|---|
| 324 | #endif |
|---|
| 325 | return st; |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | STATUS DMW_608B_FreeProgramInfo( NtscBasicEpgInfo *aNtscProgramInfo ) |
|---|
| 329 | { |
|---|
| 330 | if(aNtscProgramInfo) |
|---|
| 331 | MW_Free((void **)&aNtscProgramInfo ); |
|---|
| 332 | return 0; |
|---|
| 333 | } |
|---|
| 334 | |
|---|
| 335 | STATUS DMW_608B_GetChannelInfo ( NtscChannelInfo *pNtscChannelInfo ) |
|---|
| 336 | { |
|---|
| 337 | int semErr; |
|---|
| 338 | STATUS st = statusOK; |
|---|
| 339 | |
|---|
| 340 | if( !pNtscChannelInfo ) |
|---|
| 341 | return statusInvalidArgument; |
|---|
| 342 | |
|---|
| 343 | semErr = DHL_OS_TakeSemaphore(g_ntscChannelInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 344 | if(semErr) |
|---|
| 345 | return statusTimeout; |
|---|
| 346 | |
|---|
| 347 | /*¼¼ °¡Áö°¡ ¸ðµÎ 0À̸é ÇÊ¿äÇÑ Á¤º¸°¡ Çϳªµµ ¾È¿Â°ÅÁö...*/ |
|---|
| 348 | if(g_ntscChannelInfo.networkNameLength == 0 && g_ntscChannelInfo.stationId[0] == 0 && g_ntscChannelInfo.tsid == 0) |
|---|
| 349 | { |
|---|
| 350 | memset( pNtscChannelInfo , 0 , sizeof(NtscChannelInfo) ); |
|---|
| 351 | st = statusNotFound; |
|---|
| 352 | goto goOut; |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | |
|---|
| 356 | memcpy( pNtscChannelInfo /*destination*/ , &g_ntscChannelInfo /*source*/ , sizeof(NtscChannelInfo) ); |
|---|
| 357 | st = statusOK; |
|---|
| 358 | |
|---|
| 359 | goOut: |
|---|
| 360 | OS_GiveSemaphore(g_ntscChannelInfoSema4); |
|---|
| 361 | |
|---|
| 362 | /*Àß º¹»ç µÆ°ÚÁö..*/ |
|---|
| 363 | return st; |
|---|
| 364 | |
|---|
| 365 | |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | STATUS DMW_608B_GetCaptionInfo ( NtscCaptionInfo *pCaptionInfo ) |
|---|
| 369 | { |
|---|
| 370 | if( !pCaptionInfo ) |
|---|
| 371 | return statusInvalidArgument; |
|---|
| 372 | |
|---|
| 373 | |
|---|
| 374 | #if 0/* leon 2003.12.9 _FIX_NTSCCC_1_ */ |
|---|
| 375 | if(!g_ntscCaptionInfo.captionIsVailid[0]&&!g_ntscCaptionInfo.captionIsVailid[1]) |
|---|
| 376 | #else |
|---|
| 377 | /*ÀÌ°Ô ´Ù 0À̸é Á¤º¸°¡ ¾È¿Â°ÅÁö...*/ |
|---|
| 378 | if ( g_ntscCaptionInfo.capLanguage[0] == 0 && g_ntscCaptionInfo.capLanguage[1] == 0 && |
|---|
| 379 | g_ntscCaptionInfo.capServiceType[0] == 0 && g_ntscCaptionInfo.capServiceType[1] == 0 ) |
|---|
| 380 | #endif |
|---|
| 381 | { |
|---|
| 382 | memset( pCaptionInfo , 0 , sizeof(NtscCaptionInfo) ); |
|---|
| 383 | //epgPrintf("CC Lang[0]=%d ServiceType[0]=%d Valid=%d\n",g_ntscCaptionInfo.capLanguage[0],g_ntscCaptionInfo.capServiceType[0],g_ntscCaptionInfo.captionIsVailid[0]); |
|---|
| 384 | //epgPrintf("CC Lang[0]=%d ServiceType[0]=%d Valid=%d\n",g_ntscCaptionInfo.capLanguage[1],g_ntscCaptionInfo.capServiceType[1],g_ntscCaptionInfo.captionIsVailid[0]); |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | return statusNotFound; |
|---|
| 388 | } |
|---|
| 389 | |
|---|
| 390 | memcpy( pCaptionInfo , &g_ntscCaptionInfo , sizeof(NtscCaptionInfo) ); |
|---|
| 391 | return statusOK; |
|---|
| 392 | } |
|---|
| 393 | |
|---|
| 394 | STATUS DMW_608B_GetAudioInfo ( NtscAudioInfo *pAudioInfo ) |
|---|
| 395 | { |
|---|
| 396 | if( !pAudioInfo ) |
|---|
| 397 | return statusInvalidArgument; |
|---|
| 398 | |
|---|
| 399 | if( g_ntscAudioInfo.mainAudioLanguage == 0 && |
|---|
| 400 | g_ntscAudioInfo.mainAudioType == 0 && |
|---|
| 401 | g_ntscAudioInfo.sapLanguage == 0 && |
|---|
| 402 | g_ntscAudioInfo.sapType == 0 ) |
|---|
| 403 | { |
|---|
| 404 | memset( pAudioInfo , 0 , sizeof(NtscAudioInfo) ); |
|---|
| 405 | return statusNotFound; |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | memcpy( pAudioInfo , &g_ntscAudioInfo , sizeof( NtscAudioInfo ) ); |
|---|
| 409 | return statusOK; |
|---|
| 410 | } |
|---|
| 411 | |
|---|
| 412 | STATUS DMW_608B_GetAspectRatioInfo( NtscAspectRatioInfo *pAspectRatioInfo ) |
|---|
| 413 | { |
|---|
| 414 | if(!pAspectRatioInfo) |
|---|
| 415 | return statusInvalidArgument; |
|---|
| 416 | |
|---|
| 417 | if( g_ntscAspectRatioInfo.startLine == 0 && |
|---|
| 418 | g_ntscAspectRatioInfo.endLine == 0 ) |
|---|
| 419 | { |
|---|
| 420 | memset( pAspectRatioInfo , 0 ,sizeof( NtscAspectRatioInfo) ); |
|---|
| 421 | return statusNotFound; |
|---|
| 422 | } |
|---|
| 423 | |
|---|
| 424 | memcpy( pAspectRatioInfo , &g_ntscAspectRatioInfo , sizeof(NtscAspectRatioInfo) ); |
|---|
| 425 | return statusOK; |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | STATUS DMW_608B_GetTimeInfo( NtscTimeInfo *pTimeInfo ) |
|---|
| 429 | { |
|---|
| 430 | int semErr; |
|---|
| 431 | |
|---|
| 432 | if(!pTimeInfo) |
|---|
| 433 | return statusInvalidArgument; |
|---|
| 434 | |
|---|
| 435 | /*updateÇÏ´Â µ¿¾ÈÀ» ÇÇÇØ¼ ÂüÁ¶ ÇÏÀÚ.*/ |
|---|
| 436 | semErr = DHL_OS_TakeSemaphore(g_ntscTimeInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 437 | |
|---|
| 438 | if(semErr) |
|---|
| 439 | { |
|---|
| 440 | #ifdef eia608B_DEBUG |
|---|
| 441 | epgPrintf("in the DMW_608B_GetTimeInfo() : g_ntscTimeInfoSema4 is timeout\n"); |
|---|
| 442 | #endif |
|---|
| 443 | |
|---|
| 444 | return statusTimeout; |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | if ( g_ntscTimeInfo.iMinute == 0 && g_ntscTimeInfo.iHour == 0 && |
|---|
| 448 | g_ntscTimeInfo.iDate == 0 && g_ntscTimeInfo.iMonth == 0 && |
|---|
| 449 | g_ntscTimeInfo.timeZoneOffset == 0 && g_ntscTimeInfo.daylightSaving == 0) |
|---|
| 450 | { |
|---|
| 451 | memset( pTimeInfo , 0 , sizeof(NtscTimeInfo) ); |
|---|
| 452 | OS_GiveSemaphore(g_ntscTimeInfoSema4); |
|---|
| 453 | return statusNotFound; |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | memcpy( pTimeInfo , &g_ntscTimeInfo , sizeof(NtscTimeInfo) ); |
|---|
| 457 | |
|---|
| 458 | OS_GiveSemaphore(g_ntscTimeInfoSema4); |
|---|
| 459 | return statusOK; |
|---|
| 460 | } |
|---|
| 461 | |
|---|
| 462 | STATUS DMW_608B_GetProgramDescription( NtscProgramDescription *pDescription ) |
|---|
| 463 | { |
|---|
| 464 | |
|---|
| 465 | if(!pDescription) |
|---|
| 466 | return statusInvalidArgument; |
|---|
| 467 | |
|---|
| 468 | /*³Ñ ¹Ì·ÃÇÑ check¹æ¹ýÀΰ¡...*/ |
|---|
| 469 | if( (g_ntscProgramDescription.row[0][0] == 0 && g_ntscProgramDescription.row[0][1] == 0 ) && |
|---|
| 470 | (g_ntscProgramDescription.row[1][0] == 0 && g_ntscProgramDescription.row[1][1] == 0 ) && |
|---|
| 471 | (g_ntscProgramDescription.row[2][0] == 0 && g_ntscProgramDescription.row[2][1] == 0 ) && |
|---|
| 472 | (g_ntscProgramDescription.row[3][0] == 0 && g_ntscProgramDescription.row[3][1] == 0 ) && |
|---|
| 473 | (g_ntscProgramDescription.row[4][0] == 0 && g_ntscProgramDescription.row[4][1] == 0 ) && |
|---|
| 474 | (g_ntscProgramDescription.row[5][0] == 0 && g_ntscProgramDescription.row[5][1] == 0 ) && |
|---|
| 475 | (g_ntscProgramDescription.row[6][0] == 0 && g_ntscProgramDescription.row[6][1] == 0 ) && |
|---|
| 476 | (g_ntscProgramDescription.row[7][0] == 0 && g_ntscProgramDescription.row[7][1] == 0 ) ) |
|---|
| 477 | { |
|---|
| 478 | /*ÀÌÁ¤µµ¸¦ checkÇߴµ¥..¸ðµÎ 0À̶ó¸é..*/ |
|---|
| 479 | memset( pDescription , 0 , sizeof(NtscProgramDescription) ); |
|---|
| 480 | return statusNotFound; |
|---|
| 481 | } |
|---|
| 482 | |
|---|
| 483 | memcpy( pDescription , &g_ntscProgramDescription , sizeof(NtscProgramDescription) ); |
|---|
| 484 | return statusOK; |
|---|
| 485 | } |
|---|
| 486 | |
|---|
| 487 | void DMW_608B_SetValidRatingTimeout(UINT32 timeout) /*the unit of timeout is msec.*/ |
|---|
| 488 | { |
|---|
| 489 | g_Timeout_RatingUpdate = timeout; |
|---|
| 490 | #ifdef eia608B_DEBUG |
|---|
| 491 | epgPrintf(" DMW_608B_SetValidRatingTimeout : g_Timeout_RatingUpdate = %d.\n", g_Timeout_RatingUpdate ); |
|---|
| 492 | #endif |
|---|
| 493 | |
|---|
| 494 | } |
|---|
| 495 | |
|---|
| 496 | STATUS DMW_608B_GetRating( NtscRatingInfo *pRating ) |
|---|
| 497 | { |
|---|
| 498 | int semErr; |
|---|
| 499 | UINT32 timeoutTicks = g_Timeout_RatingUpdate*OS_GetTicksPerSecond()/1000; |
|---|
| 500 | |
|---|
| 501 | if(!pRating) |
|---|
| 502 | return statusInvalidArgument; |
|---|
| 503 | |
|---|
| 504 | /*updateÇÏ´Â µ¿¾ÈÀ» ÇÇÇØ¼ ÂüÁ¶ ÇÏÀÚ.*/ |
|---|
| 505 | semErr = DHL_OS_TakeSemaphore(g_ntscRatingUpdateSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 506 | if(semErr) |
|---|
| 507 | { |
|---|
| 508 | #ifdef eia608B_DEBUG |
|---|
| 509 | epgPrintf("in the DMW_608B_GetRating() : g_ntscRatingUpdateSema4 is timeout\n"); |
|---|
| 510 | #endif |
|---|
| 511 | return statusTimeout; /*maybe timeout*/ |
|---|
| 512 | } |
|---|
| 513 | |
|---|
| 514 | |
|---|
| 515 | |
|---|
| 516 | if(g_ntscRatingInfo.ratingType == 0 && g_ntscRatingInfo.ratingValue == 0) |
|---|
| 517 | { |
|---|
| 518 | |
|---|
| 519 | memset( pRating , 0 , sizeof(NtscRatingInfo)); |
|---|
| 520 | |
|---|
| 521 | /*lockÀ» Ç®¾î ÁÖ°í ³ª°¡¾ßÁö...*/ |
|---|
| 522 | OS_GiveSemaphore(g_ntscRatingUpdateSema4); |
|---|
| 523 | |
|---|
| 524 | return statusNotFound; |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | #ifdef eia608B_DEBUG |
|---|
| 528 | epgPrintf("DMW_608B_GetRating() : currTicks = %d.diff = %d, timeout = %d.\n",OS_GetTickCount() ,OS_GetTickCount() - g_ntscRatingCaptureTicks , timeoutTicks); |
|---|
| 529 | #endif |
|---|
| 530 | if( (g_ntscRatingCaptureTicks != 0) && |
|---|
| 531 | (OS_GetTickCount() - g_ntscRatingCaptureTicks > timeoutTicks) ) |
|---|
| 532 | { |
|---|
| 533 | #ifdef eia608B_DEBUG |
|---|
| 534 | epgPrintf("DMW_608B_GetRating() : rating info is too old. reset it. timeout = %d.\n", g_Timeout_RatingUpdate); |
|---|
| 535 | #endif |
|---|
| 536 | memset( pRating , 0 , sizeof(NtscRatingInfo)); |
|---|
| 537 | memset( &g_ntscRatingInfo , 0 , sizeof(NtscRatingInfo) ); |
|---|
| 538 | memset( &g_ntscRatingInfoRaw , 0 , sizeof(UINT8)*2); |
|---|
| 539 | |
|---|
| 540 | OS_GiveSemaphore(g_ntscRatingUpdateSema4); |
|---|
| 541 | |
|---|
| 542 | return statusTimeout; |
|---|
| 543 | } |
|---|
| 544 | |
|---|
| 545 | |
|---|
| 546 | memcpy( pRating , &g_ntscRatingInfo , sizeof(NtscRatingInfo) ); |
|---|
| 547 | |
|---|
| 548 | /*lock¸¦ Ç®°í ³ª°£´Ù.*/ |
|---|
| 549 | OS_GiveSemaphore(g_ntscRatingUpdateSema4); |
|---|
| 550 | |
|---|
| 551 | return statusOK; |
|---|
| 552 | } |
|---|
| 553 | |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | void DMW_608B_StartNtscEpgMonitor( EpgUpdateCallbackFn ntscAsynchProcedure ) |
|---|
| 557 | { |
|---|
| 558 | gNtscAsynchProcedure = ntscAsynchProcedure; |
|---|
| 559 | } |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | |
|---|
| 568 | |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | |
|---|
| 572 | |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | BOOLEAN IsSameProgramIdWithCurrentThing( UINT8 iMinute , UINT8 iHour , UINT8 iDate , UINT8 iMonth , UINT8 bTapeDelay ) |
|---|
| 579 | { |
|---|
| 580 | if( (g_ntscBasicEpgInfo.startMinute == iMinute ) && |
|---|
| 581 | (g_ntscBasicEpgInfo.startHour == iHour ) && |
|---|
| 582 | (g_ntscBasicEpgInfo.startDate == iDate ) && |
|---|
| 583 | (g_ntscBasicEpgInfo.startMonth == iMonth ) && |
|---|
| 584 | (g_ntscBasicEpgInfo.bTapeDelay == bTapeDelay) ) |
|---|
| 585 | |
|---|
| 586 | return TRUE; |
|---|
| 587 | else |
|---|
| 588 | return FALSE; |
|---|
| 589 | } |
|---|
| 590 | |
|---|
| 591 | /*programId·Î list¿¡ progaramÀÌ ÁÖ¾îÁø °Í°ú °°ÀºÁö ºñ±³ ÇÑ´Ù.*/ |
|---|
| 592 | BOOLEAN existElementWithSameProgramId( UINT8 iMinute , UINT8 iHour ,UINT8 iDate, UINT8 iMonth , UINT8 bTapeDelay ) |
|---|
| 593 | { |
|---|
| 594 | int i = 0; |
|---|
| 595 | NtscBasicEpgInfo *pCurrEpgInfo = NULL; |
|---|
| 596 | |
|---|
| 597 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 598 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 599 | { |
|---|
| 600 | if(pCurrEpgInfo) |
|---|
| 601 | { |
|---|
| 602 | if( pCurrEpgInfo->startMinute == iMinute && |
|---|
| 603 | pCurrEpgInfo->startHour == iHour && |
|---|
| 604 | pCurrEpgInfo->startDate == iDate && |
|---|
| 605 | pCurrEpgInfo->startMonth == iMonth && |
|---|
| 606 | pCurrEpgInfo->bTapeDelay == bTapeDelay ) |
|---|
| 607 | |
|---|
| 608 | { |
|---|
| 609 | return TRUE; |
|---|
| 610 | } |
|---|
| 611 | else |
|---|
| 612 | pCurrEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 613 | } |
|---|
| 614 | else |
|---|
| 615 | break; |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | /*¿©±â ±îÁö ¿Ô´Ù¸é ¸ø ãÀº°ÅÁö.*/ |
|---|
| 619 | return FALSE; |
|---|
| 620 | } |
|---|
| 621 | |
|---|
| 622 | |
|---|
| 623 | BOOLEAN IsSameRatingInfoWithCurrentThing( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 624 | { |
|---|
| 625 | |
|---|
| 626 | /*¾îÂ¥ÇÇ size = 2*/ |
|---|
| 627 | if( (g_ntscRatingInfoRaw[0] == inBuff[0]) && |
|---|
| 628 | (g_ntscRatingInfoRaw[1] == inBuff[1]) ) |
|---|
| 629 | { |
|---|
| 630 | return TRUE; |
|---|
| 631 | } |
|---|
| 632 | else |
|---|
| 633 | return FALSE; |
|---|
| 634 | } |
|---|
| 635 | |
|---|
| 636 | |
|---|
| 637 | BOOLEAN IsSameNetworkNameWithCurrentThing( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 638 | { |
|---|
| 639 | int i = 0; |
|---|
| 640 | |
|---|
| 641 | if( g_ntscChannelInfo.networkNameLength == inSize ) |
|---|
| 642 | { |
|---|
| 643 | for( i = 0 ; i < inSize ; i++ ) |
|---|
| 644 | { |
|---|
| 645 | if( g_ntscChannelInfo.networkName[i] != inBuff[i] ) |
|---|
| 646 | return FALSE; |
|---|
| 647 | } /*for( i = 0 ; i < inSize ; i++ )*/ |
|---|
| 648 | |
|---|
| 649 | return TRUE; |
|---|
| 650 | } /*if( g_ntscChannelInfo.networkNameLength == inSize )*/ |
|---|
| 651 | else |
|---|
| 652 | return FALSE; |
|---|
| 653 | |
|---|
| 654 | } |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | |
|---|
| 658 | BOOLEAN IsSameProgramNameWithCurrentThing(UINT8 *inBuff , UINT8 inSize) |
|---|
| 659 | { |
|---|
| 660 | int i = 0; |
|---|
| 661 | |
|---|
| 662 | if( g_ntscBasicEpgInfo.programNameLength == inSize ) |
|---|
| 663 | { |
|---|
| 664 | for( i = 0 ; i < inSize ; i ++ ) |
|---|
| 665 | { |
|---|
| 666 | if( g_ntscBasicEpgInfo.programName[i] != inBuff[i] ) |
|---|
| 667 | return FALSE; |
|---|
| 668 | } /*for( i = 0 ; i < inSize ; i ++ )*/ |
|---|
| 669 | |
|---|
| 670 | return TRUE; |
|---|
| 671 | } /*if( g_ntscBasicEpgInfo.programNameLength == inSize )*/ |
|---|
| 672 | else |
|---|
| 673 | return FALSE; |
|---|
| 674 | |
|---|
| 675 | } |
|---|
| 676 | |
|---|
| 677 | /*program nameÀ¸·Î program list¿¡ ÁÖ¾îÁø °Í°ú °°ÀÌ °ÍÀÌ ÀÖ´ÂÁö È®ÀÎ ÇÑ´Ù.*/ |
|---|
| 678 | BOOLEAN existElementWithSameProgramName(UINT8 *inBuff , UINT8 inSize) |
|---|
| 679 | { |
|---|
| 680 | int i = 0; |
|---|
| 681 | int j = 0; |
|---|
| 682 | NtscBasicEpgInfo *pCurrEpgInfo = NULL; |
|---|
| 683 | |
|---|
| 684 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 685 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 686 | { |
|---|
| 687 | if(pCurrEpgInfo) |
|---|
| 688 | { |
|---|
| 689 | if( pCurrEpgInfo->programNameLength == inSize ) |
|---|
| 690 | { |
|---|
| 691 | for( j = 0 ; j < inSize ; j++ ) |
|---|
| 692 | { |
|---|
| 693 | if(pCurrEpgInfo->programName[j] != inBuff[j] ) |
|---|
| 694 | return FALSE; |
|---|
| 695 | } |
|---|
| 696 | return TRUE; |
|---|
| 697 | } /*if( pCurrEpgInfo->programNameLength == inSize )*/ |
|---|
| 698 | else |
|---|
| 699 | pCurrEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 700 | } /*if(pCurrEpgInfo)*/ |
|---|
| 701 | else |
|---|
| 702 | break; |
|---|
| 703 | } /*for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++)*/ |
|---|
| 704 | |
|---|
| 705 | /*¿©±â ±îÁö ¿Ô´Ù¸é ¸ø ãÀº°ÅÁö.*/ |
|---|
| 706 | return FALSE; |
|---|
| 707 | } |
|---|
| 708 | |
|---|
| 709 | BOOLEAN exsitElementWithSameProgramName( UINT8 * pProgramName , UINT8 iProgramNameLength ) |
|---|
| 710 | { |
|---|
| 711 | int i = 0; |
|---|
| 712 | NtscBasicEpgInfo *pCurrEpgInfo = NULL; |
|---|
| 713 | |
|---|
| 714 | /*clear the ntsc epg db*/ |
|---|
| 715 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 716 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 717 | { |
|---|
| 718 | if(pCurrEpgInfo) |
|---|
| 719 | { |
|---|
| 720 | if( pCurrEpgInfo->programNameLength == iProgramNameLength ) |
|---|
| 721 | { |
|---|
| 722 | int iLength = 0; |
|---|
| 723 | for( iLength = 0 ; iLength < iProgramNameLength ; iLength++ ) |
|---|
| 724 | { |
|---|
| 725 | if( pCurrEpgInfo->programName[iLength] != pProgramName[iLength]) |
|---|
| 726 | break; |
|---|
| 727 | } |
|---|
| 728 | |
|---|
| 729 | /*Áß°£¿¡ ºüÁ® ³ª¿Â °ÍÀÌ ¾Æ´Ï¶ó¸é ¸ðµÎ °°Àº °ÍÀ̰ÚÁö...*/ |
|---|
| 730 | if(iLength == iProgramNameLength) |
|---|
| 731 | return TRUE; |
|---|
| 732 | } |
|---|
| 733 | else |
|---|
| 734 | pCurrEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 735 | } |
|---|
| 736 | else |
|---|
| 737 | break; |
|---|
| 738 | } |
|---|
| 739 | |
|---|
| 740 | /*¿©±â ±îÁö ¿Ô´Ù¸é ¸ø ãÀº°ÅÁö.*/ |
|---|
| 741 | return FALSE; |
|---|
| 742 | |
|---|
| 743 | } |
|---|
| 744 | |
|---|
| 745 | void ResetNtscEgpInfo() |
|---|
| 746 | { |
|---|
| 747 | memset( &g_ntscBasicEpgInfo , 0 , sizeof(NtscBasicEpgInfo)); |
|---|
| 748 | memset( &g_ntscCaptionInfo , 0 , sizeof(NtscCaptionInfo)); |
|---|
| 749 | memset( &g_ntscAudioInfo , 0 , sizeof(NtscAudioInfo)); |
|---|
| 750 | memset( &g_ntscCGMSA , 0 , sizeof(NtscCGMSA)); |
|---|
| 751 | memset( &g_ntscAspectRatioInfo , 0 , sizeof(NtscAspectRatioInfo)); |
|---|
| 752 | memset( &g_ntscTimeInfo , 0 , sizeof(NtscTimeInfo)); |
|---|
| 753 | memset( &g_ntscProgramDescription , 0 ,sizeof(NtscProgramDescription)); |
|---|
| 754 | memset( &g_ntscChannelInfo , 0 , sizeof(NtscChannelInfo)); |
|---|
| 755 | memset( &g_ntscRatingInfo , 0 , sizeof(NtscRatingInfo)); |
|---|
| 756 | |
|---|
| 757 | /*2004.01.17. added by jina.*/ |
|---|
| 758 | memset( &g_ntscRatingInfoRaw , 0 , sizeof(UINT8)*2); |
|---|
| 759 | g_ntscRatingCaptureTicks= 0; |
|---|
| 760 | } |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | void closeSemaphors() |
|---|
| 764 | { |
|---|
| 765 | if (g_ntscProgramInfoUpdateSema4) |
|---|
| 766 | OS_DeleteSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 767 | g_ntscProgramInfoUpdateSema4 = 0; |
|---|
| 768 | |
|---|
| 769 | if (g_ntscRatingUpdateSema4) |
|---|
| 770 | OS_DeleteSemaphore(g_ntscRatingUpdateSema4); |
|---|
| 771 | g_ntscRatingUpdateSema4 = 0; |
|---|
| 772 | |
|---|
| 773 | if (g_ntscTimeInfoSema4) |
|---|
| 774 | OS_DeleteSemaphore(g_ntscTimeInfoSema4); |
|---|
| 775 | g_ntscTimeInfoSema4 = 0; |
|---|
| 776 | |
|---|
| 777 | if(g_ntscChannelInfoSema4) |
|---|
| 778 | OS_DeleteSemaphore(g_ntscChannelInfoSema4); |
|---|
| 779 | g_ntscChannelInfoSema4 = 0; |
|---|
| 780 | |
|---|
| 781 | } |
|---|
| 782 | void createSemaphors() |
|---|
| 783 | { |
|---|
| 784 | //added by leon 2003.7.14 |
|---|
| 785 | //App¿¡¼ »ç¿ëÇϱâ À§Çؼ.(NTSC DB´Â ÃʱâÈÇÏÁö ¾Ê°í semaphore¸¸ ÃʱâÈÇϰíÀÚ ÇÒ¶§ »ç¿ë |
|---|
| 786 | |
|---|
| 787 | if (g_ntscProgramInfoUpdateSema4 == 0) |
|---|
| 788 | g_ntscProgramInfoUpdateSema4 = OS_CreateBinarySemaphore("g_ntscProgramInfoUpdateSema4", OS_SEM_FIFO, 1); //leon 2005.01.10 bug fix. ATI´Â 1·Î set |
|---|
| 789 | |
|---|
| 790 | if (g_ntscRatingUpdateSema4 == 0) |
|---|
| 791 | g_ntscRatingUpdateSema4 = OS_CreateBinarySemaphore("g_ntscRatingUpdateSema4", OS_SEM_FIFO , 1);//leon 2005.01.10 bug fix. ATI´Â 1·Î set |
|---|
| 792 | |
|---|
| 793 | if (g_ntscTimeInfoSema4 == 0) |
|---|
| 794 | g_ntscTimeInfoSema4 = OS_CreateBinarySemaphore("g_ntscTimeInfoSema4", OS_SEM_FIFO , 1);//leon 2005.01.10 bug fix. ATI´Â 1·Î set |
|---|
| 795 | |
|---|
| 796 | if (g_ntscChannelInfoSema4 == 0) |
|---|
| 797 | g_ntscChannelInfoSema4 = OS_CreateBinarySemaphore("g_ntscChannelInfoSema4", OS_SEM_FIFO , 1);//leon 2005.01.10 bug fix. ATI´Â 1·Î set |
|---|
| 798 | #if (MW_PRJ_NAME==MW_PRJ_FADO||MW_PRJ_NAME==MW_PRJ_EPIC) |
|---|
| 799 | DMW_EnableXDS(1);//leon 2005.01.11 default XDS enable |
|---|
| 800 | #elif (CC_PLATFORM == CC_PLATFORM_DDM10) |
|---|
| 801 | DMW_EnableXDS(1);//narsist 2005.12.16 default XDS enable |
|---|
| 802 | #endif |
|---|
| 803 | |
|---|
| 804 | } |
|---|
| 805 | STATUS DMW_608B_InitNtscEpgDb() |
|---|
| 806 | { |
|---|
| 807 | STATUS DMW_608B_ClearProgramInfoList(); |
|---|
| 808 | #ifdef eia608B_DEBUG |
|---|
| 809 | epgPrintf("in the DMW_608B_InitNtscEpgDb...\n"); |
|---|
| 810 | #endif |
|---|
| 811 | |
|---|
| 812 | createSemaphors();//leon 2003.7.14 |
|---|
| 813 | |
|---|
| 814 | if( g_ntscProgramInfoUpdateSema4 == 0 || g_ntscRatingUpdateSema4 == 0 || |
|---|
| 815 | g_ntscTimeInfoSema4 == 0 || g_ntscChannelInfoSema4 == 0 ) |
|---|
| 816 | { |
|---|
| 817 | #ifdef eia608B_DEBUG |
|---|
| 818 | epgPrintf("in the DMW_608B_InitNtscEpgDb()...out of semaphore resource.\n"); |
|---|
| 819 | #endif |
|---|
| 820 | closeSemaphors(); |
|---|
| 821 | |
|---|
| 822 | return statusOutOfResource; |
|---|
| 823 | } |
|---|
| 824 | |
|---|
| 825 | /*clear the ntsc epg db*/ |
|---|
| 826 | DMW_608B_ClearProgramInfoList(); |
|---|
| 827 | g_ntscProgramInfoHeader.iInternalVersion = 0; |
|---|
| 828 | |
|---|
| 829 | |
|---|
| 830 | ResetNtscEgpInfo(); |
|---|
| 831 | |
|---|
| 832 | return statusOK; |
|---|
| 833 | } |
|---|
| 834 | |
|---|
| 835 | |
|---|
| 836 | STATUS DMW_608B_ClearProgramInfoList() |
|---|
| 837 | { |
|---|
| 838 | int i = 0; |
|---|
| 839 | NtscBasicEpgInfo *pNextEpgInfo , *pCurrEpgInfo; |
|---|
| 840 | int semErr = 0; |
|---|
| 841 | |
|---|
| 842 | semErr = DHL_OS_TakeSemaphore(g_ntscProgramInfoUpdateSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 843 | |
|---|
| 844 | if(semErr) |
|---|
| 845 | { |
|---|
| 846 | #ifdef eia608B_DEBUG |
|---|
| 847 | epgPrintf("in the DMW_608B_ClearProgramInfoList() : g_ntscProgramInfoUpdateSema4 is timeout\n"); |
|---|
| 848 | #endif |
|---|
| 849 | return statusTimeout; /*maybe timeout*/ |
|---|
| 850 | } |
|---|
| 851 | |
|---|
| 852 | /*clear the ntsc epg db*/ |
|---|
| 853 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 854 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 855 | { |
|---|
| 856 | if(pCurrEpgInfo) |
|---|
| 857 | { |
|---|
| 858 | pNextEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 859 | freeNtscBasicEpgInformation(pCurrEpgInfo); |
|---|
| 860 | } |
|---|
| 861 | else |
|---|
| 862 | break; |
|---|
| 863 | |
|---|
| 864 | pCurrEpgInfo = pNextEpgInfo; |
|---|
| 865 | } |
|---|
| 866 | |
|---|
| 867 | /*reset the ntsc epg db*/ |
|---|
| 868 | g_ntscProgramInfoHeader.pNext = 0; |
|---|
| 869 | g_ntscProgramInfoHeader.iElemCount = 0; |
|---|
| 870 | |
|---|
| 871 | OS_GiveSemaphore(g_ntscProgramInfoUpdateSema4); |
|---|
| 872 | |
|---|
| 873 | #ifdef eia608B_DEBUG |
|---|
| 874 | epgPrintf("DMW_608B_ClearProgramInfoList() : g_ntscProgramInfoHeader is initialized\n"); |
|---|
| 875 | #endif |
|---|
| 876 | |
|---|
| 877 | return statusOK; |
|---|
| 878 | } |
|---|
| 879 | |
|---|
| 880 | |
|---|
| 881 | void DMW_608B_CloseNtscEpgDb() |
|---|
| 882 | { |
|---|
| 883 | int i = 0; |
|---|
| 884 | NtscBasicEpgInfo *pNextEpgInfo , *pCurrEpgInfo; |
|---|
| 885 | |
|---|
| 886 | closeSemaphors(); |
|---|
| 887 | |
|---|
| 888 | /*clear the ntsc epg db*/ |
|---|
| 889 | pCurrEpgInfo = g_ntscProgramInfoHeader.pNext; |
|---|
| 890 | for( i = 0 ; i < g_ntscProgramInfoHeader.iElemCount ; i++) |
|---|
| 891 | { |
|---|
| 892 | if(pCurrEpgInfo) |
|---|
| 893 | { |
|---|
| 894 | pNextEpgInfo = pCurrEpgInfo->pNext; |
|---|
| 895 | freeNtscBasicEpgInformation(pCurrEpgInfo); |
|---|
| 896 | } |
|---|
| 897 | else |
|---|
| 898 | break; |
|---|
| 899 | |
|---|
| 900 | pCurrEpgInfo = pNextEpgInfo; |
|---|
| 901 | } |
|---|
| 902 | |
|---|
| 903 | /*reset the ntsc epg db*/ |
|---|
| 904 | g_ntscProgramInfoHeader.pNext = 0; |
|---|
| 905 | g_ntscProgramInfoHeader.iElemCount = 0; |
|---|
| 906 | |
|---|
| 907 | } |
|---|
| 908 | |
|---|
| 909 | |
|---|
| 910 | DescKeyword_t strDescriptiveKeyword[] = |
|---|
| 911 | { |
|---|
| 912 | {0x20 , "Education"}, |
|---|
| 913 | {0x21 , "EntertainMent"}, |
|---|
| 914 | {0x22 , "Movie"}, |
|---|
| 915 | {0x23 , "News"}, |
|---|
| 916 | {0x24 , "Religious"}, |
|---|
| 917 | {0x25 , "Sports"}, |
|---|
| 918 | {0x26 , "OTHER"}, |
|---|
| 919 | {0x27 , "Action"}, |
|---|
| 920 | {0x28 , "Advertisement"}, |
|---|
| 921 | {0x29 , "Animated"}, |
|---|
| 922 | {0x2A , "Anthology"}, |
|---|
| 923 | {0x2B , "Automobile"}, |
|---|
| 924 | {0x2C , "Awards"}, |
|---|
| 925 | {0x2D , "Baseball"}, |
|---|
| 926 | {0x2E , "Basketball"}, |
|---|
| 927 | {0x2F , "Bulletin"}, |
|---|
| 928 | {0x30 , "Business"}, |
|---|
| 929 | {0x31 , "Classical"}, |
|---|
| 930 | {0x32 , "College"}, |
|---|
| 931 | {0x33 , "Combat"}, |
|---|
| 932 | {0x34 , "Comedy"}, |
|---|
| 933 | {0x35 , "Commentary"}, |
|---|
| 934 | {0x36 , "Consert"}, |
|---|
| 935 | {0x37 , "Consumer"}, |
|---|
| 936 | {0x38 , "Contemporary"}, |
|---|
| 937 | {0x39 , "Crime"}, |
|---|
| 938 | {0x3A , "Dance"}, |
|---|
| 939 | {0x3B , "Documentary"}, |
|---|
| 940 | {0x3C , "Drama"}, |
|---|
| 941 | {0x3D , "Elementary"}, |
|---|
| 942 | {0x3E , "Erotica"}, |
|---|
| 943 | {0x3F , "Exercise"}, |
|---|
| 944 | {0x40 , "Fantasy"}, |
|---|
| 945 | {0x41 , "Farm"}, |
|---|
| 946 | {0x42 , "Fashion"}, |
|---|
| 947 | {0x43 , "Fiction"}, |
|---|
| 948 | {0x44 , "Food"}, |
|---|
| 949 | {0x45 , "Football"}, |
|---|
| 950 | {0x46 , "Foreign"}, |
|---|
| 951 | {0x47 , "Fund Raiser"}, |
|---|
| 952 | {0x48 , "Game/Quiz"}, |
|---|
| 953 | {0x49 , "Garden"}, |
|---|
| 954 | {0x4A , "Golf"}, |
|---|
| 955 | {0x4B , "Government"}, |
|---|
| 956 | {0x4C , "Health"}, |
|---|
| 957 | {0x4D , "High School"}, |
|---|
| 958 | {0x4E , "History"}, |
|---|
| 959 | {0x4F , "Hobby"}, |
|---|
| 960 | {0x50 , "Hockey"}, |
|---|
| 961 | {0x51 , "Home"}, |
|---|
| 962 | {0x52 , "Horror"}, |
|---|
| 963 | {0x53 , "Information"}, |
|---|
| 964 | {0x54 , "Instruction"}, |
|---|
| 965 | {0x55 , "International"}, |
|---|
| 966 | {0x56 , "Interview"}, |
|---|
| 967 | {0x57 , "Language"}, |
|---|
| 968 | {0x58 , "Legal"}, |
|---|
| 969 | {0x59 , "Live"}, |
|---|
| 970 | {0x5A , "Local"}, |
|---|
| 971 | {0x5B , "Math"}, |
|---|
| 972 | {0x5C , "Medical"}, |
|---|
| 973 | {0x5D , "Meeting"}, |
|---|
| 974 | {0x5E , "Military"}, |
|---|
| 975 | {0x5F , "Miniseries"}, |
|---|
| 976 | {0x60 , "Music"}, |
|---|
| 977 | {0x61 , "Mystery"}, |
|---|
| 978 | {0x62 , "National"}, |
|---|
| 979 | {0x63 , "Nature"}, |
|---|
| 980 | {0x64 , "Police"}, |
|---|
| 981 | {0x65 , "Politics"}, |
|---|
| 982 | {0x66 , "Premier"}, |
|---|
| 983 | {0x67 , "Prerecorded"}, |
|---|
| 984 | {0x68 , "Product"}, |
|---|
| 985 | {0x69 , "Professional"}, |
|---|
| 986 | {0x6A , "Public"}, |
|---|
| 987 | {0x6B , "Racing"}, |
|---|
| 988 | {0x6C , "Reading"}, |
|---|
| 989 | {0x6D , "Repair"}, |
|---|
| 990 | {0x6E , "Repeat"}, |
|---|
| 991 | {0x6F , "Review"}, |
|---|
| 992 | {0x70 , "Romance"}, |
|---|
| 993 | {0x71 , "Science"}, |
|---|
| 994 | {0x72 , "Series"}, |
|---|
| 995 | {0x73 , "Sevice"}, |
|---|
| 996 | {0x74 , "Shopping"}, |
|---|
| 997 | {0x75 , "Soap Opera"}, |
|---|
| 998 | {0x76 , "Special"}, |
|---|
| 999 | {0x77 , "Suspense"}, |
|---|
| 1000 | {0x78 , "Talk"}, |
|---|
| 1001 | {0x79 , "Technical"}, |
|---|
| 1002 | {0x7A , "Tennis"}, |
|---|
| 1003 | {0x7B , "Travel"}, |
|---|
| 1004 | {0x7C , "Variety"}, |
|---|
| 1005 | {0x7D , "Video"}, |
|---|
| 1006 | {0x7E , "Weather"}, |
|---|
| 1007 | {0x7F , "Western"} |
|---|
| 1008 | }; |
|---|
| 1009 | |
|---|
| 1010 | int igKeyworkdCounts = sizeof(strDescriptiveKeyword)/sizeof(strDescriptiveKeyword[0]); |
|---|
| 1011 | |
|---|
| 1012 | |
|---|
| 1013 | /*Current Class*/ |
|---|
| 1014 | |
|---|
| 1015 | |
|---|
| 1016 | /* |
|---|
| 1017 | ÇöÀç updateÁßÀÎ programÀ» identifyÇϱâ À§ÇÑ ¼ö´ÜÀ¸·Î »ç¿ëÇÑ´Ù. |
|---|
| 1018 | »õ·Î¿î Program Identification Number¿Í Program Name ÀÌ µîÀå ÇßÀ» ¶§ »õ·Î¿î program infoÀÇ |
|---|
| 1019 | ½ÃÀÛÀÓÀ» ¾È´Ù...±×·±µ¥...µÑÁß¿¡ ´©±¸ÇÑÅ× synch¸¦ ¸ÂÃç¾ß Çϳª... |
|---|
| 1020 | ÀÇ¹Ì ÀÖ´Â À̸§À» °¡Áø Program Identification Number¸¦ ±âÁØÀ¸·Î ÇÏÀÚ. |
|---|
| 1021 | |
|---|
| 1022 | »õ·Î¿î ProgramIdentificationNumberÀÌ µîÀåÇϸé ÇöÀç °¡Áö°í ÀÖ´Â epg info list¸¦ °Ë»ö, |
|---|
| 1023 | °°Àº °ÍÀÌ ¾øÀ¸¸é »õ·Î¿î epg info ·Î list¿¡ Ãß°¡ ÇÑ´Ù. |
|---|
| 1024 | |
|---|
| 1025 | */ |
|---|
| 1026 | |
|---|
| 1027 | /*1. 0x01 Program Identification Number*/ |
|---|
| 1028 | |
|---|
| 1029 | void ProgramIdentificationNumber( UINT8 *inBuff, UINT8 inSize) |
|---|
| 1030 | { |
|---|
| 1031 | STATUS st = statusOK; |
|---|
| 1032 | UINT8 iMinute = 0; |
|---|
| 1033 | UINT8 iHour = 0; |
|---|
| 1034 | UINT8 iDate = 0; |
|---|
| 1035 | UINT8 iMonth = 0; |
|---|
| 1036 | UINT8 bTapeDelay = 0; |
|---|
| 1037 | BOOLEAN bVersionUp = FALSE; |
|---|
| 1038 | extern STATUS addNewElementIfPossible(); |
|---|
| 1039 | |
|---|
| 1040 | /*Its size is a fixed size...4 characters.*/ |
|---|
| 1041 | if( inSize < 4 ) |
|---|
| 1042 | return; |
|---|
| 1043 | |
|---|
| 1044 | /*time unit : UTC */ |
|---|
| 1045 | iMinute = inBuff[0] & 0x3f; //0011 1111b : 6bits |
|---|
| 1046 | iHour = inBuff[1] & 0x1f; //0001 1111b : 5bits |
|---|
| 1047 | iDate = inBuff[2] & 0x1f; //0001 1111b : 5bits |
|---|
| 1048 | iMonth = inBuff[3] & 0x0f; //0000 1111b : 4bits |
|---|
| 1049 | bTapeDelay = inBuff[3] & 0x10; //0001 0000b : 1bits |
|---|
| 1050 | |
|---|
| 1051 | |
|---|
| 1052 | /*¿¹Àü¿¡ ÀÌ¹Ì ¸ðµÎ ¹Þ¾Æ list¿¡ Æ÷ÇÔµÈ eventÀÇ Á¤º¸ Àΰ¡?*/ |
|---|
| 1053 | if ( existElementWithSameProgramId( iMinute , iHour , iDate , iMonth , bTapeDelay) == TRUE) |
|---|
| 1054 | { |
|---|
| 1055 | #ifdef eia608B_DEBUG |
|---|
| 1056 | epgPrintf("in the ProgramIdentificationNumber()... : it is same with before.\n"); |
|---|
| 1057 | epgPrintf("minute : %d , hour : %d , date : %d , month : %d , btapeDelay : %d\n", iMinute , iHour , iDate , iMonth , bTapeDelay); |
|---|
| 1058 | #endif |
|---|
| 1059 | return; |
|---|
| 1060 | } /*if*/ |
|---|
| 1061 | |
|---|
| 1062 | |
|---|
| 1063 | /*2003.11.28...changed by jina*/ |
|---|
| 1064 | /*ÇöÀç updateÁßÀÎ eventÀÇ Á¤º¸´Ù..ÀÌ¹Ì ¹Þ¾Ò³ª?....*/ |
|---|
| 1065 | if( (g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk ) == programIdReceiveOk ) |
|---|
| 1066 | { |
|---|
| 1067 | /*¹ÞÀº °ÍÀÌ ÇöÀç update ÁßÀÎ programÀÇ °Í°ú °°À¸¸é....¶Ç ¹ÞÀ» ÇÊ¿ä ¾ø´Ù.*/ |
|---|
| 1068 | if ( IsSameProgramIdWithCurrentThing( iMinute , iHour , iDate , iMonth , bTapeDelay ) == TRUE ) |
|---|
| 1069 | { |
|---|
| 1070 | #ifdef eia608B_DEBUG |
|---|
| 1071 | epgPrintf("in the ProgramIdentificationNumber()... : it is same with before.\n"); |
|---|
| 1072 | epgPrintf("minute : %d , hour : %d , date : %d , month : %d , btapeDelay : %d\n", iMinute , iHour , iDate , iMonth , bTapeDelay); |
|---|
| 1073 | #endif |
|---|
| 1074 | return; |
|---|
| 1075 | } /*if*/ |
|---|
| 1076 | else |
|---|
| 1077 | { |
|---|
| 1078 | #ifdef eia608B_DEBUG |
|---|
| 1079 | epgPrintf("ProgramIdentificationNumber : new programIdentification arrive...so, reset all prior epg db.\n"); |
|---|
| 1080 | epgPrintf("ProgramName : internal epg db version up\n"); |
|---|
| 1081 | #endif |
|---|
| 1082 | ResetNtscEgpInfo(); |
|---|
| 1083 | programListVersionUp(); |
|---|
| 1084 | bVersionUp = TRUE; |
|---|
| 1085 | } /*if ( IsSameProgramIdWithCurrentTh*/ |
|---|
| 1086 | } /*if( (g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk ) == programIdReceiveOk ) */ |
|---|
| 1087 | |
|---|
| 1088 | #ifdef eia608B_DEBUG |
|---|
| 1089 | epgPrintf("[XDS]g_ntscBasicEpgInfo.startMinute = %d\n", g_ntscBasicEpgInfo.startMinute); |
|---|
| 1090 | epgPrintf("[XDS]g_ntscBasicEpgInfo.startHour = %d\n", g_ntscBasicEpgInfo.startHour); |
|---|
| 1091 | epgPrintf("[XDS]g_ntscBasicEpgInfo.startDate = %d\n", g_ntscBasicEpgInfo.startDate); |
|---|
| 1092 | epgPrintf("[XDS]g_ntscBasicEpgInfo.startMongth = %d\n", g_ntscBasicEpgInfo.startMonth); |
|---|
| 1093 | epgPrintf("[XDS]g_ntscBasicEpgInfo.bTapeDelay = %d\n", g_ntscBasicEpgInfo.bTapeDelay); |
|---|
| 1094 | #endif |
|---|
| 1095 | |
|---|
| 1096 | /*time unit : UTC */ |
|---|
| 1097 | g_ntscBasicEpgInfo.startMinute = iMinute; |
|---|
| 1098 | g_ntscBasicEpgInfo.startHour = iHour; |
|---|
| 1099 | g_ntscBasicEpgInfo.startDate = iDate; |
|---|
| 1100 | g_ntscBasicEpgInfo.startMonth = iMonth; |
|---|
| 1101 | g_ntscBasicEpgInfo.bTapeDelay = bTapeDelay; |
|---|
| 1102 | |
|---|
| 1103 | g_ntscBasicEpgInfo.receiveStatus = programIdReceiveOk; |
|---|
| 1104 | |
|---|
| 1105 | |
|---|
| 1106 | st = addNewElementIfPossible(); |
|---|
| 1107 | |
|---|
| 1108 | /*¸ðµç Á¤º¸°¡ ¸ð¿©Á® »õ·Î Ãß°¡ µÇÁö ¸øÇßÁö¸¸, »õ·Î¿î event°¡ °¨Áö µÇ¾ú´Ù.*/ |
|---|
| 1109 | if( (st != statusOK) && bVersionUp && gNtscAsynchProcedure ) |
|---|
| 1110 | { |
|---|
| 1111 | |
|---|
| 1112 | #ifdef eia608B_DEBUG |
|---|
| 1113 | epgPrintf("^^^^^^......... :Send the User evtEpgNtscVersionChange , xdsProgramIdentificationNumber\n"); |
|---|
| 1114 | #endif |
|---|
| 1115 | gNtscAsynchProcedure( evtEpgNtscVersionChange , g_ntscProgramInfoHeader.iInternalVersion , xdsProgramIdentificationNumber ); |
|---|
| 1116 | } |
|---|
| 1117 | |
|---|
| 1118 | } |
|---|
| 1119 | |
|---|
| 1120 | /*2. 0x02 Length/Time-in-Show*/ |
|---|
| 1121 | |
|---|
| 1122 | /*Áߺ¹ µÇ´Â Á¤º¸À̸é not available ÇÑ informationÀ¸·Î °£ÁÖ ÇÑ´Ù.*/ |
|---|
| 1123 | BOOLEAN isAvailable() |
|---|
| 1124 | { |
|---|
| 1125 | #ifdef eia608B_DEBUG |
|---|
| 1126 | epgPrintf("g_ntscBasicEpgInfo.receiveStatus = %d\n" ,g_ntscBasicEpgInfo.receiveStatus ); |
|---|
| 1127 | epgPrintf("g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk = %d\n", g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk); |
|---|
| 1128 | #endif |
|---|
| 1129 | |
|---|
| 1130 | |
|---|
| 1131 | if ( (g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk) == programIdReceiveOk ) |
|---|
| 1132 | // if ( (g_ntscBasixEpgInfo.receiveStatus & programNameReceiveOk) == programNameReceiveOk ) |
|---|
| 1133 | { /*programNameReceiveOk*/ |
|---|
| 1134 | #ifdef eia608B_DEBUG |
|---|
| 1135 | epgPrintf("It is avaliable information\n"); |
|---|
| 1136 | #endif |
|---|
| 1137 | return TRUE; |
|---|
| 1138 | } |
|---|
| 1139 | else |
|---|
| 1140 | { |
|---|
| 1141 | #ifdef eia608B_DEBUG |
|---|
| 1142 | epgPrintf("It is non-available information\n"); |
|---|
| 1143 | #endif |
|---|
| 1144 | return FALSE; |
|---|
| 1145 | } |
|---|
| 1146 | } |
|---|
| 1147 | |
|---|
| 1148 | STATUS addNewElementForced() |
|---|
| 1149 | { |
|---|
| 1150 | STATUS st = statusOK; |
|---|
| 1151 | |
|---|
| 1152 | NtscBasicEpgInfo *pNewElem = allocNtscBasicEpgInformation(); |
|---|
| 1153 | if(pNewElem == NULL) |
|---|
| 1154 | return statusOutOfMemory; |
|---|
| 1155 | |
|---|
| 1156 | #ifdef eia608B_DEBUG |
|---|
| 1157 | epgPrintf("addNewElementForced : before copy : nameLength = %d , programName = %s\n" ,g_ntscBasicEpgInfo.programNameLength , g_ntscBasicEpgInfo.programName ); |
|---|
| 1158 | #endif |
|---|
| 1159 | |
|---|
| 1160 | copyNtscBasicEpgInformation( &g_ntscBasicEpgInfo , pNewElem ); |
|---|
| 1161 | |
|---|
| 1162 | /*ÇöÀç program¸¸ À¯È¿ÇÏ´Ù¸é ÀÌÀü¿¡ ÀÖ´ø°ÍÀº ¸ðµÎ Áö¿î´Ù.*/ |
|---|
| 1163 | if( g_bOnlyCurrentMode ) |
|---|
| 1164 | DMW_608B_ClearProgramInfoList(); |
|---|
| 1165 | st = addToEpgInfoList(pNewElem); |
|---|
| 1166 | //programListVersionUp(); |
|---|
| 1167 | // /*Ãß°¡ ÇßÀ¸´Ï global epg program data resetÇÑ´Ù.*/ |
|---|
| 1168 | // memset( &g_ntscBasicEpgInfo , 0 , sizeof(NtscBasicEpgInfo) ); |
|---|
| 1169 | |
|---|
| 1170 | return st; |
|---|
| 1171 | } |
|---|
| 1172 | |
|---|
| 1173 | /*2003.11.18....added by jina*/ |
|---|
| 1174 | STATUS addNewElementIfPossible() |
|---|
| 1175 | { |
|---|
| 1176 | STATUS st = statusError; |
|---|
| 1177 | /*program's basic informationÀÌ ¸ðµÎ ä¿öÁ³À¸¸é epg program list¿¡ addÇÏÀÚ.*/ |
|---|
| 1178 | if( ((g_ntscBasicEpgInfo.receiveStatus) == allReceiveOk) || |
|---|
| 1179 | ((g_ntscBasicEpgInfo.receiveStatus) == sosoOK) ) /*programtypeÀÌ ¾ø´õ¶óµµ..Okay.*/ |
|---|
| 1180 | { |
|---|
| 1181 | NtscBasicEpgInfo *pNewElem = allocNtscBasicEpgInformation(); |
|---|
| 1182 | copyNtscBasicEpgInformation( &g_ntscBasicEpgInfo , pNewElem ); |
|---|
| 1183 | |
|---|
| 1184 | /*ÇöÀç program¸¸ À¯È¿ÇÏ´Ù¸é ÀÌÀü¿¡ ÀÖ´ø°ÍÀº ¸ðµÎ Áö¿î´Ù.*/ |
|---|
| 1185 | if( g_bOnlyCurrentMode ) |
|---|
| 1186 | DMW_608B_ClearProgramInfoList(); |
|---|
| 1187 | st = addToEpgInfoList(pNewElem); |
|---|
| 1188 | programListVersionUp(); |
|---|
| 1189 | /*Ãß°¡ ÇßÀ¸´Ï global epg program data resetÇÑ´Ù.*/ |
|---|
| 1190 | memset( &g_ntscBasicEpgInfo , 0 , sizeof(NtscBasicEpgInfo) ); |
|---|
| 1191 | |
|---|
| 1192 | // if(st == statusOK) /*Á¦´ë·Î Ãß°¡ µÇ¾úÀ¸¸é...resetÇÑ´Ù.*/ |
|---|
| 1193 | // g_ntscBasicEpgInfo.receiveStatus = 0; |
|---|
| 1194 | |
|---|
| 1195 | #ifdef eia608B_DEBUG |
|---|
| 1196 | printBasicEpgInformation(); |
|---|
| 1197 | #endif |
|---|
| 1198 | } |
|---|
| 1199 | |
|---|
| 1200 | /*ÇÊ¿äÇÑ ¸ðµç data°¡ ¸ð¾ÆÁ® »õ·Î eventÃß°¡ ÇßÀ¸´Ï ebp db version up µÇ¾ú´Ù.*/ |
|---|
| 1201 | if( st == statusOK && gNtscAsynchProcedure ) |
|---|
| 1202 | { |
|---|
| 1203 | #ifdef eia608B_DEBUG |
|---|
| 1204 | epgPrintf("^^^^^^......... :Send the User evtEpgNtscVersionChange\n"); |
|---|
| 1205 | #endif |
|---|
| 1206 | gNtscAsynchProcedure( evtEpgNtscVersionChange , g_ntscProgramInfoHeader.iInternalVersion , 0 ); |
|---|
| 1207 | } |
|---|
| 1208 | |
|---|
| 1209 | return st; |
|---|
| 1210 | } |
|---|
| 1211 | |
|---|
| 1212 | void LengthTimeInShow ( UINT8 *inBuff , UINT8 inSize) |
|---|
| 1213 | { |
|---|
| 1214 | /* UINT8 iMinLength = 0; |
|---|
| 1215 | UINT8 iHourLength = 0; |
|---|
| 1216 | UINT8 iMinElapsed = 0; |
|---|
| 1217 | UINT8 iHourElapsed = 0; |
|---|
| 1218 | UINT8 iSecElapsed = 0; |
|---|
| 1219 | */ |
|---|
| 1220 | STATUS st = statusOK; |
|---|
| 1221 | /*Its size is 2 or 4 or 6 characters.*/ |
|---|
| 1222 | if( inSize < 2 ) |
|---|
| 1223 | return; |
|---|
| 1224 | |
|---|
| 1225 | /* if(isAvailable() == FALSE) |
|---|
| 1226 | return; |
|---|
| 1227 | */ |
|---|
| 1228 | |
|---|
| 1229 | /*2003.11.28...changed by jina*/ |
|---|
| 1230 | /*ÀÌ¹Ì ¹Þ¾ÒÀ¸¸é....*/ |
|---|
| 1231 | if( (g_ntscBasicEpgInfo.receiveStatus & lengthTimeInShowReceiveOk ) == lengthTimeInShowReceiveOk ) |
|---|
| 1232 | return; |
|---|
| 1233 | |
|---|
| 1234 | |
|---|
| 1235 | g_ntscBasicEpgInfo.minLength = inBuff[0] & 0x3f; //0011 1111b : 6bits |
|---|
| 1236 | g_ntscBasicEpgInfo.hourLength = inBuff[1] & 0x3f; //0011 1111b : 6bits |
|---|
| 1237 | |
|---|
| 1238 | if( inSize > 2) |
|---|
| 1239 | { |
|---|
| 1240 | g_ntscBasicEpgInfo.minElapsed = inBuff[2] & 0x3f; //0011 1111b : 6bits |
|---|
| 1241 | g_ntscBasicEpgInfo.hourElapsed = inBuff[3] & 0x3f; //0011 1111b : 6bits |
|---|
| 1242 | } |
|---|
| 1243 | |
|---|
| 1244 | if( inSize > 4) |
|---|
| 1245 | { |
|---|
| 1246 | g_ntscBasicEpgInfo.secElapsed = inBuff[4] & 0x3f; //0011 1111b : 6bits |
|---|
| 1247 | } |
|---|
| 1248 | |
|---|
| 1249 | (g_ntscBasicEpgInfo.receiveStatus) |= lengthTimeInShowReceiveOk; |
|---|
| 1250 | |
|---|
| 1251 | #ifdef eia608B_DEBUG |
|---|
| 1252 | epgPrintf("in the LengthTimeInShow().... : &&&&&&&&&& g_ntscBasicEpgInfo.receiveStatus = %d\n", g_ntscBasicEpgInfo.receiveStatus); |
|---|
| 1253 | #endif |
|---|
| 1254 | |
|---|
| 1255 | |
|---|
| 1256 | /*program's basic informationÀÌ ¸ðµÎ ä¿öÁ³À¸¸é epg program list¿¡ addÇÏÀÚ.*/ |
|---|
| 1257 | st = addNewElementIfPossible(); |
|---|
| 1258 | |
|---|
| 1259 | #ifdef eia608B_DEBUG |
|---|
| 1260 | epgPrintf("[XDS]g_ntscBasicEpgInfo.minLength = %d\n", g_ntscBasicEpgInfo.minLength); |
|---|
| 1261 | epgPrintf("[XDS]g_ntscBasicEpgInfo.hourLength = %d\n", g_ntscBasicEpgInfo.hourLength); |
|---|
| 1262 | epgPrintf("[XDS]g_ntscBasicEpgInfo.minElapsed = %d\n", g_ntscBasicEpgInfo.minElapsed); |
|---|
| 1263 | epgPrintf("[XDS]g_ntscBasicEpgInfo.hourElapsed = %d\n", g_ntscBasicEpgInfo.hourElapsed); |
|---|
| 1264 | epgPrintf("[XDS]g_ntscBasicEpgInfo.secElapsed = %d\n", g_ntscBasicEpgInfo.secElapsed); |
|---|
| 1265 | #endif |
|---|
| 1266 | } |
|---|
| 1267 | |
|---|
| 1268 | |
|---|
| 1269 | /*3. 0x03 Program Name(Title) */ |
|---|
| 1270 | |
|---|
| 1271 | void ProgramName( UINT8 *inBuff , UINT8 inSize) |
|---|
| 1272 | { |
|---|
| 1273 | #if 1 |
|---|
| 1274 | //ntsc cc tape#3 ¿¡¼ ÀÌ°Ô ¿ÔÀ»¶§ Á×¾î¹ö¸®´Âµ¥ ÀÌÀ¯¸¦ ¾Ë¼ö¾ø´Ù.. |
|---|
| 1275 | //¿ì¼±Àº ÇÊ¿ä¾ø¾î¼ ¸·°í..ÇÏÀÚ-_- |
|---|
| 1276 | //2006-01-13 add by narsist |
|---|
| 1277 | return; |
|---|
| 1278 | #else |
|---|
| 1279 | STATUS st; |
|---|
| 1280 | int i = 0; |
|---|
| 1281 | BOOLEAN bVersionUp = FALSE; |
|---|
| 1282 | /* UINT8 programName[32] = {0}; |
|---|
| 1283 | */ |
|---|
| 1284 | /*Its size is 2 to 32 characters.*/ |
|---|
| 1285 | if( inSize < 2 ) |
|---|
| 1286 | return; |
|---|
| 1287 | |
|---|
| 1288 | |
|---|
| 1289 | /*limit the size to 32.*/ |
|---|
| 1290 | if( inSize > 32 ) |
|---|
| 1291 | inSize = 32; |
|---|
| 1292 | |
|---|
| 1293 | |
|---|
| 1294 | //epgPrintf("@@@@@@@@@@ @@@ programName = %s\n", inBuff );//debug |
|---|
| 1295 | |
|---|
| 1296 | ////////////////// |
|---|
| 1297 | /*¿¹Àü¿¡ ÀÌ¹Ì ¸ðµÎ ¹Þ¾Æ list¿¡ Æ÷ÇÔµÈ eventÀÇ Á¤º¸ Àΰ¡?*/ |
|---|
| 1298 | if( existElementWithSameProgramName( inBuff , inSize ) == TRUE ) |
|---|
| 1299 | { |
|---|
| 1300 | #ifdef eia608B_DEBUG |
|---|
| 1301 | epgPrintf("ProgramName()... : it is same with before.\n"); |
|---|
| 1302 | #endif |
|---|
| 1303 | return; |
|---|
| 1304 | } /*if*/ |
|---|
| 1305 | |
|---|
| 1306 | |
|---|
| 1307 | /*2003.11.28...changed by jina*/ |
|---|
| 1308 | /*ÇöÀç updateÁßÀÎ eventÀÇ Á¤º¸´Ù..ÀÌ¹Ì ¹Þ¾Ò³ª?....*/ |
|---|
| 1309 | if( (g_ntscBasicEpgInfo.receiveStatus & programNameReceiveOk) == programNameReceiveOk ) |
|---|
| 1310 | { |
|---|
| 1311 | /*¹ÞÀº °ÍÀÌ ÇöÀç update ÁßÀÎ programÀÇ °Í°ú °°À¸¸é....¶Ç ¹ÞÀ» ÇÊ¿ä ¾ø´Ù.*/ |
|---|
| 1312 | if ( IsSameProgramNameWithCurrentThing( inBuff , inSize) == TRUE ) |
|---|
| 1313 | { |
|---|
| 1314 | #ifdef eia608B_DEBUG |
|---|
| 1315 | epgPrintf("ProgramName : it is same with before.\n"); |
|---|
| 1316 | #endif |
|---|
| 1317 | return; |
|---|
| 1318 | } /*if*/ |
|---|
| 1319 | else |
|---|
| 1320 | { |
|---|
| 1321 | #ifdef eia608B_DEBUG |
|---|
| 1322 | epgPrintf("ProgramName : new programIdentification arrive...so, reset all prior epg db.\n"); |
|---|
| 1323 | epgPrintf("ProgramName : internal epg db version up\n"); |
|---|
| 1324 | #endif |
|---|
| 1325 | ResetNtscEgpInfo(); |
|---|
| 1326 | programListVersionUp(); |
|---|
| 1327 | bVersionUp = TRUE; |
|---|
| 1328 | } |
|---|
| 1329 | } /*if( (g_ntscBasicEpgInfo.receiveStatus & programIdReceiveOk ) == programIdReceiveOk ) */ |
|---|
| 1330 | |
|---|
| 1331 | |
|---|
| 1332 | g_ntscBasicEpgInfo.programNameLength = inSize; |
|---|
| 1333 | for( i = 0 ; i < inSize ; i++) |
|---|
| 1334 | { |
|---|
| 1335 | g_ntscBasicEpgInfo.programName[i] = inBuff[i]; |
|---|
| 1336 | } |
|---|
| 1337 | |
|---|
| 1338 | g_ntscBasicEpgInfo.receiveStatus |= programNameReceiveOk; |
|---|
| 1339 | |
|---|
| 1340 | #ifdef eia608B_DEBUG |
|---|
| 1341 | epgPrintf("ProgramName() : g_ntscBasicEpgInfo.receiveStatus = %d\n", g_ntscBasicEpgInfo.receiveStatus); |
|---|
| 1342 | #endif |
|---|
| 1343 | |
|---|
| 1344 | st = addNewElementIfPossible(); |
|---|
| 1345 | |
|---|
| 1346 | /*¸ðµç Á¤º¸°¡ ¸ð¿©Á® »õ·Î Ãß°¡ µÇÁö ¸øÇßÁö¸¸, »õ·Î¿î event°¡ °¨Áö µÇ¾ú´Ù.*/ |
|---|
| 1347 | if( (st != statusOK) && bVersionUp && gNtscAsynchProcedure ) |
|---|
| 1348 | { |
|---|
| 1349 | #ifdef eia608B_DEBUG |
|---|
| 1350 | epgPrintf("^^^^^^......... :Send the User evtEpgNtscVersionChange , xdsProgramName \n"); |
|---|
| 1351 | #endif |
|---|
| 1352 | gNtscAsynchProcedure( evtEpgNtscVersionChange , g_ntscProgramInfoHeader.iInternalVersion , xdsProgramName ); |
|---|
| 1353 | } |
|---|
| 1354 | |
|---|
| 1355 | |
|---|
| 1356 | #ifdef eia608B_DEBUG |
|---|
| 1357 | epgPrintf("[XDS]g_ntscBasicEpgInfo.programName = %s\n", g_ntscBasicEpgInfo.programName); |
|---|
| 1358 | #endif |
|---|
| 1359 | |
|---|
| 1360 | #endif |
|---|
| 1361 | } |
|---|
| 1362 | |
|---|
| 1363 | const UINT8 * DescriptiveKeyword( UINT8 iHexCode ) |
|---|
| 1364 | { |
|---|
| 1365 | int i = 0 ; |
|---|
| 1366 | for ( i = 0 ; i < igKeyworkdCounts ; i++ ) |
|---|
| 1367 | { |
|---|
| 1368 | if( strDescriptiveKeyword[i].hexCode == iHexCode ) |
|---|
| 1369 | return strDescriptiveKeyword[i].keyWord; |
|---|
| 1370 | } |
|---|
| 1371 | |
|---|
| 1372 | return("Invalid HexCode."); |
|---|
| 1373 | } |
|---|
| 1374 | |
|---|
| 1375 | /*4. 0x04 Program Type*/ |
|---|
| 1376 | |
|---|
| 1377 | void ProgramType( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1378 | { |
|---|
| 1379 | STATUS st; |
|---|
| 1380 | #ifdef eia608B_DEBUG |
|---|
| 1381 | int i; |
|---|
| 1382 | #endif |
|---|
| 1383 | /*Its size is 2 to 32 characters.*/ |
|---|
| 1384 | if( inSize < 2 ) |
|---|
| 1385 | return; |
|---|
| 1386 | |
|---|
| 1387 | /*limit the size to 32.*/ |
|---|
| 1388 | if( inSize > 32 ) |
|---|
| 1389 | inSize = 32; |
|---|
| 1390 | |
|---|
| 1391 | /* if(isAvailable() == FALSE) |
|---|
| 1392 | return; |
|---|
| 1393 | */ |
|---|
| 1394 | |
|---|
| 1395 | /*2003.11.28...changed by jina*/ |
|---|
| 1396 | /*ÀÌ¹Ì ¹Þ¾ÒÀ¸¸é....*/ |
|---|
| 1397 | if( (g_ntscBasicEpgInfo.receiveStatus & programTypeReceiveOk) == programTypeReceiveOk ) |
|---|
| 1398 | return; |
|---|
| 1399 | |
|---|
| 1400 | memcpy( g_ntscBasicEpgInfo.programType , inBuff , inSize ); |
|---|
| 1401 | |
|---|
| 1402 | g_ntscBasicEpgInfo.receiveStatus |= programTypeReceiveOk; |
|---|
| 1403 | |
|---|
| 1404 | #ifdef eia608B_DEBUG |
|---|
| 1405 | epgPrintf("in the ProgramType().... : &&&&&&&&&& g_ntscBasicEpgInfo.receiveStatus = %d\n", g_ntscBasicEpgInfo.receiveStatus); |
|---|
| 1406 | #endif |
|---|
| 1407 | |
|---|
| 1408 | st = addNewElementIfPossible(); |
|---|
| 1409 | |
|---|
| 1410 | #ifdef eia608B_DEBUG |
|---|
| 1411 | for( i = 0 ; i < inSize ; i++ ) |
|---|
| 1412 | { |
|---|
| 1413 | epgPrintf("[XDS]g_ntscBasicEpgInfo.programType[%d] : %d , %s\n", i , g_ntscBasicEpgInfo.programType[i] , DescriptiveKeyword(g_ntscBasicEpgInfo.programType[i]) ); |
|---|
| 1414 | } |
|---|
| 1415 | #endif |
|---|
| 1416 | |
|---|
| 1417 | } |
|---|
| 1418 | |
|---|
| 1419 | |
|---|
| 1420 | void ContentAdvisory ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1421 | { |
|---|
| 1422 | UINT8 ratingSystem = 0; |
|---|
| 1423 | UINT8 mpaRating = 0; |
|---|
| 1424 | UINT8 usTvRating = 0; |
|---|
| 1425 | int semErr; |
|---|
| 1426 | BOOLEAN bSame = FALSE; |
|---|
| 1427 | |
|---|
| 1428 | /*Its size is 2 characters.*/ |
|---|
| 1429 | if(inSize < 2) |
|---|
| 1430 | return; |
|---|
| 1431 | |
|---|
| 1432 | //epgPrintf("ContentAdvisory.\n"); |
|---|
| 1433 | |
|---|
| 1434 | /*updateÇÏ´Â µ¿¾È request°¡ ¿À¸é....???Á¢±Ù ¸øÇÏ°Ô ¸·°í....½ÃÀÛ ÇÑ´Ù..¿ì¼±.*/ |
|---|
| 1435 | semErr = DHL_OS_TakeSemaphore(g_ntscRatingUpdateSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1436 | if(semErr) |
|---|
| 1437 | return; /*maybe timeout*/ |
|---|
| 1438 | |
|---|
| 1439 | g_ntscRatingCaptureTicks = OS_GetTickCount(); |
|---|
| 1440 | //epgPrintf("get data : ticks = %d.\n", g_ntscRatingCaptureTicks); |
|---|
| 1441 | |
|---|
| 1442 | /*°°Àºµ¥ ÇÏÁö ¸»ÀÚ.*/ |
|---|
| 1443 | if( ( bSame = IsSameRatingInfoWithCurrentThing( inBuff , inSize ) ) == TRUE ) |
|---|
| 1444 | goto LETSGOOUT; |
|---|
| 1445 | |
|---|
| 1446 | memcpy( &g_ntscRatingInfoRaw , inBuff , 2); |
|---|
| 1447 | memset( &g_ntscRatingInfo , 0 , sizeof(NtscRatingInfo) ); |
|---|
| 1448 | |
|---|
| 1449 | |
|---|
| 1450 | ratingSystem = ( inBuff[0] & 0x18 ) >> 3; /*0001 1000b : 2bits*/ |
|---|
| 1451 | |
|---|
| 1452 | if(ratingSystem == 0x00 || ratingSystem == 0x02) /*MPA*/ |
|---|
| 1453 | { |
|---|
| 1454 | g_ntscRatingInfo.ratingType = US_MPAA; |
|---|
| 1455 | |
|---|
| 1456 | mpaRating = inBuff[0] & 0x07; /*0000 0111b : 3bits*/ |
|---|
| 1457 | |
|---|
| 1458 | if(mpaRating == 0x07) |
|---|
| 1459 | { |
|---|
| 1460 | g_ntscRatingInfo.ratingValue = 0x08; /*not rated... leon 2003.9.2 change 0->0x08 for compatability*/ |
|---|
| 1461 | } |
|---|
| 1462 | else |
|---|
| 1463 | { |
|---|
| 1464 | g_ntscRatingInfo.ratingValue = mpaRating+1; |
|---|
| 1465 | } |
|---|
| 1466 | } |
|---|
| 1467 | else if (ratingSystem == 0x01) /*US TV Parental Guideline Rating System*/ |
|---|
| 1468 | { |
|---|
| 1469 | g_ntscRatingInfo.ratingType = US_Entire_Audience; |
|---|
| 1470 | |
|---|
| 1471 | usTvRating = inBuff[1] & 0x07; /*0000 0111 : 3bits*/ |
|---|
| 1472 | |
|---|
| 1473 | if( usTvRating == 0x01 || usTvRating == 0x02 ) |
|---|
| 1474 | { |
|---|
| 1475 | g_ntscRatingInfo.ratingType = US_Children; |
|---|
| 1476 | |
|---|
| 1477 | if(usTvRating == 0x01) |
|---|
| 1478 | { |
|---|
| 1479 | g_ntscRatingInfo.ratingValue = usTvRating; |
|---|
| 1480 | } |
|---|
| 1481 | else |
|---|
| 1482 | { |
|---|
| 1483 | g_ntscRatingInfo.ratingValue = usTvRating; |
|---|
| 1484 | } |
|---|
| 1485 | } |
|---|
| 1486 | #if 0 |
|---|
| 1487 | else if( usTvRating == 0x00) |
|---|
| 1488 | #else // °ªÀÌ 0ÀÎ none, 7ÀÎ none ¸ðµÎ ó¸®(hschang, 20040319) |
|---|
| 1489 | else if( usTvRating == 0x00 || usTvRating == 0x07) |
|---|
| 1490 | #endif |
|---|
| 1491 | { |
|---|
| 1492 | g_ntscRatingInfo.ratingValue = 1; /*none*/ |
|---|
| 1493 | } |
|---|
| 1494 | else |
|---|
| 1495 | { |
|---|
| 1496 | g_ntscRatingInfo.ratingValue = usTvRating-1; |
|---|
| 1497 | } |
|---|
| 1498 | } |
|---|
| 1499 | else if( ratingSystem == 0x03) |
|---|
| 1500 | { |
|---|
| 1501 | ratingSystem = ( inBuff[0] & 0x20 ) >> 5; /*0010 0000b : 1bits*/ |
|---|
| 1502 | g_ntscRatingInfo.ratingValue = ( inBuff[1] & 0x07 ); /*0000 0111b : 3bits*/ |
|---|
| 1503 | |
|---|
| 1504 | if(ratingSystem == 0x01) /*Candadian French Language Rating*/ |
|---|
| 1505 | { |
|---|
| 1506 | g_ntscRatingInfo.ratingType = CANADA_French; |
|---|
| 1507 | } |
|---|
| 1508 | else /*Canadian English Language Rating*/ |
|---|
| 1509 | { |
|---|
| 1510 | g_ntscRatingInfo.ratingType = CANADA_English; |
|---|
| 1511 | } |
|---|
| 1512 | } |
|---|
| 1513 | |
|---|
| 1514 | if( g_ntscRatingInfo.ratingType == US_Entire_Audience ) |
|---|
| 1515 | { |
|---|
| 1516 | switch( g_ntscRatingInfo.ratingValue) |
|---|
| 1517 | { |
|---|
| 1518 | case 0x03: /*TV-PG*/ |
|---|
| 1519 | g_ntscRatingInfo.V = ( inBuff[1] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1520 | g_ntscRatingInfo.S = ( inBuff[1] & 0x10 ) >> 4; /*0001 0000b : 1bit*/ |
|---|
| 1521 | g_ntscRatingInfo.L = ( inBuff[1] & 0x08 ) >> 3; /*0000 1000b : 1bit*/ |
|---|
| 1522 | g_ntscRatingInfo.D = ( inBuff[0] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1523 | break; |
|---|
| 1524 | |
|---|
| 1525 | case 0x04: /*TV-14*/ |
|---|
| 1526 | g_ntscRatingInfo.V = ( inBuff[1] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1527 | g_ntscRatingInfo.S = ( inBuff[1] & 0x10 ) >> 4; /*0001 0000b : 1bit*/ |
|---|
| 1528 | g_ntscRatingInfo.L = ( inBuff[1] & 0x08 ) >> 3; /*0000 1000b : 1bit*/ |
|---|
| 1529 | g_ntscRatingInfo.D = ( inBuff[0] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1530 | break; |
|---|
| 1531 | |
|---|
| 1532 | case 0x05: /*TV-MA*/ |
|---|
| 1533 | g_ntscRatingInfo.V = ( inBuff[1] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1534 | g_ntscRatingInfo.S = ( inBuff[1] & 0x10 ) >> 4; /*0001 0000b : 1bit*/ |
|---|
| 1535 | g_ntscRatingInfo.L = ( inBuff[1] & 0x08 ) >> 3; /*0000 1000b : 1bit*/ |
|---|
| 1536 | break; |
|---|
| 1537 | } |
|---|
| 1538 | } |
|---|
| 1539 | else if ( g_ntscRatingInfo.ratingType == US_Children && g_ntscRatingInfo.ratingValue == 0x02 /*TV-Y7*/) |
|---|
| 1540 | { |
|---|
| 1541 | g_ntscRatingInfo.FV = ( inBuff[1] & 0x20 ) >> 5; /*0010 0000b : 1bit*/ |
|---|
| 1542 | } |
|---|
| 1543 | |
|---|
| 1544 | LETSGOOUT: |
|---|
| 1545 | /*update ³¡³µÀ¸´Ï Ç®¾î ÁÖÀÚ.*/ |
|---|
| 1546 | OS_GiveSemaphore(g_ntscRatingUpdateSema4); |
|---|
| 1547 | |
|---|
| 1548 | if( bSame == FALSE && gNtscAsynchProcedure ) |
|---|
| 1549 | { |
|---|
| 1550 | /*2004.01.17 added by jina */ |
|---|
| 1551 | /*»õ·Î¿î rating informationÀÌ´Ù. event¸¦ ³¯·ÁÁÖÀÚ....*/ |
|---|
| 1552 | programListVersionUp();//leon 2004.1.18 : RatingÀÌ º¯ÇÏÁö ¾Ê´Â ¹®Á¦ ¼öÁ¤. |
|---|
| 1553 | |
|---|
| 1554 | #ifdef eia608B_DEBUG |
|---|
| 1555 | epgPrintf("^^^^^^......... :Send the User evtEpgNtscVersionChange , xdsContentAdvisory\n"); |
|---|
| 1556 | #endif |
|---|
| 1557 | gNtscAsynchProcedure( evtEpgNtscVersionChange , g_ntscProgramInfoHeader.iInternalVersion , xdsContentAdvisory ); |
|---|
| 1558 | #ifdef eia608B_DEBUG |
|---|
| 1559 | epgPrintf("[XDS]g_ntscRatingInfo.ratingType : %d \n",g_ntscRatingInfo.ratingType); |
|---|
| 1560 | epgPrintf("[XDS]g_ntscRatingInfo.ratingValue : %d \n", g_ntscRatingInfo.ratingValue); |
|---|
| 1561 | epgPrintf("[XDS]g_ntscRatingInfo.FV : %d \n" ,g_ntscRatingInfo.FV); |
|---|
| 1562 | epgPrintf("[XDS]g_ntscRatingInfo.V : %d \n" ,g_ntscRatingInfo.V); |
|---|
| 1563 | epgPrintf("[XDS]g_ntscRatingInfo.S : %d \n", g_ntscRatingInfo.S); |
|---|
| 1564 | epgPrintf("[XDS]g_ntscRatingInfo.L : %d \n", g_ntscRatingInfo.L); |
|---|
| 1565 | epgPrintf("[XDS]g_ntscRatingInfo.D : %d \n", g_ntscRatingInfo.D); |
|---|
| 1566 | |
|---|
| 1567 | #endif |
|---|
| 1568 | } |
|---|
| 1569 | |
|---|
| 1570 | |
|---|
| 1571 | |
|---|
| 1572 | #ifdef eia608B_DEBUG |
|---|
| 1573 | /*epgPrintf("[XDS]g_ntscRatingInfo.ratingType : %d \n",g_ntscRatingInfo.ratingType); |
|---|
| 1574 | epgPrintf("[XDS]g_ntscRatingInfo.ratingValue : %d \n", g_ntscRatingInfo.ratingValue); |
|---|
| 1575 | epgPrintf("[XDS]g_ntscRatingInfo.FV : %d \n" ,g_ntscRatingInfo.FV); |
|---|
| 1576 | epgPrintf("[XDS]g_ntscRatingInfo.V : %d \n" ,g_ntscRatingInfo.V); |
|---|
| 1577 | epgPrintf("[XDS]g_ntscRatingInfo.S : %d \n", g_ntscRatingInfo.S); |
|---|
| 1578 | epgPrintf("[XDS]g_ntscRatingInfo.L : %d \n", g_ntscRatingInfo.L); |
|---|
| 1579 | epgPrintf("[XDS]g_ntscRatingInfo.D : %d \n", g_ntscRatingInfo.D); |
|---|
| 1580 | */ |
|---|
| 1581 | #endif |
|---|
| 1582 | |
|---|
| 1583 | } |
|---|
| 1584 | |
|---|
| 1585 | |
|---|
| 1586 | /*6. 0x06 Audio Services.*/ |
|---|
| 1587 | |
|---|
| 1588 | void AudioServices ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1589 | { |
|---|
| 1590 | /* |
|---|
| 1591 | UINT8 mainAudioLanguage = 0; |
|---|
| 1592 | UINT8 mainAudioType = 0; |
|---|
| 1593 | UINT8 sapLanguage = 0; |
|---|
| 1594 | UINT8 sapType = 0; |
|---|
| 1595 | */ |
|---|
| 1596 | /*Its size is 2 characters*/ |
|---|
| 1597 | if( inSize < 2 ) |
|---|
| 1598 | return; |
|---|
| 1599 | memset( &g_ntscAudioInfo , 0 , sizeof(NtscAudioInfo) ); |
|---|
| 1600 | |
|---|
| 1601 | g_ntscAudioInfo.mainAudioLanguage = (inBuff[0] & 0x38) >> 3; //0011 1000b : 3bits |
|---|
| 1602 | g_ntscAudioInfo.mainAudioType = inBuff[0] & 0x07; //0000 0111b : 3bits |
|---|
| 1603 | |
|---|
| 1604 | g_ntscAudioInfo.sapLanguage = (inBuff[1] & 0x38) >> 3; //0011 1000b : 3bits |
|---|
| 1605 | g_ntscAudioInfo.sapType = inBuff[1] & 0x07; //0000 0111b : 3bits |
|---|
| 1606 | } |
|---|
| 1607 | |
|---|
| 1608 | |
|---|
| 1609 | /*7. 0x07 Caption Services.*/ |
|---|
| 1610 | |
|---|
| 1611 | void CaptionServices ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1612 | { |
|---|
| 1613 | int i = 0; |
|---|
| 1614 | /* UINT8 capLanguage[8] = {0}; |
|---|
| 1615 | UINT8 capServiceType[8] = {0}; |
|---|
| 1616 | */ |
|---|
| 1617 | /*Its size is 2 or 8 characters.*/ |
|---|
| 1618 | if ( inSize < 2 ) |
|---|
| 1619 | return; |
|---|
| 1620 | |
|---|
| 1621 | memset( &g_ntscCaptionInfo , 0 , sizeof(NtscCaptionInfo)); |
|---|
| 1622 | |
|---|
| 1623 | /*limit the size to 8.*/ |
|---|
| 1624 | if ( inSize > 8 ) |
|---|
| 1625 | inSize = 8; |
|---|
| 1626 | |
|---|
| 1627 | for( i = 0 ; i < inSize ; i++ ) |
|---|
| 1628 | { |
|---|
| 1629 | g_ntscCaptionInfo.capLanguage[i] = ( inBuff[i] & 0x38 ) >> 3; //0011 1000 : 3bits |
|---|
| 1630 | g_ntscCaptionInfo.capServiceType[i] = inBuff[i] & 0x07; //0000 0111 : 3bits |
|---|
| 1631 | } |
|---|
| 1632 | |
|---|
| 1633 | } |
|---|
| 1634 | |
|---|
| 1635 | /*8. 0x08 Copy Generation Management System(Analog)*/ |
|---|
| 1636 | |
|---|
| 1637 | void CopyGenerationManagementSystemA( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1638 | { |
|---|
| 1639 | #if 0 |
|---|
| 1640 | UINT8 CGMS_A = 0; /*Copy Generation Management System for Analog*/ |
|---|
| 1641 | UINT8 APS = 0; /*Analog Protection System*/ |
|---|
| 1642 | UINT8 ASB = 0; /*Analog Source Bit*/ |
|---|
| 1643 | #endif |
|---|
| 1644 | |
|---|
| 1645 | /*Its size is 2 characters.*/ |
|---|
| 1646 | if ( inSize < 2 ) |
|---|
| 1647 | return; |
|---|
| 1648 | |
|---|
| 1649 | memset( &g_ntscCGMSA , 0 , sizeof(NtscCGMSA) ); |
|---|
| 1650 | |
|---|
| 1651 | g_ntscCGMSA.CGMS_A = (inBuff[0] & 0x18) >> 3; //0001 1000 : 2bits |
|---|
| 1652 | g_ntscCGMSA.APS = (inBuff[0] & 0x06) >> 1; //0001 0110 : 2bits |
|---|
| 1653 | g_ntscCGMSA.ASB = inBuff[0] & 0x01; //0000 0001 : 1bit |
|---|
| 1654 | |
|---|
| 1655 | } |
|---|
| 1656 | |
|---|
| 1657 | /*9. 0x09 Aspect Ration Information*/ |
|---|
| 1658 | |
|---|
| 1659 | /*start line += 22 , end line = 262 - end line*/ |
|---|
| 1660 | void AspectRatioInformation( UINT8 *inBuff , UINT8 inSize) |
|---|
| 1661 | { |
|---|
| 1662 | /* |
|---|
| 1663 | UINT8 startLine = 0; |
|---|
| 1664 | UINT8 endLine = 0; |
|---|
| 1665 | UINT8 squeezed = 0; |
|---|
| 1666 | */ |
|---|
| 1667 | /*Its size is 2 or 4 characters.*/ |
|---|
| 1668 | if( inSize < 2 ) |
|---|
| 1669 | return; |
|---|
| 1670 | |
|---|
| 1671 | memset( &g_ntscAspectRatioInfo , 0 , sizeof(NtscAspectRatioInfo) ); |
|---|
| 1672 | |
|---|
| 1673 | g_ntscAspectRatioInfo.startLine = inBuff[0] & 0x3f; //0011 1111b : 6bits |
|---|
| 1674 | g_ntscAspectRatioInfo.endLine = inBuff[1] & 0x3f; //0011 1111b : bbits |
|---|
| 1675 | |
|---|
| 1676 | if( inSize > 2 ) |
|---|
| 1677 | g_ntscAspectRatioInfo.squeezed = inBuff[2] & 0x01; //0000 0001b : 1bit |
|---|
| 1678 | |
|---|
| 1679 | } |
|---|
| 1680 | |
|---|
| 1681 | /*10. 0x0C Composite Packet1*/ |
|---|
| 1682 | |
|---|
| 1683 | void CompositePacket1( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1684 | { |
|---|
| 1685 | int i = 0; |
|---|
| 1686 | |
|---|
| 1687 | UINT8 programType[5] = {0}; /*5 Chars.*/ |
|---|
| 1688 | //UINT8 contentAdviosry = 0; /*1 Chars.*/ |
|---|
| 1689 | //UINT8 length = 0; /*2 Chars.*/ |
|---|
| 1690 | //UINT8 timeInShow = 0; /*2 Chars.*/ |
|---|
| 1691 | |
|---|
| 1692 | /*Its size is 4 to 32 characters.*/ |
|---|
| 1693 | if( inSize < 4 ) |
|---|
| 1694 | return; |
|---|
| 1695 | |
|---|
| 1696 | for( i = 0 ; i < 5 ; i++ ) |
|---|
| 1697 | { |
|---|
| 1698 | programType[i] = inBuff[i] & 0x1f; //0001 1111b : 5bits |
|---|
| 1699 | } |
|---|
| 1700 | } |
|---|
| 1701 | |
|---|
| 1702 | |
|---|
| 1703 | /*11. 0x0D Composite Packet2*/ |
|---|
| 1704 | |
|---|
| 1705 | void CompositePacket2( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1706 | { |
|---|
| 1707 | |
|---|
| 1708 | |
|---|
| 1709 | } |
|---|
| 1710 | |
|---|
| 1711 | |
|---|
| 1712 | /*12. 0x10 ~ 0x17 Program Description Row 1 to Row 8*/ |
|---|
| 1713 | void ProgramDescription( UINT8 *inBuff , UINT8 inSize , UINT8 rowIndex ) |
|---|
| 1714 | { |
|---|
| 1715 | if(rowIndex > 8) |
|---|
| 1716 | return; /*It is invalid row.*/ |
|---|
| 1717 | |
|---|
| 1718 | memcpy( g_ntscProgramDescription.row[rowIndex] , inBuff , inSize); |
|---|
| 1719 | |
|---|
| 1720 | #ifdef eia608B_DEBUG |
|---|
| 1721 | epgPrintf("[XDS]g_ntscProgramDescription.row[%d] : %s\n", rowIndex , g_ntscProgramDescription.row[rowIndex]); |
|---|
| 1722 | #endif |
|---|
| 1723 | } |
|---|
| 1724 | |
|---|
| 1725 | /*12.1 Future Class Packets 0x01 through 0x3F*/ |
|---|
| 1726 | |
|---|
| 1727 | |
|---|
| 1728 | /*12.2 PSIP Class Packets 0x50 through 0x6F*/ |
|---|
| 1729 | |
|---|
| 1730 | /*12.3 0x50 Minor Channel Number*/ |
|---|
| 1731 | |
|---|
| 1732 | |
|---|
| 1733 | |
|---|
| 1734 | /*Channel Information Class*/ |
|---|
| 1735 | /*1. 0x01 Network Name.*/ |
|---|
| 1736 | |
|---|
| 1737 | void NetworkName ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1738 | { |
|---|
| 1739 | int i = 0; |
|---|
| 1740 | int semErr; |
|---|
| 1741 | BOOLEAN bSame = FALSE; |
|---|
| 1742 | /* |
|---|
| 1743 | UINT8 networkName[32] = {0}; |
|---|
| 1744 | */ |
|---|
| 1745 | /*Its size is 2 to 32 characters.*/ |
|---|
| 1746 | if(inSize < 2) |
|---|
| 1747 | return; |
|---|
| 1748 | |
|---|
| 1749 | /*limit the size to 32.*/ |
|---|
| 1750 | if ( inSize > 32 ) |
|---|
| 1751 | inSize = 32; |
|---|
| 1752 | |
|---|
| 1753 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö.*/ |
|---|
| 1754 | semErr = DHL_OS_TakeSemaphore(g_ntscChannelInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1755 | if(semErr) |
|---|
| 1756 | return; /*maybe timeout*/ |
|---|
| 1757 | |
|---|
| 1758 | /*2003.12.18. added by jina*/ |
|---|
| 1759 | bSame = IsSameNetworkNameWithCurrentThing( inBuff , inSize ); |
|---|
| 1760 | if( bSame == TRUE ) |
|---|
| 1761 | goto LETSGOOUT; |
|---|
| 1762 | |
|---|
| 1763 | |
|---|
| 1764 | memset( &g_ntscChannelInfo , 0 , sizeof(NtscChannelInfo) ); |
|---|
| 1765 | |
|---|
| 1766 | g_ntscChannelInfo.networkNameLength = inSize; |
|---|
| 1767 | |
|---|
| 1768 | for( i = 0 ; i < inSize ; i++ ) |
|---|
| 1769 | { |
|---|
| 1770 | g_ntscChannelInfo.networkName[i] = inBuff[i]; |
|---|
| 1771 | } |
|---|
| 1772 | |
|---|
| 1773 | /*´Þ¶ó Á³À¸´Ï version¿Ã¸®°í..................*/ |
|---|
| 1774 | programListVersionUp(); |
|---|
| 1775 | |
|---|
| 1776 | #ifdef eia608B_DEBUG |
|---|
| 1777 | epgPrintf("[XDS]g_ntscChannelInfo.networkName : %s\n", g_ntscChannelInfo.networkName); |
|---|
| 1778 | #endif |
|---|
| 1779 | |
|---|
| 1780 | |
|---|
| 1781 | |
|---|
| 1782 | LETSGOOUT : |
|---|
| 1783 | |
|---|
| 1784 | OS_GiveSemaphore(g_ntscChannelInfoSema4); |
|---|
| 1785 | |
|---|
| 1786 | if( bSame == FALSE && gNtscAsynchProcedure ) |
|---|
| 1787 | { |
|---|
| 1788 | /*2003.12.18. added by jina */ |
|---|
| 1789 | /*»õ·Î¿î network nameÀÌ´Ù. event¸¦ ³¯·ÁÁÖÀÚ....*/ |
|---|
| 1790 | #ifdef eia608B_DEBUG |
|---|
| 1791 | epgPrintf("^^^^^^......... :Send the User evtEpgNtscVersionChange , xdsNetworkName\n"); |
|---|
| 1792 | #endif |
|---|
| 1793 | gNtscAsynchProcedure( evtEpgNtscVersionChange , g_ntscProgramInfoHeader.iInternalVersion , xdsNetworkName ); |
|---|
| 1794 | } |
|---|
| 1795 | |
|---|
| 1796 | } |
|---|
| 1797 | |
|---|
| 1798 | |
|---|
| 1799 | /*2. 0x02 Call Letters (Station ID) and Native Channel*/ |
|---|
| 1800 | void CallLetters ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1801 | { |
|---|
| 1802 | int i = 0; |
|---|
| 1803 | int semErr; |
|---|
| 1804 | |
|---|
| 1805 | /* |
|---|
| 1806 | UINT8 stationId[6] = {0}; |
|---|
| 1807 | */ |
|---|
| 1808 | /*Its size is 4 or 6 characters.*/ |
|---|
| 1809 | if( inSize < 4 ) |
|---|
| 1810 | return; |
|---|
| 1811 | |
|---|
| 1812 | if ( inSize > 6 ) |
|---|
| 1813 | inSize = 6; |
|---|
| 1814 | |
|---|
| 1815 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö.*/ |
|---|
| 1816 | semErr = DHL_OS_TakeSemaphore(g_ntscChannelInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1817 | if(semErr) |
|---|
| 1818 | return; /*maybe timeout*/ |
|---|
| 1819 | |
|---|
| 1820 | for( i = 0 ; i < inSize ; i++ ) |
|---|
| 1821 | { |
|---|
| 1822 | g_ntscChannelInfo.stationId[i] = inBuff[i]; |
|---|
| 1823 | } |
|---|
| 1824 | |
|---|
| 1825 | #ifdef eia608B_DEBUG |
|---|
| 1826 | epgPrintf("[XDS]g_ntscChannelInfo.stationId = %s\n", g_ntscChannelInfo.stationId); |
|---|
| 1827 | #endif |
|---|
| 1828 | |
|---|
| 1829 | OS_GiveSemaphore(g_ntscChannelInfoSema4); |
|---|
| 1830 | } |
|---|
| 1831 | |
|---|
| 1832 | |
|---|
| 1833 | /*3. 0x03 Tape Delay.*/ |
|---|
| 1834 | void TapeDelay( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1835 | { |
|---|
| 1836 | int semErr; |
|---|
| 1837 | /* |
|---|
| 1838 | UINT8 tapeMinute = 0; |
|---|
| 1839 | UINT8 tapeHour = 0; |
|---|
| 1840 | */ |
|---|
| 1841 | /*Its size is 2.*/ |
|---|
| 1842 | if( inSize < 2 ) |
|---|
| 1843 | return; |
|---|
| 1844 | |
|---|
| 1845 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö.*/ |
|---|
| 1846 | semErr = DHL_OS_TakeSemaphore(g_ntscChannelInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1847 | if(semErr) |
|---|
| 1848 | return; /*maybe timeout*/ |
|---|
| 1849 | |
|---|
| 1850 | g_ntscChannelInfo.tapeMinute = inBuff[0] & 0x3f; //0011 1111b : 6bits |
|---|
| 1851 | g_ntscChannelInfo.tapeHour = inBuff[0] & 0x1f; //0001 1111b : 5bits |
|---|
| 1852 | |
|---|
| 1853 | OS_GiveSemaphore(g_ntscChannelInfoSema4); |
|---|
| 1854 | |
|---|
| 1855 | } |
|---|
| 1856 | |
|---|
| 1857 | /*4. 0x04 Transmission Signal Identifier.*/ |
|---|
| 1858 | void TransmissionSignalIdentifier ( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1859 | { |
|---|
| 1860 | UINT16 tsid = 0; |
|---|
| 1861 | int semErr; |
|---|
| 1862 | |
|---|
| 1863 | int i = 0; |
|---|
| 1864 | |
|---|
| 1865 | /*Its size is 4.*/ |
|---|
| 1866 | if( inSize < 4 ) |
|---|
| 1867 | return; |
|---|
| 1868 | |
|---|
| 1869 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö.*/ |
|---|
| 1870 | semErr = DHL_OS_TakeSemaphore(g_ntscChannelInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1871 | if(semErr) |
|---|
| 1872 | return; /*maybe timeout*/ |
|---|
| 1873 | |
|---|
| 1874 | for( i = 0 ; i < 4 ; i++ ) |
|---|
| 1875 | { |
|---|
| 1876 | UINT16 newBits = (inBuff[i]&0x0f ); |
|---|
| 1877 | tsid = (newBits << (i*4))| tsid; |
|---|
| 1878 | } |
|---|
| 1879 | |
|---|
| 1880 | g_ntscChannelInfo.tsid = tsid; |
|---|
| 1881 | |
|---|
| 1882 | #ifdef eia608B_DEBUG |
|---|
| 1883 | epgPrintf("[XDS]g_ntscChannelInfo.tsid : %d\n" , tsid); |
|---|
| 1884 | #endif |
|---|
| 1885 | |
|---|
| 1886 | OS_GiveSemaphore(g_ntscChannelInfoSema4); |
|---|
| 1887 | } |
|---|
| 1888 | |
|---|
| 1889 | /*Miscellaneous*/ |
|---|
| 1890 | /*1. 0x01 Time of Day*/ |
|---|
| 1891 | |
|---|
| 1892 | void TimeOfDay( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1893 | { |
|---|
| 1894 | int semErr; |
|---|
| 1895 | /* |
|---|
| 1896 | UINT8 iMinute = 0; |
|---|
| 1897 | UINT8 iHour = 0; |
|---|
| 1898 | UINT8 iDate = 0; |
|---|
| 1899 | UINT8 iMonth = 0; |
|---|
| 1900 | UINT8 iDay = 0; |
|---|
| 1901 | UINT8 iYear = 0; |
|---|
| 1902 | |
|---|
| 1903 | UINT8 bDaylightSaving = 0; |
|---|
| 1904 | UINT8 bFeb28or29 = 0; |
|---|
| 1905 | UINT8 bSecondReset = 0; |
|---|
| 1906 | UINT8 bTapeDelay = 0; |
|---|
| 1907 | */ |
|---|
| 1908 | /*Its size is 6 characters.*/ |
|---|
| 1909 | if( inSize < 6 ) |
|---|
| 1910 | return; |
|---|
| 1911 | |
|---|
| 1912 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö...*/ |
|---|
| 1913 | semErr = DHL_OS_TakeSemaphore(g_ntscTimeInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1914 | |
|---|
| 1915 | if(semErr){ |
|---|
| 1916 | //epgPrintf(" TimeOfDay sem Error \n"); |
|---|
| 1917 | return; /*maybe timeout*/ |
|---|
| 1918 | } |
|---|
| 1919 | //epgPrintf("TimeOfDay OK \n"); |
|---|
| 1920 | /*time unit : UTC */ |
|---|
| 1921 | g_ntscTimeInfo.iMinute = inBuff[0] & 0x3f; //0011 1111b : 6bits |
|---|
| 1922 | g_ntscTimeInfo.iHour = inBuff[1] & 0x1f; //0001 1111b : 5bits |
|---|
| 1923 | g_ntscTimeInfo.iDate = inBuff[2] & 0x1f; //0001 1111b : 5bits |
|---|
| 1924 | g_ntscTimeInfo.iMonth = inBuff[3] & 0x0f; //0000 1111b : 4bits |
|---|
| 1925 | |
|---|
| 1926 | g_ntscTimeInfo.bDaylightSaving = (inBuff[1] & 0x20) >> 5; //0010 0000b : 1bit, D |
|---|
| 1927 | g_ntscTimeInfo.bFeb28or29 = (inBuff[2] & 0x20) >> 5; //0010 0000b : 1bit, L |
|---|
| 1928 | g_ntscTimeInfo.bSecondReset = (inBuff[3] & 0x20) >> 5; //0010 0000b : 1bit, Z |
|---|
| 1929 | g_ntscTimeInfo.bTapeDelay = (inBuff[3] & 0x10) >> 5; //0001 0000b : 1bit, T |
|---|
| 1930 | |
|---|
| 1931 | g_ntscTimeInfo.iDay = inBuff[4] & 0x07; //0000 0111b : 3bits |
|---|
| 1932 | g_ntscTimeInfo.iYear = inBuff[5] & 0x3f; //0011 1111b : 6bits: harry bug fix. 1.02 2004.1.15 |
|---|
| 1933 | |
|---|
| 1934 | OS_GiveSemaphore(g_ntscTimeInfoSema4); |
|---|
| 1935 | |
|---|
| 1936 | #ifdef eia608B_DEBUG |
|---|
| 1937 | epgPrintf("[XDS]g_ntscTimeInfo.iMinute = %d\n", g_ntscTimeInfo.iMinute); |
|---|
| 1938 | epgPrintf("[XDS]g_ntscTimeInfo.iHour = %d\n", g_ntscTimeInfo.iHour); |
|---|
| 1939 | epgPrintf("[XDS]g_ntscTimeInfo.iDate = %d\n", g_ntscTimeInfo.iDate); |
|---|
| 1940 | epgPrintf("[XDS]g_ntscTimeInfo.iMonth = %d\n", g_ntscTimeInfo.iMonth); |
|---|
| 1941 | epgPrintf("[XDS]g_ntscTimeInfo.bDaylightSaving = %d\n", g_ntscTimeInfo.bDaylightSaving ); |
|---|
| 1942 | epgPrintf("[XDS]g_ntscTimeInfo.bFeb28or29 = %d\n", g_ntscTimeInfo.bFeb28or29); |
|---|
| 1943 | epgPrintf("[XDS]g_ntscTimeInfo.bSecondReset = %d\n", g_ntscTimeInfo.bSecondReset); |
|---|
| 1944 | epgPrintf("[XDS]g_ntscTimeInfo.bTapeDelay = %d\n", g_ntscTimeInfo.bTapeDelay); |
|---|
| 1945 | epgPrintf("[XDS]g_ntscTimeInfo.iDay = %d\n", g_ntscTimeInfo.iDay); |
|---|
| 1946 | epgPrintf("[XDS]g_ntscTimeInfo.iYear = %d\n", g_ntscTimeInfo.iYear ); |
|---|
| 1947 | #endif |
|---|
| 1948 | |
|---|
| 1949 | } |
|---|
| 1950 | |
|---|
| 1951 | |
|---|
| 1952 | /*2. 0x02 Impulse Capture ID.*/ |
|---|
| 1953 | |
|---|
| 1954 | void ImpulseCaptureID( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1955 | { |
|---|
| 1956 | |
|---|
| 1957 | } |
|---|
| 1958 | |
|---|
| 1959 | |
|---|
| 1960 | /*3. 0x03 Supplement Data Location*/ |
|---|
| 1961 | |
|---|
| 1962 | void SupplementDataLocation (UINT8 *inBuff , UINT8 inSize) |
|---|
| 1963 | { |
|---|
| 1964 | |
|---|
| 1965 | } |
|---|
| 1966 | |
|---|
| 1967 | |
|---|
| 1968 | /*4. 0x04 Local Time Zone & DST USE */ |
|---|
| 1969 | |
|---|
| 1970 | void LocalTimeZone_DSTUse (UINT8 *inBuff , UINT8 inSize ) |
|---|
| 1971 | { |
|---|
| 1972 | int semErr; |
|---|
| 1973 | /* |
|---|
| 1974 | UINT8 timeZoneOffset = 0; |
|---|
| 1975 | UINT8 daylightSaving = 0; |
|---|
| 1976 | */ |
|---|
| 1977 | /*Its size is 2 characters.*/ |
|---|
| 1978 | if(inSize < 2) |
|---|
| 1979 | return; |
|---|
| 1980 | |
|---|
| 1981 | /*updateÇÏ´Â µ¿¾È Á¢±Ù ±ÝÁö.*/ |
|---|
| 1982 | |
|---|
| 1983 | semErr = DHL_OS_TakeSemaphore(g_ntscTimeInfoSema4, g_Tiemout_NtscUpdate*OS_GetTicksPerSecond()/1000 ); |
|---|
| 1984 | |
|---|
| 1985 | if(semErr) |
|---|
| 1986 | { |
|---|
| 1987 | #ifdef eia608B_DEBUG |
|---|
| 1988 | epgPrintf("in the LocalTimeZone_DSTUse() : g_ntscRatingUpdateSema4 is timeout\n"); |
|---|
| 1989 | #endif |
|---|
| 1990 | return; /*maybe timeout...*/ |
|---|
| 1991 | } |
|---|
| 1992 | |
|---|
| 1993 | g_ntscTimeInfo.timeZoneOffset = inBuff[0] & 0x1f; //0001 1111b : 5bits |
|---|
| 1994 | g_ntscTimeInfo.daylightSaving = (inBuff[0] & 0x20) >> 5; //0010 0000b : 1bit |
|---|
| 1995 | |
|---|
| 1996 | OS_GiveSemaphore(g_ntscTimeInfoSema4); |
|---|
| 1997 | |
|---|
| 1998 | #ifdef eia608B_DEBUG |
|---|
| 1999 | epgPrintf("[XDS]g_ntscTimeInfo.timeZoneOffset = %d\n", g_ntscTimeInfo.timeZoneOffset); |
|---|
| 2000 | epgPrintf("[XDS]g_ntscTimeInfo.daylightSaving = %d\n", g_ntscTimeInfo.daylightSaving); |
|---|
| 2001 | #endif |
|---|
| 2002 | |
|---|
| 2003 | |
|---|
| 2004 | } |
|---|
| 2005 | |
|---|
| 2006 | |
|---|
| 2007 | /*Out-of-Band*/ |
|---|
| 2008 | /*5. 0x40 Out-of-Band Channel Information */ |
|---|
| 2009 | |
|---|
| 2010 | void OutOfBandChannelNumber( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 2011 | { |
|---|
| 2012 | UINT16 channelNumber = 0; |
|---|
| 2013 | |
|---|
| 2014 | /*Its size is 2 characters.*/ |
|---|
| 2015 | if( inSize < 2 ) |
|---|
| 2016 | return; |
|---|
| 2017 | |
|---|
| 2018 | channelNumber = (UINT16)(inBuff[1]&0x3f); |
|---|
| 2019 | channelNumber = ( channelNumber<<6 ) | (UINT16)(inBuff[0]&0x3f); |
|---|
| 2020 | } |
|---|
| 2021 | |
|---|
| 2022 | /*5. 0x41 Channel Map Pointer.*/ |
|---|
| 2023 | |
|---|
| 2024 | void ChannelMapPointer( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 2025 | { |
|---|
| 2026 | UINT16 channelNumber = 0; |
|---|
| 2027 | |
|---|
| 2028 | /*Its size is 2 characters.*/ |
|---|
| 2029 | if( inSize < 2 ) |
|---|
| 2030 | return; |
|---|
| 2031 | |
|---|
| 2032 | channelNumber =(UINT16)(inBuff[1] & 0x0f); |
|---|
| 2033 | channelNumber = (channelNumber << 6) | (UINT16)(inBuff[0] & 0x3f ); |
|---|
| 2034 | |
|---|
| 2035 | } |
|---|
| 2036 | |
|---|
| 2037 | /*5. 0x42 Channel Map Header Packet.*/ |
|---|
| 2038 | |
|---|
| 2039 | void ChannelMapHeaderPacket( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 2040 | { |
|---|
| 2041 | UINT16 channelNumber = 0; |
|---|
| 2042 | UINT8 versionNumber = 0; |
|---|
| 2043 | |
|---|
| 2044 | /*Its size is 4 characters.*/ |
|---|
| 2045 | if( inSize < 4) |
|---|
| 2046 | return; |
|---|
| 2047 | |
|---|
| 2048 | channelNumber = (UINT16) (inBuff[1] & 0x0f); |
|---|
| 2049 | channelNumber = (channelNumber << 6) | (UINT16)( inBuff[0] & 0x3f ); |
|---|
| 2050 | |
|---|
| 2051 | versionNumber = inBuff[2] & 0x3f; |
|---|
| 2052 | |
|---|
| 2053 | } |
|---|
| 2054 | |
|---|
| 2055 | /*5. 0x43 Channel Map Packet.*/ |
|---|
| 2056 | |
|---|
| 2057 | void ChannelMapPacket( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 2058 | { |
|---|
| 2059 | UINT16 userChannelNumber = 0; |
|---|
| 2060 | UINT8 bRemapped = 0; |
|---|
| 2061 | UINT16 tuneChannelNumber = 0; |
|---|
| 2062 | UINT8 channelId[6]={0}; |
|---|
| 2063 | |
|---|
| 2064 | /*Its size is 2 or 4 characters.*/ |
|---|
| 2065 | if( inSize < 2 ) |
|---|
| 2066 | return; |
|---|
| 2067 | |
|---|
| 2068 | userChannelNumber = (UINT16)(inBuff[1]&0x0f); |
|---|
| 2069 | userChannelNumber = (userChannelNumber << 6) | (UINT16)(inBuff[0] & 0x3f); |
|---|
| 2070 | bRemapped = (inBuff[1]&0x30); |
|---|
| 2071 | |
|---|
| 2072 | if( inSize > 2 && bRemapped == 1 ) |
|---|
| 2073 | { |
|---|
| 2074 | tuneChannelNumber = (UINT16) (inBuff[3]&0x0f); |
|---|
| 2075 | tuneChannelNumber = (tuneChannelNumber << 6) | (UINT16) (inBuff[2]&0x3f); |
|---|
| 2076 | } |
|---|
| 2077 | |
|---|
| 2078 | if( inSize > 4 ) |
|---|
| 2079 | { |
|---|
| 2080 | int i = 0; |
|---|
| 2081 | for( i = 0 ; i < inSize-4 ; i++) |
|---|
| 2082 | { |
|---|
| 2083 | channelId[i] = inBuff[4+i] & 0x7f; |
|---|
| 2084 | } |
|---|
| 2085 | } |
|---|
| 2086 | } |
|---|
| 2087 | |
|---|
| 2088 | /*Public Service Class.*/ |
|---|
| 2089 | /*National Weather Service Code(WRSAME).*/ |
|---|
| 2090 | void NationalWeatherServiceCode( UINT8 *inBuff , UINT8 inSize ) |
|---|
| 2091 | { |
|---|
| 2092 | |
|---|
| 2093 | } |
|---|
| 2094 | |
|---|
| 2095 | |
|---|
| 2096 | |
|---|
| 2097 | /************************************************************* |
|---|
| 2098 | *Change Logs: |
|---|
| 2099 | * $Log: DMW_EIA608B.c,v $ |
|---|
| 2100 | * Revision 1.7 2005/09/06 00:47:51 jina |
|---|
| 2101 | * OMEGAÀÎ °æ¿ì, XDS enable. |
|---|
| 2102 | * |
|---|
| 2103 | * Revision 1.6 2005/08/22 11:12:33 megakiss |
|---|
| 2104 | * NTSC : Rating Bug Fix. |
|---|
| 2105 | * |
|---|
| 2106 | * Revision 1.5 2005/08/22 00:18:15 jina |
|---|
| 2107 | * NTSC rating : rating Á¤º¸¸¦ ¼ö½ÅÇÑÁö 5ÃÊ ÀÌ»óÀÌ µÇ´Â °æ¿ì, ¹«È¿ÇÑ Á¤º¸·Î Ãë±Þ ÇÑ´Ù. |
|---|
| 2108 | * |
|---|
| 2109 | * Revision 1.4 2005/01/11 12:10:29 leon |
|---|
| 2110 | * -support XDS |
|---|
| 2111 | * |
|---|
| 2112 | * Revision 1.3 2005/01/10 12:26:24 leon |
|---|
| 2113 | * - PMT's video stream descriptor's still picture-> av lip sync set/unset |
|---|
| 2114 | * |
|---|
| 2115 | * Revision 1.2 2004/10/11 01:59:19 leon |
|---|
| 2116 | * -remove warning |
|---|
| 2117 | * |
|---|
| 2118 | * Revision 1.1 2004/09/15 02:02:21 leon |
|---|
| 2119 | * add NTSC EPG for FG/Epson |
|---|
| 2120 | * |
|---|
| 2121 | *************************************************************/ |
|---|
| 2122 | |
|---|
| 2123 | |
|---|