[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] mpeg2ts/demuxer/payload aacpayload.cpp, 1.2.8.3,
From:       jgordon () helixcommunity ! org
Date:       2011-06-30 20:17:56
Message-ID: 201106302018.p5UKIdpn025522 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/mpeg2ts/demuxer/payload
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv8844/demuxer/payload

Modified Files:
      Tag: PRODUCER_14_0_RN
	aacpayload.cpp h264payload.cpp mpapayload.cpp mpvpayload.cpp 
Log Message:
Synopsis
========
Adds support to get complete meta-data for a TS stream (all programs
and all streams) and to make program and stream selection.

Branches: PRODUCER_14_0_RN, HEAD pending
Reviewer: pending

Description
===========
This is not full implementation that should be done for more
complete integration and switching, etc.

Adds the ability to get complete meta-data (file/stream headers).
File header gives the program count and each stream from each program
is available and contains its program's ProgramNumber.
This is currently only available as a meta-data only request. Playback
request requires subscription at init and will see only the headers
for the subscribed streams.

Lots of code in the demuxer is broken up in order to allow slightly
different handling for the different cases to share most of the same
code.

The fix for PMT not contained in same read as the PAT is merged from
the head to producer_14.

Reliance on CurrentProgram is mostly removed except where related to
program timestamp sync, etc.

Add Program subscription by program number, stream subscription by
stream number (within the program) or PID or by a language preference.


Also fixed performance problems with high bandwidth content. I could
not separate this, because the only way I can test with multiple
programs and streams is with a 68.5 Mbps stream!
Changed the timeout check granularity to one second rather than *per
read*!!! I was clearly not thinking that day. ;-)
Set large network buffer values (as added in a prior netio CR)
Read whatever we can on each READ event rather than just one read.


Files Affected
==============
datatype/mpeg2ts/demuxer/tsdemuxer.cpp
datatype/mpeg2ts/demuxer/payload/aacpayload.cpp
datatype/mpeg2ts/demuxer/payload/h264payload.cpp
datatype/mpeg2ts/demuxer/payload/mpapayload.cpp
datatype/mpeg2ts/demuxer/payload/mpvpayload.cpp
datatype/mpeg2ts/demuxer/pub/aacpayload.h
datatype/mpeg2ts/demuxer/pub/h264payload.h
datatype/mpeg2ts/demuxer/pub/mpapayload.h
datatype/mpeg2ts/demuxer/pub/mpvpayload.h
datatype/mpeg2ts/demuxer/pub/tsdemuxer.h
datatype/mpeg2ts/fileformat/tsfformat.cpp
datatype/mpeg2ts/stream/tsstreamff.cpp
datatype/mpeg2ts/stream/pub/tsstreamff.h


Index: mpvpayload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/mpvpayload.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- mpvpayload.cpp	8 May 2011 00:19:44 -0000	1.1.2.2
+++ mpvpayload.cpp	30 Jun 2011 20:17:54 -0000	1.1.2.3
@@ -60,6 +60,8 @@
 
 const char* const CHXMPEGVideoPayload::zm_szMPEG1MimeType = "video/x-hx-mp1v-es";
 const char* const CHXMPEGVideoPayload::zm_szMPEG2MimeType = "video/x-hx-mp2v-es";
+const char* const CHXMPEGVideoPayload::zm_szMPEG1CodecName = "MPEG-1";
+const char* const CHXMPEGVideoPayload::zm_szMPEG2CodecName = "MPEG-2";
 
 CHXMPEGVideoPayload::CHXMPEGVideoPayload(IUnknown* pContext)
     : CHXBasePayload(pContext)
