OSDN Git Service

modified Mpeg2Ext class in Utils
authorcocot <cocot@users.sourceforge.jp>
Tue, 24 Mar 2009 14:38:31 +0000 (23:38 +0900)
committercocot <cocot@users.sourceforge.jp>
Tue, 24 Mar 2009 14:38:31 +0000 (23:38 +0900)
src/Utils.cc
src/Utils.h

index abf468c..a8ab253 100755 (executable)
@@ -1357,6 +1357,9 @@ bool DTCP_Descriptor::GetMacrovision(void)
     return ((mData[5] & 0x3) > 0);
 }
 
+/////////////////////////////
+/**   implement MlpInfo   **/
+/////////////////////////////
 MlpInfo::MlpInfo(pByte data, int offset)
 {
     UInt32 marker = 0xffffffff;
@@ -1452,7 +1455,9 @@ byte MlpInfo::GetSampleRateCode(void)
     return 0x00;
 }
 
-// implement class AC3Info : ElementaryParse
+///////////////////////////////////
+/**   implement class AC3Info   **/
+///////////////////////////////////
 readonly int AC3Info::len48k[] = {
              128,  128,  160,  160,  192,  192,  224,  224,
              256,  256,  320,  320,  384,  384,  448,  448,
@@ -1656,7 +1661,9 @@ VideoFormat AC3Info::GetVideoFormat(void)
     return VF_Reserved;
 }
 
-// implement class DtsInfo : ElementaryParse
+/////////////////////////////////
+/** implement class DtsInfo   **/
+/////////////////////////////////
 DtsInfo::DtsInfo(pByte data, int offset)
 {
     UInt32 marker = 0xffffffff;
@@ -1705,8 +1712,7 @@ byte DtsInfo::GetAmode(void)
     return ret;
 }
 
-/*
-byte DtsInfo::GetSamplingFrequency(void)
+byte DtsInfo::GetSampleFreq(void)
 {
     indicator = 34;
     byte ret = 0;
@@ -1715,9 +1721,8 @@ byte DtsInfo::GetSamplingFrequency(void)
         ret <<= 1;
         ret |= GetNextBit();
     }
-    return ret;
+    return (SamplingFrequency)ret;
 }
-*/
 
 bool DtsInfo::GetExtAudio(void)
 {
@@ -1800,38 +1805,14 @@ VideoFormat DtsInfo::GetVideoFormat(void)
     return VF_Reserved;
 }
 
+///////////////////////////////////
+/** implement class Mpeg2Info   **/
+///////////////////////////////////
 /*
-// implement class Mpeg2Info : ElementaryParse
 Mpeg2Info::Mpeg2Info(void)
 {
         private class Mpeg2Ext : ElementaryParse
         {
-            public Mpeg2Ext(byte[] data, int offset)
-                : base()
-            {
-                UInt32 marker = 0xffffffff;
-                for (; offset < data.Length - 1; offset++)
-                {
-                    marker = (UInt32)marker << 8;
-                    marker &= 0xffffff00;
-                    marker += data[offset];
-                    if (marker == Constants.MPEG2_SEQ_EXT)
-                    {
-                        if((data[offset + 1] & 0xf0) == 0x10)
-                            break;
-                    }
-                }
-                offset++;
-                if (offset < data.Length)
-                {
-                    // sequence header
-                    mData = new byte[data.Length - offset];
-                    for (int i = 0; offset < data.Length; i++, offset++)
-                        mData[i] = data[offset];
-                }
-                else
-                    mData = null;
-            }
 
             public override AspectRatio AspectRatio
             {
@@ -1857,16 +1838,8 @@ Mpeg2Info::Mpeg2Info(void)
             {
                 get { throw new Exception("The method or operation is not implemented."); }
             }
-            public bool Progressive
-            {
-                get
-                {
-                    indicator = 12;
-                    if (GetNextBit() == 1)
-                        return true;
-                    return false;
-                }
 }
+*/
 
 Mpeg2Info::Mpeg2Info(pByte data, int offset)
 {
@@ -1887,17 +1860,12 @@ Mpeg2Info::Mpeg2Info(pByte data, int offset)
         mData = pByte(new byte[sizeof(data.get()) - offset]);
         for(int i = 0; offset < sizeof(data.get()); i++, offset++)
             mData[i] = data[offset];
-        mpgext = new Mpeg2Ext(data, oldOffset);
+        mpgext = Mpeg2Ext(data, oldOffset);
     }
     else
         mData.reset();
 }
 
