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

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] mp4/payload pcmpyld.cpp,NONE,1.1.2.1
From:       gbajaj () helixcommunity ! org
Date:       2008-06-25 11:14:50
Message-ID: 200806251115.m5PBFsaT001728 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/mp4/payload
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv29254

Added Files:
      Tag: hxclient_2_0_4_cayenne
	pcmpyld.cpp 
Log Message:
Changes to support playback of pcm.mov files


--- NEW FILE: pcmpyld.cpp ---
/* ***** BEGIN LICENSE BLOCK *****
 * Source last modified: $Id: pcmpyld.cpp,v 1.1.2.1 2008/06/25 11:14:47 gbajaj 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 "pckunpck.h"
#include "concatpyld.h"
#include "pcmpyld.h"

const UINT32 MinPacketDuration = 200;

extern void SwapWordBytes(UINT16*data, int numInts);

HXConcatenatePCMPayloadFormat::HXConcatenatePCMPayloadFormat() 
{}

HXConcatenatePCMPayloadFormat::~HXConcatenatePCMPayloadFormat()
{
    Close();
}

HX_RESULT 
HXConcatenatePCMPayloadFormat::CreateInstance(REF(IHXPayloadFormatObject*) pPyld)
{
    HX_RESULT res = HXR_OUTOFMEMORY;

    pPyld = new HXConcatenatePCMPayloadFormat();

    if (pPyld)
    {
        pPyld->AddRef();
        res = HXR_OK;
    }

    return res;
}

STDMETHODIMP HXConcatenatePCMPayloadFormat::Close(THIS)
{
    HXConcatenatePayloadFormat::Close();
    HX_RELEASE(m_pHeader);

    return HXR_OK;
}

STDMETHODIMP HXConcatenatePCMPayloadFormat::SetStreamHeader(THIS_
                                                         IHXValues* pHeader)
{
    HX_RESULT res = HXR_FAILED;
    
    HX_RELEASE(m_pHeader);

    if (pHeader)
    {   
        m_pHeader = pHeader;
        m_pHeader->AddRef();

        // Get the opaque data
        IHXBuffer* pBuffer = NULL;
        res  = pHeader->GetPropertyBuffer("OpaqueData", pBuffer);
        if (SUCCEEDED(res ))
        {
            if (pBuffer->GetSize() == WAVOPAQUEHEADER::static_size())
            {
                m_OpaqueDataWavHeader.unpack(pBuffer->GetBuffer(), pBuffer->GetSize());
                res  = HXR_OK;
                const char* pMime = NULL;		
                UINT32 ulSwap16 = 0;

                if (m_OpaqueDataWavHeader.usBitsPerSample == 16)
                {
                    pMime = "audio/L16";
                }
                else
                {
                    pMime = "audio/L8";
                }
				
                if (m_OpaqueDataWavHeader.usDataFormat == WAV_FOURCC('t', 'w', 'o', 's') &&
			m_OpaqueDataWavHeader.usBitsPerSample == 16)		
                {
			ulSwap16 = 1;		
                }
                pHeader->SetPropertyULONG32("SwapL16", ulSwap16);		
                SetCStringPropertyCCF(pHeader, "MimeType", pMime, m_pCCF);
                pHeader->SetPropertyULONG32("Channels", m_OpaqueDataWavHeader.usChannels);
                pHeader->SetPropertyULONG32("SamplesPerSec", m_OpaqueDataWavHeader.ulSamplesPerSec);
                pHeader->SetPropertyULONG32("BitsPerSample", m_OpaqueDataWavHeader.usBitsPerSample);
				
            }
            HX_RELEASE(pBuffer);
        }

        res = HXR_OK;
    }

    return res;
}

STDMETHODIMP HXConcatenatePCMPayloadFormat::GetStreamHeader(THIS_
                                                       REF(IHXValues*) pHeader)
{
    HRESULT res = HXConcatenatePayloadFormat::GetStreamHeader(pHeader);
	
    if (res == HXR_OK)
    {
        pHeader->AddRef();
    }
	
    return res;	
}



_______________________________________________
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