tdt段分析
来源:互联网 发布:淘打软件官网 编辑:程序博客网 时间:2024/04/29 04:48
int32 BCD_Seconds(u_int32 _time)
{
u_int32 temp;
u_int32 hour, minute, second;
temp = bcdint_to_int(_time&0xffffff, 6, 6, 1);
hour = temp/10000;
minute = temp/100 - hour*100;
second = temp - hour*10000 - minute*100;
temp = hour*3600 + minute*60 + second;
return (temp);
}
/* si_parser_sdt_analyse */
/*************************************************************************************/
/* */
/* */
/* */
/* */
/* */
/* */
/*************************************************************************************/
int32 MJD_year_month_day(u_int32 date)
{
u_int32 month, day;
u_int32 temp, year;
u_int32 temp1;
temp = (u_int32)date;
year = (temp*100 - 1507820)/36525;
temp1 = year*36525/100;
month = (temp*10 - 149561 - temp1*10)/306.001;
day = temp - 14956 - temp1 - (month*306001/10000);
if((month == 14) || (month == 15))
{
year++;
month = month -1 - 12;
}
else
month--;
year += 1900;
return ((year&0xffff)<<16 | (month&0xff)<<8 | (day&0xff));
}
/* si_parser_eit_analyse */
/****************************************************************************/
/* FUNCTION: si_parser_tdt_analyse */
/* */
/* DESCRIPTION: */
/* */
/* INPUTS: */
/* */
/* OUTPUTS: */
/* */
/* RETURNS: */
/* */
/* NOTES: NONE */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/****************************************************************************/
static SI_STATUS si_parser_tdt_analyse (
SI_TDT_HANDLE hTDT,
u_int32 uLen,
u_int8 * pData
)
{
PTR_TDT_TABLE pTDT = (PTR_TDT_TABLE)(hTDT);
u_int8 * pBuffer = pData;
TDT_INFO * pInfo;
u_int8 tbl_id, sct_syntax_indicator;
u_int16 sct_length;
u_int32 date;
START_TIME _time;
SI_PARSER_HANDLE handle;
if ((NULL == pTDT) || (uLen < 8) || (NULL == pBuffer))
{
return (SI_ERROR);
}
/* analyse the header of the section: total 8 bytes */
tbl_id = *pBuffer++;
sct_syntax_indicator = (*pBuffer & 0x80);
sct_length = (*pBuffer++ & 0x0F) << 8;
sct_length |= *pBuffer++;
/* check the header information of the section. */
if ((tbl_id != TID_MPEG2_TDT) || (sct_syntax_indicator != 0x00) ||
(sct_length > 5) || ((sct_length + 3) != (u_int16)uLen))
{
return (SI_ERROR);
}
pInfo = &(pTDT->sTDTInfo);
pInfo->UTC_date = (*pBuffer++ ) << 8;
pInfo->UTC_date |= *pBuffer++;
pInfo->UTC_time = (*pBuffer++ ) <<16;
pInfo->UTC_time |= (*pBuffer++ ) << 8;
pInfo->UTC_time |= *pBuffer;
date = MJD_year_month_day(pInfo->UTC_date);
_time.year = date>>16 & 0xffff;
_time.month = date>>8 & 0xff;
_time.day = date & 0xff;
_time.time.seconds = BCD_Seconds((u_int32)(pInfo->UTC_time)&0xffffff);
if (NULL != pTDT->pfCbSection)
{
pTDT->pfCbSection ();
}
if (NULL != pTDT->pfCbSingleSection)
{
/* fixme, other method shoud be called to get si_parser handle */
handle = (SI_PARSER_HANDLE)(&siParser);
pTDT->pfCbSingleSection(handle, &_time);
}
return (SI_OK);
}
- tdt段分析
- TDT-文档类型定义
- xsd、tdt文件说明
- 【认证】【Spain】TDT Premium
- EIT段分析
- linux 段错误分析
- 两段代码异同分析
- TP RBAC 表字段分析
- ECSHOP goods表字段分析
- c里面位段分析
- 一些程序段分析(1)
- 一些程序段分析(2)
- Linux下段错误分析
- Linux下段错误分析
- Linux下段错误分析
- linux 下c 程序 段错误 分析
- 最大子段和问题分析
- Lucene段合并(merge)过程分析
- Linux下I2C设备驱动开发和实现
- GridView实现性别的显示
- UDT协议-基于UDP的可靠数据传输协议
- Maven2功能简介
- 学习中
- tdt段分析
- EIT段分析
- 生成图片验证码,防止软件识别
- ORACLE数据库表的操作
- 数据结构的泡妞应用
- [JS]那些相见恨晚的 JavaScript 技巧
- gdb调试coredump文件,函数名称是问号
- DataGridView控件用法合集(一)
- linux I2C驱动分析