OSDN Git Service

implement BluRayOutput class in Utils
authorcocot <cocot@users.sourceforge.jp>
Sat, 14 Mar 2009 14:53:23 +0000 (23:53 +0900)
committercocot <cocot@users.sourceforge.jp>
Sat, 14 Mar 2009 14:53:23 +0000 (23:53 +0900)
src/Utils.cc
src/Utils.h

index db62f8f..3861009 100755 (executable)
@@ -150,7 +150,7 @@ namespace TsRemux
         0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
         0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 };
 
-pByte Utility::ToArray(const std::vector<byte> vctr)
+pByte Utility::ToString(const std::vector<byte> vctr)
 {
     pByte array = pByte(new byte[vctr.size()]);
     for(int i = 0; i < vctr.size(); i++)
@@ -160,6 +160,18 @@ pByte Utility::ToArray(const std::vector<byte> vctr)
     return array;
 }
 
+void Utility::ToArray(std::vector<byte>& vctr, byte* str)
+{
+    for(int i = 0; i < sizeof(str); i++)
+       vctr.push_back(str[i]); 
+}
+
+void Utility::AddRange(std::vector<byte>& new_vctr, std::vector<byte>& old_vctr)
+{
+    for(std::vector<byte>::iterator it = old_vctr.begin(); it < old_vctr.end(); it++)
+        new_vctr.push_back(*it);
+}
+
 const int DATA_HEADER = 5;
 StreamInfo::StreamInfo(pByte data, int index)throw(std::invalid_argument)
 {
@@ -1377,7 +1389,7 @@ pByte MlpInfo::GetElementaryDescriptors(void)
     {
        descriptors.push_back(ad[i]); 
     }
-    return Utility::ToArray(descriptors);
+    return Utility::ToString(descriptors);
 }
 
 AudioPresentationType MlpInfo::GetAudioPresentationType(void)
@@ -1412,7 +1424,7 @@ pByte MlpInfo::GetAC3AudioDescriptor(void)
     desc.push_back(200);
     desc.push_back((byte)(0x0f));
     desc[1] = (byte)(desc.size() - 2);
-    return Utility::ToArray(desc);
+    return Utility::ToString(desc);
 }
 
 byte MlpInfo::GetSampleRateCode(void)
@@ -1545,7 +1557,7 @@ pByte AC3Info::GetAC3AudioDescriptor(void)
     desc.push_back((byte)((GetSampleRateCode() << 5) | GetBsid()));
     desc.push_back(200);
     desc.push_back((byte)((GetBsmod() << 5) | (GetAcmod() << 1) | 1));
-    return Utility::ToArray(desc);
+    return Utility::ToString(desc);
 }
 
 AC3Info::AC3Info(pByte data, int offset)
@@ -1608,7 +1620,7 @@ pByte AC3Info::GetElementaryDescriptors(void)
     {
         descriptors.push_back(ac3ad[j]);
     }
-    return Utility::ToArray(descriptors);
+    return Utility::ToString(descriptors);
 }
 
 AspectRatio AC3Info::GetAspectRatio(void)
