RefreshCrc();
}
-/*
-boost::shared_array<ProgramInfo> PatPacket::GetPrograms(void)
-{
- boost::shared_array<ProgramInfo> programs;
- programs.reset();
- if (GetProgramInfoLength() == 0)
- return programs;
- programs = boost::shared_array<ProgramInfo>(new ProgramInfo[GetProgramInfoLength() / 4]);
- for (int i = 0; i < GetProgramInfoLength(); i += 4)
- programs[i / 4] = boost::shared_array<ProgramInfo>(
- new ProgramInfo(mData, 13 + GetPointerSize() + i));
- return programs;
-}
-
-boost::shared_array<ProgramInfo> PatPacket::GetPrograms(void)
+std::vector<boost::shared_ptr<ProgramInfo> > PatPacket::GetPrograms(void)
{
- boost::shared_array<ProgramInfo> programs;
- programs.reset();
+ std::vector<boost::shared_ptr<ProgramInfo> > programs;
if (GetProgramInfoLength() == 0)
return programs;
- programs = boost::shared_array<ProgramInfo>(new ProgramInfo[GetProgramInfoLength() / 4]);
+ boost::shared_ptr<ProgramInfo> program;
for (int i = 0; i < GetProgramInfoLength(); i += 4)
- programs[i / 4] = boost::shared_array<ProgramInfo>(
+ {
+ program = boost::shared_ptr<ProgramInfo>(
new ProgramInfo(mData, 13 + GetPointerSize() + i));
+ programs.push_back(program);
+ }
return programs;
}
-void PatPacket::SetPrograms(boost::shared_ptr<ProgramInfo> value)
+void PatPacket::SetPrograms(std::vector<boost::shared_ptr<ProgramInfo> > value)
throw(std::invalid_argument)
{
- if (NULL == value || sizeof(value.get()) == 0)
+ if (value.size() == 0)
{
if (GetProgramInfoLength() == 0)
return;
}
else
{
- if ((sizeof(value.get()) * 4) + 17 + GetPointerSize()
- > Constants.TS_SIZE)
+ if ((value.size() * 4) + 17 + GetPointerSize()
+ > Constants::TS_SIZE)
throw std::invalid_argument("program info data too long");
- SetLength((ushort)(9 + (sizeof(value.get()) * 4)));
+ SetLength((ushort)(9 + value.size() * 4));
int index = 13 + GetPointerSize();
for(int pi = 0; pi < GetProgramInfoLength() / 4; pi++)
{
for (int i = 0; i < 4; i++)
- mData[index + i] = value[pi].Data[i];
+ mData[index + i] = value[pi]->GetData()[i];
index += 4;
}
RefreshCrc();
}
}
-*/
ushort PatPacket::GetProgramInfoLength(void)
{
PatPacket(pByte data)throw(std::invalid_argument);
ushort GetTransportStreamId(void);
void SetTransportStreamId(ushort TSId);
- boost::shared_array<ProgramInfo> GetPrograms(void);
- void SetPrograms(boost::shared_array<ProgramInfo> programinfo)
+ std::vector<boost::shared_ptr<ProgramInfo> > GetPrograms(void);
+ void SetPrograms(std::vector<boost::shared_ptr<ProgramInfo> > programinfo)
throw(std::invalid_argument);
ushort GetProgramInfoLength(void);
};