| 1 | /******************************************************************** |
|---|
| 2 | |
|---|
| 3 | DMW_EpgDebug.c |
|---|
| 4 | |
|---|
| 5 | EPG Middleware debug functions |
|---|
| 6 | |
|---|
| 7 | Copyright 2004 Digital STREAM Technology, Inc. |
|---|
| 8 | All Rights Reserved |
|---|
| 9 | |
|---|
| 10 | $Id: DMW_EpgDebug.c v1.00 2004/10 cafrii Exp $ |
|---|
| 11 | |
|---|
| 12 | ********************************************************************/ |
|---|
| 13 | |
|---|
| 14 | /*_____ I N C L U D E __________________________________________*/ |
|---|
| 15 | |
|---|
| 16 | #include "DMW_Platform.h" |
|---|
| 17 | |
|---|
| 18 | #include "DLIB_PSI.h" |
|---|
| 19 | #include "DLIB_PSIP.h" |
|---|
| 20 | #include "DLIB_PSIP_Monitor.h" |
|---|
| 21 | #include "DLIB_PSIP_Parser.h" |
|---|
| 22 | #include "DLIB_PSI_Monitor.h" |
|---|
| 23 | #include "DLIB_PSI_Parser.h" |
|---|
| 24 | #include "DHL_SYS.h" |
|---|
| 25 | |
|---|
| 26 | #include "DMW_EpgBasePriv.h" // one part channel indicator definition |
|---|
| 27 | #include "DMW_CodeConv.h" // CodeConv °ü·Ã API |
|---|
| 28 | |
|---|
| 29 | #include "DMW_Dummy.h" |
|---|
| 30 | //#include <string.h> |
|---|
| 31 | //#include <string.h> |
|---|
| 32 | #if COMMENT |
|---|
| 33 | ____DEBUG______(){} |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | /*------------------------------------------------------- |
|---|
| 37 | Configurations.. |
|---|
| 38 | -------------------------------------------------------*/ |
|---|
| 39 | |
|---|
| 40 | #define DMW_UNIPRINT_ENABLED 1 |
|---|
| 41 | /* DMW_UniPrint ¸ðµâÀÌ ÁغñµÇ¾î ÀÖÀ¸¸é 1 |
|---|
| 42 | DMW_UniPrint ÇÔ¼ö´Â DMW_CodeConv.c ¿¡ ¸¸µé¾îÁ® Àֱ⠶§¹®¿¡ |
|---|
| 43 | ÀÌ ÆÄÀÏÀÌ ÇÁ·ÎÁ§Æ®¿¡ Æ÷ÇԵǾî ÀÖÀ¸¸é 1·Î ¼³Á¤Çϰí, |
|---|
| 44 | ¾Æ´Ï¶ó¸é 0À¸·Î ÇÏ¿© ÀÏ¹Ý DHL_OS_Printf·Î ´ë½ÅÇϵµ·Ï ÇÑ´Ù. |
|---|
| 45 | µð¹ö±ëÀ» À§Çؼ¶ó¸é DMW_CodeConv.c °¡ ÀÖÀ¸¸é Æí¸®ÇÏ´Ù. |
|---|
| 46 | */ |
|---|
| 47 | |
|---|
| 48 | #define SYS_TIME_MODULE_ENABLED 1 |
|---|
| 49 | /* DMW_SysTime.c ¸ðµâÀÌ ÇÁ·ÎÁ§Æ®¿¡ Æ÷ÇԵǾî ÀÖ°í, |
|---|
| 50 | DMW_SysTime.h ÆÄÀÏÀÌ ÁغñµÇ¾î ÀÖÀ¸¸é 1.. |
|---|
| 51 | */ |
|---|
| 52 | |
|---|
| 53 | #if SYS_TIME_MODULE_ENABLED |
|---|
| 54 | #include "DMW_SysTime.h" |
|---|
| 55 | /* STTÀÇ GPS timeÀ̳ª EITÀÇ ½Ã°£ Á¤º¸¸¦ ´Ù·ç±â À§Çؼ ÇÊ¿äÇÏ´Ù.. */ |
|---|
| 56 | #endif |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | #define SimplePrint DHL_OS_Printf |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | #if SYS_TIME_MODULE_ENABLED |
|---|
| 63 | /* cafrii 061106 add */ |
|---|
| 64 | |
|---|
| 65 | /* epg debug¿¡ »ç¿ëµÇ´Â time contextÀÌ´Ù. */ |
|---|
| 66 | SysTimeContext g_EpgDebugTimeContext = |
|---|
| 67 | { |
|---|
| 68 | 0, /* BOOL bTimebaseAdjusted */ |
|---|
| 69 | 630687600, /* 2000³â 1¿ù1ÀÏ Çѱ¹¿¡¼ÀÇ UTC.. this will be updated by DMW_SetUTCTime */ |
|---|
| 70 | |
|---|
| 71 | 9, /* int nTimeZone; */ /* this will be updated to g_EpgDebugTimeZone */ |
|---|
| 72 | 0, /* BOOL bDaylightSavingOn; */ /* 1:day light saving , 0: no day light saving */ |
|---|
| 73 | |
|---|
| 74 | 13, /* int GPS_UTC_offset; */ |
|---|
| 75 | }; |
|---|
| 76 | |
|---|
| 77 | int g_EpgDebugTimeZone; |
|---|
| 78 | |
|---|
| 79 | void Dmc_SetDebugTimeZone(int time_zone) |
|---|
| 80 | { |
|---|
| 81 | if (time_zone < -12 || time_zone > 13) |
|---|
| 82 | time_zone = 0; |
|---|
| 83 | |
|---|
| 84 | g_EpgDebugTimeZone = time_zone; |
|---|
| 85 | |
|---|
| 86 | DMW_SetLocalTimeZone(&g_EpgDebugTimeContext, time_zone); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | #endif |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | /* |
|---|
| 94 | PSIP Å×À̺íÀÇ °¢Á¾ Ãâ·Â ÇÔ¼öµéÀº µð¹ö±× ¿ëÀ̸ç, ½Ç½Ã°£ Ãâ·Â¿ëÀ¸·Î ÃÖÀûÈ µÇÁö´Â ¾Ê¾ÒÀ½. |
|---|
| 95 | µð¹ö±× âÀÇ È¿À²ÀûÀΠȰ¿ëÀ» À§ÇÏ¿© debug lineÀÇ prefix´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù. |
|---|
| 96 | |
|---|
| 97 | »ç¿ë°¡´ÉÇÑ µÎ °è¿ÀÇ ÇÔ¼öÁß, printf ¿Í DHL_OS_Printf Áß¿¡¼ ÈÄÀÚ¸¦ »ç¿ëÇÑ´Ù. |
|---|
| 98 | ÈÄÀÚ ÇÔ¼ö´Â Çʿ信 µû¶ó¼ buffered print ´ë½Å Á÷Á¢ Ãâ·ÂÀ» ¼öÇàÇÒ ¼ö Àֱ⠶§¹®.. |
|---|
| 99 | |
|---|
| 100 | OS_UsePrintfSemaphore ÇÔ¼ö ÂüÁ¶.. |
|---|
| 101 | */ |
|---|
| 102 | |
|---|
| 103 | int Dmc_PsipUniPrint(UINT8 *p, int numChar) |
|---|
| 104 | { |
|---|
| 105 | |
|---|
| 106 | #if DMW_UNIPRINT_ENABLED |
|---|
| 107 | extern int DMW_UniPrint(UINT16 *ucs, int len); |
|---|
| 108 | #define SWAP16(c) ((((c) & 0xff) << 8U) | (((c) >> 8) & 0xff)) |
|---|
| 109 | #endif |
|---|
| 110 | |
|---|
| 111 | UINT16 dummy = 0x1234; |
|---|
| 112 | BOOL bLE = *(UINT8 *)&dummy == 0x12 ? FALSE : TRUE; |
|---|
| 113 | int i; |
|---|
| 114 | UINT16 *ucs = (UINT16 *)p; |
|---|
| 115 | |
|---|
| 116 | if (numChar < 0) { /* auto-detect length. */ |
|---|
| 117 | for (i=0; i<256; i++) { /* max 256.. */ |
|---|
| 118 | if (ucs[i] == 0) break; |
|---|
| 119 | } |
|---|
| 120 | numChar = i; |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | #if DMW_UNIPRINT_ENABLED |
|---|
| 124 | if (bLE) { |
|---|
| 125 | /* swap each codes.. */ |
|---|
| 126 | for (i=0; i<numChar; i++) |
|---|
| 127 | ucs[i] = SWAP16(ucs[i]); |
|---|
| 128 | } |
|---|
| 129 | return DMW_UniPrint(ucs, numChar); |
|---|
| 130 | |
|---|
| 131 | #else |
|---|
| 132 | for (i=0; i<numChar; i++) { |
|---|
| 133 | if (bLE) { |
|---|
| 134 | if ((ucs[i] & 0xff) == 0) |
|---|
| 135 | SimplePrint("%c", (ucs[i] >> 8) & 0xff); |
|---|
| 136 | else |
|---|
| 137 | SimplePrint("."); |
|---|
| 138 | } |
|---|
| 139 | else { |
|---|
| 140 | if ((ucs[i] >> 8) == 0) |
|---|
| 141 | SimplePrint("%c", ucs[i] & 0xff); |
|---|
| 142 | else |
|---|
| 143 | SimplePrint("."); |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | #endif |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | char *Dmc_ChannelNumberString(int major, int minor, char *buf) |
|---|
| 153 | { |
|---|
| 154 | static char buf0[22]; /* ÃÖ´ë Å©±â.. */ |
|---|
| 155 | |
|---|
| 156 | if (buf == NULL) buf = buf0; |
|---|
| 157 | |
|---|
| 158 | if (minor == EPG_ONE_PART_CHANNEL_INDICATOR) |
|---|
| 159 | sprintf(buf, "%d", major); |
|---|
| 160 | else |
|---|
| 161 | sprintf(buf, "%d-%d", major, minor); |
|---|
| 162 | |
|---|
| 163 | return buf; |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | /*----------------------- |
|---|
| 167 | Dmc_ConvertKs2Mss |
|---|
| 168 | |
|---|
| 169 | KS ¿Ï¼ºÇü ¹®ÀÚ¿À» MSS (MultipleStringStructure)·Î º¯È¯ÇÑ´Ù. |
|---|
| 170 | MSS¸¦ À§ÇÑ ¹öÆÛ´Â ÀÚµ¿À¸·Î ÇÒ´çµÈ´Ù. (DHL_OS_Malloc) »ç¿ë ÈÄ caller°¡ OS_Free ÇØ¾ß ÇÔ. |
|---|
| 171 | º¯È¯µÈ MSS´Â ÇÔ¼ö ÀÎÀÚ Æ÷ÀÎÅÍ¿Í ¸®Åϰª µÎ°¡Áö ¹æ½ÄÀ¸·Î ¸®ÅϵȴÙ. |
|---|
| 172 | MSS Àüü ±æÀÌ´Â ÇÔ¼ö ÀÎÀÚ·Î ¸®ÅϵȴÙ. |
|---|
| 173 | ¿¡·¯°¡ ¹ß»ýÇÒ °æ¿ì NULL ÀÌ ¸®ÅϵȴÙ. |
|---|
| 174 | */ |
|---|
| 175 | UINT8 *Dmc_ConvertKs2Mss(char *str, UINT8 **pMssPtr, int *pMssLen) |
|---|
| 176 | { |
|---|
| 177 | UINT8 *mss = NULL, *p; |
|---|
| 178 | UINT16 *ucs; /* unicode string.. */ |
|---|
| 179 | int len; |
|---|
| 180 | |
|---|
| 181 | /* string 1°³, segment 1°³ ÀÇ MSS¸¦ ¸¸µç´Ù. */ |
|---|
| 182 | ucs = DMW_ConvKs2Uc(str, -1); /* KS ¹®ÀÚ¿Àº null-terminated stringÀÌ´Ù. */ |
|---|
| 183 | |
|---|
| 184 | if (ucs == NULL) { |
|---|
| 185 | DHL_OS_Printf("!! ConvKs2Mss: Ks2Uc conv err\n"); |
|---|
| 186 | if (pMssPtr) *pMssPtr = NULL; |
|---|
| 187 | if (pMssLen) *pMssLen = 0; |
|---|
| 188 | return NULL; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | /* UCS ±æÀ̸¦ °è»êÇÒ ¶§ strlenÀ» »ç¿ëÇÏ¸é ¾ÈµÈ´Ù. |
|---|
| 192 | unicode versionÀ» »ç¿ëÇØ¾ß ÇÑ´Ù.. */ |
|---|
| 193 | len = 0; |
|---|
| 194 | while (ucs[len]) |
|---|
| 195 | len++; |
|---|
| 196 | |
|---|
| 197 | len *= 2; |
|---|
| 198 | /* DHL_OS_Printf(" converted ucs : %d bytes\n", len); */ |
|---|
| 199 | |
|---|
| 200 | mss = DHL_OS_Malloc(8 + len); /* 8 is MSS overhead in the simplest form */ |
|---|
| 201 | if (mss == NULL) { |
|---|
| 202 | DHL_OS_Printf("!! ConvKs2Mss: out of memory\n"); |
|---|
| 203 | if (pMssPtr) *pMssPtr = NULL; |
|---|
| 204 | if (pMssLen) *pMssLen = 0; |
|---|
| 205 | |
|---|
| 206 | DMW_FreeUcString(ucs); |
|---|
| 207 | |
|---|
| 208 | return NULL; |
|---|
| 209 | } |
|---|
| 210 | p = mss; |
|---|
| 211 | |
|---|
| 212 | *p++ = 1; /* number_strings */ |
|---|
| 213 | |
|---|
| 214 | *p++ = 'k'; /* ISO-639 language code´Â Çѱ¹¾î.. */ |
|---|
| 215 | *p++ = 'o'; |
|---|
| 216 | *p++ = 'r'; |
|---|
| 217 | |
|---|
| 218 | *p++ = 1; /* number_segments*/ |
|---|
| 219 | |
|---|
| 220 | *p++ = 0; /* compression_type: no compression */ |
|---|
| 221 | *p++ = 0x3F; /* mode: 16-bit unicode */ |
|---|
| 222 | *p++ = len; /* number_bytes */ |
|---|
| 223 | |
|---|
| 224 | memcpy(p, ucs, len); |
|---|
| 225 | |
|---|
| 226 | DMW_FreeUcString(ucs); |
|---|
| 227 | |
|---|
| 228 | if (pMssPtr) *pMssPtr = mss; |
|---|
| 229 | if (pMssLen) *pMssLen = 8 + len; |
|---|
| 230 | |
|---|
| 231 | return mss; |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | /*----------------------- |
|---|
| 236 | Dmc_ConvertMss2Ks |
|---|
| 237 | |
|---|
| 238 | MSS (MultipleStringStructure)¸¦ KS ¿Ï¼ºÇüÀ¸·Î º¯È¯ÇÑ´Ù. |
|---|
| 239 | caller°¡ ÁöÁ¤ÇÑ ¹öÆÛ¸¦ »ç¿ëÇϸç, ¹öÆÛ Å©±â¸¦ ³Ñ¾î¼³ °æ¿ì truncate µÊ. |
|---|
| 240 | MSS ¾È¿¡´Â ¿©·¯°³ÀÇ string ÀÌ Á¸ÀçÇÒ ¼ö Àִµ¥, instance´Â ÃßÃâÇϰíÀÚ ÇÏ´Â |
|---|
| 241 | stringÀÇ instance ¹øÈ£ÀÌ´Ù. (0ºÎÅÍ ½ÃÀÛÇÏ´Â À妽º °ª) |
|---|
| 242 | MSS¿¡ ¿øÇÏ´Â string instance°¡ ¾øÀ¸¸é statusNotFound °¡ ¸®ÅϵȴÙ. |
|---|
| 243 | */ |
|---|
| 244 | #define MAX_SEGMENT_STR_SIZE 256 |
|---|
| 245 | |
|---|
| 246 | /* cafrii 041126 add */ |
|---|
| 247 | STATUS Dmc_ConvertMss2Ks(UINT8 *mssPtr, UINT16 mssLen, char *buf, int max_buflen, char *lang, int instance) |
|---|
| 248 | { |
|---|
| 249 | /* if 'lang' is non-NULL, lang should be ISO-639 language code. ex: "eng", "kor" |
|---|
| 250 | if lang is NULL, instance should be 0 ~ mStringPtr->number_strings-1 |
|---|
| 251 | string is filled upto max_buflen-1 and null-terminator is attached at tail of string. |
|---|
| 252 | */ |
|---|
| 253 | multipleStringPtr_t mStringPtr = NULL; |
|---|
| 254 | msStringPtr_t p; |
|---|
| 255 | |
|---|
| 256 | INT32 j, pos; |
|---|
| 257 | char string[MAX_SEGMENT_STR_SIZE]; |
|---|
| 258 | DHL_RESULT err = DHL_OK; |
|---|
| 259 | STATUS status = statusOK; /* cafrii 060609 init bugfix */ |
|---|
| 260 | UINT8 *ks; |
|---|
| 261 | |
|---|
| 262 | if (buf == NULL || max_buflen < 1) |
|---|
| 263 | return statusInvalidArgument; |
|---|
| 264 | |
|---|
| 265 | if (mssPtr == NULL) |
|---|
| 266 | return statusInvalidArgument; |
|---|
| 267 | |
|---|
| 268 | buf[0] = 0; |
|---|
| 269 | |
|---|
| 270 | /* cafrii 060719 bugfix!! DS083 */ |
|---|
| 271 | if (mssLen <= 0) { /* ±×³É empty stringÀ¸·Î ¸®ÅÏ. */ |
|---|
| 272 | status = statusOK; |
|---|
| 273 | goto label_exit; |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | /* mssLenÀÌ 0ÀÎ °æ¿ì mStringPtrÀÌ NULL ÀÌ¸é¼ DHL_OK¸®ÅϵÊ. */ |
|---|
| 277 | err = ParseMultipleString(mssPtr, mssLen, &mStringPtr); |
|---|
| 278 | if (IsError(err) || mStringPtr == NULL) { /* cafrii 050315 change */ |
|---|
| 279 | mStringPtr = NULL; /* cafrii 050315 add */ |
|---|
| 280 | status = (err==DHL_FAIL_BAD_FORMAT ? statusPSIPError : statusOutOfMemory); |
|---|
| 281 | goto label_exit; |
|---|
| 282 | } |
|---|
| 283 | |
|---|
| 284 | if (lang && (lang[0] == 0 || lang[0] == ' ')) |
|---|
| 285 | lang = NULL; |
|---|
| 286 | |
|---|
| 287 | if (lang) { |
|---|
| 288 | UINT32 code; |
|---|
| 289 | for (j=0; j<mStringPtr->number_strings; j++) { |
|---|
| 290 | code = mStringPtr->msString[j].ISO639_language_code; |
|---|
| 291 | if (((code>>16)&0xff) == (unsigned char)lang[0] && |
|---|
| 292 | ((code>>8)&0xff) == (unsigned char)lang[1] && |
|---|
| 293 | ((code)&0xff) == (unsigned char)lang[2]) { |
|---|
| 294 | instance = j; |
|---|
| 295 | break; |
|---|
| 296 | } |
|---|
| 297 | } |
|---|
| 298 | } |
|---|
| 299 | if (instance < 0 || instance >= mStringPtr->number_strings) { |
|---|
| 300 | status = statusNotFound; |
|---|
| 301 | goto label_exit; |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | p = & mStringPtr->msString[instance]; |
|---|
| 305 | pos = 0; |
|---|
| 306 | |
|---|
| 307 | /* langcode = p->ISO639_language_code; */ |
|---|
| 308 | /* SimplePrint("(%c%c%c) ", (char)(langcode >> 16), (char)(langcode >> 8), (char)(langcode)); */ |
|---|
| 309 | |
|---|
| 310 | for (j=0; j<p->number_segments; j++) { |
|---|
| 311 | |
|---|
| 312 | switch (p->segment[j].compression_type) { |
|---|
| 313 | |
|---|
| 314 | case cm_None: |
|---|
| 315 | /* ÁÖÀÇ!! compresse_string_byte°¡ address alignÀÌ µÇ¾î ÀÖÁö ¾Ê´Ù¸é ¿¡·¯°¡ ³¯Áöµµ ¸ð¸£°ÚÀ½.. */ |
|---|
| 316 | |
|---|
| 317 | if (p->segment[j].mode == tm_ISO10646_1_Page_0x00) { /* 0x00 */ |
|---|
| 318 | /* ASCII, ISO Latin-1 (Roman) */ |
|---|
| 319 | |
|---|
| 320 | if (pos + p->segment[j].number_bytes < max_buflen) { |
|---|
| 321 | memcpy(buf+pos, p->segment[j].compress_string_byte, p->segment[j].number_bytes); |
|---|
| 322 | pos += p->segment[j].number_bytes; |
|---|
| 323 | } |
|---|
| 324 | else { |
|---|
| 325 | /* cafrii 060314, º¹»çÇÒ ¼ö ÀÖ´Â ¸¸Å¸¸ º¹»çÇÑ´Ù. */ |
|---|
| 326 | int len = max_buflen - 1 - pos; |
|---|
| 327 | memcpy(buf+pos, p->segment[j].compress_string_byte, len); |
|---|
| 328 | pos += len; |
|---|
| 329 | buf[pos] = 0; |
|---|
| 330 | status = statusOK; /* is it better to notify warning? */ |
|---|
| 331 | goto label_exit; |
|---|
| 332 | } |
|---|
| 333 | } |
|---|
| 334 | else if (p->segment[j].mode == tm_ISO10646_1_16_bit) { /* 0x3F */ |
|---|
| 335 | /* ISO/IEC 10646-1 mode (all) - KOREAN mode only */ |
|---|
| 336 | #if 0 |
|---|
| 337 | ks = DMW_ConvUc2Ks((UINT16 *)p->segment[j].compress_string_byte, p->segment[j].number_bytes/2); |
|---|
| 338 | /* length °è»êÀº ±×³É 2·Î ³ª´®. Ȧ¼ö ÀÎ °æ¿ì ¸¶Áö¸·Àº À߸®³ª, Á¦´ë·Î µÈ code¶ó¸é */ |
|---|
| 339 | /* Ç×»ó 2ÀÇ ¹è¼öÀÏ °ÍÀ̹ǷΠ¹®Á¦ ¾ø´Ù. */ |
|---|
| 340 | #else |
|---|
| 341 | // cafrii 090909 bugfix |
|---|
| 342 | // host endian ÀÌ big endian ÀÌ ¾Æ´Ò ¼öµµ ÀÖÀ¸¹Ç·Î ±×³É UINT8* -> UINT16* castingÀº ÇÏ¸é ¾ÈµÊ. |
|---|
| 343 | int t; |
|---|
| 344 | UINT16 uc16buf[128 + 10]; // 128 À» ³ÑÁö ¾ÊÀ½. +10 Àº safe margin |
|---|
| 345 | int segn = p->segment[j].number_bytes/2; // segment length should be even number |
|---|
| 346 | UINT8 *segs = p->segment[j].compress_string_byte; |
|---|
| 347 | |
|---|
| 348 | for (t=0; t<segn; t++) |
|---|
| 349 | uc16buf[t] = ((segs[t*2]<<8) | segs[t*2+1]); |
|---|
| 350 | ks = DMW_ConvUc2Ks(uc16buf, segn); |
|---|
| 351 | #endif |
|---|
| 352 | if (pos + strlen((char *)ks) < (unsigned int)max_buflen) { |
|---|
| 353 | memcpy(buf+pos, ks, strlen((char *)ks)); |
|---|
| 354 | pos += strlen((char *)ks); |
|---|
| 355 | DMW_FreeKsString(ks); |
|---|
| 356 | } |
|---|
| 357 | else { |
|---|
| 358 | /* cafrii 060314, º¹»çÇÒ ¼ö ÀÖ´Â ¸¸Å¸¸ º¹»çÇÑ´Ù. */ |
|---|
| 359 | int len = max_buflen - 1 - pos; |
|---|
| 360 | memcpy(buf+pos, ks, len); |
|---|
| 361 | DMW_FreeKsString(ks); |
|---|
| 362 | pos += len; /* ¸¶Áö¸· ±ÛÀÚ°¡ ÇѱÛÀÏ °æ¿ì 1byte À߸®¸é ÀÌ»óÇÏ°Ô Ç¥ÇöµÉ ¼ö ÀÖÀ½. */ |
|---|
| 363 | buf[pos] = 0; |
|---|
| 364 | status = statusOK; /* is it better to notify warning? */ |
|---|
| 365 | goto label_exit; |
|---|
| 366 | } |
|---|
| 367 | } |
|---|
| 368 | else if (p->segment[j].mode == 0x48) { /* ¿Ï¼ºÇü ÇѱÛ.. */ |
|---|
| 369 | /* ±×³É Ãâ·ÂÇϸé Shell font°¡ Çѱ۷Πº¸¿©ÁÙ °ÍÀÓ.. */ |
|---|
| 370 | |
|---|
| 371 | if (pos + p->segment[j].number_bytes < max_buflen) { |
|---|
| 372 | memcpy(buf+pos, p->segment[j].compress_string_byte, p->segment[j].number_bytes); |
|---|
| 373 | pos += p->segment[j].number_bytes; |
|---|
| 374 | } |
|---|
| 375 | else { |
|---|
| 376 | /* cafrii 060314, º¹»çÇÒ ¼ö ÀÖ´Â ¸¸Å¸¸ º¹»çÇÑ´Ù. */ |
|---|
| 377 | int len = max_buflen - 1 - pos; |
|---|
| 378 | memcpy(buf+pos, p->segment[j].compress_string_byte, len); |
|---|
| 379 | pos += len; /* ¸¶Áö¸· ±ÛÀÚ°¡ ÇѱÛÀÏ °æ¿ì 1byte À߸®¸é ÀÌ»óÇÏ°Ô Ç¥ÇöµÉ ¼ö ÀÖÀ½. */ |
|---|
| 380 | buf[pos] = 0; |
|---|
| 381 | status = statusOK; /* is it better to notify warning? */ |
|---|
| 382 | goto label_exit; |
|---|
| 383 | } |
|---|
| 384 | } |
|---|
| 385 | else { |
|---|
| 386 | char errmsg[40]; |
|---|
| 387 | int len; |
|---|
| 388 | sprintf(errmsg, "!!Unsupported(%x)!!", p->segment[j].mode); |
|---|
| 389 | len = strlen(errmsg); |
|---|
| 390 | if (pos + len < max_buflen) { |
|---|
| 391 | memcpy(buf+pos, errmsg, len); |
|---|
| 392 | pos += len; |
|---|
| 393 | } |
|---|
| 394 | } |
|---|
| 395 | break; |
|---|
| 396 | |
|---|
| 397 | case cm_Huffman_C4C5: |
|---|
| 398 | case cm_Huffman_C6C7: |
|---|
| 399 | |
|---|
| 400 | #if 0 |
|---|
| 401 | DecodeHuffmanString(p->segment[j].compress_string_byte, |
|---|
| 402 | p->segment[j].number_bytes, |
|---|
| 403 | p->segment[j].compression_type, |
|---|
| 404 | string, MAX_SEGMENT_STR_SIZE); |
|---|
| 405 | |
|---|
| 406 | ks = DMW_ConvUc2Ks((UINT16 *)string, -1); |
|---|
| 407 | |
|---|
| 408 | if (pos + strlen((char *)ks) < max_buflen) { |
|---|
| 409 | memcpy(buf+pos, ks, strlen((char *)ks)); |
|---|
| 410 | pos += strlen((char *)ks); |
|---|
| 411 | DMW_FreeKsString(ks); |
|---|
| 412 | } |
|---|
| 413 | else { |
|---|
| 414 | /* cafrii 060314, º¹»çÇÒ ¼ö ÀÖ´Â ¸¸Å¸¸ º¹»çÇÑ´Ù. */ |
|---|
| 415 | int len = max_buflen - 1 - pos; |
|---|
| 416 | memcpy(buf+pos, ks, len); |
|---|
| 417 | DMW_FreeKsString(ks); |
|---|
| 418 | pos += len; /* ¸¶Áö¸· ±ÛÀÚ°¡ ÇѱÛÀÏ °æ¿ì 1byte À߸®¸é ÀÌ»óÇÏ°Ô Ç¥ÇöµÉ ¼ö ÀÖÀ½. */ |
|---|
| 419 | buf[pos] = 0; |
|---|
| 420 | status = statusOK; /* is it better to notify warning? */ |
|---|
| 421 | goto label_exit; |
|---|
| 422 | } |
|---|
| 423 | #else |
|---|
| 424 | // cafrii 090909 bugfix |
|---|
| 425 | // huffman codeÀÇ °æ¿ì´Â ascii range¸¸ compress °¡´ÉÇÔ. µû¶ó¼ UC to ASCII º¯È¯ ºÒÇÊ¿ä. |
|---|
| 426 | |
|---|
| 427 | err = DecodeHuffmanString(p->segment[j].compress_string_byte, |
|---|
| 428 | p->segment[j].number_bytes, |
|---|
| 429 | p->segment[j].compression_type, |
|---|
| 430 | string, MAX_SEGMENT_STR_SIZE); |
|---|
| 431 | if (err) break; |
|---|
| 432 | |
|---|
| 433 | if (pos + strlen((char *)string) < (unsigned int)max_buflen) { |
|---|
| 434 | memcpy(buf+pos, string, strlen(string)); |
|---|
| 435 | pos += strlen(string); |
|---|
| 436 | } |
|---|
| 437 | else { |
|---|
| 438 | /* º¹»çÇÒ ¼ö ÀÖ´Â ¸¸Å¸¸ º¹»çÇÑ´Ù. */ |
|---|
| 439 | int len = max_buflen - 1 - pos; |
|---|
| 440 | memcpy(buf+pos, string, len); |
|---|
| 441 | pos += len; /* ¸¶Áö¸· ±ÛÀÚ°¡ ÇѱÛÀÏ °æ¿ì 1byte À߸®¸é ÀÌ»óÇÏ°Ô Ç¥ÇöµÉ ¼ö ÀÖÀ½. */ |
|---|
| 442 | buf[pos] = 0; |
|---|
| 443 | status = statusOK; /* is it better to notify warning? */ |
|---|
| 444 | goto label_exit; |
|---|
| 445 | } |
|---|
| 446 | #endif |
|---|
| 447 | break; |
|---|
| 448 | } |
|---|
| 449 | } |
|---|
| 450 | buf[pos] = 0; /* null terminate */ |
|---|
| 451 | |
|---|
| 452 | label_exit: |
|---|
| 453 | |
|---|
| 454 | if (mStringPtr) |
|---|
| 455 | FreeMultipleString(mStringPtr); |
|---|
| 456 | |
|---|
| 457 | return status; |
|---|
| 458 | } |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | |
|---|
| 462 | |
|---|
| 463 | /*----------------------- |
|---|
| 464 | Dmc_PrintMultipleString |
|---|
| 465 | |
|---|
| 466 | PSIP¿¡¼ »ç¿ëÇÏ´Â multipleStringÀ» µð¹ö±ëÀÌ ÆíÇϵµ·Ï Ãâ·ÂÇØÁØ´Ù.. |
|---|
| 467 | ÃÖÁ¾ Ãâ·ÂÀ» ÇÒ ¶§ »ç¿ëÇÏ´Â ÇÔ¼ö´Â DMW_UniPrint ·Î¼, ÀÌ ÇÔ¼öÀÇ Ãâ·Â°¡´É ¿©ºÎ¿¡ µû¶ó |
|---|
| 468 | ÀϺΠ±ÛÀÚ´Â Ãâ·ÂÀÌ ¾ÈµÈ´Ù. |
|---|
| 469 | |
|---|
| 470 | ¸¸¾à Unicode»óÅÂÀÇ code°ªÀ» º¸°í ½ÍÀ¸¸é PrintMultipleString ÇÔ¼ö¸¦ »ç¿ëÇ϶ó.. |
|---|
| 471 | */ |
|---|
| 472 | #define STR_SIZE 256 |
|---|
| 473 | void Dmc_PrintMultipleString(UINT8 *buffer, UINT16 len, int indent, int detailLevel) |
|---|
| 474 | { |
|---|
| 475 | multipleStringPtr_t mStringPtr = NULL; |
|---|
| 476 | INT32 i,j,k; |
|---|
| 477 | UINT32 langcode; |
|---|
| 478 | char string[STR_SIZE], tmp[64]; /* tmp´Â indent ¹öÆÛ ¿ë.. */ |
|---|
| 479 | DHL_RESULT err; |
|---|
| 480 | |
|---|
| 481 | if (indent > 63) indent = 63; |
|---|
| 482 | memset(tmp, ' ', indent); |
|---|
| 483 | tmp[indent] = 0; |
|---|
| 484 | |
|---|
| 485 | /* cafrii 060719 bugfix! add check. DS083 */ |
|---|
| 486 | if (buffer == NULL || len == 0) { |
|---|
| 487 | SimplePrint("%s[null]\n", tmp); |
|---|
| 488 | goto PrintMultipleStringExit; |
|---|
| 489 | } |
|---|
| 490 | |
|---|
| 491 | /* lenÀÌ 0ÀÎ °æ¿ì mStringPtrÀÌ NULL ÀÌ¸é¼ DHL_OK¸®ÅϵÊ. */ |
|---|
| 492 | err = ParseMultipleString(buffer, len, &mStringPtr); |
|---|
| 493 | if (IsError(err)) { /* cafrii 050315 change */ |
|---|
| 494 | mStringPtr = NULL; /* cafrii 050315 add */ |
|---|
| 495 | goto PrintMultipleStringExit; |
|---|
| 496 | } |
|---|
| 497 | |
|---|
| 498 | if (mStringPtr == NULL) { |
|---|
| 499 | SimplePrint("%s[None]\n", tmp); |
|---|
| 500 | goto PrintMultipleStringExit; |
|---|
| 501 | } |
|---|
| 502 | |
|---|
| 503 | for (i=0; i<mStringPtr->number_strings; i++) { |
|---|
| 504 | langcode = mStringPtr->msString[i].ISO639_language_code; |
|---|
| 505 | SimplePrint("%s(%c%c%c) ", tmp, (char)(langcode >> 16), (char)(langcode >> 8), (char)(langcode)); |
|---|
| 506 | for (j=0; j<mStringPtr->msString[i].number_segments; j++) { |
|---|
| 507 | switch (mStringPtr->msString[i].segment[j].compression_type) { |
|---|
| 508 | case cm_None: |
|---|
| 509 | /* ÁÖÀÇ!! compresse_string_byte°¡ address alignÀÌ µÇ¾î ÀÖÁö ¾Ê´Ù¸é ¿¡·¯°¡ ³¯Áöµµ ¸ð¸£°ÚÀ½.. */ |
|---|
| 510 | if (mStringPtr->msString[i].segment[j].mode == tm_ISO10646_1_Page_0x00) /* 0x00 */ |
|---|
| 511 | /* ASCII, ISO Latin-1 (Roman) */ |
|---|
| 512 | for (k=0; k<mStringPtr->msString[i].segment[j].number_bytes; k++) |
|---|
| 513 | SimplePrint("%c", mStringPtr->msString[i].segment[j].compress_string_byte[k]); |
|---|
| 514 | else if (mStringPtr->msString[i].segment[j].mode == tm_ISO10646_1_16_bit) /* 0x3F */ |
|---|
| 515 | /* ISO/IEC 10646-1 mode (all) - KOREAN mode only */ |
|---|
| 516 | Dmc_PsipUniPrint((UINT8*)(mStringPtr->msString[i].segment[j].compress_string_byte), |
|---|
| 517 | mStringPtr->msString[i].segment[j].number_bytes/2); |
|---|
| 518 | /* length °è»êÀº ±×³É 2·Î ³ª´®. Ȧ¼ö ÀÎ °æ¿ì ¸¶Áö¸·Àº À߸®³ª, Á¦´ë·Î µÈ code¶ó¸é |
|---|
| 519 | Ç×»ó 2ÀÇ ¹è¼öÀÏ °ÍÀ̹ǷΠ¹®Á¦ ¾ø´Ù. */ |
|---|
| 520 | else if (mStringPtr->msString[i].segment[j].mode == 0x48) /* ¿Ï¼ºÇü ÇѱÛ.. */ |
|---|
| 521 | /* ±×³É Ãâ·ÂÇϸé Shell font°¡ Çѱ۷Πº¸¿©ÁÙ °ÍÀÓ.. */ |
|---|
| 522 | for (k=0; k<mStringPtr->msString[i].segment[j].number_bytes; k++) |
|---|
| 523 | SimplePrint("%c", mStringPtr->msString[i].segment[j].compress_string_byte[k]); |
|---|
| 524 | else |
|---|
| 525 | SimplePrint("!!Unsupported(%x)!!", mStringPtr->msString[i].segment[j].mode); |
|---|
| 526 | break; |
|---|
| 527 | |
|---|
| 528 | case cm_Huffman_C4C5: |
|---|
| 529 | case cm_Huffman_C6C7: |
|---|
| 530 | |
|---|
| 531 | DecodeHuffmanString(mStringPtr->msString[i].segment[j].compress_string_byte, |
|---|
| 532 | mStringPtr->msString[i].segment[j].number_bytes, |
|---|
| 533 | mStringPtr->msString[i].segment[j].compression_type, |
|---|
| 534 | string, STR_SIZE); |
|---|
| 535 | Dmc_PsipUniPrint((UINT8 *)string, -1); |
|---|
| 536 | /* DecodeÇÏ´Â ÇÔ¼ö°¡ SZ Çü½ÄÀ̹ǷΠ±æÀ̸¦ ÁöÁ¤ÇÏÁö ¾Ê¾Æµµ µÈ´Ù. */ |
|---|
| 537 | break; |
|---|
| 538 | } |
|---|
| 539 | } |
|---|
| 540 | SimplePrint("\n"); |
|---|
| 541 | |
|---|
| 542 | #if 0 |
|---|
| 543 | if (detailLevel >= 1) { |
|---|
| 544 | /* Á» ´õ ÀÚ¼¼ÇÑ Á¤º¸¸¦ Ãâ·ÂÇϰíÀÚ Çϸé 'PrintMultipleString' ¸¦ »ç¿ëÇ϶ó.. */ |
|---|
| 545 | for (j=0; j<mStringPtr->msString[i].number_segments; j++) { |
|---|
| 546 | SimplePrint("%s [seg%d] comp_type %d, len %d\n", tmp, j, |
|---|
| 547 | mStringPtr->msString[i].segment[j].compression_type, mStringPtr->msString[i].segment[j].number_bytes); |
|---|
| 548 | SimplePrint("%s ", tmp); |
|---|
| 549 | for (k=0; k<mStringPtr->msString[i].segment[j].number_bytes; k++) |
|---|
| 550 | SimplePrint("%02x ", mStringPtr->msString[i].segment[j].compress_string_byte[k]); |
|---|
| 551 | SimplePrint("\n"); |
|---|
| 552 | } |
|---|
| 553 | } |
|---|
| 554 | #endif |
|---|
| 555 | |
|---|
| 556 | } |
|---|
| 557 | FreeMultipleString(mStringPtr); |
|---|
| 558 | |
|---|
| 559 | PrintMultipleStringExit: |
|---|
| 560 | return; |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | /*----------------------- |
|---|
| 565 | GpsTimeString/GpsTimeString2 |
|---|
| 566 | |
|---|
| 567 | GPS timeÀ» user time Çü½ÄÀ¸·Î º¯È¯Çؼ stringÀ¸·Î ¸¸µé¾îÁÖ´Â ÇÔ¼öÀÌ´Ù. |
|---|
| 568 | caller°¡ stringÀúÀå¿¡ »ç¿ëµÉ buffer¸¦ ÁöÁ¤Çϴ°ÍÀÌ ±ÇÀåµÈ´Ù. Å©±â´Â ÀûÀýÇϰÔ.. |
|---|
| 569 | ¸¸¾à °£´ÜÇÏ°Ô Å×½ºÆ®ÇÒ ¸ñÀûÀ̶ó¸é NULL·Î ÁöÁ¤ÇÏ¿© static buffer¸¦ »ç¿ëÇÒ ¼öµµ ÀÖÀ¸³ª |
|---|
| 570 | ÀÌ °æ¿ì multiple instance¸¦ »ç¿ëÇÏÁö ¸øÇÔ¿¡ À¯ÀÇÇ϶ó.. |
|---|
| 571 | */ |
|---|
| 572 | char *GpsTimeString2(UINT32 gps, char *buf, int level) |
|---|
| 573 | { |
|---|
| 574 | |
|---|
| 575 | #if SYS_TIME_MODULE_ENABLED |
|---|
| 576 | |
|---|
| 577 | /* 0: (3:20), 1: (3:20:15) 2: (4/19 3:20:15) 3: (2004/4/19 ¿ù 3:20:15) */ |
|---|
| 578 | char *WdayString_k[7]={"ÀÏ", "¿ù", "È", "¼ö", "¸ñ", "±Ý", "Åä"}; |
|---|
| 579 | char *WdayString_e[7]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; |
|---|
| 580 | |
|---|
| 581 | static char _buf[100]; |
|---|
| 582 | STime_t s; |
|---|
| 583 | UINT32 utc; |
|---|
| 584 | |
|---|
| 585 | utc = DMW_ConvertGPS2UTC(&g_EpgDebugTimeContext, gps); |
|---|
| 586 | DMW_ConvertUTC2LocalTime(&g_EpgDebugTimeContext, utc, &s); |
|---|
| 587 | |
|---|
| 588 | #if 0 /* verify test.. */ |
|---|
| 589 | utc2 = DMW_ConvertLocalTime2UTC(&g_EpgDebugTimeContext, &s); |
|---|
| 590 | if (utc != utc2) { |
|---|
| 591 | printf("\n!!!! utc verify err\n"); |
|---|
| 592 | } |
|---|
| 593 | #endif |
|---|
| 594 | |
|---|
| 595 | if (buf == NULL) buf = _buf; |
|---|
| 596 | |
|---|
| 597 | if (level >= 4) |
|---|
| 598 | sprintf(buf, "%d/%d/%d %s %2d:%02d:%02d [tz%+d]", |
|---|
| 599 | s.year, s.month, s.day, s.wday<7?WdayString_e[s.wday]:"", s.hour, s.min, s.sec, |
|---|
| 600 | g_EpgDebugTimeContext.nTimeZone); |
|---|
| 601 | else if (level >= 3) |
|---|
| 602 | sprintf(buf, "%d/%d/%d %s %2d:%02d:%02d", |
|---|
| 603 | s.year, s.month, s.day, s.wday<7?WdayString_k[s.wday]:"", s.hour, s.min, s.sec); |
|---|
| 604 | else if (level >= 2) |
|---|
| 605 | sprintf(buf, "%d/%d %2d:%02d:%02d", |
|---|
| 606 | s.month, s.day, s.hour, s.min, s.sec); |
|---|
| 607 | else if (level >= 1) |
|---|
| 608 | sprintf(buf, "%2d:%02d:%02d", s.hour, s.min, s.sec); |
|---|
| 609 | else |
|---|
| 610 | sprintf(buf, "%2d:%02d", s.hour, s.min); |
|---|
| 611 | |
|---|
| 612 | return buf; |
|---|
| 613 | |
|---|
| 614 | #else |
|---|
| 615 | |
|---|
| 616 | return "(NoSysTime API)"; |
|---|
| 617 | #endif |
|---|
| 618 | |
|---|
| 619 | } |
|---|
| 620 | |
|---|
| 621 | char *GpsTimeString(UINT32 gps, char *buf) |
|---|
| 622 | { |
|---|
| 623 | return GpsTimeString2(gps, buf, 3); |
|---|
| 624 | } |
|---|
| 625 | |
|---|
| 626 | /*----------------------- |
|---|
| 627 | Dmc_PrintEit |
|---|
| 628 | |
|---|
| 629 | EitÀÇ Á¤º¸¸¦ º¸±âÁÁ°Ô Ãâ·ÂÇØÁØ´Ù. SysTime ¼³Á¤¿¡ µû¶ó ÇöÀç ½Ã°£ Ãâ·ÂÀÌ Á¤È®ÇÏÁö ¾ÊÀ» ¼öµµ ÀÖ´Ù. |
|---|
| 630 | ¸¸¾à EITÀÇ ¸ðµç ÀÚ¼¼ÇÑ Á¤º¸¸¦ Ãâ·ÂÇϱ⸦ ¿øÇϸé PrintEit ¸¦ »ç¿ëÇ϶ó.. |
|---|
| 631 | */ |
|---|
| 632 | void Dmc_PrintEit(eitPtr_t eitPtr, int indent, ettSectionPtr_t *ettArray) |
|---|
| 633 | { |
|---|
| 634 | /* indent´Â ¸Å ¶óÀÎÀÇ ¾Õ¿¡ ¸îÄÀ» µé¿©¾²±â¸¦ ÇÒ °ÍÀΰ¡ ÁöÁ¤ÇÏ´Â °ÍÀε¥, ÃÖ´ë 31±îÁö °¡´ÉÇÏ´Ù. */ |
|---|
| 635 | INT32 i; |
|---|
| 636 | char tmp[32], buf1[64], buf2[64]; /* tmp´Â µé¿©¾²±â¿ë, buf´Â TimeString¿ë */ |
|---|
| 637 | |
|---|
| 638 | if (indent > 31) indent = 31; |
|---|
| 639 | memset(tmp, ' ', indent); |
|---|
| 640 | tmp[indent] = 0; |
|---|
| 641 | |
|---|
| 642 | /* SimplePrint("\n%s------ EIT ------\n", tmp); */ |
|---|
| 643 | SimplePrint("%sEIT source_id %d, ver %d, %d events\n", |
|---|
| 644 | tmp, eitPtr->source_id, eitPtr->version_number, eitPtr->numEvents); |
|---|
| 645 | for (i=0; i<eitPtr->numEvents; i++) { |
|---|
| 646 | SimplePrint("%s event[%d]: id: 0x%04X, %s ~ %s, ETM %d (%s)\n", |
|---|
| 647 | tmp, i, eitPtr->event[i].event_id, |
|---|
| 648 | GpsTimeString2(eitPtr->event[i].start_time, buf1, 2), |
|---|
| 649 | GpsTimeString2(eitPtr->event[i].start_time + eitPtr->event[i].length_in_seconds, buf2, 1), |
|---|
| 650 | /* eitPtr->event[i].start_time, eitPtr->event[i].length_in_seconds, */ |
|---|
| 651 | eitPtr->event[i].ETM_location, |
|---|
| 652 | eitPtr->event[i].ETM_location == ETM_none ? "None" : |
|---|
| 653 | eitPtr->event[i].ETM_location == ETM_in_this_PTC ? "ThisPTC" : |
|---|
| 654 | eitPtr->event[i].ETM_location == ETM_in_channel_TSID_PTC ? "ChannelTsidPTC" : "??" |
|---|
| 655 | ); |
|---|
| 656 | Dmc_PrintMultipleString(eitPtr->event[i].title, eitPtr->event[i].title_length, indent+6, 0); |
|---|
| 657 | /* SimplePrint("%s desc_len %d\n", tmp, eitPtr->event[i].descriptor_length); */ |
|---|
| 658 | |
|---|
| 659 | /* 'ettArray'°¡ ÀÖÀ¸¸é °°ÀÌ ettµµ Ãâ·ÂÇÑ´Ù. |
|---|
| 660 | ±×·±µ¥ ¿ø·¡ ¾ø´Â ettÀÎÁö, ¾ÆÁ÷ ¼ö½ÅÀÌ ´ú µÈ ettÀÎÁö ½±°Ô ¾Ë ¹æ¹ýÀÌ ¾ø´Ù. */ |
|---|
| 661 | if (eitPtr->event[i].ETM_location != ETM_none && |
|---|
| 662 | ettArray && ettArray[i]) { |
|---|
| 663 | ettSectionPtr_t ettSectPtr = ettArray[i]; |
|---|
| 664 | /* SimplePrint("%sETT ETM_id %08x, event %x, ver %d\n", tmp, ettSectPtr->ETM_id, (ettSectPtr->ETM_id>>2) & 0x3fff, */ |
|---|
| 665 | /* ettSectPtr->version_number); */ |
|---|
| 666 | Dmc_PrintMultipleString(ettSectPtr->extended_text_message, |
|---|
| 667 | ettSectPtr->extended_text_message_length, indent+7, 0); |
|---|
| 668 | /* ETT ETMÀº ÇÑÄ ´õ µé¿©¾²µµ·Ï ÇÏÀÚ.. */ |
|---|
| 669 | } |
|---|
| 670 | } |
|---|
| 671 | } |
|---|
| 672 | |
|---|
| 673 | /*----------------------- |
|---|
| 674 | Dmc_PrintEtt |
|---|
| 675 | |
|---|
| 676 | EttÀÇ Á¤º¸¸¦ º¸±âÁÁ°Ô Ãâ·ÂÇØÁØ´Ù. |
|---|
| 677 | ¸¸¾à ETTÀÇ ¸ðµç ÀÚ¼¼ÇÑ Á¤º¸¸¦ Ãâ·ÂÇϱ⸦ ¿øÇϸé PrintEtt ¸¦ »ç¿ëÇ϶ó.. |
|---|
| 678 | */ |
|---|
| 679 | void Dmc_PrintEtt(ettSectionPtr_t ettSectPtr, int indent) |
|---|
| 680 | { |
|---|
| 681 | char tmp[32]; |
|---|
| 682 | |
|---|
| 683 | if (indent > 31) indent = 31; |
|---|
| 684 | memset(tmp, ' ', indent); |
|---|
| 685 | tmp[indent] = 0; |
|---|
| 686 | |
|---|
| 687 | /* SimplePrint("\n%s------ ETT Section ------\n", tmp); */ |
|---|
| 688 | SimplePrint("%sETT ETM_id %08x, event %x, ver %d\n", tmp, ettSectPtr->ETM_id, (ettSectPtr->ETM_id>>2) & 0x3fff, |
|---|
| 689 | ettSectPtr->version_number); |
|---|
| 690 | Dmc_PrintMultipleString(ettSectPtr->extended_text_message, |
|---|
| 691 | ettSectPtr->extended_text_message_length, indent+3, 0); |
|---|
| 692 | } |
|---|
| 693 | |
|---|
| 694 | |
|---|
| 695 | /*----------------------- |
|---|
| 696 | Dmc_PrintRrt |
|---|
| 697 | |
|---|
| 698 | RrtÀÇ Á¤º¸¸¦ Ãâ·ÂÇÑ´Ù. |
|---|
| 699 | cafrii 060822, detail ¸ðµå¿¡¼ ´õ ¸¹Àº Á¤º¸ Ãâ·ÂÇϰԲû ¼öÁ¤. |
|---|
| 700 | */ |
|---|
| 701 | void Dmc_PrintRrt(rrtSectionPtr_t rrt, int indent, BOOL bDetail) |
|---|
| 702 | { |
|---|
| 703 | int i, k; |
|---|
| 704 | char ibuf[32]; |
|---|
| 705 | int offset = 0; |
|---|
| 706 | static char mssbuf[200]; |
|---|
| 707 | STATUS status; |
|---|
| 708 | |
|---|
| 709 | if (indent > 31) indent = 31; |
|---|
| 710 | memset(ibuf, ' ', indent); |
|---|
| 711 | ibuf[indent] = 0; |
|---|
| 712 | |
|---|
| 713 | /* °£´ÜÇϰԴ ù¹øÂ° langcode¸¸ Ãâ·Â. */ |
|---|
| 714 | status = Dmc_ConvertMss2Ks(rrt->rating_region_name, |
|---|
| 715 | rrt->rating_region_name_length, mssbuf, 200, NULL, 0); |
|---|
| 716 | |
|---|
| 717 | SimplePrint("%s RRT ver %d, %d dims, region 0x%x { %s }\n", |
|---|
| 718 | ibuf, (int)rrt->version_number, (int)rrt->dimensions_defined, |
|---|
| 719 | rrt->rating_region, status ? "err" : mssbuf); |
|---|
| 720 | |
|---|
| 721 | if (bDetail) { |
|---|
| 722 | /* ¸ðµç langcode¸¦ ´Ù Ãâ·ÂÇÑ´Ù. */ |
|---|
| 723 | Dmc_PrintMultipleString(rrt->rating_region_name, |
|---|
| 724 | rrt->rating_region_name_length, indent+6, 0); |
|---|
| 725 | } |
|---|
| 726 | |
|---|
| 727 | for (i=0; i<rrt->dimensions_defined; i++) |
|---|
| 728 | { |
|---|
| 729 | rrtDimensionPtr_t dim = &rrt->dimension[i]; |
|---|
| 730 | |
|---|
| 731 | status = Dmc_ConvertMss2Ks(dim->dimension_name, |
|---|
| 732 | dim->dimension_name_length, mssbuf, 200, "eng", 0); |
|---|
| 733 | if (status) |
|---|
| 734 | status = Dmc_ConvertMss2Ks(dim->dimension_name, |
|---|
| 735 | dim->dimension_name_length, mssbuf, 200, "kor", 0); |
|---|
| 736 | if (status) |
|---|
| 737 | status = Dmc_ConvertMss2Ks(dim->dimension_name, |
|---|
| 738 | dim->dimension_name_length, mssbuf, 200, NULL, 0); |
|---|
| 739 | |
|---|
| 740 | SimplePrint("%s [%d] grad %d, %d values, { %s }\n", ibuf, i, |
|---|
| 741 | (int)dim->graduated_scale, |
|---|
| 742 | (int)dim->values_defined, |
|---|
| 743 | status ? "err" : mssbuf); |
|---|
| 744 | |
|---|
| 745 | if (bDetail) |
|---|
| 746 | Dmc_PrintMultipleString(dim->dimension_name, |
|---|
| 747 | dim->dimension_name_length, indent+8, 0); |
|---|
| 748 | |
|---|
| 749 | if (dim->first_value_empty) { |
|---|
| 750 | offset = 1; |
|---|
| 751 | SimplePrint("%s (%d) --\n", ibuf, 0); |
|---|
| 752 | } |
|---|
| 753 | |
|---|
| 754 | for (k=0; k<dim->values_defined; k++) |
|---|
| 755 | { |
|---|
| 756 | rrtValuePtr_t value = &dim->value[k]; |
|---|
| 757 | |
|---|
| 758 | status = Dmc_ConvertMss2Ks(value->abbrev_rating_value, |
|---|
| 759 | value->abbrev_rating_value_length, mssbuf, 200, "eng", 0); |
|---|
| 760 | if (status) |
|---|
| 761 | status = Dmc_ConvertMss2Ks(value->abbrev_rating_value, |
|---|
| 762 | value->abbrev_rating_value_length, mssbuf, 200, "kor", 0); |
|---|
| 763 | if (status) |
|---|
| 764 | status = Dmc_ConvertMss2Ks(value->abbrev_rating_value, |
|---|
| 765 | value->abbrev_rating_value_length, mssbuf, 200, NULL, 0); |
|---|
| 766 | |
|---|
| 767 | SimplePrint("%s (%d) %s { %s }\n", ibuf, k+offset, |
|---|
| 768 | value->block_on ? "ON" : "--", |
|---|
| 769 | status ? "err" : mssbuf); |
|---|
| 770 | |
|---|
| 771 | /* Ãß°¡ Á¤º¸ Ç¥½Ã.. */ |
|---|
| 772 | if (bDetail) |
|---|
| 773 | Dmc_PrintMultipleString(value->abbrev_rating_value, |
|---|
| 774 | value->abbrev_rating_value_length, indent+10, 0); |
|---|
| 775 | |
|---|
| 776 | /* value_text Ç¥½Ã.. */ |
|---|
| 777 | if (bDetail) { |
|---|
| 778 | /* SimplePrint("%s text:\n", ibuf); */ |
|---|
| 779 | Dmc_PrintMultipleString(value->rating_value, |
|---|
| 780 | value->rating_value_length, indent+12, 0); |
|---|
| 781 | } |
|---|
| 782 | } |
|---|
| 783 | } |
|---|
| 784 | } |
|---|
| 785 | |
|---|
| 786 | |
|---|
| 787 | /*----------------------- |
|---|
| 788 | Dmc_SetGpsTimeSync |
|---|
| 789 | |
|---|
| 790 | ÀÌ ÇÔ¼ö´Â À§ÀÇ PrintEit ³»ÀÇ GPS ½Ã°£ Á¤º¸¸¦ Ç¥½ÃÇÒ¶§ÀÇ °¢Á¾ ȯ°æÀ» ¼³Á¤ÇÏ´Â ÇÔ¼öÀÌ´Ù. |
|---|
| 791 | ÀÏ¹Ý ¹ü¿ëÇÔ¼ö´Â ¾Æ´Ï¶ó µð¹ö±ë ¿ëÀ̸ç, Application¿¡¼´Â °¢ÀÚ µû·Î ¼³Á¤ÇÏ´Â Äڵ带 |
|---|
| 792 | °¡Áö°í ÀÖ¾î¾ß ÇÑ´Ù.. |
|---|
| 793 | */ |
|---|
| 794 | void Dmc_SetGpsTimeSync(sttSection_t *stt) |
|---|
| 795 | { |
|---|
| 796 | /* SysTime ¸ðµâÀ» »ç¿ëÇϱâ À§Çؼ´Â ÀÌ ÇÔ¼ö·Î Àû¾îµµ 1ȸ Ãʱâȸ¦ ½ÃÄÑÁà¾ß ÇÑ´Ù.. */ |
|---|
| 797 | if (stt == NULL) return; |
|---|
| 798 | |
|---|
| 799 | |
|---|
| 800 | #if SYS_TIME_MODULE_ENABLED |
|---|
| 801 | /* cafrii 061106, use epg debug time context. |
|---|
| 802 | user can use Dmc_SetDebugTimeZone to match system time zone. */ |
|---|
| 803 | |
|---|
| 804 | DMW_SetLocalTimeZone(&g_EpgDebugTimeContext, g_EpgDebugTimeZone); /* Seoul À¸·Î timezone ¼³Á¤.. */ |
|---|
| 805 | |
|---|
| 806 | #if 0 |
|---|
| 807 | if (stt->daylight_savings.DS_status) /* ÇöÀç DS »óÅÂÀÌ¸é ¿ì¸®µµ Àû¿ë.. */ |
|---|
| 808 | DMW_SetDayLightSaving(&g_EpgDebugTimeContext, TRUE); |
|---|
| 809 | else |
|---|
| 810 | DMW_SetDayLightSaving(&g_EpgDebugTimeContext, FALSE); |
|---|
| 811 | #else |
|---|
| 812 | /* for automatic daylight saving control.. */ |
|---|
| 813 | DMW_SetDayLightSaving2(&g_EpgDebugTimeContext, |
|---|
| 814 | stt->daylight_savings.DS_status ? 1 : 0, |
|---|
| 815 | stt->daylight_savings.DS_day_of_month, |
|---|
| 816 | stt->daylight_savings.DS_hour); |
|---|
| 817 | #endif |
|---|
| 818 | |
|---|
| 819 | DMW_SetGPS_UTC_offset(&g_EpgDebugTimeContext, stt->GPS_UTC_offset); |
|---|
| 820 | DMW_SetUTCTime(&g_EpgDebugTimeContext, DMW_ConvertGPS2UTC(&g_EpgDebugTimeContext, stt->system_time)); |
|---|
| 821 | |
|---|
| 822 | #endif |
|---|
| 823 | |
|---|
| 824 | } |
|---|
| 825 | |
|---|
| 826 | |
|---|
| 827 | |
|---|
| 828 | #if COMMENT |
|---|
| 829 | ____DbgPrint________(){} |
|---|
| 830 | #endif |
|---|
| 831 | |
|---|
| 832 | #if COMMENT |
|---|
| 833 | ____SymbolLink________(){} |
|---|
| 834 | #endif |
|---|
| 835 | |
|---|
| 836 | #if DMW_REGISTER_DEBUG_SYMBOL |
|---|
| 837 | |
|---|
| 838 | static DHL_SymbolTable _EpgDriverSymbols[] = |
|---|
| 839 | { |
|---|
| 840 | DHL_FNC_SYM_ENTRY(PrintPAT), |
|---|
| 841 | DHL_FNC_SYM_ENTRY(PrintPMT), |
|---|
| 842 | |
|---|
| 843 | DHL_FNC_SYM_ENTRY(PrintSttSection), |
|---|
| 844 | DHL_FNC_SYM_ENTRY(PrintMgtSection), |
|---|
| 845 | DHL_FNC_SYM_ENTRY(PrintTvct), |
|---|
| 846 | DHL_FNC_SYM_ENTRY(PrintCvct), |
|---|
| 847 | DHL_FNC_SYM_ENTRY(PrintRrtSection), |
|---|
| 848 | DHL_FNC_SYM_ENTRY(PrintEit), |
|---|
| 849 | DHL_FNC_SYM_ENTRY(PrintEttSection), |
|---|
| 850 | |
|---|
| 851 | }; |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | static DHL_SymbolTable _EpgDebugSymbols[] = |
|---|
| 855 | { |
|---|
| 856 | DHL_FNC_SYM_ENTRY(Dmc_PrintMultipleString), |
|---|
| 857 | DHL_FNC_SYM_ENTRY(Dmc_PrintEit), |
|---|
| 858 | DHL_FNC_SYM_ENTRY(Dmc_PrintEtt), |
|---|
| 859 | DHL_FNC_SYM_ENTRY(Dmc_PrintRrt), |
|---|
| 860 | |
|---|
| 861 | DHL_FNC_SYM_ENTRY(Dmc_SetDebugTimeZone), /* cafrii 061106 add */ |
|---|
| 862 | }; |
|---|
| 863 | |
|---|
| 864 | #endif |
|---|
| 865 | |
|---|
| 866 | void RegisterEpgDebugSymbols() |
|---|
| 867 | { |
|---|
| 868 | #if DMW_REGISTER_DEBUG_SYMBOL |
|---|
| 869 | DHL_DBG_RegisterSymbols(_EpgDebugSymbols, DHL_NUMSYMBOLS(_EpgDebugSymbols)); |
|---|
| 870 | DHL_DBG_RegisterSymbols(_EpgDriverSymbols, DHL_NUMSYMBOLS(_EpgDriverSymbols)); |
|---|
| 871 | #endif |
|---|
| 872 | |
|---|
| 873 | } |
|---|
| 874 | |
|---|
| 875 | |
|---|
| 876 | |
|---|
| 877 | |
|---|
| 878 | #if COMMENT |
|---|
| 879 | ____TEST________(){} |
|---|
| 880 | #endif |
|---|
| 881 | |
|---|
| 882 | /* cafrii 041126 add */ |
|---|
| 883 | void TestConvKs2Mss(int number) |
|---|
| 884 | { |
|---|
| 885 | int i; |
|---|
| 886 | char buf[100]; |
|---|
| 887 | UINT8 *mss; |
|---|
| 888 | int mss_len; |
|---|
| 889 | |
|---|
| 890 | if (number == 0) number = 20; |
|---|
| 891 | |
|---|
| 892 | for (i=0; i<number; i++) { |
|---|
| 893 | |
|---|
| 894 | DMW_MakeRandomKsString(buf, rand()%40+10, 2); /* ¿µ¹® ÇÑ±Û È¥¿ë */ |
|---|
| 895 | |
|---|
| 896 | DHL_OS_Printf("(%d) original string: '%s', strlen %d\n", i, buf, strlen(buf)); |
|---|
| 897 | |
|---|
| 898 | Dmc_ConvertKs2Mss(buf, &mss, &mss_len); |
|---|
| 899 | |
|---|
| 900 | if (mss == NULL) { |
|---|
| 901 | DHL_OS_Printf("!! Convert KS 2 MSS err\n"); |
|---|
| 902 | break; |
|---|
| 903 | } |
|---|
| 904 | Dmc_PrintMultipleString(mss, mss_len, 15, 0); |
|---|
| 905 | |
|---|
| 906 | DHL_OS_Free((void**)&mss); |
|---|
| 907 | } |
|---|
| 908 | } |
|---|
| 909 | |
|---|
| 910 | |
|---|
| 911 | |
|---|
| 912 | /****************************************************************************** |
|---|
| 913 | $Log: DMW_EpgDebug.c,v $ |
|---|
| 914 | |
|---|
| 915 | 1.04 2005/3/15 ParseXXX ÇÔ¼ö ¸®ÅϰªÀÌ ¿¡·¯À̸é pointer¸¦ NULL·Î °Á¦¼³Á¤ |
|---|
| 916 | 1.03 2005/2/3 remove unused header include |
|---|
| 917 | 1.02 2004/11/26 ConvertMss2Ks, ConvertKs2Mss, TestÇÔ¼ö Ãß°¡ |
|---|
| 918 | 1.01 2004/11/5 Dmc_ChannelNumberString Ãß°¡ |
|---|
| 919 | 1.00 2004/10/20 DmcDemux ¸ðµâ¿¡¼ ºÐ¸®ÇÔ |
|---|
| 920 | |
|---|
| 921 | *******************************************************************************/ |
|---|
| 922 | |
|---|