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

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] mpeg2ts/demuxer/payload mpvpayload.cpp, NONE,
From:       kliu () helixcommunity ! org
Date:       2011-04-29 2:07:54
Message-ID: 201104290208.p3T28Ev9010692 () mailer ! progressive-comp ! com
[Download RAW message or body]

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

Modified Files:
      Tag: hxclient_3_6_5_atlas
	aacpayload.cpp h264payload.cpp 
Added Files:
      Tag: hxclient_3_6_5_atlas
	mpvpayload.cpp 
Log Message:
Modified by: kliu@real.com 
Date: 04/29/2011
Project: RealPlayer for LephoneTD

Synopsis: Porting MPEG1/2 TS support to 365 from HEAD

Overview: Porting files for MPEG1/2 TS support to 365 from HEAD based on Jamie's \
                recommendations.  Files were gathered based on the following commited \
                CR's:
CR: mpeg-1/2 video TS support in producer
CR: add log 4cc for MPEG video
CR: MPEG-1/2 video in TS streams and files
CR: MPEG-1/2 video depacketizer

Files Added:
datatype/mpg/common/pub/mpgvidcommon.h
datatype/mpg/common/mpgvidcommon.cpp
datatype/mpg/payload/mpvespyld.cpp
datatype/mpg/payload/Umakefil
datatype/mpg/payload/pub/mpvespyld.h
datatype/mpeg2ts/demuxer/payload/mpvpayload.cpp
datatype/mpeg2ts/demuxer/pub/mpvpayload.h
datatype/mpeg2ts/stream/guids.cpp
datatype/mpeg2ts/stream/tsstreamff.cpp
datatype/mpeg2ts/stream/tsstreamff.ver
datatype/mpeg2ts/stream/Umakefil
datatype/mpeg2ts/stream/pub
datatype/mpeg2ts/stream/pub/tsstreamff.h

Files Modified:
datatype/mp4/video/renderer/dllumakefil
datatype/mp4/video/renderer/libumakefil
datatype/mp4/video/renderer/mp4vdec.cpp
datatype/mp4/video/renderer/mp4vdfmt.cpp
datatype/mp4/video/renderer/mp4video.cpp

datatype/mpeg2ts/demuxer/payload/aacpayload.cpp
datatype/mpeg2ts/demuxer/payload/h264payload.cpp
datatype/mpeg2ts/demuxer/pub/aacpayload.h
datatype/mpeg2ts/demuxer/pub/h264payload.h
datatype/mpeg2ts/demuxer/pub/tsdemuxer.h
datatype/mpeg2ts/demuxer/tsdemuxer.cpp
datatype/mpeg2ts/demuxer/Umakefil
datatype/mpeg2ts/fileformat/tsfformat.cpp
datatype/mpeg2ts/fileformat/Umakefil

common/include/ihxtlogsystem.h
client/build/BIF/hxclient_3_6_5_atlas.bif

Image Size and Heap Use impact (Client -Only): 
None

Platforms and Profiles Affected: 
Platform: android-2.3-arm-smdk_c110
Profile: helix-client-android-full

Distribution Libraries Affected: 
None 

Distribution library impact and planned action: 
None 

Platforms and Profiles Build Verified: 
Platform: android-2.3-arm-smdk_c110
Profile: helix-client-android-full

Platforms and Profiles Functionality verified: 
Platform: android-2.3-arm-smdk_c110
Profile: helix-client-android-full

Branch: 365atlas
 
Copyright assignment: I am a RealNetworks employee or contractor