-Mpeg2Info::~Mpeg2Info(void)
-{
-    delete mpgext;
-}
-
 AspectRatio Mpeg2Info::GetAspectRatio(void)
 {
     switch (GetAspect())
@@ -2046,11 +2014,10 @@ byte Mpeg2Info::GetFrameRateCode(void)
 
 bool Mpeg2Info::GetProgressive(void)
 {
-    if (mpgext.mValid() && mpgext.GetProgressive())
+    if (mpgext.mValid && mpgext.GetProgressive())
         return true;
     return false;
 }
-*/
 
 // implement class H264Info : ElementaryParse
 H264Info::H264Info(pByte data, int offset)
@@ -2395,8 +2362,9 @@ ushort PmtPacket::GetStreamInfoLength(void)
     return (ushort)(GetLength() - 13 - GetProgramDescriptorsLength());
 }
 
-
-// implement class BluRayOutput
+//////////////////////////////////////
+/** implement class BluRayOutput   **/
+//////////////////////////////////////
 readonly byte BluRayOutput::index_bdmv[] = {
     0x49, 0x4e, 0x44, 0x58, 0x30, 0x31, 0x30, 0x30, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x78,
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
index ad6766c..d29525a 100755 (executable)
@@ -465,11 +465,11 @@ class ElementaryParse {
   virtual SamplingFrequency GetSamplingFrequency(void);
   virtual void SetSamplingFrequency(SamplingFrequency samplingFrequency);
   virtual pByte GetElementaryDescriptors(void);
+  bool mValid;
  protected:
   byte GetNextBit(void);
   pByte mData;
   int indicator;
-  bool mValid;
   VideoFormat mVideoFormat;
   FrameRate mFrameRate;
   AspectRatio mAspectRatio;
@@ -527,12 +527,12 @@ class DtsInfo : ElementaryParse {
   AspectRatio GetAspectRatio(void);
   FrameRate GetFrameRate(void);
   AudioPresentationType GetAudioPresentationType(void);
-  SamplingFrequency GetSamplingFrequency(void);
+  byte GetSampleFreq(void);
   pByte GetElementaryDescriptors(void);
   ushort GetFrameSize(void);
   byte GetExtAudioId(void);
   byte GetAmode(void);
-  byte GetGetSamplingFrequency(void);
+  SamplingFrequency GetSamplingFrequency(void);
 };
 
 class MlpInfo : ElementaryParse {
@@ -565,17 +565,45 @@ class Mpeg2Info : ElementaryParse {
   byte GetFrameRateCode(void);
   bool GetProgressive(void);
  private:
-  class Mpeg2Ext :ElementaryParse {
+  class Mpeg2Ext : public ElementaryParse {
    public:
     Mpeg2Ext(void);
-    Mpeg2Ext(pByte data, int offset);
+    Mpeg2Ext(pByte data, int offset) {
+        UInt32 marker = 0xffffffff;
+        for (; offset < sizeof(data.get()) - 1; offset++)
+        {
+            marker = (UInt32)marker << 8;
+            marker &= 0xffffff00;
+            marker += data[offset];
+            if (marker == Constants::MPEG2_SEQ_EXT)
+            {
+                if((data[offset + 1] & 0xf0) == 0x10)
+                break;
+            }
+        }
+        offset++;
+        if (offset < sizeof(data.get()))
+        {
+            // sequence header
+            mData = pByte(new byte[sizeof(data.get()) - offset]);
+            for (int i = 0; offset < sizeof(data.get()); i++, offset++)
+                mData[i] = data[offset];
+        }
+        else
+            mData.reset();
+    };
     AspectRatio GetAspectRatio(void);
     AudioPresentationType GetAudioPresentationType(void);
     pByte GetElementaryDescriptors(void);
     FrameRate GetFrameRate(void);
     SamplingFrequency GetSamplingFrequency(void);
     VideoFormat GetVideoFormat(void);
-    bool GetProgressive(void);
+    bool GetProgressive(void){
+        indicator = 12;
+        if (GetNextBit() == 1)
+           return true;
+        return false;
+    };
   };
   Mpeg2Ext mpgext;
 };