@@ -173,45 +175,39 @@
 HX_RESULT
 CHXMPEGVideoPayload::PrepareHeader(IHXValues* pHeader)
 {
-    HX_RESULT rc = HXR_NO_DATA;
-
     HX_ASSERT(pHeader);
-    if (pHeader && m_pVideoSeq)
+
+    SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);
+    pHeader->SetPropertyULONG32("HasOutOfOrderTS", 1);
+
+    if (m_pVideoSeq)
     {
-        rc = SetCStringPropertyCCF(pHeader, "MimeType", 
+        SetCStringPropertyCCF(pHeader, "MimeType", 
                 m_pVideoSeq->bMPEG2 ? zm_szMPEG2MimeType : zm_szMPEG1MimeType,
                 m_pContext);
-        
-        if (SUCCEEDED(rc))
-        {
-            SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);
-        }
-        if (SUCCEEDED(rc))
-        {
-            rc = pHeader->SetPropertyULONG32("Width", m_pVideoSeq->ulWidth);
-        }
-        if (SUCCEEDED(rc))
-        {
-            rc = pHeader->SetPropertyULONG32("Height", m_pVideoSeq->ulHeight);
-        }
-        if (SUCCEEDED(rc) && m_pVideoSeq->ulBitRate != MAX_UINT32)
+        SetCStringPropertyCCF(pHeader, "CodecName", 
+                m_pVideoSeq->bMPEG2 ? zm_szMPEG2CodecName : zm_szMPEG1CodecName,
+                m_pContext);
+
+        pHeader->SetPropertyULONG32("Width", m_pVideoSeq->ulWidth);
+        pHeader->SetPropertyULONG32("Height", m_pVideoSeq->ulHeight);
+        pHeader->SetPropertyULONG32("FramesPerMSecond", 
+                                        m_pVideoSeq->ulFramesPerMSec);
+
+        if (m_pVideoSeq->ulBitRate != MAX_UINT32)
         {
             // We really only know the MaxBitRate, not average for VBR
             // And I don't think there is a way to know whether it is CBR
-            // In case of file-based playback, 
-            rc = pHeader->SetPropertyULONG32("MaxBitRate", m_pVideoSeq->ulBitRate);
-        }
-        if (SUCCEEDED(rc))
-        {
-            rc = pHeader->SetPropertyULONG32("FramesPerMSecond", 
-                            m_pVideoSeq->ulFramesPerMSec);
-        }
-        if (SUCCEEDED(rc))
-        {
-            rc = pHeader->SetPropertyULONG32("HasOutOfOrderTS", 1);
+            pHeader->SetPropertyULONG32("MaxBitRate", m_pVideoSeq->ulBitRate);
         }
-   }
-   return rc;
+        return HXR_OK;
+    }
+    
+    // We don't have full header info yet
+    SetCStringPropertyCCF(pHeader, "MimeType", zm_szMPEG2MimeType, m_pContext);
+    SetCStringPropertyCCF(pHeader, "CodecName", zm_szMPEG2CodecName, m_pContext);
+
+    return HXR_NO_DATA;
 }
 
 HX_RESULT

Index: mpapayload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/mpapayload.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- mpapayload.cpp	18 May 2011 23:19:34 -0000	1.1.2.2
+++ mpapayload.cpp	30 Jun 2011 20:17:54 -0000	1.1.2.3
@@ -118,7 +118,8 @@
 
             int nChannels = 0;
             int nTmp = 0;