--- NEW FILE: mpvpayload.cpp ---
/* ***** BEGIN LICENSE BLOCK *****
 * Source last modified: $Id: mpvpayload.cpp,v 1.2.2.2 2011/04/29 02:07:52 kliu Exp $
 * 
 * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
 * 
 * The contents of this file, and the files included with this file,
 * are subject to the current version of the RealNetworks Public
 * Source License (the "RPSL") available at
 * http://www.helixcommunity.org/content/rpsl unless you have licensed
 * the file under the current version of the RealNetworks Community
 * Source License (the "RCSL") available at
 * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
 * will apply. You may also obtain the license terms directly from
 * RealNetworks.  You may not use this file except in compliance with
 * the RPSL or, if you have a valid RCSL with RealNetworks applicable
 * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
 * the rights, obligations and limitations governing use of the
 * contents of the file.
 * 
 * Alternatively, the contents of this file may be used under the
 * terms of the GNU General Public License Version 2 (the
 * "GPL") in which case the provisions of the GPL are applicable
 * instead of those above. If you wish to allow use of your version of
 * this file only under the terms of the GPL, and not to allow others
 * to use your version of this file under the terms of either the RPSL
 * or RCSL, indicate your decision by deleting the provisions above
 * and replace them with the notice and other provisions required by
 * the GPL. If you do not delete the provisions above, a recipient may
 * use your version of this file under the terms of any one of the
 * RPSL, the RCSL or the GPL.
 * 
 * This file is part of the Helix DNA Technology. RealNetworks is the
 * developer of the Original Code and owns the copyrights in the
 * portions it created.
 * 
 * This file, and the files included with this file, is distributed
 * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
 * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
 * ENJOYMENT OR NON-INFRINGEMENT.
 * 
 * Technology Compatibility Kit Test Suite(s) Location:
 *    http://www.helixcommunity.org/content/tck
 * 
 * Contributor(s):
 * 
 * ***** END LICENSE BLOCK ***** */

#include "hxtypes.h"
#include "hxresult.h"

#include "hxassert.h"
#include "pckunpck.h"
#include "safestring.h"

#include "mpgvidcommon.h"
#include "mpvpayload.h"


const char* const CHXMPEGVideoPayload::zm_szMPEG1MimeType = "video/x-hx-mp1v-es";
const char* const CHXMPEGVideoPayload::zm_szMPEG2MimeType = "video/x-hx-mp2v-es";

CHXMPEGVideoPayload::CHXMPEGVideoPayload(IUnknown* pContext)
    : CHXBasePayload(pContext)
    , m_pVideoSeq(NULL)
{
}

CHXMPEGVideoPayload::~CHXMPEGVideoPayload()
{
    HX_DELETE(m_pVideoSeq);
}

HXBOOL
CHXMPEGVideoPayload::IsStreamHeaderInfoReady(void)
{
    return (m_pVideoSeq != NULL);
}

HXBOOL
CHXMPEGVideoPayload::IsKeyFrame(BYTE* pDataIn, UINT32 ulSize)
{
    // Don't do full start code scan again here.
    // Caller is assumed to be passing something we returned
    // via FindAU. Let's minimize the amount of re-parsing
    // per packet...

    // Mark as a key frame if it starts with a sequence header, 
    // GOP header, or an I-Frame.
    if (ulSize >= 4)
    {
        UINT32 ulStartCode = 0x00000100 | ((UINT32)(pDataIn[3]));
        return (ulStartCode == SEQ_START_CODE || 
                ulStartCode == GROUP_START_CODE ||
                (ulStartCode == PICTURE_START_CODE && ulSize > 5 && 
                (pDataIn[5] & 0x38 == 0x08)));
    }
    return FALSE;
}

BYTE* 
CHXMPEGVideoPayload::FindAU(Byte* pData, UINT32 ulSize)
{
    HX_RESULT rc = HXR_OK;

    BYTE* pBuffer = pData;
    UINT32 ulBuffSize = ulSize;
    UINT32 ulStartCode = NO_START_CODE;

    do
    {
        ulStartCode = GetStartCode(&pBuffer, ulBuffSize);

        if (ulStartCode == PICTURE_START_CODE || 
            ulStartCode == GROUP_START_CODE || 
            ulStartCode == SEQ_START_CODE)
        {
            return pBuffer;
        }
        pBuffer += 4;

    } while (ulStartCode != NO_START_CODE);

    return NULL;
}