@@ -2489,7 +2501,7 @@ void BluRayOutput::Author(EpElement* EpInfo, StreamInfo* sis, UInt32 numOfSource
     UInt32 Start = (UInt32)((EpInfo[0].PTS >> 1) & 0xffffffff);
     UInt32 End = (UInt32)((EpInfo[EpInfo.Length - 1].PTS >> 1) & 0xffffffff);
     UInt32 Interval = ((UInt32)(chapterLen.TotalMinutes)) * 2700000;
-    byte[] StnTable = BuildStnTable(VideoEntry, VideoAttribute, AudioEntries.ToArray(), AudioAttributes.ToArray(), PgEntries.ToArray(), PgAttributes.ToArray());
+    byte[] StnTable = BuildStnTable(VideoEntry, VideoAttribute, AudioEntries.ToString(), AudioAttributes.ToString(), PgEntries.ToString(), PgAttributes.ToString());
     PlayItems[0] = BuildFirstPlayItem(0, Start, End, StnTable);
     byte[] PlayList = BuildPlayList(PlayItems);
     byte[] PlayListMark = BuildFirstPlayMarks(Start, End, Interval);
@@ -2499,7 +2511,7 @@ void BluRayOutput::Author(EpElement* EpInfo, StreamInfo* sis, UInt32 numOfSource
 
     byte[] ClipInfo = BuildClipInfo(numOfSourcePackets,EpInfo);
     byte[] SequenceInfo = BuildSequenceInfo(Start, End);
-    byte[] ProgramInf = BuildProgramInfo(Pids.ToArray(), StreamCodingInfos.ToArray());
+    byte[] ProgramInf = BuildProgramInfo(Pids.ToString(), StreamCodingInfos.ToString());
     byte[] EpMap = BuildEpMap(EpInfo);
     byte[] CPI = BuildCpi(EpMap);
     byte[] clpi = Build_clpi(ClipInfo, SequenceInfo, ProgramInf, CPI);
@@ -2589,7 +2601,7 @@ pByte BluRayOutput::BuildStnTable(pByte VideoEntry, pByte VideoAttributes, byte[
             temp.Add((byte)((len >> 8) & 0xff));
             temp.Add((byte)(len & 0xff));
             temp.AddRange(table);
-            return temp.ToArray();
+            return temp.ToString();
 }
 
 pByte BluRayOutput:: UintToByteArraryNetwork(UInt32 value)
@@ -2604,192 +2616,191 @@ pByte BluRayOutput:: UintToByteArraryNetwork(UInt32 value)
 
 pByte BluRayOutput::Build_mlps(pByte PlayList, pByte PlayListMark)
 {
-    List<byte> mlps;
-    mlps.AddRange(PlayList_00000_mpls);
-    UInt32 temp = (UInt32)AppInfoPlayList.Length;
+    std::vector<byte> mlps;
+    Utility::AddRange(mlps, PlayList_00000_mpls);
+    UInt32 temp = sizeof(AppInfoPlayList);
     temp += 40;
-    mlps.AddRange(UintToByteArraryNetwork(temp));
+    Utility::AddRange(mlps, UintToByteArraryNetwork(temp).get());
     temp += (UInt32)PlayList.Length;
-    mlps.AddRange(UintToByteArraryNetwork(temp));
+    Utility::AddRange(mlps, UintToByteArraryNetwork(temp).get());
     for (int i = 0; i < 24; i++)
-        mlps.Add(0x00);
-    mlps.AddRange(AppInfoPlayList);
-    mlps.AddRange(PlayList);
-    mlps.AddRange(PlayListMark);
-    return mlps.ToArray();
+        mlps.push_back(0x00);
+    Utility::AddRange(mlps, AppInfoPlayList);
+    Utility::AddRange(mlps, PlayList);
+    Utility::AddRange(mlps, PlayListMark);
+    return Utility::ToString(mlps);
 }
 
-pByte BluRayOutput::BuildPlayList(byte[][] PlayItems)
+pByte BluRayOutput::BuildPlayList(pByte PlayItems)
 {
-    std::List<byte> playList;
-    UInt32 playItemNum = sizeof(PlayItems);
+    std::vector<byte> playList;
+    UInt32 playItemNum = sizeof(PlayItems.get());
     playItemNum <<= 16;
     playItemNum &= 0xffff0000;
-    UInt32 len = sizeof(PlayItems) + 6;
-    playList.AddRange(UintToByteArraryNetwork(len));
+    UInt32 len = sizeof(PlayItems.get()) + 6;
+    Utility::AddRange(playList, UintToByteArraryNetwork(len).get());
     playList.push_back(0x00);
     playList.push_back(0x00);
-    playList.AddRange(UintToByteArraryNetwork(playItemNum));
-    for (int i = 0; i < PlayItems.Length; i++)
-        playList.AddRange(PlayItems[i]);
-    return playList.ToArray();
+    Utility::AddRange(playList, UintToByteArraryNetwork(playItemNum)get());
+   Utility::.AddRange(playList, PlayItems.get());
+    return Utility::ToString(playList);
 }
 
-byte[] BuildFirstPlayItem(byte stc_id, UInt32 start, UInt32 end, byte[] StnTable)
+pByte BluRayOutput::BuildFirstPlayItem(byte stc_id, UInt32 start, UInt32 end, pByte StnTable)
 {
-            List<byte> playItem = new List<byte>();
-            List<byte> playTemp = new List<byte>();
-            for (int i = 0; i < 4; i++)
-                playItem.Add(0x30);
-            playItem.Add(0x31);
-            playItem.Add(0x4d);
-            playItem.Add(0x32);
-            playItem.Add(0x54);
-            playItem.Add(0x53);
-            playItem.Add(0x00);
-            playItem.Add(0x01);
-            playItem.Add(stc_id);
-            playItem.AddRange(UintToByteArraryNetwork(start));
-            playItem.AddRange(UintToByteArraryNetwork(end));
-            for (int i = 0; i < 12; i++)
-                playItem.Add(0x00);
-            playItem.AddRange(StnTable);
-            UInt32 len = (UInt32)playItem.Count;
-            playTemp.Add((byte)((len >> 8) & 0xff));
-            playTemp.Add((byte)(len & 0xff));
-            playTemp.AddRange(playItem);
-            return playTemp.ToArray();
-}
-
-byte[] BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval)
-{
-            List<byte> marks = new List<byte>();
-            List<byte> temp = new List<byte>();
-            UInt32 num = 0;
-            for (UInt32 i = start; i < end; i += interval, num++)
-            {
-                marks.Add(0x00);
-                marks.Add(0x01);
-                marks.Add(0x00);
-                marks.Add(0x00);
-                UInt32 time = i;
-                marks.AddRange(UintToByteArraryNetwork(time));
-                marks.Add(0xff);
-                marks.Add(0xff);
-                time = 0;
-                marks.AddRange(UintToByteArraryNetwork(time));
-            }
-            UInt32 len = (UInt32)marks.Count;
-            len += 2;
-            temp.AddRange(UintToByteArraryNetwork(len));
-            temp.Add((byte)((num >> 8) & 0xff));
-            temp.Add((byte)(num & 0xff));
-            temp.AddRange(marks);
-            return temp.ToArray();
-}
-
-byte[] Build_clpi(byte[] ClipInfo, byte[] SequenceInfo, byte[] ProgramInfo, byte[] CPI)
-{
-            List<byte> clpi = new List<byte>();
-            clpi.AddRange(ClipInfo_0000_clpi);
-            UInt32 len = 40;
-            len += (UInt32)ClipInfo.Length;
-            clpi.AddRange(UintToByteArraryNetwork(len));
-            len += (UInt32)SequenceInfo.Length;
-            clpi.AddRange(UintToByteArraryNetwork(len));
-            len += (UInt32)ProgramInfo.Length;
-            clpi.AddRange(UintToByteArraryNetwork(len));
-            len += (UInt32)CPI.Length;
-            clpi.AddRange(UintToByteArraryNetwork(len));
-            for (int i = 0; i < 16; i++)
-                clpi.Add(0x00);
-            clpi.AddRange(ClipInfo);
-            clpi.AddRange(SequenceInfo);
-            clpi.AddRange(ProgramInfo);
-            clpi.AddRange(CPI);
-            clpi.AddRange(UintToByteArraryNetwork(0x00000000));
-            return clpi.ToArray();
-}
-
-byte[] BuildClipInfo(UInt32 numOfSourcePackets, EpElement[] EpInfo)
-{
-            List<byte> clip = new List<byte>();
-            List<byte> temp = new List<byte>();
-
-            clip.Add(0x00);
-            clip.Add(0x00);
-            clip.Add(0x01);
-            clip.Add(0x01);
-            clip.Add(0x00);
-            clip.Add(0x00);
-            clip.Add(0x00);
-            clip.Add(0x00);
-            Int64 rate = EpInfo[EpInfo.Length - 1].SPN - EpInfo[0].SPN;
-            rate *= 192;
-            rate /= ((EpInfo[EpInfo.Length - 1].PTS - EpInfo[0].PTS) / 90000);
-            clip.AddRange(UintToByteArraryNetwork((UInt32)rate));
-            clip.AddRange(UintToByteArraryNetwork(numOfSourcePackets));
-            for (int i = 0; i < 128; i++)
-                clip.Add(0x00);
-            clip.AddRange(TsTypeInfoBlock);
-            UInt32 len = (UInt32)clip.Count;
-            temp.AddRange(UintToByteArraryNetwork(len));
-            temp.AddRange(clip);
-            return temp.ToArray();
-}
-
-byte[] BuildSequenceInfo(UInt32 start, UInt32 end)
-{
-            List<byte> seq = new List<byte>();
-            List<byte> temp = new List<byte>();
-
-            seq.Add(0x00);
-            seq.Add(0x01);
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.Add(0x01);
-            seq.Add(0x00);
-            seq.Add((byte)((Constants.DEFAULT_PCR_PID >> 8) & 0xff));
-            seq.Add((byte)(Constants.DEFAULT_PCR_PID & 0xff));
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.Add(0x00);
-            seq.AddRange(UintToByteArraryNetwork(start));
-            seq.AddRange(UintToByteArraryNetwork(end));
-            UInt32 len = (UInt32)seq.Count;
-            temp.AddRange(UintToByteArraryNetwork(len));
-            temp.AddRange(seq);
-            return temp.ToArray();
-}
-
-byte[] BuildProgramInfo(ushort[] pids, byte[][] StreamCodingInfos)
-{
-            List<byte> info = new List<byte>();
-            List<byte> temp = new List<byte>();
-            info.Add(0x00);
-            info.Add(0x01);
-            info.Add(0x00);
-            info.Add(0x00);
-            info.Add(0x00);
-            info.Add(0x00);
-            info.Add((byte)((Constants.DEFAULT_PMT_PID >> 8) & 0xff));
-            info.Add((byte)(Constants.DEFAULT_PMT_PID & 0xff));
-            info.Add((byte)pids.Length);
-            info.Add(0x00);
-            for (int i = 0; i < pids.Length; i++)
-            {
-                info.Add((byte)((pids[i] >> 8) & 0xff));
-                info.Add((byte)(pids[i] & 0xff));
-                info.AddRange(StreamCodingInfos[i]);
-            }
-
-            UInt32 len = (UInt32)info.Count;
-            temp.AddRange(UintToByteArraryNetwork(len));
-            temp.AddRange(info);
-            return temp.ToArray();
+    std::vector<byte> playItem;
+    std::vector<byte> playTemp;
+    for (int i = 0; i < 4; i++)
+        playItem.push_back(0x30);
+    playItem.push_back(0x31);
+    playItem.push_back(0x4d);
+    playItem.push_back(0x32);
+    playItem.push_back(0x54);
+    playItem.push_back(0x53);
+    playItem.push_back(0x00);
+    playItem.push_back(0x01);
+    playItem.push_back(stc_id);
+    Utility::AddRange(playItem, UintToByteArraryNetwork(start).get());
+    Utility::AddRange(playItem, UintToByteArraryNetwork(end).get());
+    for (int i = 0; i < 12; i++)
+        playItem.Add(0x00);
+    playItem.AddRange(StnTable);
+    UInt32 len = (UInt32)playItem.Count;
+    playTemp.Add((byte)((len >> 8) & 0xff));
+    playTemp.Add((byte)(len & 0xff));
+    playTemp.AddRange(playItem);
+    return playTemp.ToString();
+}
+
+pByte BluRayOutput::BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval)
+{
+    std::vector<byte> marks;
+    std::vector<byte> temp;
+    UInt32 num = 0;
+    for (UInt32 i = start; i < end; i += interval, num++)
+    {
+        marks.push_back(0x00);
+        marks.push_back(0x01);
+        marks.push_back(0x00);
+        marks.push_back(0x00);
+        UInt32 time = i;
+        Utility::AddRange(marks, UintToByteArraryNetwork(time));
+        marks.push_back(0xff);
+        marks.push_back(0xff);
+        time = 0;
+        Utility::AddRange(marks, UintToByteArraryNetwork(time));
+    }
+    UInt32 len = (UInt32)marks.size();
+    len += 2;
+    Utility::AddRange(temp, UintToByteArraryNetwork(len));
+    temp.push_back((byte)((num >> 8) & 0xff));
+    temp.push_back((byte)(num & 0xff));
+    Utility::AddRange(temp, marks);
+    return Utility::ToString(temp);
+}
+
+pByte BluRayOutput::Build_clpi(pByte ClipInfo, pByte SequenceInfo, pByte ProgramInfo, pByte CPI)
+{
+    std::vector<byte> clpi;
+    Utility::AddRange(clpi, ClipInfo_0000_clpi);
+    UInt32 len = 40;
+    len += sizeof(ClipInfo.get());
+    Utility::AddRange(clpi, UintToByteArraryNetwork(len).get());
+    len += sizeof(SequenceInfo.get());
+    Utility::AddRange(clpi, UintToByteArraryNetwork(len).get());
+    len += sizeof(ProgramInfo.get());
+    Utility::AddRange(clpi, UintToByteArraryNetwork(len).get());
+    len += (UInt32)CPI.Length;
+    Utility::AddRange(clpi, UintToByteArraryNetwork(len).get());
+    for (int i = 0; i < 16; i++)
+        clpi.push_back(0x00);
+    Utility::AddRange(clpi, ClipInfo);
+    Utility::AddRange(clpi, SequenceInfo);
+    Utility::AddRange(clpi, ProgramInfo);
+    Utility::AddRange(clpi, CPI);
+    Utility::AddRange(clpi, UintToByteArraryNetwork(0x00000000));
+    return Utility::ToString(clpi);
+}
+
+pByte BluRayOutput::BuildClipInfo(UInt32 numOfSourcePackets, EpElement* EpInfo)
+{
+    std::vector<byte> clip;
+    std::vector<byte> temp;
+
+    clip.push_back(0x00);
+    clip.push_back(0x00);
+    clip.push_back(0x01);
+    clip.push_back(0x01);
+    clip.push_back(0x00);
+    clip.push_back(0x00);
+    clip.push_back(0x00);
+    clip.push_back(0x00);
+    Int64 rate = EpInfo[sizeof(EpInfo)/sizeof(EpElement) - 1].spn_ - EpInfo[0].spn_;
+    rate *= 192;
+    rate /= ((EpInfo[sizeof(EpInfo)/sizeof(EpElement) - 1].PTS_ - EpInfo[0].pts_) / 90000);
+    Utility::AddRange(clip, UintToByteArraryNetwork((UInt32)rate));
+    Utility::AddRange(clip, UintToByteArraryNetwork(numOfSourcePackets));
+    for (int i = 0; i < 128; i++)
+        clip.push_back(0x00);
+    Utility::AddRange(clip, TsTypeInfoBlock);
+    UInt32 len = (UInt32)clip.size();
+    Utility::AddRange(temp, UintToByteArraryNetwork(len).get());
+    Utility::AddRange(temp, clip);
+    return ToString(temp);
+}
+
+pByte BluRayOutput::BuildSequenceInfo(UInt32 start, UInt32 end)
+{
+    std::vector<byte> seq;
+    std::vector<byte> temp;
+
+    seq.push_back(0x00);
+    seq.push_back(0x01);
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    seq.push_back(0x01);
+    seq.push_back(0x00);
+    seq.push_back((byte)((Constants::DEFAULT_PCR_PID >> 8) & 0xff));
+    seq.push_back((byte)(Constants::DEFAULT_PCR_PID & 0xff));
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    seq.push_back(0x00);
+    Utility::AddRange(seq, UintToByteArraryNetwork(start));
+    Utility::AddRange(seq, UintToByteArraryNetwork(end));
+    UInt32 len = (UInt32)seq.size();
+    Utility::AddRange(temp, UintToByteArraryNetwork(len));
+    Utility::AddRange(temp, seq);
+    return Utility::ToString(temp);
+}
+
+pByte BluRayOutput::BuildProgramInfo(ushort* pids, pByte StreamCodingInfos)
+{
+    std::vector<byte> info;
+    std::vector<byte> temp;
+    info.push_back(0x00);
+    info.push_back(0x01);
+    info.push_back(0x00);
+    info.push_back(0x00);
+    info.push_back(0x00);
+    info.push_back(0x00);
+    info.push_back((byte)((Constants::DEFAULT_PMT_PID >> 8) & 0xff));
+    info.push_back((byte)(Constants::DEFAULT_PMT_PID & 0xff));
+    info.push_back((byte)sizeof(pids));
+    info.push_back(0x00);
+    for (int i = 0; i < sizeof(pids); i++)
+    {
+        info.push_back((byte)((pids[i] >> 8) & 0xff));
+        info.push_back((byte)(pids[i] & 0xff));
+        Utility::AddRange(info, StreamCodingInfos[i]);
+    }
+
+    UInt32 len = info.size();
+    Utility::AddRange(temp, UintToByteArraryNetwork(len)get());
+    Utility::AddRange(temp, info);
+    return Utility::ToString(temp);
 }
 
 byte[] BuildVideoStreamCodingInfo(ElementaryStreamTypes type, VideoFormat format, FrameRate rate, AspectRatio ratio)
@@ -2801,7 +2812,7 @@ byte[] BuildVideoStreamCodingInfo(ElementaryStreamTypes type, VideoFormat format
             info.Add((byte)(((byte)(ratio)) << 4));
             for(int i = 0; i < 18; i++)
                 info.Add(0x00);
-            return info.ToArray();
+            return info.ToString();
 }
 
 byte[] BuildAudioStreamCodingInfo(ElementaryStreamTypes type, AudioPresentationType format, SamplingFrequency rate)
@@ -2815,7 +2826,7 @@ byte[] BuildAudioStreamCodingInfo(ElementaryStreamTypes type, AudioPresentationT
             info.Add(0x67);
             for (int i = 0; i < 16; i++)
                 info.Add(0x00);
-            return info.ToArray();
+            return info.ToString();
 }
 
 byte[] BuildPgStreamCodingInfo()
@@ -2828,7 +2839,7 @@ byte[] BuildPgStreamCodingInfo()
             info.Add(0x67);
             for (int i = 0; i < 17; i++)
                 info.Add(0x00);
-            return info.ToArray();
+            return info.ToString();
 }
 
 byte[] BuildCpi(byte[] EpMap)
