数字电视中TS包解码函数 (三)

2014-11-24 02:57:07 · 作者: · 浏览: 6
number和last_section_number的功能是当PAT内容>184字节时,PAT表会分成多个段(sections),解复用程序必须在全部接收完成后再进行PAT的分析)从for()开始,就是描述了当前流中的频道数目(N),每一个频道对应的PMT PID是什么.解复用程序需要和上图类似的循环来接收所有的频道号码和对应的PMT PID,并把这些信息在缓冲区中保存起来.在后部的处理中需要使用到PMT PID.
p_section->p_payload_start = p_section->p_data + 8; //前面已分析了8个字节,指向新的开始
}
else
{
p_section->p_payload_start = p_section->p_data + 3;
}
h_dvbpsi->pf_callback(h_dvbpsi, p_section);
h_dvbpsi->p_current_section = NULL;
}
else
{
/* PSI section isn't valid => trash it */
dvbpsi_DeletePSISections(p_section);
h_dvbpsi->p_current_section = NULL;
}
/* If there is a new section not being handled then go forward
in the packet */
if(p_new_pos)
{
h_dvbpsi->p_current_section
= p_section
= dvbpsi_NewPSISection(h_dvbpsi->i_section_max_size);
p_payload_pos = p_new_pos;
p_new_pos = NULL;
h_dvbpsi->i_need = 3;
h_dvbpsi->b_complete_header = 0;
i_available = 188 + p_data - p_payload_pos;
}
else
{
i_available = 0;
}
}
}
else
{
/* There aren't enough bytes in this packet to complete the
header/section */
memcpy(p_section->p_payload_end, p_payload_pos, i_available);
p_section->p_payload_end += i_available;
h_dvbpsi->i_need -= i_available;
i_available = 0;
}
}