PREFIX = /usr/local
TARGETS = epgdump
-OBJ_TARGETS = epgdump.o aribstr.o eit.o ts.o util.o sdt.o
-HEDDERDEPEND = eit.h sdt.h aribstr.h ts.h util.h
+OBJ_TARGETS = epgdump.o aribstr.o eit.o ts.o util.o psi.o sdt.o cdt.o sdtt.o dsmcc.o tot.o bit.o clt2png.o
+HEDDERDEPEND = aribstr.h eit.h ts.h util.h psi.h sdt.h cdt.h sdtt.h dsmcc.h tot.h bit.h clt2png.h
LANG = C
CC = gcc
#CFLAGS = -std=c99 -O2 -Wall -g
+#CFLAGS = -std=c99 -O0 -Wall -ggdb
CFLAGS = -std=c99 -O2 -Wall -ggdb
+#CFLAGS = -std=c99 -O2 -Wall -ggdb -lefence
+
+CXX = g++
+CXXFLAGS = -O2 -Wall -ggdb -lstdc++
LIBS =
.c.o: ${CC} ${CFLAGS} -c $<
+.cpp.o: $(CXX) $(CXXFLAGS) -o $@ -c $^
+
all: ${TARGETS}
${TARGETS}: ${OBJ_TARGETS}
#include "aribstr.h"
-#define CODE_UNKNOWN 0 // ÉÔÌÀ¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È(ÈóÂбþ)
+#define CODE_UNKNOWN 0 // 不明なグラフィックセット(非対応)
#define CODE_KANJI 1 // Kanji
#define CODE_ALPHANUMERIC 2 // Alphanumeric
#define CODE_HIRAGANA 3 // Hiragana
static const DWORD PutKanjiChar(TCHAR *lpszDst, const WORD wCode);
static const DWORD PutAlphanumericChar(TCHAR *lpszDst, const WORD wCode);
+//static const DWORD PutAlphanumericHankakuChar(TCHAR *lpszDst, const WORD wCode);
static const DWORD PutHiraganaChar(TCHAR *lpszDst, const WORD wCode);
static const DWORD PutKatakanaChar(TCHAR *lpszDst, const WORD wCode);
static const DWORD PutJisKatakanaChar(TCHAR *lpszDst, const WORD wCode);
static const bool DesignationGSET(const BYTE byIndexG, const BYTE byCode);
static const bool DesignationDRCS(const BYTE byIndexG, const BYTE byCode);
-static WORD convertjis(DWORD);
-
static const bool abCharSizeTable[] =
{
- false, // CODE_UNKNOWN ÉÔÌÀ¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È(ÈóÂбþ)
+ false, // CODE_UNKNOWN 不明なグラフィックセット(非対応)
true, // CODE_KANJI Kanji
false, // CODE_ALPHANUMERIC Alphanumeric
false, // CODE_HIRAGANA Hiragana
true // CODE_ADDITIONAL_SYMBOLS Additional symbols
};
+typedef enum{
+ STR_SMALL = 0, //SSZ
+ STR_MEDIUM, //MSZ
+ STR_NORMAL, //NSZ
+ STR_MICRO, //SZX 0x60
+ STR_HIGH_W, //SZX 0x41
+ STR_WIDTH_W, //SZX 0x44
+ STR_W, //SZX 0x45
+ STR_SPECIAL_1, //SZX 0x6B
+ STR_SPECIAL_2, //SZX 0x64
+} STRING_SIZE;
+
+STRING_SIZE m_emStrSize;
+
+bool IsSmallCharMode(void)
+{
+ bool bRet = false;
+ switch(m_emStrSize){
+ case STR_SMALL:
+ bRet = true;
+ break;
+ case STR_MEDIUM:
+ bRet = true;
+ break;
+ case STR_NORMAL:
+ bRet = false;
+ break;
+ case STR_MICRO:
+ bRet = true;
+ break;
+ case STR_HIGH_W:
+ bRet = false;
+ break;
+ case STR_WIDTH_W:
+ bRet = false;
+ break;
+ case STR_W:
+ bRet = false;
+ break;
+ case STR_SPECIAL_1:
+ bRet = false;
+ break;
+ case STR_SPECIAL_2:
+ bRet = false;
+ break;
+ default:
+ break;
+ }
+ return bRet;
+}
+
int AribToString(
char *lpszDst,
const char *pSrcData,
DWORD dwDstLen = 0UL;
int dwSrcData;
- // ¾õÂÖ½é´üÀßÄê
+ // 状態初期設定
m_byEscSeqCount = 0U;
m_pSingleGL = NULL;
m_pLockingGL = &m_CodeG[0];
m_pLockingGR = &m_CodeG[2];
+ m_emStrSize = STR_NORMAL;
while(dwSrcPos < dwSrcLen){
dwSrcData = pSrcData[dwSrcPos] & 0xFF;
+ //printf("Arib:pos%d:%d:%s\n",dwSrcPos,dwSrcData,lpszDst);
if(!m_byEscSeqCount){
- // GL/GRÎΰè
+ // GL/GR領域
if((dwSrcData >= 0x21U) && (dwSrcData <= 0x7EU)){
- // GLÎΰè
+ // GL領域
const CODE_SET CurCodeSet = (m_pSingleGL)? *m_pSingleGL : *m_pLockingGL;
m_pSingleGL = NULL;
if(abCharSizeTable[CurCodeSet]){
- // 2¥Ð¥¤¥È¥³¡¼¥É
+ // 2バイトコード
if((dwSrcLen - dwSrcPos) < 2UL)break;
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], ((WORD)pSrcData[dwSrcPos + 0] << 8) | (WORD)pSrcData[dwSrcPos + 1], CurCodeSet);
dwSrcPos++;
}
else{
- // 1¥Ð¥¤¥È¥³¡¼¥É
+ // 1バイトコード
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], (WORD)dwSrcData, CurCodeSet);
}
}
else if((dwSrcData >= 0xA1U) && (dwSrcData <= 0xFEU)){
- // GRÎΰè
+ // GR領域
const CODE_SET CurCodeSet = *m_pLockingGR;
if(abCharSizeTable[CurCodeSet]){
- // 2¥Ð¥¤¥È¥³¡¼¥É
+ // 2バイトコード
if((dwSrcLen - dwSrcPos) < 2UL)break;
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], ((WORD)(pSrcData[dwSrcPos + 0] & 0x7FU) << 8) | (WORD)(pSrcData[dwSrcPos + 1] & 0x7FU), CurCodeSet);
dwSrcPos++;
}
else{
- // 1¥Ð¥¤¥È¥³¡¼¥É
+ // 1バイトコード
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], (WORD)(dwSrcData & 0x7FU), CurCodeSet);
}
}
else{
- // À©¸æ¥³¡¼¥É
+ // 制御コード
switch(dwSrcData){
case 0x0FU : LockingShiftGL(0U); break; // LS0
case 0x0EU : LockingShiftGL(1U); break; // LS1
case 0x19U : SingleShiftGL(2U); break; // SS2
case 0x1DU : SingleShiftGL(3U); break; // SS3
case 0x1BU : m_byEscSeqCount = 1U; break; // ESC
+ case 0x89U : m_emStrSize = STR_MEDIUM; break; // MSZ
+ case 0x8AU : m_emStrSize = STR_NORMAL; break; // NSZ
case 0x20U :
- case 0xA0U : lpszDst[dwDstLen++] = TEXT(' '); break; // SP
- default : break; // ÈóÂбþ
+ case 0xA0U :
+ //SP 空白
+ //空白は文字サイズの影響あり
+ if( IsSmallCharMode() == false ){
+ strcpy(&lpszDst[dwDstLen], " ");
+ dwDstLen += 3U;
+ } else {
+ lpszDst[dwDstLen++] = TEXT(' ');
+ }
+ break;
+ default : break; // 非対応
}
}
}
else{
- // ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹½èÍý
+ // エスケープシーケンス処理
ProcessEscapeSeq(dwSrcData);
}
dwSrcPos++;
}
- // ½ªÃ¼Ê¸»ú
+ // 終端文字
lpszDst[dwDstLen] = TEXT('\0');
-
return dwDstLen;
}
case CODE_KANJI :
case CODE_JIS_KANJI_PLANE_1 :
case CODE_JIS_KANJI_PLANE_2 :
- // ´Á»ú¥³¡¼¥É½ÐÎÏ
+ // 漢字コード出力
return PutKanjiChar(lpszDst, wCode);
case CODE_ALPHANUMERIC :
case CODE_PROP_ALPHANUMERIC :
- // ±Ñ¿ô»ú¥³¡¼¥É½ÐÎÏ
+ // 英数字コード出力
+ if( IsSmallCharMode() == false ){
+ //全角テーブルコード取得
return PutAlphanumericChar(lpszDst, wCode);
+ } else {
+ //半角はそのまま出力
+ lpszDst[0] = wCode;
+ return 1UL;
+ }
case CODE_HIRAGANA :
case CODE_PROP_HIRAGANA :
- // ¤Ò¤é¤¬¤Ê¥³¡¼¥É½ÐÎÏ
+ // ひらがなコード出力
return PutHiraganaChar(lpszDst, wCode);
case CODE_PROP_KATAKANA :
case CODE_KATAKANA :
- // ¥«¥¿¥«¥Ê¥³¡¼¥É½ÐÎÏ
+ // カタカナコード出力
return PutKatakanaChar(lpszDst, wCode);
case CODE_JIS_X0201_KATAKANA :
- // JIS¥«¥¿¥«¥Ê¥³¡¼¥É½ÐÎÏ
+ // JISカタカナコード出力
return PutJisKatakanaChar(lpszDst, wCode);
-#if 1
+
case CODE_ADDITIONAL_SYMBOLS :
- // Äɲå·¥ó¥Ü¥ë¥³¡¼¥É½ÐÎÏ
+ // 追加シンボルコード出力
return PutSymbolsChar(lpszDst, wCode);
-#endif
+
default :
return 0UL;
}
const DWORD PutKanjiChar(TCHAR *lpszDst, const WORD wCode)
{
- // JIS¢ªShift-JIS´Á»ú¥³¡¼¥ÉÊÑ´¹
- const WORD wShiftJIS = convertjis(wCode);
+ char code[9];
+ char xcode[5];
+ iconv_t cd;
-#ifdef _UNICODE
- // Shift-JIS ¢ª UNICODE
- const char szShiftJIS[3] = {(char)(wShiftJIS >> 8), (char)(wShiftJIS & 0x00FFU), '\0'};
- ::MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, szShiftJIS, 2, lpszDst, 2);
+ size_t inbyte = 8;
+ size_t outbyte = sizeof(xcode);
- return 1UL;
-#else
- // Shift-JIS ¢ª Shift-JIS
- lpszDst[0] = (wShiftJIS >> 8) & 0xFF;
- lpszDst[1] = (char)(wShiftJIS & 0x00FFU);
+ memset(xcode, '\0', sizeof(xcode));
- return 2UL;
-#endif
+ const char *fptr;
+ char *tptr;
+
+ code[0] = 0x1BU;
+ code[1] = 0x24U;
+ code[2] = 0x40U;
+ code[3] = wCode >> 8;
+ code[4] = wCode & 0xFF;
+ code[5] = 0x1BU;
+ code[6] = 0x28U;
+ code[7] = 0x4AU;
+ code[8] = '\0';
+
+ cd = iconv_open("UTF-8","ISO-2022-JP");
+
+ fptr = code;
+ tptr = xcode;
+ iconv(cd, &fptr, &inbyte, &tptr, &outbyte);
+
+ iconv_close(cd);
+
+ strncpy(lpszDst, xcode, strlen(xcode));
+
+ return strlen(lpszDst);
}
const DWORD PutAlphanumericChar(TCHAR *lpszDst, const WORD wCode)
{
- // ±Ñ¿ô»úʸ»ú¥³¡¼¥ÉÊÑ´¹
+ // 英数字全角文字コード変換
static const TCHAR *acAlphanumericTable =
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡ª¡É¡ô¡ð¡ó¡õ¡Ç¡Ê¡Ë¡ö¡Ü¡¤¡Ý¡¥¡¿")
- TEXT("£°£±£²£³£´£µ£¶£·£¸£¹¡§¡¨¡ã¡á¡ä¡©")
- TEXT("¡÷£Á£Â£Ã£Ä£Å£Æ£Ç£È£É£Ê£Ë£Ì£Í£Î£Ï")
- TEXT("£Ð£Ñ£Ò£Ó£Ô£Õ£Ö£×£Ø£Ù£Ú¡Î¡ï¡Ï¡°¡²")
- TEXT("¡¡£á£â£ã£ä£å£æ£ç£è£é£ì£ë£ì£í£î£ï")
- TEXT("£ð£ñ£ò£ó£ô£õ£ö£÷£ø£ù£ú¡Ð¡Ã¡Ñ¡±¡¡");
+ TEXT(" ")
+ TEXT(" ")
+ TEXT(" !”#$%&’()*+,-./")
+ TEXT("0123456789:;<=>?")
+ TEXT("@ABCDEFGHIJKLMNO")
+ TEXT("PQRSTUVWXYZ[¥]^_")
+ TEXT(" abcdefghijklmno")
+ TEXT("pqrstuvwxyz{|} ̄ ");
#ifdef _UNICODE
- lpszDst[0] = acAlphanumericTable[wCode];
+ lpszDst[0] = acAlphanumericTableZenkaku[wCode];
return 1UL;
#else
- lpszDst[0] = acAlphanumericTable[wCode * 2U + 0U];
- lpszDst[1] = acAlphanumericTable[wCode * 2U + 1U];
+ lpszDst[0] = acAlphanumericTable[wCode * 3U + 0U];
+ lpszDst[1] = acAlphanumericTable[wCode * 3U + 1U];
+ lpszDst[2] = acAlphanumericTable[wCode * 3U + 2U];
- return 2UL;
+ return 3UL;
#endif
}
const DWORD PutHiraganaChar(TCHAR *lpszDst, const WORD wCode)
{
- // ¤Ò¤é¤¬¤Êʸ»ú¥³¡¼¥ÉÊÑ´¹
+ // ひらがな文字コード変換
static const TCHAR *acHiraganaTable =
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¤¡¤¢¤£¤¤¤¥¤¦¤§¤¨¤©¤ª¤«¤¬¤¤®¤¯")
- TEXT("¤°¤±¤²¤³¤´¤µ¤¶¤·¤¸¤¹¤º¤»¤¼¤½¤¾¤¿")
- TEXT("¤À¤Á¤Â¤Ã¤Ä¤Å¤Æ¤Ç¤È¤É¤Ê¤Ë¤Ì¤Í¤Î¤Ï")
- TEXT("¤Ð¤Ñ¤Ò¤Ó¤Ô¤Õ¤Ö¤×¤Ø¤Ù¤Ú¤Û¤Ü¤Ý¤Þ¤ß")
- TEXT("¤à¤á¤â¤ã¤ä¤å¤æ¤ç¤è¤é¤ê¤ë¤ì¤í¤î¤ï")
- TEXT("¤ð¤ñ¤ò¤ó¡¡¡¡¡¡¡µ¡¶¡¼¡£¡Ö¡×¡¢¡¦¡¡");
+ TEXT(" ")
+ TEXT(" ")
+ TEXT(" ぁあぃいぅうぇえぉおかがきぎく")
+ TEXT("ぐけげこごさざしじすずせぜそぞた")
+ TEXT("だちぢっつづてでとどなにぬねのは")
+ TEXT("ばぱひびぴふぶぷへべぺほぼぽまみ")
+ TEXT("むめもゃやゅゆょよらりるれろゎわ")
+ TEXT("ゐゑをん ゝゞー。「」、・ ");
#ifdef _UNICODE
lpszDst[0] = acHiraganaTable[wCode];
return 1UL;
#else
- lpszDst[0] = acHiraganaTable[wCode * 2U + 0U];
- lpszDst[1] = acHiraganaTable[wCode * 2U + 1U];
+ lpszDst[0] = acHiraganaTable[wCode * 3U + 0U];
+ lpszDst[1] = acHiraganaTable[wCode * 3U + 1U];
+ lpszDst[2] = acHiraganaTable[wCode * 3U + 2U];
- return 2UL;
+ return 3UL;
#endif
}
const DWORD PutKatakanaChar(TCHAR *lpszDst, const WORD wCode)
{
- // ¥«¥¿¥«¥Ê±Ñ¿ô»úʸ»ú¥³¡¼¥ÉÊÑ´¹
+ // カタカナ英数字文字コード変換
static const TCHAR *acKatakanaTable =
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¥¡¥¢¥£¥¤¥¥¥¦¥§¥¨¥©¥ª¥«¥¬¥¥®¥¯")
- TEXT("¥°¥±¥²¥³¥´¥µ¥¶¥·¥¸¥¹¥º¥»¥¼¥½¥¾¥¿")
- TEXT("¥À¥Á¥Â¥Ã¥Ä¥Å¥Æ¥Ç¥È¥É¥Ê¥Ë¥Ì¥Í¥Î¥Ï")
- TEXT("¥Ð¥Ñ¥Ò¥Ó¥Ô¥Õ¥Ö¥×¥Ø¥Ù¥Ú¥Û¥Ü¥Ý¥Þ¥ß")
- TEXT("¥à¥á¥â¥ã¥ä¥å¥æ¥ç¥è¥é¥ê¥ë¥ì¥í¥î¥ï")
- TEXT("¥ð¥ñ¥ò¥ó¥ô¥õ¥ö¡³¡´¡¼¡£¡Ö¡×¡¢¡¦¡¡");
+ TEXT(" ")
+ TEXT(" ")
+ TEXT("ã\80\80ã\82¡ã\82¢ã\82£ã\82¤ã\82¥ã\82¦ã\82§ã\82¨ã\82©ã\82ªã\82«ã\82¬ã\82ã\82®ã\82¯")
+ TEXT("ã\82°ã\82±ã\82²ã\82³ã\82´ã\82µã\82¶ã\82·ã\82¸ã\82¹ã\82ºã\82»ã\82¼ã\82½ã\82¾ã\82¿")
+ TEXT("ダチヂッツヅテデトドナニヌネノハ")
+ TEXT("バパヒビピフブプヘベペホボポマミ")
+ TEXT("ムメモャヤュユョヨラリルレロヮワ")
+ TEXT("ヰヱヲンヴヵヶヽヾー。「」、・ ");
#ifdef _UNICODE
lpszDst[0] = acKatakanaTable[wCode];
return 1UL;
#else
- lpszDst[0] = acKatakanaTable[wCode * 2U + 0U];
- lpszDst[1] = acKatakanaTable[wCode * 2U + 1U];
+ lpszDst[0] = acKatakanaTable[wCode * 3U + 0U];
+ lpszDst[1] = acKatakanaTable[wCode * 3U + 1U];
+ lpszDst[2] = acKatakanaTable[wCode * 3U + 2U];
- return 2UL;
+ return 3UL;
#endif
}
const DWORD PutJisKatakanaChar(TCHAR *lpszDst, const WORD wCode)
{
- // JIS¥«¥¿¥«¥Êʸ»ú¥³¡¼¥ÉÊÑ´¹
+ // JISカタカナ文字コード変換
static const TCHAR *acJisKatakanaTable =
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡£¡Ö¡×¡¢¡¦¥ò¥¡¥£¥¥¥§¥©¥ã¥å¥ç¥Ã")
- TEXT("¡¼¥¢¥¤¥¦¥¨¥ª¥«¥¥¯¥±¥³¥µ¥·¥¹¥»¥½")
- TEXT("¥¿¥Á¥Ä¥Æ¥È¥Ê¥Ë¥Ì¥Í¥Î¥Ï¥Ò¥Õ¥Ø¥Û¥Þ")
- TEXT("¥ß¥à¥á¥â¥ä¥æ¥è¥é¥ê¥ë¥ì¥í¥ï¥ó¡«¡¬")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡")
- TEXT("¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡");
+ TEXT(" ")
+ TEXT(" ")
+ TEXT(" 。「」、・ヲァィゥェォャュョッ")
+ TEXT("ã\83¼ã\82¢ã\82¤ã\82¦ã\82¨ã\82ªã\82«ã\82ã\82¯ã\82±ã\82³ã\82µã\82·ã\82¹ã\82»ã\82½")
+ TEXT("タチツテトナニヌネノハヒフヘホマ")
+ TEXT("ミムメモヤユヨラリルレロワン゛゜")
+ TEXT(" ")
+ TEXT(" ");
#ifdef _UNICODE
lpszDst[0] = acJisKatakanaTable[wCode];
return 1UL;
#else
- lpszDst[0] = acJisKatakanaTable[wCode * 2U + 0U];
- lpszDst[1] = acJisKatakanaTable[wCode * 2U + 1U];
+ lpszDst[0] = acJisKatakanaTable[wCode * 3U + 0U];
+ lpszDst[1] = acJisKatakanaTable[wCode * 3U + 1U];
+ lpszDst[2] = acJisKatakanaTable[wCode * 3U + 2U];
- return 2UL;
+ return 3UL;
#endif
}
const DWORD PutSymbolsChar(TCHAR *lpszDst, const WORD wCode)
{
- // Äɲå·¥ó¥Ü¥ëʸ»ú¥³¡¼¥ÉÊÑ´¹(¤È¤ê¤¢¤¨¤ºÉ¬Íפ½¤¦¤Ê¤â¤Î¤À¤±)
+ // 追加シンボル文字コード変換(とりあえず必要そうなものだけ)
static const TCHAR *aszSymbolsTable1[] =
{
- _T("[HV]"), _T("[SD]"), _T("[£Ð]"), _T("[£×]"), _T("[MV]"), _T("[¼ê]"), _T("[»ú]"), _T("[ÁÐ]"), // 0x7A50 - 0x7A57 90/48 - 90/55
- _T("[¥Ç]"), _T("[£Ó]"), _T("[Æó]"), _T("[¿]"), _T("[²ò]"), _T("[SS]"), _T("[£Â]"), _T("[£Î]"), // 0x7A58 - 0x7A5F 90/56 - 90/63
- _T("¢£"), _T("¡ü"), _T("[Å·]"), _T("[¸ò]"), _T("[±Ç]"), _T("[̵]"), _T("[ÎÁ]"), _T("[ǯÎðÀ©¸Â]"), // 0x7A60 - 0x7A67 90/64 - 90/71
- _T("[Á°]"), _T("[¸å]"), _T("[ºÆ]"), _T("[¿·]"), _T("[½é]"), _T("[½ª]"), _T("[À¸]"), _T("[ÈÎ]"), // 0x7A68 - 0x7A6F 90/72 - 90/79
- _T("[À¼]"), _T("[¿á]"), _T("[PPV]"), _T("(Èë)"), _T("¤Û¤«") // 0x7A70 - 0x7A74 90/80 - 90/84
+ _T("[HV]"), _T("[SD]"), _T("[P]"), _T("[W]"), _T("[MV]"), _T("[手]"), _T("[字]"), _T("[双]"), // 0x7A50 - 0x7A57 90/48 - 90/55
+ _T("[デ]"), _T("[S]"), _T("[二]"), _T("[多]"), _T("[解]"), _T("[SS]"), _T("[B]"), _T("[N]"), // 0x7A58 - 0x7A5F 90/56 - 90/63
+ _T("■"), _T("●"), _T("[天]"), _T("[交]"), _T("[映]"), _T("[無]"), _T("[料]"), _T("[年齢制限]"), // 0x7A60 - 0x7A67 90/64 - 90/71
+ _T("[前]"), _T("[後]"), _T("[再]"), _T("[新]"), _T("[初]"), _T("[終]"), _T("[生]"), _T("[販]"), // 0x7A68 - 0x7A6F 90/72 - 90/79
+ _T("[声]"), _T("[吹]"), _T("[PPV]"), _T("(秘)"), _T("ほか") // 0x7A70 - 0x7A74 90/80 - 90/84
};
static const TCHAR *aszSymbolsTable2[] =
{
- _T("¢ª"), _T("¢«"), _T("¢¬"), _T("¢"), _T("¡ü"), _T("¡û"), _T("ǯ"), _T("·î"), // 0x7C21 - 0x7C28 92/01 - 92/08
- _T("Æü"), _T("±ß"), _T("Ö"), _T("ΩÊý£í"), _T("Ñ"), _T("Ê¿ÊýÑ"), _T("ΩÊýÑ"), _T("£°."), // 0x7C29 - 0x7C30 92/09 - 92/16
- _T("£±."), _T("£²."), _T("£³."), _T("£´."), _T("£µ."), _T("£¶."), _T("£·."), _T("£¸."), // 0x7C31 - 0x7C38 92/17 - 92/24
- _T("£¹."), _T("»á"), _T("Éû"), _T("¸µ"), _T("¸Î"), _T("Á°"), _T("¿·"), _T("£°,"), // 0x7C39 - 0x7C40 92/25 - 92/32
- _T("£±,"), _T("£²,"), _T("£³,"), _T("£´,"), _T("£µ,"), _T("£¶,"), _T("£·,"), _T("£¸,"), // 0x7C41 - 0x7C48 92/33 - 92/40
- _T("£¹,"), _T("(¼Ò)"), _T("(ºâ)"), _T("(Í)"), _T("(³ô)"), _T("(Âå)"), _T("(Ìä)"), _T("¡ä"), // 0x7C49 - 0x7C50 92/41 - 92/48
- _T("¡ã"), _T("¡Ú"), _T("¡Û"), _T("¡þ"), _T("^2"), _T("^3"), _T("(CD)"), _T("(vn)"), // 0x7C51 - 0x7C58 92/49 - 92/56
+ _T("→"), _T("←"), _T("↑"), _T("↓"), _T("●"), _T("○"), _T("年"), _T("月"), // 0x7C21 - 0x7C28 92/01 - 92/08
+ _T("日"), _T("円"), _T("㎡"), _T("㎥"), _T("㎝"), _T("㎠"), _T("㎤"), _T("0."), // 0x7C29 - 0x7C30 92/09 - 92/16
+ _T("1."), _T("2."), _T("3."), _T("4."), _T("5."), _T("6."), _T("7."), _T("8."), // 0x7C31 - 0x7C38 92/17 - 92/24
+ _T("9."), _T("氏"), _T("副"), _T("元"), _T("故"), _T("前"), _T("新"), _T("0,"), // 0x7C39 - 0x7C40 92/25 - 92/32
+ _T("1,"), _T("2,"), _T("3,"), _T("4,"), _T("5,"), _T("6,"), _T("7,"), _T("8,"), // 0x7C41 - 0x7C48 92/33 - 92/40
+ _T("9,"), _T("(社)"), _T("(財)"), _T("(有)"), _T("(株)"), _T("(代)"), _T("(問)"), _T("▶"), // 0x7C49 - 0x7C50 92/41 - 92/48
+ _T("◀"), _T("〖"), _T("〗"), _T("⟐"), _T("^2"), _T("^3"), _T("(CD)"), _T("(vn)"), // 0x7C51 - 0x7C58 92/49 - 92/56
_T("(ob)"), _T("(cb)"), _T("(ce"), _T("mb)"), _T("(hp)"), _T("(br)"), _T("(p)"), _T("(s)"), // 0x7C59 - 0x7C60 92/57 - 92/64
_T("(ms)"), _T("(t)"), _T("(bs)"), _T("(b)"), _T("(tb)"), _T("(tp)"), _T("(ds)"), _T("(ag)"), // 0x7C61 - 0x7C68 92/65 - 92/72
_T("(eg)"), _T("(vo)"), _T("(fl)"), _T("(ke"), _T("y)"), _T("(sa"), _T("x)"), _T("(sy"), // 0x7C69 - 0x7C70 92/73 - 92/80
- _T("n)"), _T("(or"), _T("g)"), _T("(pe"), _T("r)"), _T("(R)"), _T("(C)"), _T("(ä·)"), // 0x7C71 - 0x7C78 92/81 - 92/88
- _T("DJ"), _T("[±é]"), _T("Fax") // 0x7C79 - 0x7C7B 92/89 - 92/91
+ _T("n)"), _T("(or"), _T("g)"), _T("(pe"), _T("r)"), _T("(R)"), _T("(C)"), _T("(箏)"), // 0x7C71 - 0x7C78 92/81 - 92/88
+ _T("DJ"), _T("[演]"), _T("Fax") // 0x7C79 - 0x7C7B 92/89 - 92/91
};
static const TCHAR *aszSymbolsTable3[] =
{
- _T("(·î)"), _T("(²Ð)"), _T("(¿å)"), _T("(ÌÚ)"), _T("(¶â)"), _T("(ÅÚ)"), _T("(Æü)"), _T("(½Ë)"), // 0x7D21 - 0x7D28 93/01 - 93/08
- _T("í"), _T("î"), _T("ï"), _T("ß"), _T("â"), _T("ä"), _T("(¢©)"), _T("¡û"), // 0x7D29 - 0x7D30 93/09 - 93/16
- _T("¡ÌËÜ¡Í"), _T("¡Ì»°¡Í"), _T("¡ÌÆó¡Í"), _T("¡Ì°Â¡Í"), _T("¡ÌÅÀ¡Í"), _T("¡ÌÂÇ¡Í"), _T("¡ÌÅð¡Í"), _T("¡Ì¾¡¡Í"), // 0x7D31 - 0x7D38 93/17 - 93/24
- _T("¡ÌÇÔ¡Í"), _T("¡Ì£Ó¡Í"), _T("¡ÎÅê¡Ï"), _T("¡ÎÊá¡Ï"), _T("¡Î°ì¡Ï"), _T("¡ÎÆó¡Ï"), _T("¡Î»°¡Ï"), _T("¡ÎÍ·¡Ï"), // 0x7D39 - 0x7D40 93/25 - 93/32
- _T("¡Îº¸¡Ï"), _T("¡ÎÃæ¡Ï"), _T("¡Î±¦¡Ï"), _T("¡Î»Ø¡Ï"), _T("¡ÎÁö¡Ï"), _T("¡ÎÂÇ¡Ï"), _T("È"), _T("Ô"), // 0x7D41 - 0x7D48 93/33 - 93/40
- _T("Hz"), _T("ha"), _T("km"), _T("Ê¿Êýkm"), _T("hPa"), _T("¡¦"), _T("¡¦"), _T("1/2"), // 0x7D49 - 0x7D50 93/41 - 93/48
+ _T("㈪"), _T("㈫"), _T("㈬"), _T("㈭"), _T("㈮"), _T("㈯"), _T("㈰"), _T("㈷"), // 0x7D21 - 0x7D28 93/01 - 93/08
+ _T("㍾"), _T("㍽"), _T("㍼"), _T("㍻"), _T("№"), _T("℡"), _T("〶"), _T("○"), // 0x7D29 - 0x7D30 93/09 - 93/16
+ _T("〔本〕"), _T("〔三〕"), _T("〔二〕"), _T("〔安〕"), _T("〔点〕"), _T("〔打〕"), _T("〔盗〕"), _T("〔勝〕"), // 0x7D31 - 0x7D38 93/17 - 93/24
+ _T("〔敗〕"), _T("〔S〕"), _T("[投]"), _T("[捕]"), _T("[一]"), _T("[二]"), _T("[三]"), _T("[遊]"), // 0x7D39 - 0x7D40 93/25 - 93/32
+ _T("[左]"), _T("[中]"), _T("[右]"), _T("[指]"), _T("[走]"), _T("[打]"), _T("㍑"), _T("㎏"), // 0x7D41 - 0x7D48 93/33 - 93/40
+ _T("㎐"), _T("ha"), _T("㎞"), _T("㎢"), _T("㍱"), _T("・"), _T("・"), _T("1/2"), // 0x7D49 - 0x7D50 93/41 - 93/48
_T("0/3"), _T("1/3"), _T("2/3"), _T("1/4"), _T("3/4"), _T("1/5"), _T("2/5"), _T("3/5"), // 0x7D51 - 0x7D58 93/49 - 93/56
- _T("4/5"), _T("1/6"), _T("5/6"), _T("1/7"), _T("1/8"), _T("1/9"), _T("1/10"), _T("À²¤ì"), // 0x7D59 - 0x7D60 93/57 - 93/64
- _T("ÆÞ¤ê"), _T("±«"), _T("Àã"), _T("¢¤"), _T("¢¥"), _T("¢¦"), _T("¢§"), _T("¢¡"), // 0x7D61 - 0x7D68 93/65 - 93/72
- _T("¡¦"), _T("¡¦"), _T("¡¦"), _T("¡þ"), _T("¡ý"), _T("!!"), _T("!?"), _T("ÆÞ/À²"), // 0x7D69 - 0x7D70 93/73 - 93/80
- _T("±«"), _T("±«"), _T("Àã"), _T("ÂçÀã"), _T("Íë"), _T("Í뱫"), _T("¡¡"), _T("¡¦"), // 0x7D71 - 0x7D78 93/81 - 93/88
- _T("¡¦"), _T("¢ö"), _T("ä") // 0x7D79 - 0x7D7B 93/89 - 93/91
+ _T("4/5"), _T("1/6"), _T("5/6"), _T("1/7"), _T("1/8"), _T("1/9"), _T("1/10"), _T("☀"), // 0x7D59 - 0x7D60 93/57 - 93/64
+ _T("☁"), _T("☂"), _T("☃"), _T("☖"), _T("☗"), _T("▽"), _T("▼"), _T("♦"), // 0x7D61 - 0x7D68 93/65 - 93/72
+ _T("♥"), _T("♣"), _T("♠"), _T("⌺"), _T("⦿"), _T("‼"), _T("⁉"), _T("(曇/晴)"), // 0x7D69 - 0x7D70 93/73 - 93/80
+ _T("☔"), _T("(雨)"), _T("(雪)"), _T("(大雪)"), _T("⚡"), _T("(雷雨)"), _T(" "), _T("・"), // 0x7D71 - 0x7D78 93/81 - 93/88
+ _T("・"), _T("♬"), _T("☎") // 0x7D79 - 0x7D7B 93/89 - 93/91
};
static const TCHAR *aszSymbolsTable4[] =
{
- _T("µ"), _T("¶"), _T("·"), _T("¸"), _T("¹"), _T("º"), _T("»"), _T("¼"), // 0x7E21 - 0x7E28 94/01 - 94/08
- _T("½"), _T("¾"), _T("XI"), _T("X¶"), _T("±"), _T("²"), _T("³"), _T("´"), // 0x7E29 - 0x7E30 94/09 - 94/16
- _T("(1)"), _T("(2)"), _T("(3)"), _T("(4)"), _T("(5)"), _T("(6)"), _T("(7)"), _T("(8)"), // 0x7E31 - 0x7E38 94/17 - 94/24
- _T("(9)"), _T("(10)"), _T("(11)"), _T("(12)"), _T("(21)"), _T("(22)"), _T("(23)"), _T("(24)"), // 0x7E39 - 0x7E40 94/25 - 94/32
+ _T("Ⅰ"), _T("Ⅱ"), _T("Ⅲ"), _T("Ⅳ"), _T("Ⅴ"), _T("Ⅵ"), _T("Ⅶ"), _T("Ⅷ"), // 0x7E21 - 0x7E28 94/01 - 94/08
+ _T("Ⅸ"), _T("Ⅹ"), _T("Ⅺ"), _T("Ⅻ"), _T("⑰"), _T("⑱"), _T("⑲"), _T("⑳"), // 0x7E29 - 0x7E30 94/09 - 94/16
+ _T("⑴"), _T("⑵"), _T("⑶"), _T("⑷"), _T("⑸"), _T("⑹"), _T("⑺"), _T("⑻"), // 0x7E31 - 0x7E38 94/17 - 94/24
+ _T("⑼"), _T("⑽"), _T("⑾"), _T("⑿"), _T("㉑"), _T("㉒"), _T("㉓"), _T("㉔"), // 0x7E39 - 0x7E40 94/25 - 94/32
_T("(A)"), _T("(B)"), _T("(C)"), _T("(D)"), _T("(E)"), _T("(F)"), _T("(G)"), _T("(H)"), // 0x7E41 - 0x7E48 94/33 - 94/40
_T("(I)"), _T("(J)"), _T("(K)"), _T("(L)"), _T("(M)"), _T("(N)"), _T("(O)"), _T("(P)"), // 0x7E49 - 0x7E50 94/41 - 94/48
_T("(Q)"), _T("(R)"), _T("(S)"), _T("(T)"), _T("(U)"), _T("(V)"), _T("(W)"), _T("(X)"), // 0x7E51 - 0x7E58 94/49 - 94/56
- _T("(Y)"), _T("(Z)"), _T("(25)"), _T("(26)"), _T("(27)"), _T("(28)"), _T("(29)"), _T("(30)"), // 0x7E59 - 0x7E60 94/57 - 94/64
- _T("¡"), _T("¢"), _T("£"), _T("¤"), _T("¥"), _T("¦"), _T("§"), _T("¨"), // 0x7E61 - 0x7E68 94/65 - 94/72
- _T("©"), _T("ª"), _T("«"), _T("¬"), _T(""), _T("®"), _T("¯"), _T("°"), // 0x7E69 - 0x7E70 94/73 - 94/80
- _T("¡"), _T("¢"), _T("£"), _T("¤"), _T("¥"), _T("¦"), _T("§"), _T("¨"), // 0x7E71 - 0x7E78 94/81 - 94/88
- _T("©"), _T("ª"), _T("«"), _T("¬"), _T("(31)") // 0x7E79 - 0x7E7D 94/89 - 94/93
+ _T("(Y)"), _T("(Z)"), _T("㉕"), _T("㉖"), _T("㉗"), _T("㉘"), _T("㉙"), _T("㉚"), // 0x7E59 - 0x7E60 94/57 - 94/64
+ _T("①"), _T("②"), _T("③"), _T("④"), _T("⑤"), _T("⑥"), _T("⑦"), _T("⑧"), // 0x7E61 - 0x7E68 94/65 - 94/72
+ _T("⑨"), _T("⑩"), _T("⑪"), _T("⑫"), _T("⑬"), _T("⑭"), _T("⑮"), _T("⑯"), // 0x7E69 - 0x7E70 94/73 - 94/80
+ _T("❶"), _T("❷"), _T("❸"), _T("❹"), _T("❺"), _T("❻"), _T("❼"), _T("❽"), // 0x7E71 - 0x7E78 94/81 - 94/88
+ _T("❾"), _T("❿"), _T("⓫"), _T("⓬"), _T("㉛") // 0x7E79 - 0x7E7D 94/89 - 94/93
};
- // ¥·¥ó¥Ü¥ë¤òÊÑ´¹¤¹¤ë
+ static const TCHAR *aszSymbolsTable5[] =
+ {
+ _T("㐂"), _T("亭"), _T("份"), _T("仿"), _T("侚"), _T("俉"), _T("傜"), _T("儞"), // 0x7521 - 0x7528 85/01 - 85/08
+ _T("冼"), _T("㔟"), _T("匇"), _T("卡"), _T("卬"), _T("詹"), _T("吉"), _T("呍"), // 0x7529 - 0x7530 85/09 - 85/16
+ _T("咖"), _T("咜"), _T("咩"), _T("唎"), _T("啊"), _T("噲"), _T("囤"), _T("圳"), // 0x7531 - 0x7538 85/17 - 85/24
+ _T("圴"), _T("塚"), _T("墀"), _T("姤"), _T("娣"), _T("婕"), _T("寬"), _T("﨑"), // 0x7539 - 0x7540 85/25 - 85/32
+ _T("㟢"), _T("庬"), _T("弴"), _T("彅"), _T("德"), _T("怗"), _T("恵"), _T("愰"), // 0x7541 - 0x7548 85/33 - 85/40
+ _T("昤"), _T("曈"), _T("曙"), _T("曺"), _T("曻"), _T("桒"), _T("・"), _T("椑"), // 0x7549 - 0x7550 85/41 - 85/48
+ _T("椻"), _T("橅"), _T("檑"), _T("櫛"), _T("・"), _T("・"), _T("・"), _T("毱"), // 0x7551 - 0x7558 85/49 - 85/56
+ _T("泠"), _T("洮"), _T("海"), _T("涿"), _T("淊"), _T("淸"), _T("渚"), _T("潞"), // 0x7559 - 0x7560 85/57 - 85/64
+ _T("濹"), _T("灤"), _T("・"), _T("・"), _T("煇"), _T("燁"), _T("爀"), _T("玟"), // 0x7561 - 0x7568 85/65 - 85/72
+ _T("・"), _T("珉"), _T("珖"), _T("琛"), _T("琡"), _T("琢"), _T("琦"), _T("琪"), // 0x7569 - 0x7570 85/73 - 85/80
+ _T("琬"), _T("琹"), _T("瑋"), _T("㻚"), _T("畵"), _T("疁"), _T("睲"), _T("䂓"), // 0x7571 - 0x7578 85/81 - 85/88
+ _T("磈"), _T("磠"), _T("祇"), _T("禮"), _T("・"), _T("・") // 0x7579 - 0x757E 85/89 - 85/94
+ };
+
+ static const TCHAR *aszSymbolsTable6[] =
+ {
+ _T("・"), _T("秚"), _T("稞"), _T("筿"), _T("簱"), _T("䉤"), _T("綋"), _T("羡"), // 0x7621 - 0x7628 86/01 - 86/08
+ _T("脘"), _T("脺"), _T("・"), _T("芮"), _T("葛"), _T("蓜"), _T("蓬"), _T("蕙"), // 0x7629 - 0x7630 86/09 - 86/16
+ _T("藎"), _T("蝕"), _T("蟬"), _T("蠋"), _T("裵"), _T("角"), _T("諶"), _T("跎"), // 0x7631 - 0x7638 86/17 - 86/24
+ _T("辻"), _T("迶"), _T("郝"), _T("鄧"), _T("鄭"), _T("醲"), _T("鈳"), _T("銈"), // 0x7639 - 0x7640 86/25 - 86/32
+ _T("錡"), _T("鍈"), _T("閒"), _T("雞"), _T("餃"), _T("饀"), _T("髙"), _T("鯖"), // 0x7641 - 0x7648 86/33 - 86/40
+ _T("鷗"), _T("麴"), _T("麵") // 0x7649 - 0x764B 86/41 - 86/43
+ };
+
+ // シンボルを変換する
if((wCode >= 0x7A50U) && (wCode <= 0x7A74U)){
strcpy(lpszDst, aszSymbolsTable1[wCode - 0x7A50U]);
}
else if((wCode >= 0x7E21U) && (wCode <= 0x7E7DU)){
strcpy(lpszDst, aszSymbolsTable4[wCode - 0x7E21U]);
}
+ else if((wCode >= 0x7521U) && (wCode <= 0x757EU)){
+ strcpy(lpszDst, aszSymbolsTable5[wCode - 0x7521U]);
+ }
+ else if((wCode >= 0x7621U) && (wCode <= 0x764BU)){
+ strcpy(lpszDst, aszSymbolsTable6[wCode - 0x7621U]);
+ }
else{
- strcpy(lpszDst, TEXT("¡¦"));
+ strcpy(lpszDst, TEXT("・"));
}
return strlen(lpszDst);
void ProcessEscapeSeq(const BYTE byCode)
{
- // ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹½èÍý
+ // エスケープシーケンス処理
switch(m_byEscSeqCount){
- // 1¥Ð¥¤¥ÈÌÜ
+ // 1バイト目
case 1U :
switch(byCode){
// Invocation of code elements
case 0x29U : m_byEscSeqIndex = 1U; break;
case 0x2AU : m_byEscSeqIndex = 2U; break;
case 0x2BU : m_byEscSeqIndex = 3U; break;
- default : m_byEscSeqCount = 0U; return; // ¥¨¥é¡¼
+ default : m_byEscSeqCount = 0U; return; // ã\82¨ã\83©ã\83¼
}
break;
- // 2¥Ð¥¤¥ÈÌÜ
+ // 2バイト目
case 2U :
if(DesignationGSET(m_byEscSeqIndex, byCode)){
m_byEscSeqCount = 0U;
case 0x29 : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 1U; break;
case 0x2A : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 2U; break;
case 0x2B : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 3U; break;
- default : m_byEscSeqCount = 0U; return; // ¥¨¥é¡¼
+ default : m_byEscSeqCount = 0U; return; // ã\82¨ã\83©ã\83¼
}
break;
- // 3¥Ð¥¤¥ÈÌÜ
+ // 3バイト目
case 3U :
if(!m_bIsEscSeqDrcs){
if(DesignationGSET(m_byEscSeqIndex, byCode)){
m_bIsEscSeqDrcs = true;
}
else{
- // ¥¨¥é¡¼
+ // ã\82¨ã\83©ã\83¼
m_byEscSeqCount = 0U;
return;
}
break;
- // 4¥Ð¥¤¥ÈÌÜ
+ // 4バイト目
case 4U :
DesignationDRCS(m_byEscSeqIndex, byCode);
m_byEscSeqCount = 0U;
const bool DesignationGSET(const BYTE byIndexG, const BYTE byCode)
{
- // G¤Î¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È¤ò³ä¤êÅö¤Æ¤ë
+ // Gのグラフィックセットを割り当てる
switch(byCode){
case 0x42U : m_CodeG[byIndexG] = CODE_KANJI; return true; // Kanji
case 0x4AU : m_CodeG[byIndexG] = CODE_ALPHANUMERIC; return true; // Alphanumeric
case 0x39U : m_CodeG[byIndexG] = CODE_JIS_KANJI_PLANE_1; return true; // JIS compatible Kanji Plane 1
case 0x3AU : m_CodeG[byIndexG] = CODE_JIS_KANJI_PLANE_2; return true; // JIS compatible Kanji Plane 2
case 0x3BU : m_CodeG[byIndexG] = CODE_ADDITIONAL_SYMBOLS; return true; // Additional symbols
- default : return false; // ÉÔÌÀ¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È
+ default : return false; // 不明なグラフィックセット
}
}
const bool DesignationDRCS(const BYTE byIndexG, const BYTE byCode)
{
- // DRCS¤Î¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È¤ò³ä¤êÅö¤Æ¤ë
+ // DRCSのグラフィックセットを割り当てる
switch(byCode){
case 0x40U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; // DRCS-0
case 0x41U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; // DRCS-1
case 0x4EU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; // DRCS-14
case 0x4FU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; // DRCS-15
case 0x70U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; // Macro
- default : return false; // ÉÔÌÀ¤Ê¥°¥é¥Õ¥£¥Ã¥¯¥»¥Ã¥È
- }
+ default : return false; // 不明なグラフィックセット
}
-
-WORD convertjis(DWORD jiscode) {
- char code[3];
- char xcode[4];
- iconv_t cd;
-
- size_t inbyte = 2;
- size_t outbyte = 4;
-
- const char *fptr;
- char *tptr;
-
- WORD rtn;
-
- code[0] = jiscode >> 8;
- code[1] = jiscode & 0xFF;
- code[3] = '\0';
-
- /*
- cd = iconv_open("ISO-2022-JP","UTF-8");
-
- fptr = code;
- tptr = xcode;
- iconv(cd, &fptr, &inbyte, &tptr, &outbyte);
-
- iconv_close(cd);
- */
-
- xcode[0] = code[0] | 0x80;
- xcode[1] = code[1] | 0x80;
-
- rtn = ((xcode[0] << 8) & 0xFF00) | (xcode[1] & 0xFF);
-
- return rtn;
-
}
+// -*- tab-width:4 -*-
+// see TR-B14 4-296 (p.318)
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "eit.h"
char *subtitle_cnv_str[] = {
-// "¡¡Âè",
-// "¡¼Âè",
-// "-Âè",
-// " Âè",
-// "¡¡¡Ö",
-// "¡¡¡ô",
-// "¡Ê",
-// "¡Ö",
NULL
};
static void timecmp(int *,int *,int *,
int, int, int);
+void append_desc(EIT_CONTROL* eittop, int service_id, int event_id, EEVTDitem* eevtitem);
int parseEIThead(unsigned char *data, EIThead *h) {
int boff = 0;
b->free_CA_mode = getBit(data, &boff, 1);
b->descriptors_loop_length = getBit(data, &boff, 12);
- /* ÆüÉÕÊÑ´¹ */
+ /* 日付変換 */
tnum = (b->start_time[0] & 0xFF) << 8 | (b->start_time[1] & 0xFF);
b->yy = (tnum - 15078.2) / 365.25;
b->dhh = b->dhm = b->dss = 0;
}else{
memset(buf, '\0', sizeof(buf));
- sprintf(buf, "%x", b->duration[0]);
- b->dhh = atoi(buf);
+ sprintf(buf, "%x", b->duration[0]);
+ b->dhh = atoi(buf);
memset(buf, '\0', sizeof(buf));
- sprintf(buf, "%x", b->duration[1]);
- b->dhm = atoi(buf);
+ sprintf(buf, "%x", b->duration[1]);
+ b->dhm = atoi(buf);
memset(buf, '\0', sizeof(buf));
- sprintf(buf, "%x", b->duration[2]);
- b->dss = atoi(buf);
+ sprintf(buf, "%x", b->duration[2]);
+ b->dss = atoi(buf);
}
return 12;
}
return -1;
}
desc->descriptor_length = getBit(data, &boff, 8);
- memcpy(desc->content, data+(boff/8), desc->descriptor_length);
- //getStr(desc->content, data, &boff, desc->descriptor_length);
+ //memcpy(desc->content, data+(boff/8), desc->descriptor_length);
+ // FIXME: 1つ目のコンテント記述子のみパース
+ desc->content_nibble_level_1 = getBit(data, &boff, 4);
+ desc->content_nibble_level_2 = getBit(data, &boff, 4);
+ desc->user_nibble_1 = getBit(data, &boff, 4);
+ desc->user_nibble_2 = getBit(data, &boff, 4);
return desc->descriptor_length + 2;
}
return desc->descriptor_length + 2;
}
+int parseComponentDesc(unsigned char *data, ComponentDesc *desc) {
+ int boff = 0;
+
+ memset(desc, 0, sizeof(ComponentDesc));
+
+ desc->descriptor_tag = getBit(data, &boff, 8);
+ if((desc->descriptor_tag & 0xFF) != 0x50) {
+ return -1;
+ }
+ desc->descriptor_length = getBit(data, &boff, 8);
+ desc->reserved_future_use = getBit(data, &boff, 4);
+ desc->stream_content = getBit(data, &boff, 4);
+ desc->component_type = getBit(data, &boff, 8);
+ desc->component_tag = getBit(data, &boff, 8);
+ memcpy(desc->ISO_639_language_code, data + boff / 8, 3);
+ boff += 24;
+ getStr(desc->text_char, data, &boff, desc->descriptor_length - 6);
+ return desc->descriptor_length + 2;
+}
+
+int parseAudioComponentDesc(unsigned char *data, AudioComponentDesc *desc) {
+ int boff = 0;
+
+ memset(desc, 0, sizeof(AudioComponentDesc));
+
+ desc->descriptor_tag = getBit(data, &boff, 8);
+ if((desc->descriptor_tag & 0xFF) != 0xC4) {
+ return -1;
+ }
+ desc->descriptor_length = getBit(data, &boff, 8);
+ desc->reserved_future_use_1 = getBit(data, &boff, 4);
+ desc->stream_content = getBit(data, &boff, 4);
+ desc->component_type = getBit(data, &boff, 8);
+ desc->component_tag = getBit(data, &boff, 8);
+ desc->stream_type = getBit(data, &boff, 8);
+ desc->simulcast_group_tag = getBit(data, &boff, 8);
+ desc->ES_multi_lingual_flag = getBit(data, &boff, 1);
+ desc->main_component_flag = getBit(data, &boff, 1);
+ desc->quality_indicator = getBit(data, &boff, 2);
+ desc->sampling_rate = getBit(data, &boff, 3);
+ desc->reserved_future_use_2 = getBit(data, &boff, 1);
+ memcpy(desc->ISO_639_language_code_1, data + boff / 8, 3);
+ boff += 24;
+ memcpy(desc->ISO_639_language_code_2, data + boff / 8, 3);
+ boff += 24;
+ getStr(desc->text_char, data, &boff, desc->descriptor_length - desc->ES_multi_lingual_flag ? 12 : 9);
+ return desc->descriptor_length + 2;
+}
+
+char* parseComponentDescType(int componentDescType) {
+ static char str[MAXSECLEN];
+ memset(str, '\0', sizeof(str));
+ char *strpart;
+
+ switch (componentDescType & 0xF0) {
+ case 0x00 :
+ strpart = "映像480i ";
+ break;
+ case 0x90 :
+ strpart = "映像2160p ";
+ break;
+ case 0xA0 :
+ strpart = "映像480p ";
+ break;
+ case 0xB0 :
+ strpart = "映像1080i ";
+ break;
+ case 0xC0 :
+ strpart = "映像720p ";
+ break;
+ case 0xD0 :
+ strpart = "映像240p ";
+ break;
+ case 0xE0 :
+ strpart = "映像1080p ";
+ break;
+ default :
+ strpart = "映像不明 ";
+ break;
+ }
+ strcat(str, strpart);
+
+ switch (componentDescType & 0x0F) {
+ case 0x01 :
+ strpart = "アスペクト比4:3";
+ break;
+ case 0x02 :
+ strpart = "アスペクト比16:9 パンベクトルあり";
+ break;
+ case 0x03 :
+ strpart = "アスペクト比16:9 パンベクトルなし";
+ break;
+ case 0x04 :
+ strpart = "アスペクト比 > 16:9";
+ break;
+ default :
+ strpart = "アスペクト比不明";
+ break;
+ }
+ strcat(str, strpart);
+
+ return str;
+}
+
+char* parseAudioComponentDescType(int AudiocomponentDescType) {
+ static char str[MAXSECLEN];
+ memset(str, '\0', sizeof(str));
+ char *strpart;
+
+ switch (AudiocomponentDescType) {
+ case 0x01 :
+ strpart = "音声1/0モード(シングルモノ)";
+ break;
+ case 0x02 :
+ strpart = "音声1/0+1/0モード(デュアルモノ)";
+ break;
+ case 0x03 :
+ strpart = "音声2/0モード(ステレオ)";
+ break;
+ case 0x04 :
+ strpart = "音声2/1モード";
+ break;
+ case 0x05 :
+ strpart = "音声3/0モード";
+ break;
+ case 0x06 :
+ strpart = "音声2/2モード";
+ break;
+ case 0x07 :
+ strpart = "音声3/1モード";
+ break;
+ case 0x08 :
+ strpart = "音声3/2モード";
+ break;
+ case 0x09 :
+ strpart = "音声3/2+LFEモード(3/2.1モード)";
+ break;
+ case 0x0A :
+ strpart = "音声3/3.1モード";
+ break;
+ case 0x0B :
+ strpart = "音声2/0/0-2/0/2-0.1モード";
+ break;
+ case 0x0C :
+ strpart = "音声5/2.1モード";
+ break;
+ case 0x0D :
+ strpart = "音声3/2/2.1モード";
+ break;
+ case 0x0E :
+ strpart = "音声2/0/0-3/0/2-0.1モード";
+ break;
+ case 0x0F :
+ strpart = "音声0/2/0-3/0/2-0.1モード";
+ break;
+ case 0x10 :
+ strpart = "音声2/0/0-3/2/3-0.2モード";
+ break;
+ case 0x11 :
+ strpart = "音声3/3/3-5/2/3-3/0/0.2モード";
+ break;
+ case 0x40 :
+ strpart = "音声視覚障害者用解説";
+ break;
+ case 0x41 :
+ strpart = "音声聴覚障害者用";
+ break;
+ default :
+ strpart = "音声不明";
+ break;
+ }
+ strcat(str, strpart);
+
+ return str;
+}
+
int parseEEVTDhead(unsigned char *data, EEVTDhead *desc) {
int boff = 0;
memset(desc, 0, sizeof(EEVTDitem));
desc->item_description_length = getBit(data, &boff, 8);
+ memset(desc->item_description, 0, MAXSECLEN);
getStr(desc->item_description, data, &boff, desc->item_description_length);
desc->item_length = getBit(data, &boff, 8);
-// memcpy(desc->item, data + (boff / 8), desc->item_length);
- getStr(desc->item, data, &boff, desc->item_length);
+ memset(desc->item, 0, MAXSECLEN);
+ memcpy(desc->item, data + (boff / 8), desc->item_length);
+ /* getStr(desc->item, data, &boff, desc->item_length); */
return desc->item_description_length + desc->item_length + 2;
}
memset(desc, 0, sizeof(EEVTDtail));
desc->text_length = getBit(data, &boff, 8);
+ memset(desc->text, 0, MAXSECLEN);
getStr(desc->text, data, &boff, desc->text_length);
return desc->text_length + 1;
EEVTDitem swap;
int boff = 0;
+
if(new == NULL) {
if(save->item_length != 0) {
swap = *save;
+ memset(save->item, 0, MAXSECLEN);
getStr(save->item, (unsigned char*)swap.item, &boff, swap.item_length);
-
-
- //save->descriptor_number = descriptor_number;
- //*new = swap;
- //*save = swap;
- if (swap.descriptor_number==1){
-// printf("descriptor_num %d typeB\n",swap.descriptor_number);
- }
-
return 1;
} else {
-
-
- //printf("descriptor_num %d typeC\n",swap.descriptor_number);
-
-
-
return 0;
}
}
if(new->item_description_length == 0) {
- /* ³¤ Êݸ */
+ /* 続き 保存 */
memcpy(save->item + save->item_length, new->item, new->item_length);
save->item_length += new->item_length;
-
-
- if (swap.descriptor_number==1){
- printf("descriptor_num %d typeD\n",swap.descriptor_number);
- }
-
-
return 0;
} else {
- /* ¥Ö¥ì¡¼¥¯¡£save¤ò°õºþÂоݤˤ¹¤ë¡£save¤ò¥¯¥ê¥¢? */
+ /* ã\83\96ã\83¬ã\83¼ã\82¯ã\80\82saveã\82\92å\8d°å\88·å¯¾è±¡ã\81«ã\81\99ã\82\8bã\80\82saveã\82\92ã\82¯ã\83ªã\82¢? */
if(save->item_length != 0) {
- /* ÂàÈòºÑ¤ß¤¬¤¢¤ê */
+ /* 退避済みがあり */
swap = *save;
+ memset(save->item, 0, MAXSECLEN);
getStr(save->item, (unsigned char*)swap.item, &boff, swap.item_length);
+
+ // swap save new -> swap save new
+ // b c -> ( c) c b
swap = *new;
*new = *save;
*save = swap;
save->descriptor_number = descriptor_number;
-
-
-
-
- if (swap.descriptor_number==1){
- printf("descriptor_num %d typeE\n",swap.descriptor_number);
- }
-
-
+ return 1;
} else {
*save = *new;
save->descriptor_number = descriptor_number;
-
- if (swap.descriptor_number==1){
- printf("descriptor_num %d typeF\n",swap.descriptor_number);
- }
-
-
return 0;
}
}
-
- return 1;
}
EIT_CONTROL *searcheit(EIT_CONTROL *top, int servid, int eventid)
{
}
return NULL ;
}
+char *strstr_eucjp(const char *str, const char *search)
+{
+ char *pos ;
+ pos = (char *)str ;
+
+ while (*pos != '\0') {
+ if (*pos == *search) {
+ if (strncmp(pos, search, strlen(search)) == 0) {
+ return pos ;
+ }
+ }
+ if ((unsigned char)*pos == 0x8Fu) {
+ pos += 3 ;
+ } else if ((unsigned char)*pos >= 0x80u) {
+ pos += 2 ;
+ } else {
+ pos += 1 ;
+ }
+ }
+
+ return NULL ;
+}
void conv_title_subtitle(EIT_CONTROL *eitptr)
{
int lp = 0 ;
- size_t addsize ;
+// size_t addsize ;
char *ptr ;
+ char *ptr2 ;
char *newsubtitle ;
for(lp = 0 ; subtitle_cnv_str[lp] != NULL ; lp++){
if(ptr == NULL){
continue ;
}
- // ¥¿¥¤¥È¥ë¤¬¤Ê¤¯¤Ê¤é¤Ê¤¤¤è¤¦¤Ë
+ // タイトルがなくならないように
if(ptr == eitptr->title){
continue ;
}
+ /*
+ ptr2 = ptr ;
+ for( ; (unsigned char)*ptr2 == 0x20u ; ptr2++ );
+ for( ; (unsigned char)*ptr2 == 0xA1u && (unsigned char)*(ptr2+1) == 0xA1u ; ptr2 += 2);
+ for( ; (unsigned char)*ptr2 == 0x20u ; ptr2++ );
+ newsubtitle = calloc(1, ((strlen(ptr2) + 2) + (strlen(eitptr->subtitle) + 1)));
+ memcpy(newsubtitle, ptr2, strlen(ptr2));
+// *(newsubtitle+strlen(ptr)) = ' ';
+ strcat(newsubtitle, "▽");
+ */
newsubtitle = calloc(1, ((strlen(ptr) + 1) + (strlen(eitptr->subtitle) + 1)));
memcpy(newsubtitle, ptr, strlen(ptr));
newsubtitle[strlen(ptr)] = ' ';
- *ptr = NULL ;
+
+ *ptr = '\0';
strcat(newsubtitle, eitptr->subtitle);
free(eitptr->subtitle);
eitptr->subtitle = newsubtitle ;
int loop_len = 0;
int loop_blen = 0;
int loop_elen = 0;
- int str_alen = 0;
int ehh, emm, ess;
len = parseEIThead(ptr, &eith);
ptr += len;
- loop_len = eith.section_length - (len - 3 + 4); // 3¤Ï¶¦Ḁ̈إåÀĹ 4¤ÏCRC
+ loop_len = eith.section_length - (len - 3 + 4); // 3は共通ヘッダ長 4はCRC
while(loop_len > 0) {
- /* Ϣ³¤¹¤ë³ÈÄ¥¥¤¥Ù¥ó¥È¤Ï¡¢´Á»ú¥³¡¼¥É¤¬µã¤Ê̤줷¤Æ
- ʬ³ä¤µ¤ì¤ë¤è¤¦¤À¡£Ï¢Â³¤«¤É¤¦¤«¤Ï¡¢item_description_length¤¬
- ÀßÄꤵ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ÇȽÃǤǤ¤ë¤è¤¦¤À¡£ */
+ /* 連続する拡張イベントは、漢字コードが泣き別れして
+ 分割されるようだ。連続かどうかは、item_description_lengthが
+ 設定されているかどうかで判断できるようだ。 */
memset(&save_eevtitem, 0, sizeof(EEVTDitem));
len = parseEITbody(ptr, &eitb);
ptr += len;
loop_len -= len;
-
+
/* printf("evtid:%d\n", eitb.event_id); */
-
+
loop_blen = eitb.descriptors_loop_length;
loop_len -= loop_blen;
+
while(loop_blen > 0) {
-/*yukikaze-test*/
+ /*yukikaze-test*/
//printf("desc_tag");
//int itt=getBit(*ptr,0,8);
//printf("%x",itt);
len = parseEEVTDhead(ptr, &eevthead);
/*
- if(eith.service_id == 19304 &&
- eitb.event_id == 46564) {
- printf("aa");
- }
+ if(eith.service_id == 19304 &&
+ eitb.event_id == 46564) {
+ printf("aa");
+ }
*/
if(len > 0) {
ptr += len;
loop_elen -= len;
loop_blen -= len;
-
- if (1||checkEEVTDitem(&save_eevtitem, &eevtitem,
- eevthead.descriptor_number)) {
-#if 0
- {
- if (eevtitem.descriptor_number>0){
- //printf("descriptor_num %d\n",eevtitem.descriptor_number);
- }
-
- /* long format */
- //printf("descriptor_num %d\n",eevtitem.descriptor_number);
-#if 1
- printf("EEVT,%d,%d,%d,%s,%s\n",
- eith.service_id,
- eitb.event_id,
- eevtitem.descriptor_number, // ÂàÈò¹àÌÜ
- eevtitem.item_description,
- eevtitem.item);
-#endif
- }
-#endif
- cur = searcheit(eittop, eith.service_id, eitb.event_id);
- if(cur == NULL){
- curtmp = NULL;
- cur = calloc(1, sizeof(EIT_CONTROL));
- }
- else {
- curtmp = cur;
- }
+ if(checkEEVTDitem(&save_eevtitem, &eevtitem,
+ eevthead.descriptor_number)) {
-#if 1
- if ( cur->desc ) {
- str_alen = strlen( cur->desc );
- }
- else {
- str_alen = 0;
- }
- eevtitem.item_description_length = strlen(eevtitem.item_description);
- eevtitem.item_length = strlen(eevtitem.item);
- cur->desc = realloc(cur->desc, str_alen + eevtitem.item_description_length + eevtitem.item_length + 1000);
- if ( !str_alen ) *cur->desc = '\0';
-
- if ( eevtitem.item_description_length && !strstr(cur->desc, eevtitem.item_description) ) {
- strcat(cur->desc, eevtitem.item_description);
- strcat(cur->desc, "\t");
+ {
+ if (eevtitem.descriptor_number>0){
+ //printf("descriptor_num %d\n",eevtitem.descriptor_number);
+ }
+ /* long format */
+ //printf("descriptor_num %d\n",eevtitem.descriptor_number);
+#if 0
+ printf("EEVT,%d,%d,%d,%s,%s\n",
+ eith.service_id,
+ eitb.event_id,
+ eevtitem.descriptor_number, // 退避項目
+ eevtitem.item_description,
+ eevtitem.item);
+#endif
}
+ append_desc(eittop, eith.service_id, eitb.event_id, &eevtitem);
- if ( eevtitem.item_length && !strstr(cur->desc, eevtitem.item) ) {
- strcat(cur->desc, eevtitem.item);
- strcat(cur->desc, "\\n");
- }
-#endif
- if ( !curtmp ) enqueue(eittop, cur);
}
}
}
#endif
} else {
- ContentDesc contentDesc;
- len = parseContentDesc(ptr, &contentDesc);
- if (len > 0) {
- int header_printed = 0;
- for (int i = 0; i < contentDesc.descriptor_length - 1; i+=2) {
- /*
- if (0xff == (unsigned char)contentDesc.content[i])
- continue;
- */
-#if 0
- if (!header_printed) {
- fprintf(out, "Content,%d,%d",
- eith.service_id,
- eitb.event_id);
- header_printed = 1;
- }
-#endif
+ ContentDesc contentDesc;
+ SeriesDesc seriesDesc;
+ ComponentDesc componentDesc;
+ AudioComponentDesc audioComponentDesc;
-#if 0
- fprintf(out, ",%02x%02x", (unsigned char)contentDesc.content[i], (unsigned char)contentDesc.content[i+1]);
-#endif
- }
- if((eith.original_network_id == original_network_id) && (eith.transport_stream_id == transport_stream_id)){
- cur = searcheit(eittop, eith.service_id, eitb.event_id);
- if(cur != NULL){
- cur->content_type = (unsigned char)(contentDesc.content[0] >> 4);
-#if 0
- fprintf(stdout, "%s:", cur->title);
- fprintf(stdout, ",%02x%02x", (unsigned char)contentDesc.content[0], (unsigned char)contentDesc.content[1]);
- fprintf(stdout, ",%02x%02x\n", (unsigned char)contentDesc.content[2], (unsigned char)contentDesc.content[3]);
-#endif
+ if((eith.original_network_id == original_network_id) && (eith.transport_stream_id == transport_stream_id)){
+ cur = searcheit(eittop, eith.service_id, eitb.event_id);
+ }
+ else {
+ cur = NULL;
+ }
+ switch (*ptr) {
+ case 0x54 :
+ len = parseContentDesc(ptr, &contentDesc);
+ if (len > 0) {
+ if(cur != NULL){
+ cur->content_type = (unsigned char)contentDesc.content_nibble_level_1;
}
-#if 0
- if (header_printed) {
- fprintf(out, "\n");
- }
-#endif
}
- } else {
- SeriesDesc seriesDesc;
+ break;
+ case 0xD5 :
len = parseSeriesDesc(ptr, &seriesDesc);
if (len > 0) {
-#if 0
- printf("Series,%d,%d,series=%d,repeat=%01x,pattern=%d,expire_valid=%d,expire=%04x,epinum=%d,lastepinum=%d,%s\n",
- eith.service_id,
- eitb.event_id,
- seriesDesc.series_id,
- seriesDesc.repeat_label,
- seriesDesc.program_pattern,
- seriesDesc.expire_date_valid_flag,
- seriesDesc.expire_date,
- seriesDesc.episode_number,
- seriesDesc.last_episode_number,
- seriesDesc.series_name_char);
-#endif
- } else {
- len = parseOTHERdesc(ptr);
+ #if 0
+ printf("Series,%d,%d,series=%d,repeat=%01x,pattern=%d,expire_valid=%d,expire=%04x,epinum=%d,lastepinum=%d,%s\n",
+ eith.service_id,
+ eitb.event_id,
+ seriesDesc.series_id,
+ seriesDesc.repeat_label,
+ seriesDesc.program_pattern,
+ seriesDesc.expire_date_valid_flag,
+ seriesDesc.expire_date,
+ seriesDesc.episode_number,
+ seriesDesc.last_episode_number,
+ seriesDesc.series_name_char);
+ #endif
+ }
+ break;
+ case 0x50 :
+ len = parseComponentDesc(ptr, &componentDesc);
+ if (len > 0) {
+ if(cur != NULL){
+ cur->video_type = componentDesc.component_type;
+ }
+ #if 0
+ printf("Component,%d %d %s\n",
+ componentDesc.stream_content,
+ componentDesc.component_type,
+ parseComponentDescType(componentDesc.component_type));
+ #endif
}
+ break;
+ case 0xC4 :
+ len = parseAudioComponentDesc(ptr, &audioComponentDesc);
+ if (len > 0) {
+ if(cur != NULL){
+ cur->audio_type = audioComponentDesc.component_type;
+ cur->multi_type = audioComponentDesc.ES_multi_lingual_flag;
+ }
+ #if 0
+ printf("AudioComponent,%d %d %d %s\n",
+ audioComponentDesc.component_type,
+ audioComponentDesc.ES_multi_lingual_flag,
+ audioComponentDesc.sampling_rate,
+ parseAudioComponentDescType(audioComponentDesc.component_type)
+ );
+ #endif
+ }
+ break;
+ default :
+ len = parseOTHERdesc(ptr);
}
}
}
ptr += len;
loop_blen -= len;
}
- /* ºÇ¸å¤Î¥Ö¥ì¡¼¥¯¥Á¥§¥Ã¥¯ */
-
+ /* æ\9c\80å¾\8cã\81®ã\83\96ã\83¬ã\83¼ã\82¯ã\83\81ã\82§ã\83\83ã\82¯ */
+
if(checkEEVTDitem(&save_eevtitem, NULL, 0)) {
#if 0
- if(mode == 1) { /* long format */
- fprintf(out, "EEVT,%d,%d,%d,%s,%s\n",
+ { /* long format */
+ fprintf(stdout, "EEVT,%d,%d,%d,%s,%s\n",
eith.service_id,
eitb.event_id,
save_eevtitem.descriptor_number,
save_eevtitem.item);
}
#endif
+ append_desc(eittop, eith.service_id, eitb.event_id, &save_eevtitem);
}
}
return;
}
+void append_desc(EIT_CONTROL* eittop, int service_id, int event_id, EEVTDitem* eevtitem) {
+ EIT_CONTROL *cur;
+ int str_alen = 0;
+
+ cur = searcheit(eittop, service_id, event_id);
+ if (cur == NULL) {
+ return;
+ }
+
+ if ( cur->desc ) {
+ str_alen = strlen( cur->desc );
+ }
+ else {
+ str_alen = 0;
+ }
+ //eevtitem->item_description_length = strlen(eevtitem->item_description);
+ //eevtitem->item_length = strlen(eevtitem->item);
+ cur->desc = realloc(cur->desc, str_alen + eevtitem->item_description_length + eevtitem->item_length + 1000);
+ if ( !str_alen ) *cur->desc = '\0';
+
+ if ( eevtitem->item_description_length && !strstr(cur->desc, eevtitem->item_description) ) {
+ strcat(cur->desc + str_alen, eevtitem->item_description);
+ strcat(cur->desc, "\t");
+ }
+
+ if ( eevtitem->item_length && !strstr(cur->desc, eevtitem->item) ) {
+ strcat(cur->desc + str_alen, eevtitem->item);
+ //printf("%s\n",eevtitem->item);
+ strcat(cur->desc, "\\n");
+ }
+}
+
void timecmp(int *thh, int *tmm, int *tss,
int dhh, int dmm, int dss) {
int running_status;
int free_CA_mode;
int descriptors_loop_length;
- /* °Ê²¼¤Ï²òÀÏ·ë²ÌÊݸÍÑ */
+ /* 以下は解析結果保存用 */
int yy;
int mm;
int dd;
typedef struct _ContentDesc {
int descriptor_tag;
int descriptor_length;
- char content[MAXSECLEN];
+ char content_nibble_level_1;
+ char content_nibble_level_2;
+ char user_nibble_1;
+ char user_nibble_2;
} ContentDesc;
typedef struct _SeriesDesc {
char series_name_char[MAXSECLEN];
} SeriesDesc;
+typedef struct _ComponentDesc {
+ int descriptor_tag;
+ int descriptor_length;
+ int reserved_future_use;
+ int stream_content;
+ int component_type;
+ int component_tag;
+ char ISO_639_language_code[3];
+ char text_char[MAXSECLEN];
+} ComponentDesc;
+
+typedef struct _AudioComponentDesc {
+ int descriptor_tag;
+ int descriptor_length;
+ int reserved_future_use_1;
+ int stream_content;
+ int component_type;
+ int component_tag;
+ int stream_type;
+ int simulcast_group_tag;
+ int ES_multi_lingual_flag;
+ int main_component_flag;
+ int quality_indicator;
+ int sampling_rate;
+ int reserved_future_use_2;
+ char ISO_639_language_code_1[3];
+ char ISO_639_language_code_2[3];
+ char text_char[MAXSECLEN];
+} AudioComponentDesc;
+
typedef struct _EEVTDhead {
int descriptor_tag;
int descriptor_length;
char item_description[MAXSECLEN];
int item_length;
char item[MAXSECLEN];
- /* ÂàÈòÍÑ */
+ /* 退避用 */
int descriptor_number;
} EEVTDitem;
#include <time.h>
#include "ts.h"
+#include "psi.h"
#include "sdt.h"
+#include "sdtt.h"
#include "eit.h"
+#include "tot.h"
+#include "dsmcc.h"
#include "ts_ctl.h"
+#include "util.h"
typedef struct _ContentTYPE{
char *japanese ;
#define CAT_COUNT 16
static CONTENT_TYPE ContentCatList[CAT_COUNT] = {
- { "¥Ë¥å¡¼¥¹¡¦ÊóÆ»", "news" },
- { "¥¹¥Ý¡¼¥Ä", "sports" },
- { "¾ðÊó", "information" },
- { "¥É¥é¥Þ", "drama" },
- { "²»³Ú", "music" },
- { "¥Ð¥é¥¨¥Æ¥£", "variety" },
- { "±Ç²è", "cinema" },
- { "¥¢¥Ë¥á¡¦Æû£", "anime" },
- { "¥É¥¥å¥á¥ó¥¿¥ê¡¼¡¦¶µÍÜ", "documentary" },
- { "±é·à", "stage" },
- { "¼ñÌ£¡¦¼ÂÍÑ", "hobby" },
- { "Ê¡»ã", "etc" }, //Ê¡»ã
- { "ͽÈ÷", "etc" }, //ͽÈ÷
- { "ͽÈ÷", "etc" }, //ͽÈ÷
- { "ͽÈ÷", "etc" }, //ͽÈ÷
- { "¤½¤Î¾", "etc" } //¤½¤Î¾
+ { "ニュース・報道", "news" },
+ { "スポーツ", "sports" },
+ { "情報", "information" },
+ { "ドラマ", "drama" },
+ { "音楽", "music" },
+ { "ã\83\90ã\83©ã\82¨ã\83\86ã\82£", "variety" },
+ { "映画", "cinema" },
+ { "アニメ・特撮", "anime" },
+ { "ドキュメンタリー・教養", "documentary" },
+ { "演劇", "stage" },
+ { "趣味・実用", "hobby" },
+ { "福祉", "welfare" },
+ { "予備", "etc" },
+ { "予備", "etc" },
+ { "予備", "etc" },
+ { "その他", "etc" }
};
+
SVT_CONTROL *svttop = NULL;
-#define SECCOUNT 4
-char title[1024];
-char subtitle[1024];
-char desc[102400] = {0};
-char Category[1024];
-char ServiceName[1024];
-iconv_t cd ;
+DSM_CONTROL dsmctl[1024];
+#define SECCOUNT 64
+static unsigned char *base64 = (unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static void base64_char(unsigned long bb, int srclen, unsigned char *dest, int j)
+{
+ int x, i, base;
+
+ /* 最終位置の計算 */
+ for ( i = srclen; i < 2; i++ )
+ bb <<= 8;
+
+ /* BASE64変換 */
+ for ( base = 18, x = 0; x < srclen + 2; x++, base -= 6) {
+ dest[j++] = base64[ (unsigned long)((bb>>base) & 0x3F) ];
+ }
+
+ /* 端数の判断 */
+ for ( i = x; i < 4; i++ ) {
+ dest[j++] = (unsigned char)'='; /* 端数 */
+ }
+
+}
+
+static void base64_encode(unsigned char *dest, const unsigned char *src, int len)
+{
+ unsigned char *p = src;
+ unsigned long bb = (unsigned long)0;
+ int i = 0, j = 0;
+
+ while (len--)
+ {
+ bb <<= 8;
+ bb |= (unsigned long)*p;
+
+ /* 24bit単位に編集 */
+ if (i == 2) {
+ base64_char(bb, i, dest, j);
+
+ j = j + 4;
+ i = 0;
+ bb = 0;
+ } else
+ i++;
+
+ p++;
+ }
+
+ /* 24bitに満たない場合 */
+ if (i) base64_char(bb, i - 1, dest, j);
+
+}
void xmlspecialchars(char *str)
{
-void GetSDT(FILE *infile, SVT_CONTROL *svttop, SECcache *secs, int count)
+void GetSDT(FILE *infile, SVT_CONTROL *svttop, SECcache *secs,
+ int count, STATION **station, int * station_count, char *header, int is_logo)
{
SECcache *bsecs;
+ int pmtpids[SECCOUNT];
+ memset(pmtpids, 0, sizeof(pmtpids));
+ int dsmccpids[SECCOUNT];
+ memset(dsmccpids, 0, sizeof(dsmccpids));
+ int i = 0 , downloadDataId = 0;
while((bsecs = readTS(infile, secs, count)) != NULL) {
/* SDT */
if((bsecs->pid & 0xFF) == 0x11) {
- dumpSDT(bsecs->buf, svttop);
+ dumpSDT(bsecs->buf, svttop, station, station_count, header);
}
- }
-}
-void GetSDT_chout(FILE *infile, SVT_CONTROL *svttop, SECcache *secs, int count,STATION *station, int * station_count,char *header)
-{
- SECcache *bsecs;
-
- while((bsecs = readTS(infile, secs, count)) != NULL) {
- /* SDT */
- if((bsecs->pid & 0xFF) == 0x11) {
- dumpSDT_chout(bsecs->buf,svttop,station,station_count,header);
+ /* TOT */
+ else if((bsecs->pid & 0xFF) == 0x14) {
+ dumpTOT(bsecs->buf);
+ }
+ /* SDTT */
+ //else if((bsecs->pid & 0xFF) == 0x23) {
+ // dumpSDTT(bsecs->buf, *station, *station_count);
+ //}
+ /* BIT */
+ else if((bsecs->pid & 0xFF) == 0x24) {
+ dumpBIT(bsecs->buf);
+ }
+ /* CDT */
+ else if((bsecs->pid & 0xFF) == 0x29) {
+ dumpCDT(bsecs->buf, *station, *station_count);
+ }
+ else if ( is_logo ) {
+ /* PAT */
+ if((bsecs->pid & 0xFF) == 0x00) {
+ dumpPAT(bsecs->buf, secs, count, pmtpids);
+ }
+ /* PMT */
+ for ( i = 1; i < SECCOUNT; i++ ) {
+ if ( pmtpids[i] == 0 ) {
+ break;
+ }
+ /* PMT specified by PAT */
+ if ( bsecs->pid == pmtpids[i] ) {
+ dumpPMT(bsecs->buf, secs, count, dsmccpids);
+ }
+ }
+ /* DSM-CC */
+ for ( i = 0; i < SECCOUNT; i++ ) {
+ if ( dsmccpids[i] == 0 ) {
+ break;
+ }
+ /* DSM-CC specified by PMT */
+ if ( bsecs->pid == dsmccpids[i] ) {
+ dumpDSMCC(bsecs->buf, &downloadDataId, &dsmctl);
+ }
+ }
}
}
}
-void GetEIT(FILE *infile, FILE *outfile, STATION *psta, SECcache *secs, int count)
+
+void GetEIT(FILE *infile, FILE *outfile, STATION *psta, SECcache *secs)
{
SECcache *bsecs;
EIT_CONTROL *eitcur ;
EIT_CONTROL *eitnext ;
EIT_CONTROL *eittop = NULL;
- char *outptr ;
- char *inptr ;
- size_t ilen;
- size_t olen;
time_t l_time ;
time_t end_time ;
struct tm tl ;
char cendtime[32];
char cstarttime[32];
+ char title[1024];
+ char subtitle[1024];
+ char desc[102400] = {0};
+ char Category[1024];
+ char VideoType[1024];
+ char AudioType[1024];
+
+ memset(secs, 0, sizeof(SECcache) * SECCOUNT);
+ secs[0].pid = 0x12; /* EIT */
+ secs[1].pid = 0x26; /* EIT */
+ secs[2].pid = 0x27; /* EIT */
+
eittop = calloc(1, sizeof(EIT_CONTROL));
eitcur = eittop ;
fseek(infile, 0, SEEK_SET);
if(eitcur->content_type > CAT_COUNT){
eitcur->content_type = CAT_COUNT -1 ;
}
- outptr = title ;
memset(title, '\0', sizeof(title));
- ilen = strlen(eitcur->title);
- olen = sizeof(title);
- inptr = eitcur->title;
- iconv(cd, &inptr, &ilen, &outptr, &olen);
+ strcpy(title, eitcur->title);
xmlspecialchars(title);
memset(subtitle, '\0', sizeof(subtitle));
- ilen = strlen(eitcur->subtitle);
- olen = sizeof(subtitle);
- outptr = subtitle ;
- inptr = eitcur->subtitle;
- iconv(cd, &inptr, &ilen, &outptr, &olen);
+ strcpy(subtitle, eitcur->subtitle);
xmlspecialchars(subtitle);
memset(desc, '\0', sizeof(desc));
if ( eitcur->desc ) {
- ilen = strlen(eitcur->desc);
- olen = sizeof(desc);
- outptr = desc ;
- inptr = eitcur->desc;
- iconv(cd, &inptr, &ilen, &outptr, &olen);
+ strcpy(desc, eitcur->desc);
xmlspecialchars(desc);
}
memset(Category, '\0', sizeof(Category));
- ilen = strlen(ContentCatList[eitcur->content_type].japanese);
- olen = sizeof(Category);
- outptr = Category ;
- inptr = ContentCatList[eitcur->content_type].japanese;
- iconv(cd, &inptr, &ilen, &outptr, &olen);
+ strcpy(Category, ContentCatList[eitcur->content_type].japanese);
xmlspecialchars(Category);
+ memset(VideoType, '\0', sizeof(VideoType));
+ strcpy(VideoType, parseComponentDescType(eitcur->video_type));
+ xmlspecialchars(VideoType);
+
+ memset(AudioType, '\0', sizeof(AudioType));
+ strcpy(AudioType, parseAudioComponentDescType(eitcur->audio_type));
+ xmlspecialchars(AudioType);
+
tl.tm_sec = eitcur->ss ;
tl.tm_min = eitcur->hm ;
tl.tm_hour = eitcur->hh ;
l_time = mktime(&tl);
if((eitcur->ehh == 0) && (eitcur->emm == 0) && (eitcur->ess == 0)){
(void)time(&l_time);
- end_time = l_time + (60 * 5); // £µÊ¬¸å¤ËÀßÄê
+ end_time = l_time + (60 * 5); // 5分後に設定
endtl = localtime(&end_time);
}else{
end_time = l_time + eitcur->ehh * 3600 + eitcur->emm * 60 + eitcur->ess;
memset(cstarttime, '\0', sizeof(cstarttime));
strftime(cendtime, (sizeof(cendtime) - 1), "%Y%m%d%H%M%S", endtl);
strftime(cstarttime, (sizeof(cstarttime) - 1), "%Y%m%d%H%M%S", &tl);
-#if 1
- fprintf(outfile, " <programme start=\"%s +0900\" stop=\"%s +0900\" channel=\"%s\">\n",
- cstarttime, cendtime, psta->ontv);
+
+ fprintf(outfile, " <programme start=\"%s +0900\" stop=\"%s +0900\" channel=\"%s\" event=\"%d\">\n",
+ cstarttime, cendtime, psta->ontv, eitcur->event_id);
fprintf(outfile, " <title lang=\"ja_JP\">%s</title>\n", title);
fprintf(outfile, " <desc lang=\"ja_JP\">%s</desc>\n", subtitle);
fprintf(outfile, " <longdesc lang=\"ja_JP\">%s</longdesc>\n", desc);
fprintf(outfile, " <category lang=\"ja_JP\">%s</category>\n", Category);
-// fprintf(outfile, " <category lang=\"en\">%s</category>\n", ContentCatList[eitcur->content_type].english);
+ fprintf(outfile, " <video type=\"%d\">%s</video>\n", eitcur->video_type, VideoType);
+ fprintf(outfile, " <audio type=\"%d\" multi=\"%d\">%s</audio>\n", eitcur->audio_type, eitcur->multi_type, AudioType);
+ //fprintf(outfile, " <category lang=\"en\">%s</category>\n", ContentCatList[eitcur->content_type].english);
fprintf(outfile, " </programme>\n");
-#else
+#if 0
fprintf(outfile, "(%x:%x:%x)%s,%s,%s,%s,%s,%s\n",
eitcur->servid, eitcur->table_id, eitcur->event_id,
cstarttime, cendtime,
title, subtitle,
Category,
ContentCatList[eitcur->content_type].english);
-#endif
-#if 0
+
fprintf(outfile, "(%x:%x)%04d/%02d/%02d,%02d:%02d:%02d,%02d:%02d:%02d,%s,%s,%s,%s\n",
eitcur->table_id, eitcur->event_id,
eitcur->yy, eitcur->mm, eitcur->dd,
free(eittop);
eittop = NULL;
}
-void checkSta_BS(STATION **station,int *stalength){
- STATION *statmp;
- int chl[90];
- int chlt=0;
- int stal=0;
- STATION * statin= *station;
- statmp=malloc(sizeof(STATION)*2);
- for (int i=0;i<*stalength;i++){
- int noidinchl=1;
- for (int j=0;j<chlt;j++){
- if (chl[j]==statin[i].svId || statin[i].svId >= 290){
- noidinchl=0;
- }
- }
- if (noidinchl==1){
- statmp=realloc(statmp,(stal+1)*sizeof(STATION));
- statmp[stal]=statin[i];
- //memcpy(statmp[stal-1],station[i],sizeof(STATION));
- chl[chlt]=statin[i].svId;
- chlt++;
- stal++;
- }
- }
- //*station=realloc(station,(stal+1)*sizeof(STATION));
- //memcpy(*station,statmp,(stal+1)*sizeof(STATION));
- *station=statmp;
- *stalength=stal;
- //memcpy(statin,statmp,chlt*sizeof(STATION));
- //free(statmp);
- return;
-}
void checkSta(STATION **station,int *stalength){
STATION *statmp;
int chl[90];
- int chlt=0;
- int stal=0;
- STATION * statin= *station;
- statmp=malloc(sizeof(STATION)*2);
- for (int i=0;i<*stalength;i++){
- int noidinchl=1;
- for (int j=0;j<chlt;j++){
- if (chl[j]==statin[i].svId){
- noidinchl=0;
+ int chlt = 0;
+ int stal = 0;
+ STATION * statin = *station;
+ statmp = malloc( sizeof(STATION) * 2 );
+ for (int i = 0 ; i < *stalength ; i++){
+ int noidinchl = 1;
+ for (int j = 0 ; j < chlt ; j++){
+ if ( chl[j] == statin[i].svId ) {
+ noidinchl = 0;
}
}
- if (noidinchl==1){
- statmp=realloc(statmp,(stal+1)*sizeof(STATION));
- statmp[stal]=statin[i];
- //memcpy(statmp[stal-1],station[i],sizeof(STATION));
- chl[chlt]=statin[i].svId;
+ if ( noidinchl == 1 ) {
+ statmp = realloc(statmp, (stal+1) * sizeof(STATION));
+ statmp[stal] = statin[i];
+ chl[chlt] = statin[i].svId;
chlt++;
stal++;
- }
+ }
}
- sleep(1);
- *station=statmp;
- *stalength=stal;//¤³¤³¤¤¤é¤¬²ø¤·¤¤
+ *station = statmp;
+ *stalength = stal;//ここいらが怪しい
//memcpy(statin,statmp,chlt*sizeof(STATION));
//free(statmp);
return;
}
+
int main(int argc, char *argv[])
{
FILE *infile = stdin;
FILE *outfile = stdout;
- int arg_maxcount = 1 ;
char *arg_onTV ;
- int mode = 1;
int staCount ;
- int eitcnt;
- char *file;
int inclose = 0;
int outclose = 0;
- int flag = 0 ;
- int outputhtml = 1;
SVT_CONTROL *svtcur ;
SVT_CONTROL *svtsave ;
- char *outptr ;
- char *inptr ;
- size_t ilen;
- size_t olen;
SECcache secs[SECCOUNT];
- int rtn;
int lp ;
STATION *pStas ;
- int act ;
+ int act = 0;
+ int i , j, k ;
+ int is_logo = 0;
+ SDTTdata sdtd;
+ SDTTdataLoop *loop;
+ SDTTdataService *service;
- /* ¶½Ì£¤Î¤¢¤ëpid¤ò»ØÄê */
- memset(secs, 0, sizeof(SECcache) * SECCOUNT);
- secs[0].pid = 0x11;
- secs[1].pid = 0x12;
- secs[2].pid = 0x26;
- secs[3].pid = 0x27;
+ memset(dsmctl, 0, sizeof(dsmctl));
+ if(argc == 5 && strcmp(argv[1], "/LOGO") == 0){
+ argc--;
+ argv[1] = argv[2];
+ argv[2] = argv[3];
+ argv[3] = argv[4];
+ is_logo = 1;
+ }
if(argc == 4){
arg_onTV = argv[1];
- file = argv[2];
- if(strcmp(file, "-")) {
- infile = fopen(file, "r");
+ if(strcmp(argv[2], "-")) {
+ infile = fopen(argv[2], "r");
+ if ( !infile) {
+ printf( "tsFile not found (Can't open file: %s)\n", argv[2] );
+ exit( -1 );
+ }
inclose = 1;
}
+ else {
+ infile = stdin;
+ }
if(strcmp(argv[3], "-")) {
outfile = fopen(argv[3], "w+");
+ if ( !outfile) {
+ printf( "xmlFile not found (Can't open file: %s)\n", argv[3] );
+ exit( -1 );
+ }
outclose = 1;
}
+ else {
+ outfile = stdout;
+ }
}else{
- fprintf(stdout, "Usage : %s /BS <tsFile> <outfile>\n", argv[0]);
- fprintf(stdout, "Usage : %s <ontvcode> <tsFile> <outfile>\n", argv[0]);
- fprintf(stdout, "ontvcode ¥Á¥ã¥ó¥Í¥ë¼±Ê̻ҡ£****.ontvjapan.com ¤Ê¤É\n");
- fprintf(stdout, "/BS BS¥â¡¼¥É¡£°ì¤Ä¤ÎTS¤«¤éBSÁ´¶É¤Î¥Ç¡¼¥¿¤òÆɤ߹þ¤ß¤Þ¤¹¡£\n");
- fprintf(stdout, "/CS CS¥â¡¼¥É¡£°ì¤Ä¤ÎTS¤«¤éÊ£¿ô¶É¤Î¥Ç¡¼¥¿¤òÆɤ߹þ¤ß¤Þ¤¹¡£\n");
+ fprintf(stdout, "Usage : %s (/LOGO) {/BS|/CS|<id>} <tsFile> <outfile>\n", argv[0]);
+ fprintf(stdout, "\n");
+ fprintf(stdout, "/LOGO ロゴ取得モード。独立して指定し、番組表の出力を行ないません。\n");
+ fprintf(stdout, " 必要なTSの長さ 地上波は10分 BS/CSは20分です。\n");
+ fprintf(stdout, "id チャンネル識別子。地上波の物理チャンネルを与えます。\n");
+ fprintf(stdout, "/BS BSモード。一つのTSからBS全局のデータを読み込みます。\n");
+ fprintf(stdout, "/CS CSモード。一つのTSから複数局のデータを読み込みます。\n");
+ fprintf(stdout, "/TIME 時刻合わせモード。TSからTOT(Time Offset Table)を読み込みます。\n");
+ fprintf(stdout, " recpt1 <任意> 10(秒以上) - | epgdump /TIME - <任意>の形で使用してください。\n");
+ fprintf(stdout, " TOTは5秒に1回しか来ないため、recpt1に与える時間をある程度長くしてください。\n");
+/*
+ fprintf(stdout, " ontvcode Channel identifier (ex. ****.ontvjapan.com)\n");
+ fprintf(stdout, " /BS BS mode\n");
+ fprintf(stdout, " This mode reads the data of all BS TV stations\n");
+ fprintf(stdout, " from one TS data.\n");
+ fprintf(stdout, " /CS CS mode\n");
+ fprintf(stdout, " This mode reads the data of two or more CS TV stations\n");
+ fprintf(stdout, " from one TS data.\n");
+*/
return 0;
}
- if(strcmp(arg_onTV, "/BS") == 0){
- STATION *sta=malloc(sizeof(STATION)*2);
- int sta_count = 0;
- svttop = calloc(1, sizeof(SVT_CONTROL));
- char *head="BS";
- GetSDT_chout(infile, svttop, secs, SECCOUNT,&sta, &sta_count,head);
- checkSta_BS(&sta,&sta_count);
- //if (sta_count)
- //printf("Station count: %d\n1st ontv=%s,name=%s\n",sta_count, sta[0].ontv, sta[0].name);
- pStas = sta;
- staCount = sta_count;// sizeof(pStas) / sizeof (STATION);
- act = 0 ;
- outputhtml=1;
+ pStas = NULL;
+ staCount = 0;
+ svttop = calloc(1, sizeof(SVT_CONTROL));
+ act = 0 ;
+
+ /* 興味のあるpidを指定 */
+ if ( is_logo ) {
+ memset(secs, 0, sizeof(SECcache) * SECCOUNT);
+ secs[0].pid = 0x00; /* PAT */
+ secs[1].pid = 0x11; /* SDT */
+ secs[2].pid = 0x29; /* CDT */
+ }
+ else {
+ memset(secs, 0, sizeof(SECcache) * SECCOUNT);
+ secs[0].pid = 0x00; /* PAT */
+ secs[1].pid = 0x11; /* SDT */
+ secs[2].pid = 0x12; /* EIT */
+ secs[3].pid = 0x23; /* SDTT */
+ secs[4].pid = 0x26; /* EIT */
+ secs[5].pid = 0x27; /* EIT */
+ secs[6].pid = 0x29; /* CDT */
+ }
+
+ if(strcmp(arg_onTV, "/TIME") == 0){
+ printf("TSに載っている時刻データは2秒ほど早めてあるのかもしれません。\n");
+ memset(secs, 0, sizeof(SECcache) * SECCOUNT);
+ secs[0].pid = 0x14; /* TOT */
+
+ GetSDT(infile, NULL, secs, SECCOUNT,NULL, NULL,NULL, 0);
+
+ goto cleanup;
+ }else if(strcmp(arg_onTV, "/BS") == 0){
+ char *head = "BS";
+ GetSDT(infile, svttop, secs, SECCOUNT, &pStas, &staCount, head, is_logo);
}else if(strcmp(arg_onTV, "/CS") == 0){
- STATION *sta=NULL;
- int sta_count = 0;
- svttop = calloc(1, sizeof(SVT_CONTROL));
- char *head="CS";
- GetSDT_chout(infile, svttop, secs, SECCOUNT,&sta, &sta_count,head);
- checkSta(&sta,&sta_count);
- //if (sta_count)
- //printf("Station count: %d\n1st ontv=%s,name=%s\n",sta_count, sta[0].ontv, sta[0].name);
- pStas = sta;
- staCount = sta_count;
- //staCount=sizeof(pStas) / sizeof (STATION);
- act = 0 ;
- outputhtml=1;
+ char *head = "CS";
+ GetSDT(infile, svttop, secs, SECCOUNT, &pStas, &staCount, head, is_logo);
}else if(strcmp(arg_onTV, "/TEST") == 0){
- STATION *sta=NULL;
- int sta_count = 0;
- svttop = calloc(1, sizeof(SVT_CONTROL));
- char *head="TEST";
- GetSDT_chout(infile, svttop, secs, SECCOUNT,&sta, &sta_count,head);
- checkSta(&sta,&sta_count);
+ memset(secs, 0, sizeof(SECcache) * SECCOUNT);
+ secs[0].pid = 0x24; /* BIT */
+
+ char *head = "TEST";
+ GetSDT(infile, svttop, secs, SECCOUNT, &pStas, &staCount, head, 0);
//if (sta_count)
- //printf("Station count: %d\n1st ontv=%s,name=%s\n",sta_count, sta[0].ontv, sta[0].name);
- pStas = sta;
- staCount = sta_count;// sizeof(pStas) / sizeof (STATION);
- act = 0 ;
- outputhtml=1;
+ // printf("Station count: %d\n1st ontv=%s,name=%s\n",staCount, pStas[0].ontv, pStas[0].name);
}else{
- /*act = 1 ;
+ GetSDT(infile, svttop, secs, SECCOUNT, &pStas, &staCount, arg_onTV, 0);
+
+ // 地上波のマルチチャンネル対応のためコメントアウト
+ /*
+ act = 1 ;
svttop = calloc(1, sizeof(SVT_CONTROL));
GetSDT(infile, svttop, secs, SECCOUNT);
- svtcur = svttop->next ; //ÀèƬ
+ svtcur = svttop->next ; //先頭
if(svtcur == NULL){
free(svttop);
- return ;
+ return 1;
}
pStas = calloc(1, sizeof(STATION));
pStas->svId = svtcur->event_id ;
pStas->ontv = arg_onTV ;
pStas->name = svtcur->servicename ;
- staCount = 1;*/
- ///Êѹ¹¸å
- STATION *sta=NULL;
- int sta_count = 0;
- svttop = calloc(1, sizeof(SVT_CONTROL));
- //char *head=arg_onTV;
- GetSDT_chout(infile, svttop, secs, SECCOUNT,&sta, &sta_count,arg_onTV);
- checkSta(&sta,&sta_count);
- //if (sta_count)
- //printf("Station count: %d\n1st ontv=%s,name=%s\n",sta_count, sta[0].ontv, sta[0].name);
- pStas = sta;
- staCount = sta_count;// sizeof(pStas) / sizeof (STATION);
- act = 0 ;
- outputhtml=1;
+ staCount = 1;
+ */
}
- if (outputhtml == 1){
- fprintf(outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- fprintf(outfile, "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">\n\n");
- fprintf(outfile, "<tv generator-info-name=\"tsEPG2xml\" generator-info-url=\"http://localhost/\">\n");
+ checkSta(&pStas, &staCount);
- cd = iconv_open("UTF-8", "EUC-JP");
- for(lp = 0 ; lp < staCount ; lp++){
- memset(ServiceName, '\0', sizeof(ServiceName));
- ilen = strlen(pStas[lp].name);
- olen = sizeof(ServiceName);
- outptr = ServiceName ;
- inptr = pStas[lp].name ;
- iconv(cd, &inptr, &ilen, &outptr, &olen);
- xmlspecialchars(ServiceName);
-
- fprintf(outfile, " <channel id=\"%s\">\n", pStas[lp].ontv);
- fprintf(outfile, " <display-name lang=\"ja_JP\">%s</display-name>\n", ServiceName);
- fprintf(outfile, " </channel>\n");
- }
+ fprintf(outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ fprintf(outfile, "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">\n\n");
+ fprintf(outfile, "<tv generator-info-name=\"tsEPG2xml\" generator-info-url=\"http://localhost/\">\n");
+
+ char ServiceName[1024];
+ char Logo[8192];
+
+ if ( is_logo ) {
+ memset(Logo, '\0', sizeof(Logo));
for(lp = 0 ; lp < staCount ; lp++){
- GetEIT(infile, outfile, &pStas[lp], secs, SECCOUNT);
- }
- fprintf(outfile, "</tv>\n");
- if(inclose) {
- fclose(infile);
+ for ( i = 0 ; i < 6 ; i++) {
+ if (pStas[lp].logo_array[i].logo) {
+ base64_encode(Logo, pStas[lp].logo_array[i].logo, pStas[lp].logo_array[i].logo_size);
+ xmlspecialchars(Logo);
+ fprintf(outfile, " <logo ts=\"%d\" on=\"%d\" sv=\"%d\" type=\"%d\">%s</logo>\n",
+ pStas[lp].tsId,
+ pStas[lp].onId,
+ pStas[lp].svId,
+ i,
+ Logo);
+ }
+ }
}
- if(outclose) {
- fclose(outfile);
- }
- iconv_close(cd);
- if(act){
- free(pStas);
- svtcur = svttop ; //ÀèƬ
- while(svtcur != NULL){
- svtsave = svtcur->next ;
- free(svtcur);
- svtcur = svtsave ;
+ for ( i = 0; i < 1024; i++) {
+ if ( dsmctl[i].isUsed == 0 ) break;
+ parseSDTTdata(dsmctl[i].blockData, &sdtd);
+
+ for (j = 0; j < sdtd.number_of_loop; j++) {
+ loop = sdtd.loop + sizeof(SDTTdataLoop) * j;
+
+ for ( k = 0; k < loop->number_of_services; k++) {
+ service = loop->services + sizeof(SDTTdataService) * k;
+
+ /*
+ for(lp = 0 ; lp < staCount ; lp++){
+ if (
+ pStas[lp].tsId == service->transport_stream_id &&
+ pStas[lp].onId == service->original_network_id &&
+ pStas[lp].svId == service->service_id
+ ) {
+ clt2png(loop->data,
+ &pStas[lp].logo_array[sdtd.logo_type].logo,
+ &pStas[lp].logo_array[sdtd.logo_type].logo_size);
+ }
+ }
+ */
+
+ #if 0
+ printf( "SDTTdataLoop (%d:%d) %d:%d[%d:%d:%d]%d\n",
+ i, j,
+ sdtd.logo_type,
+ loop->logo_id,
+ service->transport_stream_id,
+ service->original_network_id,
+ service->service_id,
+ loop->data_size
+ );
+ #endif
+
+
+ void* logo = NULL;
+ int logo_size = 0;
+
+ clt2png(loop->data, &logo, &logo_size);
+ memset(Logo, '\0', sizeof(Logo));
+ base64_encode(Logo, logo, logo_size);
+ xmlspecialchars(Logo);
+
+ fprintf(outfile, " <logo ts=\"%d\" on=\"%d\" sv=\"%d\" type=\"%d\" dlid=\"%d\">%s</logo>\n",
+ service->transport_stream_id,
+ service->original_network_id,
+ service->service_id,
+ sdtd.logo_type,
+ loop->logo_id,
+ Logo);
+ }
+
}
}
- }else{
-
}
+ for(lp = 0 ; lp < staCount ; lp++){
+ memset(ServiceName, '\0', sizeof(ServiceName));
+ strcpy(ServiceName, pStas[lp].name);
+ xmlspecialchars(ServiceName);
+
+ fprintf(outfile, " <channel id=\"%s\">\n", pStas[lp].ontv);
+ fprintf(outfile, " <display-name lang=\"ja_JP\">%s</display-name>\n", ServiceName);
+ fprintf(outfile, " <id ts=\"%d\" on=\"%d\" sv=\"%d\"/>\n", pStas[lp].tsId, pStas[lp].onId, pStas[lp].svId);
+
+ fprintf(outfile, " </channel>\n");
+ }
+ if ( is_logo ) {
+ fprintf(outfile, "</tv>\n");
+ goto cleanup;
+ }
+ for(lp = 0 ; lp < staCount ; lp++){
+ GetEIT(infile, outfile, &pStas[lp], secs);
+ }
+ fprintf(outfile, "</tv>\n");
+cleanup:
+ if(inclose) {
+ fclose(infile);
+ }
+ if(outclose) {
+ fclose(outfile);
+ }
+ if(act){
+ free(pStas);
+ svtcur = svttop ; //先頭
+ while(svtcur != NULL){
+ svtsave = svtcur->next ;
+ free(svtcur);
+ svtcur = svtsave ;
+ }
+ }
+
return 0;
}
+
\8eg\97p\95û\96@\82Í\88È\89º\82Ì\92Ê\82è\82Å\82·\81B
-Usage : ./epgdump /BS <tsFile> <outfile>
-Usage : ./epgdump <ontvcode> <tsFile> <outfile>
-ontvcode \83`\83\83\83\93\83l\83\8b\8e¯\95Ê\8eq\81B****.ontvjapan.com \82È\82Ç
+Usage : ./epgdump {/BS|/CS} <tsFile> <outfile>
+Usage : ./epgdump <id> <tsFile> <outfile>
+
+id \83`\83\83\83\93\83l\83\8b\8e¯\95Ê\8eq\81B\92n\8fã\94g\82Ì\95¨\97\9d\83`\83\83\83\93\83l\83\8b\82ð\97^\82¦\82Ü\82·\81B
/BS BS\83\82\81[\83h\81B\88ê\82Â\82ÌTS\82©\82çBS\91S\8bÇ\82Ì\83f\81[\83^\82ð\93Ç\82Ý\8d\9e\82Ý\82Ü\82·\81B
/CS CS\83\82\81[\83h\81B\88ê\82Â\82ÌTS\82©\82ç\95¡\90\94\8bÇ\82Ì\83f\81[\83^\82ð\93Ç\82Ý\8d\9e\82Ý\82Ü\82·\81B
+/TIME \8e\9e\8d\8f\8d\87\82í\82¹\83\82\81[\83h\81BTS\82©\82çTOT(Time Offset Table)\82ð\93Ç\82Ý\8d\9e\82Ý\82Ü\82·\81B
+ recpt1 <\94C\88Ó> 10(\95b\88È\8fã) - | epgdump /TIME - <\94C\88Ó>\82Ì\8c`\82Å\8eg\97p\82µ\82Ä\82\82¾\82³\82¢\81B
+ TOT\82Í5\95b\82É1\89ñ\82µ\82©\97\88\82È\82¢\82½\82ß\81Arecpt1\82É\97^\82¦\82é\8e\9e\8aÔ\82ð\82 \82é\92ö\93x\92·\82\82µ\82Ä\82\82¾\82³\82¢\81B
make\82·\82é\82Æepgdump\82ª\83r\83\8b\83h\82³\82ê\82Ü\82·\81B
\81E\8ag\92£\83c\81[\83\8b\92\86\82Ì\90l
\81E\81\9fN/E9PqspSk\8e\81
\81EARIB(\8e\91\97¿\82Ì\96³\97¿\83_\83E\83\93\83\8d\81[\83h\82É\91Î\82µ\82Ä)
+\81E\83f\81[\83^\95ú\91\97\97p\83v\83\8d\83O\83\89\83\80\8bl\82ß\8d\87\82í\82¹ \82»\82Ì2\82Ì\95û(clt2png\82Ì\83\\81[\83X\83R\81[\83h\82ð\8eg\97p)
\93®\8dì\8am\94F\8aÂ\8b«:
Debian GNU/Linux sid
+// -*- tab-width:4 -*-
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
return 5;
}
-int parseSVCdesc(unsigned char *data, SVCdesc *desc) {//0x48\82Ì\83T\81[\83r\83X\8bL\8fq\8eq\81A\95ú\91\97\8bÇ\82Ì\96¼\91O\82È\82Ç\82ª\93ü\82Á\82Ä\82¢\82é\82æ\82¤
+int parseSVCdesc(unsigned char *data, SVCdesc *desc) {
+//0x48のサービス記述子、放送局の名前などが入っているよう
int boff = 0;
-
- memset(desc, 0, sizeof(SVCdesc));
+ memset(desc, 0, sizeof(SVCdesc));
desc->descriptor_tag = getBit(data, &boff, 8);
desc->descriptor_length = getBit(data, &boff, 8);
desc->service_type = getBit(data, &boff, 8);
return desc->descriptor_length + 2;
}
-int serachid(SVT_CONTROL *top, int service_id)
+
+int parseLOGdesc(unsigned char *data, LOGdesc *desc) {
+//0xC1のデジタルコピー制御記述子
+//0xCFのロゴ伝送記述子
+ int boff = 0;
+
+ memset(desc, 0, sizeof(LOGdesc));
+ desc->descriptor_tag = getBit(data, &boff, 8);
+ desc->descriptor_length = getBit(data, &boff, 8);
+ desc->logo_transmission_type = getBit(data, &boff, 8);
+ if ( desc->logo_transmission_type == 0x01 ) {
+ desc->reserved_future_use1 = getBit(data, &boff, 7);
+ desc->logo_id = getBit(data, &boff, 9);
+ desc->reserved_future_use2 = getBit(data, &boff, 4);
+ desc->logo_version = getBit(data, &boff, 12);
+ desc->download_data_id = getBit(data, &boff, 16);
+ }
+ else if ( desc->logo_transmission_type == 0x02 ) {
+ desc->reserved_future_use1 = getBit(data, &boff, 7);
+ desc->logo_id = getBit(data, &boff, 9);
+ }
+ else if ( desc->logo_transmission_type == 0x03 ) {
+ memcpy(desc->logo_char, data + boff / 8, desc->descriptor_length);
+ // getStr(desc->logo_char, data, &boff, desc->descriptor_length);
+ }
+
+ return desc->descriptor_length + 2;
+}
+
+int serachid(SVT_CONTROL *top, int service_id)
{
SVT_CONTROL *cur = top ;
while(cur != NULL){
return 0 ;
}
-void enqueue_sdt(SVT_CONTROL *top, SVT_CONTROL *sdtptr)
+void enqueue_sdt(SVT_CONTROL *top, SVT_CONTROL *sdtptr)
{
SVT_CONTROL *cur ;
+
if(top->next == NULL){
top->next = sdtptr ;
top->prev = top ;
}
-void dumpSDT(unsigned char *ptr, SVT_CONTROL *top)
+void dumpSDT(unsigned char *ptr, SVT_CONTROL *top,STATION **station, int * station_count,char *ontvheader)
{
SDThead sdth;
SDTbody sdtb;
SVCdesc desc;
+ LOGdesc logd;
SVT_CONTROL *svtptr ;
+ STATION * pStation = *station;
int rc ;
int len = 0;
int loop_len = 0;
+ int desc_len = 0;
+ char sid[80];
+ int stationi = *station_count;
+ int i = 0;
/* SDT */
len = parseSDThead(ptr, &sdth);
ptr += len;
- loop_len = sdth.section_length - (len - 3 + 4); // 3¤Ï¶¦Ḁ̈إåÀĹ 4¤ÏCRC
+ loop_len = sdth.section_length - (len - 3 + 4); // 3は共通ヘッダ長 4はCRC
while(loop_len > 0) {
len = parseSDTbody(ptr, &sdtb);
+ //printf("body %d - %d = %d\n",loop_len,len,loop_len - len);
ptr += len;
loop_len -= len;
- parseSVCdesc(ptr, &desc);
-
- rc = serachid(top, sdtb.service_id);
- if(rc == 0){
- svtptr = calloc(1, sizeof(SVT_CONTROL));
- svtptr->event_id = sdtb.service_id;
- svtptr->original_network_id = sdth.original_network_id;
- svtptr->transport_stream_id = sdth.transport_stream_id;
- svtptr->event_id = sdtb.service_id;
- memcpy(svtptr->servicename, desc.service_name, strlen(desc.service_name));
- enqueue_sdt(top, svtptr);
-#if 0
- printf("STATION=%s,%d,%d,%d,%d\n",
- desc.service_name,sdtb.service_id,sdth.transport_stream_id,
- sdth.original_network_id,sdtb.service_id);
-#endif
-#if 0
- printf("SDT=%s,%d,%x,%x,%x,%x,%x,%x,%x\n",
- desc.service_name, sdtb.service_id, sdtb.reserved_future_use1,
- sdtb.EIT_user_defined_flags, sdtb.EIT_schedule_flag, sdtb.EIT_present_following_flag,
- sdtb.running_status, sdtb.free_CA_mode, sdtb.descriptors_loop_length);
-/*
-0x01:\83f\83W\83^\83\8bTV\83T\81[\83r\83X
-0xA5:\83v\83\8d\83\82\81[\83V\83\87\83\93\89f\91\9c\83T\81[\83r\83X
-0x0C:\83f\81[\83^\83T\81[\83r\83X
- */
- printf("SDT=(%x:%x)%s,%d,%d,%d,%d,%d(%d,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n",
- sdth.table_id, desc.service_type,
- desc.service_name, sdtb.service_id,
- desc.descriptor_tag, desc.descriptor_length, desc.service_type,
- desc.service_provider_name_length, desc.service_name_length,
- sdth.table_id, sdth.section_syntax_indicator, sdth.reserved_future_use1,
- sdth.reserved1, sdth.section_length, sdth.transport_stream_id,
- sdth.reserved2, sdth.version_number, sdth.current_next_indicator,
- sdth.section_number, sdth.last_section_number, sdth.original_network_id,
- sdth.reserved_future_use2);
-#endif
- }
- ptr += sdtb.descriptors_loop_length;
- loop_len -= sdtb.descriptors_loop_length;
- }
-
- return;
-}
-void dumpSDT_chout(unsigned char *ptr, SVT_CONTROL *top,STATION **station, int * station_count,char *ontvheader)
-{
+ desc_len = sdtb.descriptors_loop_length;
+ loop_len -= desc_len;
+ while(desc_len > 0) {
+ if ( *ptr == 0xCF ) {
+ len = parseLOGdesc(ptr, &logd);
+ ptr += len;
+ desc_len -= len;
- SDThead sdth;
- SDTbody sdtb;
- SVCdesc desc;
- SVT_CONTROL *svtptr ;
- STATION * pStation = *station;
- int rc ;
+ #if 0
+ printf("LOG=%d,%d,%d,%d\n",
+ logd.logo_transmission_type, logd.logo_id,
+ logd.logo_version, logd.download_data_id);
+ #endif
- int len = 0;
- int loop_len = 0;
- char sid[80];
- int stationi=*station_count;
- /* SDT */
- len = parseSDThead(ptr, &sdth);
- ptr += len;
- loop_len = sdth.section_length - (len - 3 + 4); // 3¤Ï¶¦Ḁ̈إåÀĹ 4¤ÏCRC
- while(loop_len > 0) {
- len = parseSDTbody(ptr, &sdtb);
- ptr += len;
- loop_len -= len;
- parseSVCdesc(ptr, &desc);
- rc = serachid(top, sdtb.service_id);
- if(rc == 0){
- svtptr = calloc(1, sizeof(SVT_CONTROL));
- svtptr->event_id = sdtb.service_id;
- svtptr->original_network_id = sdth.original_network_id;
- svtptr->transport_stream_id = sdth.transport_stream_id;
- svtptr->event_id = sdtb.service_id;
- memcpy(svtptr->servicename, desc.service_name, strlen(desc.service_name));
- if (desc.service_type == 1){
- enqueue_sdt(top, svtptr);
- pStation = realloc(pStation,(stationi+1)*sizeof(STATION));
- if (!pStation) printf( "Realloc returned NULL!!! stationi = %d\n", stationi);
- //char sidt[32];
- //char *tt="_";
- //sprintf(sidt, "%d", sdtb.service_id ); //ontv\83t\83H\81[\83}\83b\83g\82æ\82\82í\82©\82ç\82È\82¢
- //STATION stt={NULL,NULL,sdth.transport_stream_id,
- // sdth.original_network_id,sdtb.service_id};
- //\88È\89º\82É\93W\8aJ\82µ\82½
- //strcpy(sid,ontvheader);
- //strcat(sid,tt);
- //strcat(sid,sidt);
- sprintf(sid, "%s_%d", ontvheader, sdtb.service_id );
- pStation[stationi].name = malloc( strlen(desc.service_name) + 1 );
- pStation[stationi].ontv = malloc( strlen(sid) + 1 );
- pStation[stationi].tsId = sdth.transport_stream_id;
- pStation[stationi].onId = sdth.original_network_id;
- pStation[stationi].svId = sdtb.service_id;
-
- strcpy(pStation[stationi].name, desc.service_name);
- strcpy(pStation[stationi].ontv, sid);
-
- //printf("%s\n",sttt.name);
- //printf("%s\n",pStation[stationi].name);
- //printf( "iii %d \n", stationi);
- stationi++;
-
- //sprintf(*lastservicename, "%s", "lastservice2" );
-#if 0
- printf("STATION=%s,%d,%d,%d,%d,%d\n",
- desc.service_name,sdtb.service_id,sdth.transport_stream_id,
- sdth.original_network_id,sdtb.service_id,desc.service_type);
-#endif
-
+ /*
+ logd.logo_transmission_type
+ 0x01 CDT 伝送方式1:CDT をダウンロードデータ識別で直接参照する場合
+ 0x02 CDT 伝送方式2:CDT をロゴ識別を用いてダウンロードデータ識別を間接的に参照する場合
+ 0x03 簡易ロゴ方式
+ */
+ if ( logd.logo_transmission_type != 0x01 ) continue;
+ for (i=0; i<stationi; i++) {
+ // FIXME: pStation[i].logo_version < logd.logo_version
+ if ( pStation[i].svId == sdtb.service_id ) {
+ pStation[i].logo_download_data_id = logd.download_data_id;
+ pStation[i].logo_version = logd.logo_version;
+ }
+ }
+
+ continue;
+ }
+ else if ( *ptr != 0x48 ) {
+ len = parseOTHERdesc(ptr);
+ ptr += len;
+ desc_len -= len;
+ continue;
}
+ len = parseSVCdesc(ptr, &desc);
+ //printf("desc %d - %d = %d\n",desc_len,len,desc_len - len);
+ ptr += len;
+ desc_len -= len;
+
+ rc = serachid(top, sdtb.service_id);
+ if(rc == 0){
+ svtptr = calloc(1, sizeof(SVT_CONTROL));
+ svtptr->original_network_id = sdth.original_network_id;
+ svtptr->transport_stream_id = sdth.transport_stream_id;
+ svtptr->event_id = sdtb.service_id;
+ memcpy(svtptr->servicename, desc.service_name, strlen(desc.service_name));
+ if (desc.service_type == 1){
+ enqueue_sdt(top, svtptr);
+
+ sprintf(sid, "%s_%d", ontvheader, sdtb.service_id );
+ for (i=0; i<stationi; i++) {
+ if ( !strcmp( pStation[i].ontv, sid ) ) {
+ // 既に同じものが含まれるのでスキップ
+ break;
+ }
+ }
+
+ pStation = realloc(pStation, (stationi + 1) * sizeof(STATION));
+ memset(&pStation[stationi], 0, sizeof(STATION));
+
+ pStation[stationi].name = malloc( strlen(desc.service_name) + 1 );
+ pStation[stationi].ontv = malloc( strlen(sid) + 1 );
+ pStation[stationi].tsId = sdth.transport_stream_id;
+ pStation[stationi].onId = sdth.original_network_id;
+ pStation[stationi].svId = sdtb.service_id;
+
+ strcpy(pStation[stationi].name, desc.service_name);
+ strcpy(pStation[stationi].ontv, sid);
+
+ stationi++;
+ }
#if 0
- printf("STATION=%s,%s,%d,%d,%d\n",
- sttt.name,sttt.ontv,sttt.tsId,sttt.onId,sttt.svId
- );
-#endif
-#if 0
- printf("SDT=%s,%d,%x,%x,%x,%x,%x,%x,%x\n",
- desc.service_name, sdtb.service_id, sdtb.reserved_future_use1,
- sdtb.EIT_user_defined_flags, sdtb.EIT_schedule_flag, sdtb.EIT_present_following_flag,
- sdtb.running_status, sdtb.free_CA_mode, sdtb.descriptors_loop_length);
+ printf("STATION=%s,%d,%d,%d,%d,%d\n",
+ desc.service_name,sdtb.service_id,sdth.transport_stream_id,
+ sdth.original_network_id,sdtb.service_id,desc.service_type);
+
+ printf("SDT=%s,%d,%x,%x,%x,%x,%x,%x,%x\n",
+ desc.service_name, sdtb.service_id, sdtb.reserved_future_use1,
+ sdtb.EIT_user_defined_flags, sdtb.EIT_schedule_flag, sdtb.EIT_present_following_flag,
+ sdtb.running_status, sdtb.free_CA_mode, sdtb.descriptors_loop_length);
/*
-0x01:\83f\83W\83^\83\8bTV\83T\81[\83r\83X
-0xA5:\83v\83\8d\83\82\81[\83V\83\87\83\93\89f\91\9c\83T\81[\83r\83X
-0x0C:\83f\81[\83^\83T\81[\83r\83X
- */
-
- printf("SDT=(%x:%x)%s,%d,%d,%d,%d,%d(%d,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n",
- sdth.table_id, desc.service_type,
- desc.service_name, sdtb.service_id,
- desc.descriptor_tag, desc.descriptor_length, desc.service_type,
- desc.service_provider_name_length, desc.service_name_length,
- sdth.table_id, sdth.section_syntax_indicator, sdth.reserved_future_use1,
- sdth.reserved1, sdth.section_length, sdth.transport_stream_id,
- sdth.reserved2, sdth.version_number, sdth.current_next_indicator,
- sdth.section_number, sdth.last_section_number, sdth.original_network_id,
- sdth.reserved_future_use2);
+0x01:デジタルTVサービス
+0xA5:プロモーション映像サービス
+0x0C:データサービス
+*/
+ printf("SDT=(%x:%x)%s,%d,%d,%d,%d,%d(%d,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n",
+ sdth.table_id, desc.service_type,
+ desc.service_name, sdtb.service_id,
+ desc.descriptor_tag, desc.descriptor_length, desc.service_type,
+ desc.service_provider_name_length, desc.service_name_length,
+ sdth.table_id, sdth.section_syntax_indicator, sdth.reserved_future_use1,
+ sdth.reserved1, sdth.section_length, sdth.transport_stream_id,
+ sdth.reserved2, sdth.version_number, sdth.current_next_indicator,
+ sdth.section_number, sdth.last_section_number, sdth.original_network_id,
+ sdth.reserved_future_use2);
#endif
+ }
}
+/*
//ptr += sdtb.descriptors_loop_length;
loop_len -= sdtb.descriptors_loop_length;
if (loop_len>0){
ptr += sdtb.descriptors_loop_length;
}
-
+*/
}
*station = pStation;
*station_count = stationi;
- //printf("stationi %d -",stationi);//stationi==294\82Å\97\8e\82¿\82é
+ //printf("stationi %d -",stationi);//stationi==294で落ちる
return;
}
+
char service_name[MAXSECLEN];
} SVCdesc;
+typedef struct _LOGdesc {
+ int descriptor_tag;
+ int descriptor_length;
+ int logo_transmission_type;
+ int reserved_future_use1;
+ int logo_id;
+ int reserved_future_use2;
+ int logo_version;
+ int download_data_id;
+
+ char logo_char[MAXSECLEN];
+} LOGdesc;
+
+typedef struct _TAG_LOGO
+{
+ void *logo;
+ int logo_size;
+} LOGO;
+
typedef struct _TAG_STATION
{
char *name;
int tsId; // OriginalNetworkID
int onId; // TransportStreamID
int svId; // ServiceID
+ unsigned int logo_download_data_id;
+ unsigned int logo_version;
+ LOGO logo_array[6];
} STATION;
#ifdef __cplusplus
int parseSDThead(unsigned char *data, SDThead *h);
int parseSDTbody(unsigned char *data, SDTbody *b);
int parseSVCdesc(unsigned char *data, SVCdesc *desc);
- void dumpSDT(unsigned char *data, SVT_CONTROL *top);
- void dumpSDT_chout(unsigned char *ptr, SVT_CONTROL *top, STATION **station, int * station_count,char *ontvheader);
+ void dumpSDT(unsigned char *ptr, SVT_CONTROL *top, STATION **station, int * station_count, char *ontvheader);
#ifdef __cplusplus
}
int inchar;
int i;
- /* sync¥Ð¥¤¥È¤Þ¤ÇÆɤßÈô¤Ð¤· */
+ /* syncバイトまで読み飛ばし */
if(rcount == 0) {
while((inchar = fgetc(in)) != EOF) {
if((inchar & 0xFF) == 0x47) {
retry:
- /* Ì᤹¤Ù¤»Ä¤ê¤¬¤¢¤ë¤«? */
+ /* 戻すべき残りがあるか? */
if(ridx >= 0 && secs[ridx].cont) {
- /* ¥Ð¥Ã¥Õ¥¡¥Á¥§¥Ã¥¯ */
+ /* ã\83\90ã\83\83ã\83\95ã\82¡ã\83\81ã\82§ã\83\83ã\82¯ */
if((secs[ridx].cur.payload[secs[ridx].curlen] & 0xFF) == 0xFF) {
secs[ridx].cont = 0;
secs[ridx].seclen = 0;
secs[ridx].curlen = 0;
} else {
len = secs[ridx].cur.payloadlen - secs[ridx].curlen;
- /* Á´ÉôÀßÄêºÑ¤ß¥Á¥§¥Ã¥¯ */
+ /* å\85¨é\83¨è¨å®\9aæ¸\88ã\81¿ã\83\81ã\82§ã\83\83ã\82¯ */
if(len == 0) {
secs[ridx].cont = 0;
secs[ridx].seclen = 0;
secs[ridx].setlen = 0;
secs[ridx].curlen = 0;
} else {
- /* ¤³¤³¤Çseclen¤¬¸Ù¤ë¤è¤¦¤ËTSʬ³ä¤µ¤ì¤Æ¤¤¤ë¤Èº¤¤ë¤Ê @@
+ /* ここでseclenが跨るようにTS分割されていると困るな @@
if(secs[ridx].pid == 0x12) {
int check = secs[ridx].cur.payload[secs[ridx].curlen] & 0xFF;
if(!(check == 0x4E ||
*/
boff = 12;
- secs[ridx].seclen = getBit(&secs[ridx].cur.payload[secs[ridx].curlen], &boff, 12) + 3; // ¥Ø¥Ã¥À
+ secs[ridx].seclen = getBit(&secs[ridx].cur.payload[secs[ridx].curlen], &boff, 12) + 3; // ヘッダ
+ /*
+ if(secs[ridx].seclen > MAXSECLEN){
+ // セクションが MAXSECLEN より大きい時はこのセクションをスキップ
+ secs[ridx].cont = 0;
+ goto retry;
+ }
+ */
/*
if(secs[ridx].seclen == 2334) {
}
*/
- /* TS¥Ç¡¼¥¿Ä¹-ÀßÄêºÑ¤ß¥Ç¡¼¥¿Ä¹ */
+ /* TSデータ長-設定済みデータ長 */
if(secs[ridx].seclen > len) {
memcpy(secs[ridx].buf, &secs[ridx].cur.payload[secs[ridx].curlen], len);
secs[ridx].setlen = len;
secs[ridx].curlen = 0;
secs[ridx].cont = 1;
- /* ¼¡¤Î¥ì¥³¡¼¥ÉÆɤ߹þ¤ß */
+ /* 次のレコード読み込み */
} else {
memcpy(secs[ridx].buf,
&secs[ridx].cur.payload[secs[ridx].curlen], secs[ridx].seclen);
secs[ridx].curlen += secs[ridx].seclen;
secs[ridx].cont = 1;
- /* CRC¤Î¥Á¥§¥Ã¥¯ */
+ /* CRCã\81®ã\83\81ã\82§ã\83\83ã\82¯ */
if(checkcrc(&(secs[ridx]))) {
- return &(secs[ridx]); /* Ìá¤ë */
+ return &(secs[ridx]); /* 戻る */
}
- goto retry; /* ¤â¤¦°ì²ó */
+ goto retry; /* もう一回 */
}
}
}
int roffset = 0;
while(1) {
if(fread(buf+roffset, 188-roffset, 1, in) != 1) {
- /* »Ä¤ê¤Î½èÍý? */
+ /* 残りの処理? */
return NULL;
}
roffset = 0;
rcount++;
if((buf[0] & 0xFF) != 0x47) {
- /* ºÇ½é¤ÏbufÃæ¤Ë0x47¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯ */
+ /* æ\9c\80å\88\9dã\81¯bufä¸ã\81«0x47ã\81\8cã\81\82ã\82\8bã\81\8bã\83\81ã\82§ã\83\83ã\82¯ */
for(i = 1; i < 188; i++) {
if((buf[i] & 0xFF) == 0x47) {
break;
}
if(i < 188) {
- /* ¤½¤³¤«¤éºÆÆɤ߹þ¤ß¤·¤ÆÍߤ·¤¤¤Î¤Çseek */
+ /* そこから再読み込みして欲しいのでseek */
//fseek(in, (188 - i) * -1, SEEK_CUR);
roffset = i;
memmove(buf, buf + i, 188 - i);
shall be '1', indicating that the first byte of the payload of this Transport Stream packet carries the pointer_field.
*/
if(pk.payload_unit_start_indicator == 1) {
- /* pointer_field¤Ï¤¤¤é¤Ê¤¤ */
+ /* pointer_fieldはいらない */
payptr += 1;
pk.payloadlen -= 1;
}
+
memset(pk.payload, 0xFF, sizeof(pk.payload));
-#if 1 /* 07/07/2009 add: */
+ /* 07/07/2009 add: */
+ //if((pk.payloadlen <= 0) || (pk.payloadlen > sizeof(pk.payload))){
if( pk.payloadlen > sizeof(pk.payload) ){
continue;
}
-#endif
memcpy(pk.payload, payptr, pk.payloadlen);
/*
}
*/
- /* ¶½Ì£¤Î¤¢¤ëpid¤«³Îǧ */
+ /* 興味のあるpidか確認 */
for(int i = 0;i < size; i++) {
if(secs[i].pid == pk.pid) {
secs[i].cur = pk;
- /* ÅÓÃæ½èÍýÃ椫ºÇ½é¤«? */
+ /* 途中処理中か最初か? */
if(!secs[i].cont) {
- /* ºÇ½é ¥»¥¯¥·¥ç¥óŤòÄ´¤Ù¤ë */
+ /* 最初 セクション長を調べる */
boff = 12;
- secs[i].seclen = getBit(secs[i].cur.payload, &boff, 12) + 3; // ¥Ø¥Ã¥À;
+ secs[i].seclen = getBit(secs[i].cur.payload, &boff, 12) + 3; // ヘッダ;
+ /*
+ if(secs[i].seclen > MAXSECLEN){
+ // セクション長が MAXSECLEN より長いときはこのセクションをスキップ
+ secs[i].cont = 0;
+ goto retry;
+ }
+ */
/*
if(secs[i].seclen == 2334) {
printf("aa");
secs[i].curlen = secs[i].seclen;
secs[i].cont = 1;
ridx = i;
- /* CRC¤Î¥Á¥§¥Ã¥¯ */
+ /* CRCã\81®ã\83\81ã\82§ã\83\83ã\82¯ */
if(checkcrc(&(secs[ridx]))) {
- return &(secs[i]); /* ¼è¤ê¹ç¤¨¤ºÌá¤ë */
+ return &(secs[i]); /* 取り合えず戻る */
}
- goto retry; /* »Ä¤ê½èÍý¤Ø */
+ goto retry; /* 残り処理へ */
}
- /* ¥»¥¯¥·¥ç¥óĹ-ÀßÄêºÑ¤ßĹ */
+ /* セクション長-設定済み長 */
len = secs[i].seclen - secs[i].setlen;
if(len > secs[i].cur.payloadlen) {
- /* Á´ÂΞÁ÷ */
+ /* 全体転送 */
memcpy(&secs[i].buf[secs[i].setlen],
secs[i].cur.payload, secs[i].cur.payloadlen);
secs[i].setlen += secs[i].cur.payloadlen;
continue;
}
- /* ¥»¥¯¥·¥ç¥óŤλĤê¤òÀßÄê */
+ /* セクション長の残りを設定 */
memcpy(&secs[i].buf[secs[i].setlen], secs[i].cur.payload, len);
secs[i].setlen = secs[i].seclen;
secs[i].curlen += len;
secs[i].cont = 1;
ridx = i;
- /* CRC¤Î¥Á¥§¥Ã¥¯ */
+ /* CRCã\81®ã\83\81ã\82§ã\83\83ã\82¯ */
if(checkcrc(&(secs[ridx]))) {
return &(secs[i]);
}
- goto retry; /* »Ä¤ê½èÍý¤Ø */
+ goto retry; /* 残り処理へ */
}
}
}
//return NULL;
}
-/* BonTest/TsStream.cpp¤«¤é¤Î¥Ñ¥¯¥ê */
+/* BonTest/TsStream.cppからのパクリ */
unsigned int CalcCrc(unsigned int crc, unsigned char *buf, int len) {
unsigned int c = crc;
int n;
int checkcrc(SECcache *secs) {
-#if 1 /* 07/07/2009 add: °Û¾ï¾õÂÖ²óÈò¤Î¤¿¤á */
- /* ¥»¥¯¥·¥ç¥óºÇÂçŤòĶ¤¨¤ë¤³¤È¤Ê¤É¤¢¤êÆÀ¤Ê¤¤¤Ï¤º¤À¤¬... */
+ /* 07/07/2009 add: 異常状態回避のため */
+ /* セクション最大長を超えることなどあり得ないはずだが... */
if( secs->seclen > MAXSECLEN ){
- /* ¤è¤¯Ê¬¤«¤é¤ó¤Î¤ÇÇË´þ¤·¤Æ¤ä¤ë */
+ /* よく分からんので破棄してやる */
return 0;
}
-#endif
- /* ¥»¥¯¥·¥ç¥ó¤Î½ª¤ê¤ËÃÖ¤«¤ì¤ë4¥Ð¥¤¥È¤ÎCRC32¤Ï¡¢
- CRC·×»»¤Î·ë²Ì0¤Ë¤Ê¤ë¤è¤¦¤ËÀßÄꤵ¤ì¤ë¡£
- Ãͤ¬È¯À¸¤·¤¿¾ì¹ç¤Ï¡¢¥¨¥é¡¼¤Ê¤Î¤ÇÂоݳ°¤Ë¤¹¤ë */
+ /* セクションの終りに置かれる4バイトのCRC32は、
+ CRC計算の結果0になるように設定される。
+ 値が発生した場合は、エラーなので対象外にする */
if(CalcCrc(0xffffffffU, secs->buf, secs->seclen)) {
// fprintf(stderr, "tblid:0x%x CRC error\n", secs->buf[0]);
return 0;
struct _SVT_CONTROL{
SVT_CONTROL *next ;
SVT_CONTROL *prev ;
- int event_id ; // ¥¤¥Ù¥ó¥ÈID
+ int event_id ; // イベントID
int original_network_id ; // OriginalNetworkID
- int transport_stream_id ; // TransporrtStreamID
- char servicename[MAXSECLEN] ; // ¥µ¡¼¥Ó¥¹Ì¾
+ int transport_stream_id ; // TransportStreamID
+ char servicename[MAXSECLEN] ; // サービス名
};
typedef struct _EIT_CONTROL EIT_CONTROL;
EIT_CONTROL *prev ;
int table_id ;
int servid ;
- int event_id ; // ¥¤¥Ù¥ó¥ÈID
- int content_type ; // ¥³¥ó¥Æ¥ó¥È¥¿¥¤¥×
- int yy;
- int mm;
- int dd;
- int hh;
- int hm;
+ int event_id ; // イベントID
+ int content_type ; // コンテントタイプ
+ int yy;
+ int mm;
+ int dd;
+ int hh;
+ int hm;
int ss;
int dhh;
int dhm;
int ehh;
int emm;
int ess;
- char *title ; // ¥¿¥¤¥È¥ë
- char *subtitle ; // ¥µ¥Ö¥¿¥¤¥È¥ë
- char *desc ; // Description
+ char *title ; // タイトル
+ char *subtitle ; // サブタイトル
+ char *desc ; // Description
+ int desc_length ; // Description Length
+ int video_type ; // 映像のタイプ
+ int audio_type ; // 音声のタイプ
+ int multi_type ; // 音声の 2 カ国語多重
};
+
+typedef struct _DSM_CONTROL DSM_CONTROL;
+struct _DSM_CONTROL{
+ int isUsed ;
+ int moduleId ;
+ int lastBlockNumber ;
+ int blockSize ;
+ void *blockData ;
+};
+
#endif
+
int strrep(char *buf, char *mae, char *ato)
{
- char *mituke;
+ char *mitsuke, *findpos;
size_t maelen, atolen;
+ int shift;
+ findpos = buf;
maelen = strlen(mae);
atolen = strlen(ato);
- if (maelen == 0 || (mituke = strstr(buf, mae)) == NULL) return 0;
- memmove(mituke + atolen, mituke + maelen, strlen(buf) - (mituke + maelen - buf ) + 1);
- memcpy(mituke, ato, atolen);
+ shift = (int)(strlen(ato)-strlen(mae));
+
+ if (maelen == 0 || strstr(findpos, mae) == NULL) return 0;
+ while ((mitsuke = strstr(findpos, mae)) != NULL) {
+ if (shift > 0) {
+ memmove(mitsuke + shift, mitsuke, strlen(mitsuke) + 1);
+ } else if (shift < 0) {
+ memmove(mitsuke, mitsuke - shift, strlen(mitsuke) + shift + 1);
+ }
+ memmove(mitsuke, ato, atolen);
+ findpos = mitsuke + atolen;
+ }
return 1;
}
+
int getBit(unsigned char *byte, int *pbit, int gbit) {
int pbyte = *pbit / 8;
unsigned char *fbyte = byte + pbyte;
int cutbit = *pbit - (pbyte * 8);
int lcutbit = 32 - (cutbit + gbit);
- unsigned char tbuf[4]; /* int¤ÎºÇÂç32bit */
+ unsigned char tbuf[4]; /* intの最大32bit */
unsigned int tnum;
memcpy(tbuf, fbyte, sizeof(unsigned char) * 4);
- /* ÀèƬ¥Ð¥¤¥È¤«¤éÉÔÍ×bit¤ò¥«¥Ã¥È */
+ /* 先頭バイトから不要bitをカット */
tbuf[0] = tbuf[0] << cutbit;
tbuf[0] = tbuf[0] >> cutbit;
- /* int¤Ë¤·¤Æ¤·¤Þ¤¦ */
+ /* intにしてしまう */
tnum = tbuf[0] << 24 | tbuf[1] << 16 | tbuf[2] << 8 | tbuf[3];
- /* ¸å¤í¤ÎÉÔÍץХ¤¥È¤ò¥«¥Ã¥È */
+ /* 後ろの不要バイトをカット */
tnum = tnum >> lcutbit;
*pbit += gbit;
return descriptor_length + 2;
}
+void* allocCopy(void* src, int *boff, size_t size) {
+ void* mem = NULL;
+ if ( size == 0 ) return NULL;
+
+ mem = malloc(size);
+ memcpy(mem, src + *boff / 8, size);
+ *boff += size * 8;
+ return mem;
+}
+
+time_t parseMJD( unsigned char *data ) {
+ int tnum, year, mon, mday;
+ struct tm MJD;
+
+ tnum = (data[0] & 0xFF) << 8 | (data[1] & 0xFF);
+ year = (tnum - 15078.2) / 365.25;
+ mon = ((tnum - 14956.1) - (int)(year * 365.25)) / 30.6001;
+ mday = (tnum - 14956) - (int)(year * 365.25) - (int)(mon * 30.6001);
+
+ if(mon == 14 || mon == 15) {
+ year += 1;
+ mon -= 13;
+ } else {
+ mon -= 1;
+ }
+
+ memset( &MJD, 0, sizeof(MJD) );
+ MJD.tm_year = year;
+ MJD.tm_mon = mon - 1;
+ MJD.tm_mday = mday;
+
+ MJD.tm_hour = BCD(data[2]);
+ MJD.tm_min = BCD(data[3]);
+ MJD.tm_sec = BCD(data[4]);
+ return mktime( &MJD );
+}
+
#ifndef UTIL_H
-#define UTILH 1
+#define UTIL_H 1
#define MAXSECLEN 4096
+#include <time.h>
+//#define BCD(n) ((n/100)<<8)|(((n%100)/10)<<4)|(n%10)
+#define BCD(n) ((n>>4)*10+(n&0xf))
+
#ifdef __cplusplus
extern "C"{
#endif /* __cplusplus */
- int getBit(unsigned char *byte, int *pbit, int gbit);
- void getStr(char *tostr, unsigned char *byte, int *pbit, int len);
- int parseOTHERdesc(unsigned char *data);
+ int strrep(char *buf, char *mae, char *ato);
+ int getBit(unsigned char *byte, int *pbit, int gbit);
+ void getStr(char *tostr, unsigned char *byte, int *pbit, int len);
+ int parseOTHERdesc(unsigned char *data);
+ void* allocCopy(void* src, int *boff, size_t size);
+ time_t parseMJD( unsigned char *data );
#ifdef __cplusplus
}
{ "NHK BS1", "3001.ontvjapan.com", 16625, 4, 101},
{ "NHK BS2", "3002.ontvjapan.com", 16625, 4, 102},
{ "NHK BSh", "3003.ontvjapan.com", 16626, 4, 103},
- { "BSÆü¥Æ¥ì", "3004.ontvjapan.com", 16592, 4, 141},
- { "BSÄ«Æü", "3005.ontvjapan.com", 16400, 4, 151},
- { "BS-i", "3006.ontvjapan.com", 16401, 4, 161},
- { "BS¥¸¥ã¥Ñ¥ó", "3007.ontvjapan.com", 16433, 4, 171},
- { "BS¥Õ¥¸", "3008.ontvjapan.com", 16593, 4, 181},
+ { "BS日テレ", "3004.ontvjapan.com", 16592, 4, 141},
+ { "BS朝日", "3005.ontvjapan.com", 16400, 4, 151},
+ { "BS-TBS", "3006.ontvjapan.com", 16401, 4, 161},
+ { "BSジャパン", "3007.ontvjapan.com", 16433, 4, 171},
+ { "BSã\83\95ã\82¸", "3008.ontvjapan.com", 16593, 4, 181},
{ "WOWOW", "3009.ontvjapan.com", 16432, 4, 191},
{ "WOWOW2", "3010.ontvjapan.com", 16432, 4, 192},
{ "WOWOW3", "3011.ontvjapan.com", 16432, 4, 193},
+ { "スター・チャンネル", "3012.ontvjapan.com", 16529, 4, 200},
{ "BS11", "3013.ontvjapan.com", 16528, 4, 211},
{ "TwellV", "3014.ontvjapan.com", 16530, 4, 222},
};
static STATION csSta[] = {
- { "¥¹¥¿¡¼£ã£è¥×¥é¥¹", "1002.ontvjapan.com", 24608, 6, 237},
- { "ÆüËܱDzèÀìÌç£ã£è£È£Ä", "1086.ontvjapan.com", 24608, 6, 239},
- { "¥Õ¥¸¥Æ¥ì¥Ó£Ã£Ó£È£Ä", "306ch.epgdata.ontvjapan", 24608, 6, 306},
- { "¥·¥ç¥Ã¥×¥Á¥ã¥ó¥Í¥ë", "1059.ontvjapan.com", 24704, 6, 55},
- { "¥¶¡¦¥·¥Í¥Þ", "1217.ontvjapan.com", 24736, 6, 228},
- { "¥¹¥«¥Á¥ã¥ó£È£Ä£¸£°£°", "800ch.epgdata.ontvjapan", 24736, 6, 800},
- { "¥¹¥«¥Á¥ã¥ó£¸£°£±", "801ch.epgdata.ontvjapan", 24736, 6, 801},
- { "¥¹¥«¥Á¥ã¥ó£¸£°£²", "802ch.epgdata.ontvjapan", 24736, 6, 802},
- { "£å£²¥×¥í¥â", "100ch.epgdata.ontvjapan", 28736, 7, 100},
- { "¥¤¥ó¥¿¡¼¥í¡¼¥«¥ë£Ô£Ö", "194ch.epgdata.ontvjapan", 28736, 7, 194},
- { "£Ê¥¹¥Ý¡¼¥Ä¡¡£Å£Ó£Ð£Î", "1025.ontvjapan.com", 28736, 7, 256},
- { "£Æ£Ï£Ø", "1016.ontvjapan.com", 28736, 7, 312},
- { "¥¹¥Ú¡¼¥¹¥·¥ã¥ï¡¼£Ô£Ö", "1018.ontvjapan.com", 28736, 7, 322},
- { "¥«¡¼¥È¥¥¡¼¥ó¡¡¥Í¥Ã¥È", "1046.ontvjapan.com", 28736, 7, 331},
- { "¥È¥¥¡¼¥ó¡¦¥Ç¥£¥º¥Ë¡¼", "1213.ontvjapan.com", 28736, 7, 334},
- { "Åì±Ç¥Á¥ã¥ó¥Í¥ë", "1010.ontvjapan.com", 28768, 7, 221},
- { "±ÒÀ±·à¾ì", "1005.ontvjapan.com", 28768, 7, 222},
- { "¥Á¥ã¥ó¥Í¥ë£Î£Å£Ã£Ï", "1008.ontvjapan.com", 28768, 7, 223},
- { "Íβè¡ú¥·¥Í¥Õ¥£¥ë", "1009.ontvjapan.com", 28768, 7, 224},
- { "¥¹¥¿¡¼¡¦¥¯¥é¥·¥Ã¥¯", "1003.ontvjapan.com", 28768, 7, 238},
- { "»þÂå·àÀìÌç¥Á¥ã¥ó¥Í¥ë", "1133.ontvjapan.com", 28768, 7, 292},
- { "¥¹¡¼¥Ñ¡¼¥É¥é¥Þ", "1006.ontvjapan.com", 28768, 7, 310},
- { "£Á£Ø£Î", "1014.ontvjapan.com", 28768, 7, 311},
- { "¥Ê¥·¥ç¥¸¥ª¥Á¥ã¥ó¥Í¥ë", "1204.ontvjapan.com", 28768, 7, 343},
- { "¥ï¥ó¥Æ¥ó¥Ý¡¼¥¿¥ë", "110ch.epgdata.ontvjapan", 28864, 7, 110},
- { "¥´¥ë¥Õ¥Á¥ã¥ó¥Í¥ë", "1028.ontvjapan.com", 28864, 7, 260},
- { "¥Æ¥ìÄ«¥Á¥ã¥ó¥Í¥ë", "1092.ontvjapan.com", 28864, 7, 303},
- { "£Í£Ô£Ö", "1019.ontvjapan.com", 28864, 7, 323},
- { "¥ß¥å¡¼¥¸¥Ã¥¯¡¦¥¨¥¢", "1024.ontvjapan.com", 28864, 7, 324},
- { "Ä«Æü¥Ë¥å¡¼¥¹¥¿¡¼", "1067.ontvjapan.com", 28864, 7, 352},
- { "£Â£Â£Ã¥ï¡¼¥ë¥É", "1070.ontvjapan.com", 28864, 7, 353},
- { "£Ã£Î£Î£ê", "1069.ontvjapan.com", 28864, 7, 354},
- { "¥¸¥ã¥¹¥È¡¦¥¢¥¤", "361ch.epgdata.ontvjapan", 28864, 7, 361},
- { "£Ê¥¹¥Ý¡¼¥Ä¡¡£±", "1041.ontvjapan.com", 28896, 7, 251},
- { "£Ê¥¹¥Ý¡¼¥Ä¡¡£²", "1042.ontvjapan.com", 28896, 7, 252},
- { "£Ê¥¹¥Ý¡¼¥Ä£Ð£ì£õ£ó£È", "1043.ontvjapan.com", 28896, 7, 253},
- { "£Ç£Á£Ï£Ò£Á", "1026.ontvjapan.com", 28896, 7, 254},
- { "£ó£ë£ù¡¦£Á¥¹¥Ý¡¼¥Ä¡Ü", "1040.ontvjapan.com", 28896, 7, 255},
- { "ÊõÄÍ¥×¥í¥â¥Á¥ã¥ó¥Í¥ë", "101ch.epgdata.ontvjapan", 28928, 7, 101},
- { "£Ó£Ë£Ù¡¦£Ó£Ô£Á£Ç£Å", "1207.ontvjapan.com", 28928, 7, 290},
- { "¥Á¥ã¥ó¥Í¥ë¶ä²Ï", "305ch.epgdata.ontvjapan", 28928, 7, 305},
- { "£Á£Ô-£Ø", "1201.ontvjapan.com", 28928, 7, 333},
- { "¥Ò¥¹¥È¥ê¡¼¥Á¥ã¥ó¥Í¥ë", "1050.ontvjapan.com", 28928, 7, 342},
- { "¥¹¥«¥Á¥ã¥ó£¸£°£³", "803ch.epgdata.ontvjapan", 28928, 7, 803},
- { "¥¹¥«¥Á¥ã¥ó£¸£°£´", "804ch.epgdata.ontvjapan", 28928, 7, 804},
- { "¥à¡¼¥Ó¡¼¥×¥é¥¹£È£Ä", "1007.ontvjapan.com", 28960, 7, 240},
- { "¥´¥ë¥Õ¥Í¥Ã¥È¥ï¡¼¥¯", "1027.ontvjapan.com", 28960, 7, 262},
- { "£Ì£á£Ì£á¡¡£È£Ä", "1074.ontvjapan.com", 28960, 7, 314},
- { "¥Õ¥¸¥Æ¥ì¥Ó£·£³£¹", "1073.ontvjapan.com", 28992, 7, 258},
- { "¥Õ¥¸¥Æ¥ì¥Ó£·£²£±", "1072.ontvjapan.com", 28992, 7, 302},
- { "¥¢¥Ë¥Þ¥Ã¥¯¥¹", "1047.ontvjapan.com", 28992, 7, 332},
- { "¥Ç¥£¥¹¥«¥Ð¥ê¡¼", "1062.ontvjapan.com", 28992, 7, 340},
- { "¥¢¥Ë¥Þ¥ë¥×¥é¥Í¥Ã¥È", "1193.ontvjapan.com", 28992, 7, 341},
- { "£Ã-£Ô£Â£Ó¥¦¥¨¥ë¥«¥à", "160ch.epgdata.ontvjapan", 29024, 7, 160},
- { "£Ñ£Ö£Ã", "1120.ontvjapan.com", 29024, 7, 161},
- { "¥×¥é¥¤¥à£³£¶£µ¡¥£Ô£Ö", "185ch.epgdata.ontvjapan", 29024, 7, 185},
- { "¥Õ¥¡¥ß¥ê¡¼·à¾ì", "1015.ontvjapan.com", 29024, 7, 293},
- { "£Ô£Â£Ó¥Á¥ã¥ó¥Í¥ë", "3201.ontvjapan.com", 29024, 7, 301},
- { "¥Ç¥£¥º¥Ë¡¼¥Á¥ã¥ó¥Í¥ë", "1090.ontvjapan.com", 29024, 7, 304},
+ { "ã\82¹ã\82¿ã\83¼ï½\83ï½\88ã\83\97ã\83©ã\82¹", "1002.ontvjapan.com", 24608, 6, 237},
+ { "日本映画専門chHD", "1086.ontvjapan.com", 24608, 6, 239},
+ { "フジテレビCSHD", "306ch.epgdata.ontvjapan", 24608, 6, 306},
+ { "ショップチャンネル", "1059.ontvjapan.com", 24704, 6, 55},
+ { "ザ・シネマ", "1217.ontvjapan.com", 24736, 6, 228},
+ { "スカチャンHD800", "800ch.epgdata.ontvjapan", 24736, 6, 800},
+ { "スカチャン801", "801ch.epgdata.ontvjapan", 24736, 6, 801},
+ { "スカチャン802", "802ch.epgdata.ontvjapan", 24736, 6, 802},
+ { "e2プロモ", "100ch.epgdata.ontvjapan", 28736, 7, 100},
+ { "インターローカルTV", "194ch.epgdata.ontvjapan", 28736, 7, 194},
+ { "Jスポーツ ESPN", "1025.ontvjapan.com", 28736, 7, 256},
+ { "FOX", "1016.ontvjapan.com", 28736, 7, 312},
+ { "スペースシャワーTV", "1018.ontvjapan.com", 28736, 7, 322},
+ { "カートゥーン ネット", "1046.ontvjapan.com", 28736, 7, 331},
+ { "ã\83\88ã\82¥ã\83¼ã\83³ã\83»ã\83\87ã\82£ã\82ºã\83\8bã\83¼", "1213.ontvjapan.com", 28736, 7, 334},
+ { "東映チャンネル", "1010.ontvjapan.com", 28768, 7, 221},
+ { "衛星劇場", "1005.ontvjapan.com", 28768, 7, 222},
+ { "チャンネルNECO", "1008.ontvjapan.com", 28768, 7, 223},
+ { "洋画★シネフィル", "1009.ontvjapan.com", 28768, 7, 224},
+ { "ã\82¹ã\82¿ã\83¼ã\83»ã\82¯ã\83©ã\82·ã\83\83ã\82¯", "1003.ontvjapan.com", 28768, 7, 238},
+ { "時代劇専門チャンネル", "1133.ontvjapan.com", 28768, 7, 292},
+ { "スーパードラマ", "1006.ontvjapan.com", 28768, 7, 310},
+ { "AXN", "1014.ontvjapan.com", 28768, 7, 311},
+ { "ナショジオチャンネル", "1204.ontvjapan.com", 28768, 7, 343},
+ { "ワンテンポータル", "110ch.epgdata.ontvjapan", 28864, 7, 110},
+ { "ゴルフチャンネル", "1028.ontvjapan.com", 28864, 7, 260},
+ { "テレ朝チャンネル", "1092.ontvjapan.com", 28864, 7, 303},
+ { "MTV", "1019.ontvjapan.com", 28864, 7, 323},
+ { "ã\83\9fã\83¥ã\83¼ã\82¸ã\83\83ã\82¯ã\83»ã\82¨ã\82¢", "1024.ontvjapan.com", 28864, 7, 324},
+ { "æ\9c\9dæ\97¥ã\83\8bã\83¥ã\83¼ã\82¹ã\82¿ã\83¼", "1067.ontvjapan.com", 28864, 7, 352},
+ { "BBCワールド", "1070.ontvjapan.com", 28864, 7, 353},
+ { "CNNj", "1069.ontvjapan.com", 28864, 7, 354},
+ { "ã\82¸ã\83£ã\82¹ã\83\88ã\83»ã\82¢ã\82¤", "361ch.epgdata.ontvjapan", 28864, 7, 361},
+ { "Jスポーツ 1", "1041.ontvjapan.com", 28896, 7, 251},
+ { "Jスポーツ 2", "1042.ontvjapan.com", 28896, 7, 252},
+ { "JスポーツPlusH", "1043.ontvjapan.com", 28896, 7, 253},
+ { "GAORA", "1026.ontvjapan.com", 28896, 7, 254},
+ { "sky・Aスポーツ+", "1040.ontvjapan.com", 28896, 7, 255},
+ { "宝塚プロモチャンネル", "101ch.epgdata.ontvjapan", 28928, 7, 101},
+ { "SKY・STAGE", "1207.ontvjapan.com", 28928, 7, 290},
+ { "チャンネル銀河", "305ch.epgdata.ontvjapan", 28928, 7, 305},
+ { "AT-X", "1201.ontvjapan.com", 28928, 7, 333},
+ { "ヒストリーチャンネル", "1050.ontvjapan.com", 28928, 7, 342},
+ { "スカチャン803", "803ch.epgdata.ontvjapan", 28928, 7, 803},
+ { "スカチャン804", "804ch.epgdata.ontvjapan", 28928, 7, 804},
+ { "ムービープラスHD", "1007.ontvjapan.com", 28960, 7, 240},
+ { "ã\82´ã\83«ã\83\95ã\83\8dã\83\83ã\83\88ã\83¯ã\83¼ã\82¯", "1027.ontvjapan.com", 28960, 7, 262},
+ { "LaLa HD", "1074.ontvjapan.com", 28960, 7, 314},
+ { "フジテレビ739", "1073.ontvjapan.com", 28992, 7, 258},
+ { "フジテレビ721", "1072.ontvjapan.com", 28992, 7, 302},
+ { "ã\82¢ã\83\8bã\83\9eã\83\83ã\82¯ã\82¹", "1047.ontvjapan.com", 28992, 7, 332},
+ { "ã\83\87ã\82£ã\82¹ã\82«ã\83\90ã\83ªã\83¼", "1062.ontvjapan.com", 28992, 7, 340},
+ { "アニマルプラネット", "1193.ontvjapan.com", 28992, 7, 341},
+ { "C-TBSウエルカム", "160ch.epgdata.ontvjapan", 29024, 7, 160},
+ { "QVC", "1120.ontvjapan.com", 29024, 7, 161},
+ { "プライム365.TV", "185ch.epgdata.ontvjapan", 29024, 7, 185},
+ { "ファミリー劇場", "1015.ontvjapan.com", 29024, 7, 293},
+ { "TBSチャンネル", "3201.ontvjapan.com", 29024, 7, 301},
+ { "ディズニーチャンネル", "1090.ontvjapan.com", 29024, 7, 304},
{ "MUSIC ON! TV", "1022.ontvjapan.com", 29024, 7, 325},
- { "¥¥Ã¥º¥¹¥Æ¡¼¥·¥ç¥ó", "1045.ontvjapan.com", 29024, 7, 330},
- { "£Ô£Â£Ó¥Ë¥å¡¼¥¹¥Ð¡¼¥É", "1076.ontvjapan.com", 29024, 7, 351},
- { "£Ã£ÓÆüËÜÈÖÁÈ¥¬¥¤¥É", "147ch.epgdata.ontvjapan", 29056, 7, 147},
- { "Æü¥Æ¥ì£Ç¡Ü", "1068.ontvjapan.com", 29056, 7, 257},
+ { "キッズステーション", "1045.ontvjapan.com", 29024, 7, 330},
+ { "TBSニュースバード", "1076.ontvjapan.com", 29024, 7, 351},
+ { "CS日本番組ガイド", "147ch.epgdata.ontvjapan", 29056, 7, 147},
+ { "日テレG+", "1068.ontvjapan.com", 29056, 7, 257},
{ "fashion TV", "5004.ontvjapan.com", 29056, 7, 291},
- { "Æü¥Æ¥ì¥×¥é¥¹", "300ch.epgdata.ontvjapan", 29056, 7, 300},
- { "¥¨¥³¥ß¥å¡¼¥¸¥Ã¥¯£Ô£Ö", "1023.ontvjapan.com", 29056, 7, 320},
+ { "æ\97¥ã\83\86ã\83¬ã\83\97ã\83©ã\82¹", "300ch.epgdata.ontvjapan", 29056, 7, 300},
+ { "エコミュージックTV", "1023.ontvjapan.com", 29056, 7, 320},
{ "Music Japan TV", "1208.ontvjapan.com", 29056, 7, 321},
- { "Æü¥Æ¥ì£Î£Å£×£Ó£²£´", "2002.ontvjapan.com", 29056, 7, 350},
+ { "日テレNEWS24", "2002.ontvjapan.com", 29056, 7, 350},
};
static int csStaCount = sizeof(csSta) / sizeof (STATION);