@@ -2839,7 +2850,7 @@ byte[] BuildCpi(byte[] EpMap)
             info.Add(0x00);
             info.Add(0x01);
             info.AddRange(EpMap);
-            return info.ToArray();
+            return info.ToString();
 }
 
 byte[] BuildEpMap(EpElement[] EpInfo)
@@ -2896,7 +2907,7 @@ byte[] BuildEpMap(EpElement[] EpInfo)
             EpMap.AddRange(UintToByteArraryNetwork(start));
             EpMap.AddRange(coarseloop);
             EpMap.AddRange(fineloop);
-            return EpMap.ToArray();
+            return EpMap.ToString();
         }
 }
 **/
index 47021ba..0e4a580 100755 (executable)
@@ -105,7 +105,9 @@ struct EpElement {
 
 class Utility {
  public:
-  static pByte ToArray(std::vector<byte> vector);
+  static pByte ToString(std::vector<byte> vector);
+  static void ToArray(std::vector<byte>& vctr, byte* str);
+  static void AddRange(std::vector<byte>& new_vctr, std::vector<byte>& old_vctr);
 };
 
 class StreamInfo {
@@ -153,30 +155,25 @@ class BluRayOutput {
   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);
+  pByte BuildPlayList(pByte PlayItems);
+  pByte BuildFirstPlayItem(byte stc_id, UInt32 start, UInt32 end, byte* StnTable);
   pByte BuildFirstPlayMarks(UInt32 start, UInt32 end, UInt32 interval);
-  pByte Build_clpi(byte* ClipInfo, byte* SequenceInfo,
-        byte* ProgramInfo, byte* CPI);
+  pByte Build_clpi(byte* ClipInfo, byte* SequenceInfo, byte* ProgramInfo, byte* CPI);
   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);
-  pByte BuildAudioStreamCodingInfo(ElementaryStreamTypes type,
-        AudioPresentationType format, SamplingFrequency rate);
+  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);
  private:
   pByte BuildStreamEntry(ushort pid);
-  pByte BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr);
+  pByte BuildVideoStreamAttributes(byte type, VideoFormat vf, FrameRate fr)throw(std::invalid_argument);
   pByte BuildAudioStreamAttributes(byte type, AudioPresentationType vf,
-        SamplingFrequency fr);
+        SamplingFrequency fr)throw(std::invalid_argument);
   pByte BuildStnTable(byte* VideoEntry, byte* VideoAttributes,
-        byte* AudioEntries, byte* AudioAttributes,
-        byte* PgEntries, byte* PgAttributes);
+        byte* AudioEntries, byte* AudioAttributes, byte* PgEntries, byte* PgAttributes);
   pByte UintToByteArraryNetwork(UInt32 value);
   pByte Build_mlps(byte* PlayList, byte* PlayListMark);
   std::string path;