mp4vdfmt.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:17k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0 and Exhibits. 
  3.  * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM 
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. 
  5.  * All Rights Reserved. 
  6.  * 
  7.  * The contents of this file, and the files included with this file, are 
  8.  * subject to the current version of the RealNetworks Community Source 
  9.  * License Version 1.0 (the "RCSL"), including Attachments A though H, 
  10.  * all available at http://www.helixcommunity.org/content/rcsl. 
  11.  * You may also obtain the license terms directly from RealNetworks. 
  12.  * You may not use this file except in compliance with the RCSL and 
  13.  * its Attachments. There are no redistribution rights for the source 
  14.  * code of this file. Please see the applicable RCSL for the rights, 
  15.  * obligations and limitations governing use of the contents of the file. 
  16.  * 
  17.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  18.  * developer of the Original Code and owns the copyrights in the portions 
  19.  * it created. 
  20.  * 
  21.  * This file, and the files included with this file, is distributed and made 
  22.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  23.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  24.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  25.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  26.  * 
  27.  * Technology Compatibility Kit Test Suite(s) Location: 
  28.  * https://rarvcode-tck.helixcommunity.org 
  29.  * 
  30.  * Contributor(s): 
  31.  * 
  32.  * ***** END LICENSE BLOCK ***** */ 
  33. /****************************************************************************
  34.  *  Defines
  35.  */
  36. #define _IGNORE_UNSUPPORTED
  37. #define NON_KEYFRM_DCDE_FALLBEHIND_THRSHLD  33 // in milliseconds
  38. #if defined(HELIX_FEATURE_MIN_HEAP)
  39. #define MP4V_DEFAULT_PREROLL     2000 // in milliseconds
  40. #else
  41. #define MP4V_DEFAULT_PREROLL     3500 // in milliseconds
  42. #endif
  43. #define MAX_NONKEY_CODED_FRAME_FALLBEHIND -800
  44. /****************************************************************************
  45.  *  Includes
  46.  */
  47. #include "mp4vdfmt.h"
  48. #include "hxasm.h"
  49. #include "hxwin.h"
  50. #include "hxvsurf.h"
  51. #include "hxvctrl.h"
  52. #include "hxsite2.h"
  53. #include "hxthread.h"
  54. #include "hxtick.h"
  55. #include "hxassert.h"
  56. #include "hxstrutl.h"
  57. #include "unkimp.h"
  58. #include "timeval.h"
  59. #include "cttime.h"
  60. #include "hxcodec.h"
  61. #include "mp4video.h"
  62. /****************************************************************************
  63.  *  Locals
  64.  */
  65. /****************************************************************************
  66.  *  Method:
  67.  *    CMP4VideoFormat::CQTVideoFormat
  68.  *
  69.  */
  70. CMP4VideoFormat::CMP4VideoFormat(IHXCommonClassFactory* pCommonClassFactory,
  71.  CMP4VideoRenderer* pMP4VideoRenderer,
  72.  BOOL bSecure)
  73.     : CVideoFormat(pCommonClassFactory, pMP4VideoRenderer)
  74.     , m_pMP4VideoRenderer(pMP4VideoRenderer)
  75.     , m_pRssm(NULL)
  76.     , m_pDecoder(NULL)
  77.     , m_pInputAllocator(NULL)
  78.     , m_ulMaxDecodedFrames(0)
  79. {
  80.     HX_ASSERT(m_pCommonClassFactory);
  81.     HX_ASSERT(pMP4VideoRenderer);
  82.     m_DecodedPacket.dataLength = 0;
  83.     m_DecodedPacket.data = NULL;
  84.     m_DecoderDims.cx = 0;
  85.     m_DecoderDims.cy = 0;
  86.     m_pMP4VideoRenderer->AddRef();
  87. }
  88. /****************************************************************************
  89.  *  Method:
  90.  *    CMP4VideoFormat::~CQTVideoFormat
  91.  *
  92.  */
  93. CMP4VideoFormat::~CMP4VideoFormat()
  94. {
  95.     CVideoFormat::Reset();
  96.     HX_RELEASE(m_pMP4VideoRenderer);
  97.     if (m_pRssm)
  98.     {
  99. m_pRssm->Close();
  100. m_pRssm->Release();
  101. m_pRssm = NULL;
  102.     }
  103.     HX_DELETE(m_pDecoder);
  104.     _Reset();
  105.     HX_DELETE(m_pInputAllocator);
  106. }
  107. /****************************************************************************
  108.  *  Method:
  109.  *    CMP4VideoFormat::Init
  110.  */
  111. HX_RESULT CMP4VideoFormat::Init(IHXValues* pHeader)
  112. {
  113.     HX_RESULT retVal = CVideoFormat::Init(pHeader);
  114.     // Create memory allocators
  115.     if (SUCCEEDED(retVal))
  116.     {
  117. retVal = CreateAllocators();
  118.     }
  119.     // Create Packet Assembler
  120.     if (SUCCEEDED(retVal))
  121.     {
  122. retVal = HXR_OUTOFMEMORY;
  123. m_pRssm = new MP4VPayloadFormat(m_pInputAllocator);
  124. if (m_pRssm)
  125. {
  126.     m_pRssm->AddRef();
  127.     retVal = HXR_OK;
  128. }
  129.     }
  130.     
  131.     // Create Decoder
  132.     if (SUCCEEDED(retVal))
  133.     {
  134. retVal = HXR_OUTOFMEMORY;
  135.     m_pDecoder = CreateDecoder();
  136. if (m_pDecoder)
  137. {
  138.     retVal = HXR_OK;
  139. }
  140.     }
  141.     // Initialize Assembler
  142.     if (SUCCEEDED(retVal) && m_pRssm)
  143.     {
  144. retVal = m_pRssm->Init(m_pCommonClassFactory, FALSE);
  145.     }
  146.     
  147.     if (SUCCEEDED(retVal) && m_pRssm)
  148.     {
  149. retVal = m_pRssm->SetStreamHeader(pHeader);
  150. if (retVal == HXR_NO_DATA)
  151. {
  152.     retVal = HXR_OK;
  153. }
  154. #ifdef _IGNORE_UNSUPPORTED
  155. if (FAILED(retVal))
  156. {
  157.     HXxSize nullViewFrame = {1, 1};
  158.     m_pMP4VideoRenderer->ResizeViewFrame(nullViewFrame);
  159.     HX_RELEASE(m_pRssm);
  160.     retVal = HXR_OK;
  161. }
  162. #endif // _IGNORE_UNSUPPORTED
  163.     }
  164.     // Initialize Decoder
  165.     if (SUCCEEDED(retVal) && m_pRssm)
  166.     {
  167. retVal = m_pDecoder->Init(m_pMP4VideoRenderer->GetContext(),
  168.   this,
  169.   NULL,
  170.   m_pInputAllocator,
  171.   m_pMP4VideoRenderer->m_pOutputAllocator);
  172. #ifdef _IGNORE_UNSUPPORTED
  173. if (FAILED(retVal))
  174. {
  175.     HXxSize nullViewFrame = {1, 1};
  176.     m_pMP4VideoRenderer->ResizeViewFrame(nullViewFrame);
  177.     HX_RELEASE(m_pRssm);
  178.     retVal = HXR_OK;
  179. }
  180. #endif // _IGNORE_UNSUPPORTED
  181.     }
  182.     m_DecoderDims.cx = 0;
  183.     m_DecoderDims.cy = 0;
  184.     m_ulMaxDecodedFrames = GetMaxDecodedFrames();
  185.     return retVal;
  186. }
  187. /****************************************************************************
  188.  *  Method:
  189.  *    CVideoFormat::GetDefaultPreroll
  190.  *
  191.  */
  192. ULONG32 CMP4VideoFormat::GetDefaultPreroll(IHXValues* pValues)
  193. {
  194.     return MP4V_DEFAULT_PREROLL;
  195. }
  196. /****************************************************************************
  197.  *  Method:
  198.  *    CQTVideoFormat::GetBitstreamHeaderSize
  199.  */
  200. ULONG32 CMP4VideoFormat::GetBitstreamHeaderSize(void)
  201. {
  202.     ULONG32 ulSize = 0;
  203.     if (m_pRssm)
  204.     {
  205. ulSize = m_pRssm->GetBitstreamHeaderSize();
  206.     }
  207.     return ulSize;
  208. }
  209. /****************************************************************************
  210.  *  Method:
  211.  *    CQTVideoFormat::GetBitstreamHeader
  212.  */
  213. const UINT8* CMP4VideoFormat::GetBitstreamHeader(void)
  214. {
  215.     const UINT8* pHeader = NULL;
  216.     if (m_pRssm)
  217.     {
  218. pHeader = m_pRssm->GetBitstreamHeader();
  219.     }
  220.     return pHeader;
  221. }
  222. /****************************************************************************
  223.  *  Method:
  224.  *    CQTVideoFormat::CreateAssembledPacket
  225.  */
  226. CMediaPacket* CMP4VideoFormat::CreateAssembledPacket(IHXPacket* pCodecData)
  227. {
  228.     ULONG32* pCodecPacketRaw = NULL;
  229.     HXCODEC_DATA* pCodecPacket;
  230.     CMediaPacket* pFramePacket = NULL;
  231.     IHXPacket* pPacket = NULL;
  232. #ifdef _IGNORE_UNSUPPORTED
  233.     if (!m_pRssm)
  234.     {
  235. return NULL;
  236.     }
  237. #endif // _IGNORE_UNSUPPORTED
  238.     m_pMP4VideoRenderer->BltIfNeeded();
  239.     m_LastError = m_pRssm->SetPacket(pCodecData);
  240.     if( m_LastError == HXR_OUTOFMEMORY )
  241.     {
  242.         return NULL;
  243.     }
  244.     m_pRssm->CreateHXCodecPacket(pCodecPacketRaw);
  245.     pCodecPacket = (HXCODEC_DATA*) pCodecPacketRaw;
  246.     
  247.     if (pCodecPacket)
  248.     {
  249. pFramePacket = new CMediaPacket(
  250. pCodecPacket,
  251. (UINT8*) pCodecPacket, 
  252. pCodecPacket->dataLength,
  253. pCodecPacket->dataLength,
  254. pCodecPacket->timestamp,
  255. pCodecPacket->flags, //0,
  256. NULL);
  257. if (pFramePacket == NULL)
  258. {
  259.     HX_ASSERT(HXR_OUTOFMEMORY == HXR_OK);
  260.     KillInputBuffer(pCodecPacket, this);
  261.             m_LastError == HXR_OUTOFMEMORY;
  262.             return NULL;
  263. }
  264. else
  265. {
  266.     pFramePacket->SetBufferKiller(KillInputBuffer);
  267.     pFramePacket->m_pUserData = this;
  268. }
  269. m_pMP4VideoRenderer->BltIfNeeded();
  270.     }
  271.     
  272.     return pFramePacket;
  273. }
  274. /****************************************************************************
  275.  *  Method:
  276.  *    CMP4VideoFormat::Reset
  277.  */
  278. void CMP4VideoFormat::Reset()
  279. {
  280.     _Reset();
  281.     CVideoFormat::Reset();
  282. }
  283. void CMP4VideoFormat::_Reset(void)
  284. {
  285.     ReleaseDecodedPacket(&m_DecodedPacket);
  286.     if (m_pRssm)
  287.     {
  288. m_pRssm->Reset();
  289. m_pRssm->SetTimeAnchor(GetStartTime());
  290.     }
  291.     m_DecoderDims.cx = 0;
  292.     m_DecoderDims.cy = 0;
  293. }
  294. void CMP4VideoFormat::ReleaseDecodedPacket(HXCODEC_DATA* pDecodedPacket)
  295. {
  296.     HX_ASSERT(pDecodedPacket);
  297.     if (pDecodedPacket->data && 
  298. m_pMP4VideoRenderer && 
  299. m_pMP4VideoRenderer->m_pOutputAllocator)
  300.     {
  301. m_pMP4VideoRenderer->m_pOutputAllocator->ReleasePacketPtr(pDecodedPacket->data);
  302. pDecodedPacket->data = NULL;
  303. pDecodedPacket->dataLength = NULL;
  304.     }
  305. }
  306. /****************************************************************************
  307.  *  Method:
  308.  *    CMP4VideoFormat::CreateDecodedPacket
  309.  *
  310.  */
  311. CMediaPacket* CMP4VideoFormat::CreateDecodedPacket(CMediaPacket* pFrameToDecode)
  312. {
  313.     HXCODEC_DATA oldDecodedPacket;
  314.     HXCODEC_DATA* pDecodedPacket = NULL;
  315.     CMediaPacket* pDecodedFrame = NULL;
  316.     UINT8* pData = NULL;
  317.  
  318.     HX_ASSERT(pFrameToDecode);
  319. #if defined(HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES)
  320. // discard late frames before they are decoded
  321.     if (m_pMP4VideoRenderer->IsActive())
  322.     {
  323. LONG32 lTimeAhead;
  324. lTimeAhead = m_pMP4VideoRenderer->ComputeTimeAhead(
  325. pFrameToDecode->m_ulTime, 
  326. 0);
  327. if (lTimeAhead < MAX_NONKEY_CODED_FRAME_FALLBEHIND)
  328. {
  329.     // Throw away this frame
  330.     pFrameToDecode->Clear();
  331.     delete pFrameToDecode;
  332.     pFrameToDecode = NULL;
  333. #if defined(HELIX_FEATURE_STATS)
  334.     m_pMP4VideoRenderer->ReportDroppedFrame();
  335. #endif /* #if defined(HELIX_FEATURE_STATS) */
  336. }
  337.     }
  338. #endif // HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES
  339.     if (m_DecodedPacket.data)
  340.     {
  341. oldDecodedPacket = m_DecodedPacket;
  342. m_DecodedPacket.data = NULL;
  343. m_DecodedPacket.dataLength = 0;
  344. pDecodedPacket = &oldDecodedPacket;
  345.     }
  346.     m_pMP4VideoRenderer->BltIfNeeded();
  347.     if (pFrameToDecode)
  348.         ProcessAssembledFrame(pFrameToDecode);
  349.     if (pFrameToDecode && 
  350. m_pDecoder->Decode(pFrameToDecode, MAX_DECODE_QUALITY) == HXR_OK)
  351.     {
  352. if ((pDecodedPacket == NULL) && (m_DecodedPacket.data))
  353. {
  354.     pDecodedPacket = &m_DecodedPacket;
  355. }
  356. #if !defined(HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES)
  357. if (pDecodedPacket)
  358. {
  359.     if (m_pMP4VideoRenderer->ComputeTimeAhead(
  360.     pDecodedPacket->timestamp, 
  361.     0) 
  362. < NON_KEYFRM_DCDE_FALLBEHIND_THRSHLD)
  363.     {
  364. ReleaseDecodedPacket(pDecodedPacket);
  365. pDecodedPacket = NULL;
  366.     }
  367. }
  368. #endif // HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES
  369. if (pDecodedPacket)
  370. {
  371.     CMediaPacket* pVideoPacket = NULL;
  372.     HXxSize* pSampleDesc = NULL;
  373.     // Obtain frame dimensions if not set
  374.     if (m_DecoderDims.cx == 0) 
  375.     {
  376. HX_FORMAT_IMAGE imageInfo;
  377. if (m_pDecoder->GetImageInfo(imageInfo) == HXR_OK)
  378. {
  379.     pSampleDesc = new HXxSize;
  380.     if (pSampleDesc)
  381.     {
  382. pSampleDesc->cx = m_DecoderDims.cx = imageInfo.uiWidth;
  383. pSampleDesc->cy = m_DecoderDims.cy = imageInfo.uiHeight;
  384. m_pMP4VideoRenderer->ResizeViewFrame(m_DecoderDims);
  385.     }
  386. }
  387.     }
  388.     // Form decoded media packets if dimensions set
  389.     if (m_DecoderDims.cx != 0)
  390.     {
  391. pVideoPacket = (CMediaPacket*) m_pFramePool->Get(0);
  392. if (pVideoPacket == NULL)
  393. {
  394.     pVideoPacket = pFrameToDecode;
  395.     pFrameToDecode = NULL;
  396. }
  397. if (pVideoPacket)
  398. {
  399.     pVideoPacket->SetBuffer(pDecodedPacket->data,
  400.     pDecodedPacket->data,
  401.     pDecodedPacket->dataLength,
  402.     pDecodedPacket->dataLength,
  403.     FALSE);
  404.     pVideoPacket->Init(pDecodedPacket->data,
  405.        pDecodedPacket->dataLength,
  406.        pDecodedPacket->timestamp,
  407.        pDecodedPacket->flags,
  408.        pSampleDesc);
  409.     pVideoPacket->SetSampleDescKiller(KillMP4VSampleDesc);
  410.     pVideoPacket->SetBufferKiller(KillOutputBuffer);
  411.     pVideoPacket->m_pUserData = m_pMP4VideoRenderer;
  412.     pDecodedPacket->data = NULL;
  413.     pDecodedPacket->dataLength = 0;
  414.     pDecodedPacket = NULL;
  415.     pSampleDesc = NULL;
  416.     pDecodedFrame = pVideoPacket;
  417.     pVideoPacket = NULL;
  418. }
  419.     }
  420.     if (pVideoPacket)
  421.     {
  422. delete pVideoPacket;
  423.     }
  424.     if (pSampleDesc)
  425.     {
  426. delete pSampleDesc;
  427.     }
  428. }
  429.     }
  430.     if (pFrameToDecode != NULL)
  431.     {
  432. pFrameToDecode->Clear();
  433. delete pFrameToDecode;
  434.     }
  435.     if (pDecodedPacket)
  436.     {
  437. ReleaseDecodedPacket(pDecodedPacket);
  438.     }
  439.     return pDecodedFrame;
  440. }
  441. CMP4VDecoder* CMP4VideoFormat::CreateDecoder()
  442. {
  443.     return new CMP4VDecoder();
  444. }
  445. /****************************************************************************
  446.  *  Method:
  447.  *    CMP4VideoFormat::DecodeDone
  448.  */
  449. HX_RESULT CMP4VideoFormat::DecodeDone(HXCODEC_DATA* pData)
  450. {
  451.     HX_RESULT retVal = HXR_OK;
  452.     m_pMP4VideoRenderer->BltIfNeeded();
  453.     if (pData)
  454.     {
  455. HX_ASSERT(m_DecodedPacket.data == NULL);
  456. retVal = HXR_UNEXPECTED;
  457. if (m_DecodedPacket.data == NULL)
  458. {
  459.     m_DecodedPacket = *pData;
  460.     retVal = HXR_OK;
  461. }
  462.     }
  463.     return retVal;
  464. }
  465. /****************************************************************************
  466.  *  Method:
  467.  *    CMP4VideoFormat::IsBitmapFormatChanged
  468.  *
  469.  */
  470. BOOL CMP4VideoFormat::IsBitmapFormatChanged(
  471.     HXBitmapInfoHeader &BitmapInfoHeader,
  472.     CMediaPacket* pVideoPacket)
  473. {
  474.     if (pVideoPacket->m_pSampleDesc != NULL)
  475.     {
  476. HXxSize* pDims = (HXxSize*) pVideoPacket->m_pSampleDesc;
  477. if ((BitmapInfoHeader.biWidth != pDims->cx) ||
  478.     (BitmapInfoHeader.biHeight != pDims->cy))
  479. {
  480.     return TRUE;
  481. }
  482.     }
  483.     return FALSE;
  484. }
  485. /****************************************************************************
  486.  *  Method:
  487.  *    CMP4VideoFormat::InitBitmapInfoHeader
  488.  */
  489. HX_RESULT CMP4VideoFormat::InitBitmapInfoHeader(
  490.     HXBitmapInfoHeader &bitmapInfoHeader,
  491.     CMediaPacket* pVideoPacket)
  492. {
  493.     HXxSize* pDims = (HXxSize*) pVideoPacket->m_pSampleDesc;
  494.     if (pDims)
  495.     {
  496. bitmapInfoHeader.biWidth = pDims->cx;
  497. bitmapInfoHeader.biHeight = pDims->cy;
  498. bitmapInfoHeader.biSizeImage = bitmapInfoHeader.biWidth * 
  499.        bitmapInfoHeader.biHeight * 
  500.        bitmapInfoHeader.biBitCount / 
  501.        8;
  502.     }
  503.     return HXR_OK;
  504. }
  505. /****************************************************************************
  506.  *  Method:
  507.  *    CMP4VideoFormat::CreateAllocators()
  508.  */
  509. HX_RESULT CMP4VideoFormat::CreateAllocators(void)
  510. {
  511.     HX_RESULT retVal = HXR_OK;
  512.     HX20ALLOCPROPS allocRequest, allocActual;
  513.     HX_RELEASE(m_pInputAllocator);
  514.     HX_DELETE(m_pMP4VideoRenderer->m_pOutputAllocator);
  515.     
  516.     // setup the input allocator for the codec
  517.     if (retVal == HXR_OK)
  518.     {
  519. m_pInputAllocator = new CHXBufferMemoryAllocator(TRUE);
  520. retVal = HXR_OUTOFMEMORY;
  521. if (m_pInputAllocator)
  522. {
  523.     m_pInputAllocator->AddRef();
  524.     m_pInputAllocator->GetProperties(&allocRequest);
  525.     allocRequest.nNumBuffers = 0;   // No retention
  526.     m_pInputAllocator->SetProperties(&allocRequest, 
  527.      &allocActual);
  528.     retVal = HXR_OK;
  529. }
  530.     }
  531.     // setup the output allocator for the codec
  532.     if (retVal == HXR_OK)
  533.     {
  534. m_pMP4VideoRenderer->m_pOutputAllocator = new CHXMemoryAllocator(TRUE);
  535. retVal = HXR_OUTOFMEMORY;
  536. if (m_pMP4VideoRenderer->m_pOutputAllocator)
  537. {
  538.     m_pMP4VideoRenderer->m_pOutputAllocator->AddRef();
  539.     m_pMP4VideoRenderer->m_pOutputAllocator->GetProperties(&allocRequest);
  540.     allocRequest.nNumBuffers = GetMaxDecodedFrames() * 2;
  541.     m_pMP4VideoRenderer->m_pOutputAllocator->SetProperties(&allocRequest, 
  542. &allocActual);
  543.     retVal = HXR_OK;
  544. }
  545.     }
  546. #if _MACINTOSH
  547.     // TODO: we want to pre-allocate the output buffers here so they come
  548.     // from the standard memory pools instead of the interrupt memory
  549.     // pools.
  550. #endif // _MACINTOSH
  551.     return retVal;
  552. }
  553. /****************************************************************************
  554.  *  Method:
  555.  *    CMP4VideoFormat::KillMP4VSampleDesc
  556.  *
  557.  */
  558. void CMP4VideoFormat::KillMP4VSampleDesc(void* pSampleDesc, void* pUserData)
  559. {
  560.     if (pSampleDesc)
  561.     {
  562. HXxSize* pFrameDims = (HXxSize*) pSampleDesc;
  563. delete pFrameDims;
  564.     }
  565. }
  566. /****************************************************************************
  567.  *  Method:
  568.  *    CMP4VideoFormat::KillInputBuffer
  569.  *
  570.  */
  571. void CMP4VideoFormat::KillInputBuffer(void* pBuffer, void* pUserData)
  572. {
  573.     if (pBuffer)
  574.     {
  575. HXCODEC_DATA* pDeadData = (HXCODEC_DATA*) pBuffer;
  576. CMP4VideoFormat* pVidFmt = (CMP4VideoFormat*) pUserData;
  577. HX_ASSERT(pUserData);
  578. if (pDeadData->data)
  579. {
  580.     pVidFmt->m_pInputAllocator->ReleasePacketPtr(pDeadData->data);
  581. }
  582. delete[] ((ULONG32*) pDeadData);
  583.     }
  584. }
  585. /****************************************************************************
  586.  *  Method:
  587.  *    CMP4VideoFormat::KillOutputBuffer
  588.  *
  589.  */
  590. void CMP4VideoFormat::KillOutputBuffer(void* pBuffer, void* pUserData)
  591. {
  592.     if (pBuffer)
  593.     {
  594. CMP4VideoRenderer* pVidRnd = (CMP4VideoRenderer*) pUserData;
  595. HX_ASSERT(pUserData);
  596. pVidRnd->m_pOutputAllocator->ReleasePacketPtr((UINT8*) pBuffer);
  597.     }
  598. }