#ifndef TSREMUXCPP_UTILS_H_
#define TSREMUXCPP_UTILS_H_
-#include <string>
+#include <cstring>
+#include <ctime>
#include <list>
#include <vector>
#include <stdexcept>
#include <boost/shared_array.hpp>
-// #include "BlueMux.h"
+#include <boost/filesystem.hpp>
#include "tsremuxcpp_define.h"
namespace TsRemux {
class Utility {
public:
- static pByte ToArray(std::vector<byte> vector);
+ static pByte ToString(std::vector<byte> vector);
+ static void AddRange(std::vector<byte>& new_vctr, const byte* str);
+ static void AddRange(std::vector<byte>& new_vctr, const pByte str);
+ static void AddRange(std::vector<byte>& new_vctr, const std::vector<byte>& old_vctr);
};
class StreamInfo {
class BluRayOutput {
public:
+ static readonly byte index_bdmv[];
+ static readonly byte MovieObject_bdmv[];
+ static readonly byte PlayList_00000_mpls[];
+ static readonly byte AppInfoPlayList[];
+ static readonly byte PgStreamAttributes[];
+ static readonly byte ClipInfo_0000_clpi[];
+ static readonly byte TsTypeInfoBlock[];
BluRayOutput(std::string path, TimeSpan chapterLen);
- void Author(EpElement* EpInfo, StreamInfo* sis, UInt32 numOfSourcePackets);
- pByte BuildPlayList(byte* PlayItems);
- pByte BuildFirstPlayItem(byte stc_id, UInt32 start,
- UInt32 end, byte* StnTable);
+ void Author(std::vector<EpElement>& EpInfo, std::vector<StreamInfo>& sis, UInt32 numOfSourcePackets);
+ pByte BuildPlayList(std::vector<pByte> PlayItems);
+ pByte BuildFirstPlayItem(byte stc_id, UInt32 start, UInt32 end, pByte StnTable);
pByte BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval);
- pByte Build_clpi(byte* ClipInfo, byte* SequenceInfo,
- byte* ProgramInfo, byte* CPI);
- pByte BuildClipInfo(UInt32 numOfSourcePackets, EpElement* EpInfo);
+ pByte Build_clpi(pByte ClipInfo, pByte SequenceInfo, pByte ProgramInfo, pByte CPI);
+ pByte BuildClipInfo(UInt32 numOfSourcePackets, std::vector<EpElement> EpInfo);
pByte BuildSequenceInfo(UInt32 start, UInt32 end);
- pByte BuildProgramInfo(ushort pids, byte* StreamCodingInfos);
- pByte BuildVideoStreamCodingInfo(ElementaryStreamTypes type,
- VideoFormat format, FrameRate rate, AspectRatio ratio);
- pByte BuildAudioStreamCodingInfo(ElementaryStreamTypes type,
- AudioPresentationType format, SamplingFrequency rate);
+ pByte BuildProgramInfo(std::vector<ushort> pids, std::vector<pByte> StreamCodingInfos);
+ pByte BuildVideoStreamCodingInfo(ElementaryStreamTypes type, VideoFormat format, FrameRate rate, AspectRatio ratio);
+ pByte BuildAudioStreamCodingInfo(ElementaryStreamTypes type, AudioPresentationType format, SamplingFrequency rate);
pByte BuildPgStreamCodingInfo(void);
- pByte BuildCpi(byte* EpMap);
- pByte BuildEpMap(EpElement* EpInfo);
+ pByte BuildCpi(pByte EpMap);
+ pByte BuildEpMap(std::vector<EpElement>& EpInfo);
private:
pByte BuildStreamEntry(ushort pid);
- pByte BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr);
- pByte BuildAudioStreamAttributes(byte type, AudioPresentationType vf,
- SamplingFrequency fr);
- pByte BuildStnTable(byte* VideoEntry, byte* VideoAttributes,
- byte* AudioEntries, byte* AudioAttributes,
- byte* PgEntries, byte* PgAttributes);
+ pByte BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr)throw(std::invalid_argument);
+ pByte BuildAudioStreamAttributes(byte type, AudioPresentationType vf, SamplingFrequency fr)
+ throw(std::invalid_argument);
+ pByte BuildStnTable(pByte VideoEntry, pByte VideoAttributes,
+ std::vector<pByte>& AudioEntries, std::vector<pByte>& AudioAttributes,
+ std::vector<pByte>& PgEntries, std::vector<pByte>& PgAttributes);
pByte UintToByteArraryNetwork(UInt32 value);
- pByte Build_mlps(byte* PlayList, byte* PlayListMark);
+ pByte Build_mlps(pByte PlayList, pByte PlayListMark);
+ boost::filesystem::path path;
+ TimeSpan chapterLen;
};
class Descriptor {
class SitPacket : TsTable {
public:
SitPacket(void);
- SitPacket(byte* data);
+ SitPacket(pByte data);
};
-class PmPacket : TsTable {
+class PmtPacket : TsTable {
public:
- PmPacket(void);
- PmPacket(byte* data);
- DTCP_Descriptor DtcpInfo;
- pByte ProgramDescriptorsData;
- StreamInfo* ElementaryStreams;
- ushort ProgramNumber;
- ushort PcrPID;
+ PmtPacket(void);
+ PmtPacket(pByte data)throw(std::invalid_argument);
+ boost::shared_array<DTCP_Descriptor> GetDtcpInfo(void);
+ pByte GetProgramDescriptorsData(void);
+ void SetProgramDescriptorsData(pByte value);
+ ushort GetProgramDescriptorsLength(void);
+ void SetProgramDescriptorsLength(ushort value);
+ ushort GetProgramNumber(void);
+ void SetProgramNumber(ushort id);
+ ushort GetPcrPID(void);
+ void SetPcrPID(ushort pid);
+ ushort GetStreamInfoLength(void);
private:
- ushort ProgramDescriptorsLength;
- ushort StreamInfoLength;
+ ushort PcrPID;
};
class PesHeader {
class H264Info : ElementaryParse {
public:
H264Info(pByte data, int offset);
- pByte ElementaryDescriptors;
- VideoFormat GetVideoFormati(void);
- void SetVideoFormat(VideoFormat videoformat);
+ pByte GetElementaryDescriptors(void);
+ VideoFormat GetVideoFormat(void);
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;
+ UInt32 GetWidth(void);
+ UInt32 GetHeigth(void);
+ pByte GetHdmvVideoRegistrationDescriptor(void);
};
class AC3Info : ElementaryParse {