-            if (m_pAudInfo->GetEncodeInfo(
+            if (m_pAudInfo->Init(pDataBuf + lOffset, ulFrameSize) &&
+                m_pAudInfo->GetEncodeInfo(
                         pDataBuf + lOffset, ulFrameSize,
                         m_ulBitRate, m_ulSampleRate, nChannels, 
                         nTmp, nTmp, nTmp))
@@ -172,14 +173,15 @@
     HX_ASSERT(pHeader);
     HX_RESULT rc = HXR_NO_DATA;
 
-    if (m_bInited)
-    {
-        SetCStringPropertyCCF(pHeader, "MimeType", GetMimeType(), m_pContext);
+    SetCStringPropertyCCF(pHeader, "MimeType", GetMimeType(), m_pContext);
+    SetCStringPropertyCCF(pHeader, "CodecName", GetCodecName(), m_pContext);
 
-        // ASMRuleBook - basic RTP rule book
-        SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);
+    // ASMRuleBook - basic RTP rule book
+    SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);
+    pHeader->SetPropertyULONG32("IsAudioStream", 1);
 
-        pHeader->SetPropertyULONG32("IsAudioStream", 1);
+    if (m_bInited)
+    {
         pHeader->SetPropertyULONG32("SamplesPerSecond", m_ulSampleRate);
         pHeader->SetPropertyULONG32("Channels", m_ulChannels);
 
@@ -199,6 +201,33 @@
     m_pAudInfo = new CMp3Format(NULL);
 }
 
+const char* CHXMPEGAudioPayload::GetCodecName()
+{
+    if (m_pAudInfo)
+    {
+        UINT16 uSyncWord = m_pAudInfo->GetSyncWord();
+        switch (uSyncWord & 0xFFFE)
+        {
+        case 0xFFFE:
+            return "MPEG-1 Layer I";
+        case 0xFFFC:
+            return "MPEG-1 Layer II";
+        case 0xFFFA:
+            return "MPEG-1 Layer III";
+        case 0xFFF6:
+            return "MPEG-2 Layer I";
+        case 0xFFF4:
+            return "MPEG-2 Layer II";
+        case 0xFFF2:
+            return "MPEG-2 Layer III";
+        case 0xFFE2:
+            return "MPEG-2.5 Layer III";
+        }
+    }
+
+    return HX_TS_MPA_CODEC_NAME;
+}
+
 CHXAC3AudioPayload::CHXAC3AudioPayload(IUnknown* pContext)
 : CHXBaseAudioPayload(pContext)
 {

Index: h264payload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/h264payload.cpp,v
retrieving revision 1.1.10.1
retrieving revision 1.1.10.2
diff -u -d -r1.1.10.1 -r1.1.10.2
--- h264payload.cpp	4 Apr 2011 06:37:01 -0000	1.1.10.1
+++ h264payload.cpp	30 Jun 2011 20:17:54 -0000	1.1.10.2
@@ -162,7 +162,12 @@
     HX_ASSERT(pHeader);
     if (pHeader)
     {
+        // FXD: set packetization mode to one AU per PES (mode 1)
+        //      this will not be true for all h.264 PES in TS. Only temporarly!
+        pHeader->SetPropertyULONG32("PacketizationMode", 1);
+
         SetCStringPropertyCCF(pHeader, "MimeType", HX_TS_AVC1_MIME_TYPE, m_pContext);
+        SetCStringPropertyCCF(pHeader, "CodecName", HX_TS_AVC1_CODEC_NAME, m_pContext);
 
         // ASMRuleBook - basic RTP rule book
         SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);
@@ -176,10 +181,6 @@
         {
             return HXR_NO_DATA;
         }
-
-        // FXD: set packetization mode to one AU per PES (mode 1)
-        //      this will not be true for all h.264 PES in TS. Only temporarly!
-        pHeader->SetPropertyULONG32("PacketizationMode", 1);
    }
    return HXR_OK;
 }

Index: aacpayload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/aacpayload.cpp,v
retrieving revision 1.2.8.3
retrieving revision 1.2.8.4
diff -u -d -r1.2.8.3 -r1.2.8.4
--- aacpayload.cpp	8 May 2011 00:19:44 -0000	1.2.8.3
+++ aacpayload.cpp	30 Jun 2011 20:17:53 -0000	1.2.8.4
@@ -179,6 +179,7 @@
     if (pHeader)
     {
         SetCStringPropertyCCF(pHeader, "MimeType", HX_TS_AAC_ADTS_MIME_TYPE, m_pContext);
+        SetCStringPropertyCCF(pHeader, "CodecName", HX_TS_AAC_ADTS_CODEC_NAME, m_pContext);
 
         // ASMRuleBook - basic RTP rule book
         SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", m_pContext);


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic