qtpacketizerfct.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 174 行

CPP
174
字号
/* ***** BEGIN LICENSE BLOCK ***** 
 * Version: RCSL 1.0/RPSL 1.0 
 *  
 * Portions Copyright (c) 1995-2002 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 
 * Version 1.0 (the "RPSL") available at 
 * http://www.helixcommunity.org/content/rpsl unless you have licensed 
 * the file under the RealNetworks Community Source License Version 1.0 
 * (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.  
 *  
 * 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 ***** */ 

/****************************************************************************
 *  Defines
 */

/****************************************************************************
 *  Includes
 */
#include "qtpacketizerfct.h"
#include "qttrkmgr.h"
#include "qtatmmgs.h"

#include "mp4vpyld.h"
#include "mp4apyld.h"
#include "rule2flg.h" // /For RuleToFlagMap (ASM-rule-to-flag map)
#include "mp4tpyld.h"
#include "concatpyld.h"


/****************************************************************************
 *  Class CQTPacketizerFactory
 */
/****************************************************************************
 *  Constructor/Destructor
 */
CQTPacketizerFactory::CQTPacketizerFactory()
{
    ;
}

CQTPacketizerFactory::~CQTPacketizerFactory()
{
    ;
}

/****************************************************************************
 *  Main Interface
 */
/****************************************************************************
 *  Construct
 */
HX_RESULT CQTPacketizerFactory::Construct(IHXPayloadFormatObject* &pPacketizer,
					  const char* pProtocol,
					  CQT_TrackInfo_Manager* pTrackInfo,
					  CQT_MovieInfo_Manager* pMovieInfo,
					  CQTTrackManager* pTrackManager,
					  CQTTrack* pTrack,
					  IUnknown* pContext)
{
    HX_RESULT retVal = HXR_OK;

    switch (pTrackManager->GetFType())
    {
    case QT_FTYPE_QT:
	break;
    case QT_FTYPE_MP4:
	switch (pTrackInfo->GetTrackType())
	{
	case QT_vide:
#ifdef QTCONFIG_VIDEO_PACKETIZER
	    if (pProtocol == NULL)
	    {
		MP4VPayloadFormat* pMP4VPacketizer = new MP4VPayloadFormat;
		
		retVal = HXR_OUTOFMEMORY;
		if (pMP4VPacketizer)
		{
		    pMP4VPacketizer->AddRef();
		    pPacketizer = (IHXPayloadFormatObject*) pMP4VPacketizer;
		    retVal = HXR_OK;
		}
	    }   
#else	// QTCONFIG_VIDEO_PACKETIZER
	    retVal = HXR_NO_DATA;
#endif	// QTCONFIG_VIDEO_PACKETIZER
	    break;
	case QT_soun:
#ifdef QTCONFIG_AUDIO_PACKETIZER
	    if (pProtocol == NULL)
	    {
		MP4APayloadFormat* pMP4APacketizer = new MP4APayloadFormat;
		
		retVal = HXR_OUTOFMEMORY;
		if (pMP4APacketizer)
		{
		    pMP4APacketizer->AddRef();
		    pPacketizer = (IHXPayloadFormatObject*) pMP4APacketizer;
		    retVal = HXR_OK;
		}
	    }   
#endif	// QTCONFIG_AUDIO_PACKETIZER

	    if ((HXR_OK == retVal) && !pPacketizer)
	    {
		const char* pMimeType = pTrackInfo->GetMimeType();
		if (pMimeType &&
		    (!strcasecmp(pMimeType, "audio/X-RN-3GPP-AMR") ||
		     !strcasecmp(pMimeType, "audio/X-RN-3GPP-AMR-WB")))
		{
		    retVal = 
			HXConcatenatePayloadFormat::CreateInstance(pPacketizer);
		}
		else
		{
		    retVal = HXR_NO_DATA;
		}
	    }

	    break;
#ifdef QTCONFIG_TIMEDTEXT_PACKETIZER
	case QT_text:
	    if (pProtocol == NULL)
	    {
		MP4TPayloadFormat* pMP4TPacketizer = new MP4TPayloadFormat(
			pTrack, pTrackInfo);
		
		retVal = HXR_OUTOFMEMORY;
		if (pMP4TPacketizer)
		{
		    pMP4TPacketizer->AddRef();
		    pPacketizer = (IHXPayloadFormatObject*) pMP4TPacketizer;
		    retVal = HXR_OK;
		}
	    }
	    break;
#endif	// QTCONFIG_TIMEDTEXT_PACKETIZER
	}
	break;
	
	case QT_FTYPE_EMC:
	    retVal = HXR_NOTIMPL;
	    break;
	default:
	    retVal = HXR_FAIL;
	    break;
    }

    return retVal;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?