HX_RESULT
CHXMPEGVideoPayload::OnPacket(BYTE* pData, UINT32 ulSize)
{
    if (m_pVideoSeq)
    {
        // Once weve got the stream info initialized, we don't
        // need to do anything here
        return HXR_OK;
    }

    // Look for a sequence header
    HX_RESULT rc = HXR_OK;
    BYTE* pBuffer = pData;
    UINT32 ulBuffSize = ulSize;
    UINT32 ulStartCode = NO_START_CODE;

    do
    {
        ulStartCode = GetStartCode(&pBuffer, ulBuffSize);

        if (ulStartCode == SEQ_START_CODE)
        {
            // there it is!
            rc = OnSeqHeader(pBuffer, ulSize);
            break;
        }
        else if (ulStartCode != NO_START_CODE)
        {
            if (ulBuffSize >= 4)
            {
                // move past this start code
                pBuffer += 4;
                ulBuffSize -= 4;
            }
            else
            {
                ulStartCode = NO_START_CODE;
            }
        }

    } while(ulStartCode != NO_START_CODE);

    return rc;
}

HX_RESULT
CHXMPEGVideoPayload::PrepareHeader(IHXValues* pHeader)
{
    HX_RESULT rc = HXR_NO_DATA;

    HX_ASSERT(pHeader);
    if (pHeader && m_pVideoSeq)
    {
        rc = 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)
        {
            // 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);
        }
   }
   return rc;
}

HX_RESULT
CHXMPEGVideoPayload::OnSeqHeader(BYTE *pData, UINT32 ulSize)
{
    HX_RESULT rc = HXR_OUTOFMEMORY;
    m_pVideoSeq = new MPEGVideoSeq;

    if (m_pVideoSeq)
    {
        rc = HXR_OK;
        memset((void*)m_pVideoSeq, 0, sizeof(MPEGVideoSeq));

        // XXX Can a sequence header be split across PES packets?
        // It doesn't appear to be explicitly forbidden, but why would 
        // anyone ever implement it that way?? I'm not going to bother
        // handling it unless it seems necessary
        
        UINT32 ulSeqSize = ParseSequenceHeader(pData, ulSize, m_pVideoSeq);
        if (!ulSeqSize)
        {
            // Bad sequence header
            HX_DELETE(m_pVideoSeq);
            rc = HXR_INVALID_FILE;
        }
    }
    
    return rc;
}

Index: h264payload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/h264payload.cpp,v
retrieving revision 1.1
retrieving revision 1.1.16.1
diff -u -d -r1.1 -r1.1.16.1
--- h264payload.cpp	7 May 2010 22:04:58 -0000	1.1
+++ h264payload.cpp	29 Apr 2011 02:07:52 -0000	1.1.16.1
@@ -162,6 +162,11 @@
     HX_ASSERT(pHeader);
     if (pHeader)
     {
+        SetCStringPropertyCCF(pHeader, "MimeType", HX_TS_AVC1_MIME_TYPE, \
m_pContext); +
+        // ASMRuleBook - basic RTP rule book
+        SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", \
m_pContext); +
         // set OpaqueData header property to SPS/PPS bytestream
         if (m_pPSBuffer)
         {

Index: aacpayload.cpp
===================================================================
RCS file: /cvsroot/datatype/mpeg2ts/demuxer/payload/aacpayload.cpp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.1.4.1
diff -u -d -r1.2.2.1 -r1.2.2.1.4.1
--- aacpayload.cpp	1 Sep 2010 19:26:10 -0000	1.2.2.1
+++ aacpayload.cpp	29 Apr 2011 02:07:52 -0000	1.2.2.1.4.1
@@ -184,6 +184,10 @@
     HX_ASSERT(pHeader);
     if (pHeader)
     {
+        SetCStringPropertyCCF(pHeader, "MimeType", HX_TS_AAC_ADTS_MIME_TYPE, \
m_pContext); +
+        // ASMRuleBook - basic RTP rule book
+        SetCStringPropertyCCF(pHeader, "ASMRuleBook", "Marker=0;Marker=1;", \
m_pContext);  
         pHeader->SetPropertyULONG32("IsAudioStream", 1);
         pHeader->SetPropertyULONG32("Preroll", 3000);


_______________________________________________
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