#include <string>
#include <list>
+#include <vector>
#include <stdexcept>
+#include <boost/shared_array.hpp>
// #include "BlueMux.h"
#include "tsremuxcpp_define.h"
EpElement(signed long long pts, unsigned long spn);
};
+//class Utility {
+// public:
+// static pByte ToArray(pByte vector);
+//};
+
class StreamInfo {
public:
- StreamInfo(byte* data, int index)throw(std::invalid_argument);
+ StreamInfo(pByte data, int index)throw(std::invalid_argument);
+ StreamInfo(ElementaryStreamTypes streamType, ushort elementaryPid);
VideoFormat GetVideoFormat(void);
void SetVideoFormat(VideoFormat videoformat);
AspectRatio GetAspectRatio(void);
void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
SamplingFrequency GetSamplingFrequency(void);
void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- StreamInfo(ElementaryStreamTypes streamType, ushort elementaryPid);
- byte* GetByteData(void);
ElementaryStreamTypes GetElementaryStreamTypes(void);
void SetElementaryStreamTypes(ElementaryStreamTypes stream_type);
ushort GetElementaryPID(void);
- void GetElementaryPID(ushort pid);
- byte* GetElementaryDescriptors(void);
- void SetElementaryDescriptors(byte* value)throw(std::invalid_argument);
+ void SetElementaryPID(ushort pid);
+ pByte GetElementaryDescriptors(void);
+ void SetElementaryDescriptors(pByte value)throw(std::invalid_argument);
+ pByte GetByteData(void);
private:
- byte* mData;
+ pByte mData;
VideoFormat mVideoFormat;
AspectRatio mAspectRatio;
FrameRate mFrameRate;
AudioPresentationType mAudioPresentationType;
SamplingFrequency mSamplingFrequency;
- ElementaryStreamTypes StreamType;
- ushort ElementaryPID;
- byte* ElementaryDescriptors;
+// ElementaryStreamTypes StreamType;
+// ushort ElementaryPID;
+// pByte ElementaryDescriptors;
};
class BluRayOutput {
public:
BluRayOutput(std::string path, TimeSpan chapterLen);
void Author(EpElement* EpInfo, StreamInfo* sis, UInt32 numOfSourcePackets);
- byte* BuildPlayList(byte* PlayItems);
- byte* BuildFirstPlayItem(byte stc_id, UInt32 start,
+ pByte BuildPlayList(byte* PlayItems);
+ pByte BuildFirstPlayItem(byte stc_id, UInt32 start,
UInt32 end, byte* StnTable);
- byte* BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval);
- byte* Build_clpi(byte* ClipInfo, byte* SequenceInfo,
+ pByte BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval);
+ pByte Build_clpi(byte* ClipInfo, byte* SequenceInfo,
byte* ProgramInfo, byte* CPI);
- byte* BuildClipInfo(UInt32 numOfSourcePackets, EpElement* EpInfo);
- byte* BuildSequenceInfo(UInt32 start, UInt32 end);
- byte* BuildProgramInfo(ushort pids, byte* StreamCodingInfos);
- byte* BuildVideoStreamCodingInfo(ElementaryStreamTypes type,
+ pByte BuildClipInfo(UInt32 numOfSourcePackets, EpElement* EpInfo);
+ pByte BuildSequenceInfo(UInt32 start, UInt32 end);
+ pByte BuildProgramInfo(ushort pids, byte* StreamCodingInfos);
+ pByte BuildVideoStreamCodingInfo(ElementaryStreamTypes type,
VideoFormat format, FrameRate rate, AspectRatio ratio);
- byte* BuildAudioStreamCodingInfo(ElementaryStreamTypes type,
+ pByte BuildAudioStreamCodingInfo(ElementaryStreamTypes type,
AudioPresentationType format, SamplingFrequency rate);
- byte* BuildPgStreamCodingInfo(void);
- byte* BuildCpi(byte* EpMap);
- byte* BuildEpMap(EpElement* EpInfo);
+ pByte BuildPgStreamCodingInfo(void);
+ pByte BuildCpi(byte* EpMap);
+ pByte BuildEpMap(EpElement* EpInfo);
private:
- byte* BuildStreamEntry(ushort pid);
- byte* BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr);
- byte* BuildAudioStreamAttributes(byte type, AudioPresentationType vf,
+ pByte BuildStreamEntry(ushort pid);
+ pByte BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr);
+ pByte BuildAudioStreamAttributes(byte type, AudioPresentationType vf,
SamplingFrequency fr);
- byte* BuildStnTable(byte* VideoEntry, byte* VideoAttributes,
+ pByte BuildStnTable(byte* VideoEntry, byte* VideoAttributes,
byte* AudioEntries, byte* AudioAttributes,
byte* PgEntries, byte* PgAttributes);
- byte* UintToByteArraryNetwork(UInt32 value);
- byte* Build_mlps(byte* PlayList, byte* PlayListMark);
+ pByte UintToByteArraryNetwork(UInt32 value);
+ pByte Build_mlps(byte* PlayList, byte* PlayListMark);
};
class Descriptor {
public:
- Descriptor(byte* data, int startIndex);
+ Descriptor(pByte data, int startIndex)throw(std::invalid_argument);
+ pByte GetData(void);
+ byte GetTag(void);
+ byte GetLength(void);
+ protected:
+ pByte mData;
};
-class DTCP_Descriptor : Descriptor {
+class DTCP_Descriptor : public Descriptor {
public:
- DTCP_Descriptor(byte* data, int startIndex);
+ DTCP_Descriptor(pByte data, int startIndex)
+ throw(std::invalid_argument);
+ DtcpCci GetCopyStatus(void);
+ bool GetAnalogConstrain(void);
+ bool GetMacrovision(void);
};
class Constants {
static readonly byte ac3_registration_descriptor[];
static readonly byte DefaultSitTableOne[];
static readonly uint crc_table[];
- static uint ComputeCrc(byte* data);
- static uint ComputeCrc(byte* data, int length);
- static uint ComputeCrc(byte* data, int length, int startIndex);
+ static uint ComputeCrc(pByte data);
+ static uint ComputeCrc(pByte data, int length);
+ static uint ComputeCrc(pByte data, int length, int startIndex);
};
class ProgramInfo {
public:
- ProgramInfo(byte* data, int index);
+ ProgramInfo(pByte data, int index)throw(std::invalid_argument);
ProgramInfo(ushort programNumber, ushort programPid);
- ushort ProgramNumber;
- ushort ProgramPID;
- byte* Data;
+ ushort GetProgramNumber(void);
+ void SetProgramNumber(ushort programNumber);
+ ushort GetProgramPID(void);
+ void SetProgramPID(ushort programPID);
+ pByte GetData(void);
private:
- byte* mData;
+ pByte mData;
};
class TsPacket {
ushort GetPID(void);
void SetPID(ushort pid);
byte GetPointerSize(void);
- byte* GetData(void);
- void SetData(byte* data, int startIndex)throw(std::invalid_argument);
+ pByte GetData(void);
+ void SetData(pByte data, int startIndex)throw(std::invalid_argument);
bool HasPcr(void);
Int64 GetPcr(void)throw(std::out_of_range);
- byte* Payload(void);
+ pByte Payload(void);
void IncrementContinuityCounter(void);
byte GetContinuityCounter(void);
void SetContinuityCounter(byte value)throw(std::out_of_range);
bool HasPesHeader(void);
protected:
- byte* mData;
+ pByte mData;
private:
bool Priority;
ushort PID;
PcrPacket(Int64 pcr, byte counter, ushort pid);
};
-class TsTable : TsPacket {
+class TsTable : public TsPacket {
public:
TsTable();
- TsTable(byte* data);
- void AddData(byte* data, int offset, int len);
+ TsTable(pByte data);
+ void AddData(pByte data, int offset, int len);
bool Complete(void);
byte GetTableId(void);
void SetTableId(byte value);
void RefreshCrc(void);
};
-class PatPacket : TsTable {
+class PatPacket : public TsTable {
public:
PatPacket(void);
- PatPacket(byte* data);
- ushort TransportStreamId;
- ProgramInfo* Programs;
- private:
- ushort ProgramInfoLength;
+ 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)
+ throw(std::invalid_argument);
+ ushort GetProgramInfoLength(void);
};
class SitPacket : TsTable {
PmPacket(void);
PmPacket(byte* data);
DTCP_Descriptor DtcpInfo;
- byte* ProgramDescriptorsData;
+ pByte ProgramDescriptorsData;
StreamInfo* ElementaryStreams;
ushort ProgramNumber;
ushort PcrPID;
class PesHeader {
public:
- PesHeader(byte* data);
- byte StreamId;
+ PesHeader(pByte data)throw(std::invalid_argument);
+ byte GetStreamId(void);
byte GetByte(int i);
- void SetByte(byte dat);
- byte HeaderLength;
- int TotalHeaderLength;
- ushort PacketLength;
- bool HasPts;
- bool HasDts;
- Int64 Pts;
- Int64 Dts;
- byte Extention2;
- byte* Data;
+ void SetByte(int i, byte dat);
+ byte GetHeaderLength(void);
+ int GetTotalHeaderLength(void);
+ ushort GetPacketLength(void);
+ bool HasPts(void);
+ bool HasDts(void);
+ Int64 GetPts(void)throw(std::invalid_argument);
+ void SetPts(Int64 value)throw(std::invalid_argument);
+ Int64 GetDts(void)throw(std::invalid_argument);
+ void SetDts(Int64 value)throw(std::invalid_argument);
+ byte GetExtention2(void);
+ pByte GetData(void);
private:
- byte* mData;
+ pByte mData;
};
class PesPacket {
public:
- PesPacket(byte* buff, int offset, int length, ushort pid);
- bool Priority;
- byte* GetData(void);
- byte* GetPayload(void);
+ PesPacket(pByte buff, int offset, int length, ushort pid);
+ bool GetPriority(void);
+ void SetPriority(bool priority);
+ pByte GetData(void);
+ pByte GetPayload(void);
byte GetByte(int i);
- void SetByte(byte dat);
- ushort PID;
- bool Complete;
- PesHeader GetHeader(void);
- void AddData(std::list<byte> moredata);
- void AddData(byte* buff, int offset, int length);
- byte BaseId;
- byte ExtendedId;
- UInt32 ExtendedType;
+ void SetByte(int i, byte dat);
+ ushort GetPID(void);
+ void SetPID(ushort id);
+ bool GetComplete(void);
+ void SetComplete(bool value);
+ boost::shared_ptr<PesHeader> GetHeader(void);
+ void AddData(pByte moredata);
+ void AddData(pByte buff, int offset, int length);
+ byte GetBaseId(void);
+ byte GetExtendedId(void);
+ UInt32 GetExtendedType(void);
private:
- std::list<byte> data;
- ushort pid;
- bool priority;
+ pByte mData;
+ bool mPriority;
+ ushort mPID;
};
class VC1SequenceInfo {
public:
- VC1SequenceInfo(byte* data, int offset);
- bool Valid;
- VideoFormat GetVideoFormati(void);
- void SetVideoFormat(VideoFormat videoformat);
+ VC1SequenceInfo(pByte data, int offset);
+ int GetHeight(void);
+ int GetWidth(void);
+ bool Valid(void);
+ bool Interlaced(void);
+ bool DisplayExt(void);
+ bool AspectFlag(void);
+ byte GetVc1AspectRatio(void);
+ bool FrameFlag(void);
+ bool FrameRateIndicatorFlag(void);
AspectRatio GetAspectRatio(void);
- void SetAspectRatio(AspectRatio aspectratio);
+ VideoFormat GetVideoFormat(void);
FrameRate GetFrameRate(void);
- void SetFrameRate(FrameRate frameRate);
private:
- byte* mData;
- int Height;
- int Width;
- bool Interlaced;
- bool DisplayExt;
- bool AspectFlag;
- byte Vc1AspectRatio;
- bool FrameFlag;
- bool FrameRateIndicatorFlag;
- AspectRatio mAspectRatio;
- VideoFormat mVideoFormat;
- FrameRate mFrameRate;
-};
-
-class H264Info {
- public:
- H264Info(byte* data, int offset);
- byte* ElementaryDescriptors;
- VideoFormat GetVideoFormati(void);
- void SetVideoFormat(VideoFormat videoformat);
- AspectRatio GetAspectRatio(void);
- void SetAspectRatio(AspectRatio aspectratio);
- FrameRate GetFrameRate(void);
- void SetFrameRate(FrameRate frameRate);
- AudioPresentationType GetAudioPresentationType(void);
- void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
- SamplingFrequency GetsamplingFrequency(void);
- void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- private:
- UInt32 GetNextExpGolomb();
- void ScalingListSkip(int skip);
- UInt32 Width;
- UInt32 Heigth;
- byte* HdmvVideoRegistrationDescriptor;
- VideoFormat mVideoFormat;
- AspectRatio mAspectRatio;
- FrameRate mFrameRate;
- AudioPresentationType mAudioPresentationType;
- SamplingFrequency mSamplingFrequency;
+ pByte mData;
};
enum Ac3SyntaxType {
AudioPresentationType audioPresentationTyp);
virtual SamplingFrequency GetsamplingFrequency(void);
virtual void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- virtual byte* GetElementaryDescriptors(void);
+ virtual pByte GetElementaryDescriptors(void);
protected:
byte GetNextBit(void);
- byte* mData;
+ pByte mData;
int indicator;
bool mValid;
VideoFormat mVideoFormat;
AspectRatio mAspectRatio;
SamplingFrequency mSamplingFrequency;
AudioPresentationType mAudioPresentationType;
- byte* ElementaryDescriptors;
+ pByte ElementaryDescriptors;
+};
+
+class H264Info : ElementaryParse {
+ public:
+ H264Info(pByte data, int offset);
+ pByte ElementaryDescriptors;
+ VideoFormat GetVideoFormati(void);
+ void SetVideoFormat(VideoFormat videoformat);
+ AspectRatio GetAspectRatio(void);
+ void SetAspectRatio(AspectRatio aspectratio);
+ FrameRate GetFrameRate(void);
+ void SetFrameRate(FrameRate frameRate);
+ AudioPresentationType GetAudioPresentationType(void);
+ void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
+ SamplingFrequency GetsamplingFrequency(void);
+ void SetSamplingFrequency(SamplingFrequency samplingFrequency);
+ private:
+ UInt32 GetNextExpGolomb();
+ void ScalingListSkip(int skip);
+ UInt32 Width;
+ UInt32 Heigth;
+ pByte HdmvVideoRegistrationDescriptor;
+ VideoFormat mVideoFormat;
+ AspectRatio mAspectRatio;
+ FrameRate mFrameRate;
+ AudioPresentationType mAudioPresentationType;
+ SamplingFrequency mSamplingFrequency;
};
class AC3Info : ElementaryParse {
int FrameLength;
bool IndependentStream;
Ac3SyntaxType SyntaxType;
- AC3Info(byte* data, int offset);
+ AC3Info(pByte data, int offset);
VideoFormat GetVideoFormati(void);
void SetVideoFormat(VideoFormat videoformat);
AspectRatio GetAspectRatio(void);
void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
SamplingFrequency GetsamplingFrequency(void);
void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- byte* GetElementaryDescriptors(void);
+ pByte GetElementaryDescriptors(void);
private:
static readonly int* len48k;
static readonly int* len44k;
class DtsInfo : ElementaryParse {
public:
- DtsInfo(byte* data, int offset);
+ DtsInfo(pByte data, int offset);
VideoFormat GetVideoFormati(void);
void SetVideoFormat(VideoFormat videoformat);
AspectRatio GetAspectRatio(void);
void SetAudioPresentationType( AudioPresentationType audioPresentationTyp);
SamplingFrequency GetsamplingFrequency(void);
void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- byte* GetElementaryDescriptors(void);
+ pByte GetElementaryDescriptors(void);
ushort FrameSize;
byte ExtAudioId;
private:
class MlpInfo : ElementaryParse {
public:
- MlpInfo(byte* data, int offset);
+ MlpInfo(pByte data, int offset);
VideoFormat GetVideoFormati(void);
void SetVideoFormat(VideoFormat videoformat);
AspectRatio GetAspectRatio(void);
void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
SamplingFrequency GetsamplingFrequency(void);
void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- byte* GetElementaryDescriptors(void);
+ pByte GetElementaryDescriptors(void);
private:
- byte* AC3AudioDescriptor;
+ pByte AC3AudioDescriptor;
byte SampleRateCode;
};
class Mpeg2Info : ElementaryParse {
public:
- Mpeg2Info(byte* data, int offset);
+ Mpeg2Info(pByte data, int offset);
VideoFormat GetVideoFormati(void);
void SetVideoFormat(VideoFormat videoformat);
AspectRatio GetAspectRatio(void);
void SetAudioPresentationType(AudioPresentationType audioPresentationTyp);
SamplingFrequency GetsamplingFrequency(void);
void SetSamplingFrequency(SamplingFrequency samplingFrequency);
- byte* GetElementaryDescriptors(void);
+ pByte GetElementaryDescriptors(void);
private:
- byte* Mpeg2VideoRegistrationDescriptor;
+ pByte Mpeg2VideoRegistrationDescriptor;
ushort Horizontal;
ushort Vertical;
byte Aspect;