audstats.cpp
Upload User: zhongxx05
Upload Date: 2007-06-06
Package Size: 33641k
Code Size: 4k
Category:

Symbian

Development Platform:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. /****************************************************************************
  36.  *  Defines
  37.  */
  38. #define MAX_FLOAT_STRING_LENGTH     35
  39. /****************************************************************************
  40.  *  Includes
  41.  */
  42. #include <stdio.h>
  43. #include "rendstats.h"
  44. #include "audstats.h"
  45. #include "hxstrutl.h"
  46. /****************************************************************************
  47.  *  CAudioStatistics
  48.  */
  49. /****************************************************************************
  50.  *  Costructor/Destructor
  51.  */
  52. CAudioStatistics::CAudioStatistics(IUnknown* pContext)
  53.     : m_pRegistry(NULL)
  54.     , m_pDisplay(NULL)
  55. {
  56.     pContext->QueryInterface(IID_IHXRegistry, (void**)&m_pRegistry);
  57.     m_pDisplay = new CRendererStatisticsDisplay(m_pRegistry, 
  58. (UINT32) AS_NUM_ENTRIES);
  59.     HX_ASSERT(m_pDisplay);
  60.     PrimeEntries();
  61. }
  62. CAudioStatistics::~CAudioStatistics()
  63. {
  64.     HX_DELETE(m_pDisplay);
  65.     HX_RELEASE(m_pRegistry);
  66. }
  67. /****************************************************************************
  68.  *  PrimeEntries
  69.  */
  70. HX_RESULT CAudioStatistics::PrimeEntries(void)
  71. {
  72.     HX_RESULT retVal = HXR_FAIL;
  73.     if (m_pDisplay)
  74.     {
  75. m_pDisplay->PrimeEntry((UINT32) AS_REND_NAME, "Name", REG_TYPE_STRING);
  76. m_pDisplay->PrimeEntry((UINT32) AS_CODEC_NAME, "CodecName", REG_TYPE_STRING);
  77. m_pDisplay->PrimeEntry((UINT32) AS_CODEC_4CC, "CodecFourCC", REG_TYPE_STRING);
  78. m_pDisplay->PrimeEntry((UINT32) AS_CODEC_VERSION, "CodecVersion", REG_TYPE_NUMBER);
  79. m_pDisplay->PrimeEntry((UINT32) AS_SURESTREAM, "SureStream", REG_TYPE_STRING);
  80. m_pDisplay->PrimeEntry((UINT32) AS_CODECS, "CodecsSuite", REG_TYPE_STRING);
  81. m_pDisplay->PrimeEntry((UINT32) AS_CHANNELS, "Channels", REG_TYPE_NUMBER);
  82. m_pDisplay->PrimeEntry((UINT32) AS_SAMPLING_RATE, "SamplesPerSec", REG_TYPE_NUMBER);
  83. m_pDisplay->PrimeEntry((UINT32) AS_SAMPLE_SIZE, "BitsPerSample", REG_TYPE_NUMBER);
  84. m_pDisplay->PrimeEntry((UINT32) AS_SURROUND, "Surround", REG_TYPE_STRING);
  85. retVal = HXR_OK;
  86.     }
  87.     return retVal;
  88. }
  89. /****************************************************************************
  90.  *  UpdateStatistics
  91.  */
  92. HX_RESULT CAudioStatistics::DisplayStats(UINT32 ulRegistryID)
  93. {
  94.     HX_RESULT retVal = HXR_FAIL;
  95.     if (m_pDisplay && (ulRegistryID != 0))
  96.     {
  97. retVal = HXR_OK;
  98.     }
  99.     // Refresh Display
  100.     if (SUCCEEDED(retVal))
  101.     {
  102. m_pDisplay->RefreshEntries(ulRegistryID);
  103.     }
  104.     return HXR_OK;
  105. }