/*******************************************************}
{
}
{ File : program_association_section_class.h }
{ Created by Tsviatko Jongov }
{ http://tsviatko.jongov.com }
{
}
{ PAT transport packet class. }
{
}
{*******************************************************/
#ifndef
__PROGRAM_ASSOCIATION_SECTION_CLASS_H__
#define
__PROGRAM_ASSOCIATION_SECTION_CLASS_H__
#include "MPEGTSUtils.h"
#include "psi_transport_packet_class.h"
class
Cprogram_association_section_class : public
Cpsi_transport_packet_class
{
public:
program_association_section
m_program_association_section;
public:
bool
SetData(void * Data, unsigned
long Size)
{
unsigned
char * p = NULL;
unsigned
int i;
bool
res;
res =
Cpsi_transport_packet_class::SetData(Data, Size);
if
(!res)
{
OutputDebugString(L"tsv: Error in Cprogram_association_section_class.SetData
call...");
return
res;
}
p = &m_Data[m_PayloadOffset + 1 +
m_pointer_field];
m_program_association_section.table_id
= *p;
p++;
m_program_association_section.section_syntax_indicator = (*p >> 7)
& 0x01;
m_program_association_section.zero_bit
= (*p >> 6) & 0x01;
m_program_association_section.reserved0
= (*p >> 4) & 0x03;
m_program_association_section.section_length
= (*p & 0x0F) << 8;
p++;
m_program_association_section.section_length =
m_program_association_section.section_length | *p;
p++;
m_program_association_section.transport_stream_id = *p << 8;
p++;
m_program_association_section.transport_stream_id =
m_program_association_section.transport_stream_id | *p;
p++;
m_program_association_section.reserved1
= (*p >> 6) & 0x03;
m_program_association_section.version_number
= (*p >> 1) & 0x1F;
m_program_association_section.current_next_indicator = *p & 0x01;
p++;
m_program_association_section.section_number = *p;
p++;
m_program_association_section.last_section_number
= *p;
p++;
m_program_association_section.programs_count =
(m_program_association_section.section_length - 9) / 4;
for (i
= 0; i < m_program_association_section.programs_count; i++)
{
m_program_association_section.program_number[i] = *p << 8;
p++;
m_program_association_section.program_number[i] =
m_program_association_section.program_number[i] | *p;
p++;
m_program_association_section.reserved2[i] = (*p >> 5) & 0x07;
m_program_association_section.PID[i] = (*p & 0x1F) << 8;
p++;
m_program_association_section.PID[i] = m_program_association_section.PID[i]
| *p;
p++;
}
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart = *p << 24;
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart | (*p << 16);
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart | (*p << 8);
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->HighPart | *p;
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart = *p << 24;
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart | (*p << 16);
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart | (*p << 8);
p++;
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart =
((LARGE_INTEGER
*)(&m_program_association_section.CRC_32))->LowPart | *p;
return true;
}
};
#endif // __PROGRAM_ASSOCIATION_SECTION_CLASS_H__