home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / vidprop.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  3.6 KB  |  119 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11.  
  12. #include <streams.h>
  13. #include <sampvid.h>
  14. #include <vidprop.h>
  15.  
  16.  
  17. // This class implements a property page dialog for the video renderer. We
  18. // expose certain statistics from the quality management implementation. In
  19. // particular we have two edit fields that show the number of frames we have
  20. // actually drawn and the number of frames that we dropped. The number of
  21. // frames we dropped does NOT represent the total number dropped in any play
  22. // back sequence (as expressed through MCI status frames skipped) since the
  23. // quality management protocol may have negotiated with the source filter for
  24. // it to send fewer frames in the first place. Dropping frames in the source
  25. // filter is nearly always a more efficient mechanism when we are flooded
  26.  
  27.  
  28. // Constructor
  29.  
  30. CQualityProperties::CQualityProperties(LPUNKNOWN pUnk,HRESULT *phr) :
  31.     CBasePropertyPage(NAME("Quality Page"),pUnk,phr,IDD_QUALITY,IDS_NAME),
  32.     m_pQualProp(NULL)
  33. {
  34.     ASSERT(phr);
  35. }
  36.  
  37.  
  38. // Create a quality properties object
  39.  
  40. CUnknown *CQualityProperties::CreateInstance(LPUNKNOWN lpUnk, HRESULT *phr)
  41. {
  42.     return new CQualityProperties(lpUnk, phr);
  43. }
  44.  
  45.  
  46. // Give us the filter to communicate with
  47.  
  48. HRESULT CQualityProperties::OnConnect(IUnknown *pUnknown)
  49. {
  50.     ASSERT(m_pQualProp == NULL);
  51.  
  52.     // Ask the renderer for it's IQualProp interface
  53.  
  54.     HRESULT hr = pUnknown->QueryInterface(IID_IQualProp,(void **)&m_pQualProp);
  55.     if (FAILED(hr)) {
  56.         return E_NOINTERFACE;
  57.     }
  58.  
  59.     ASSERT(m_pQualProp);
  60.  
  61.     // Get quality data for our page
  62.  
  63.     m_pQualProp->get_FramesDroppedInRenderer(&m_iDropped);
  64.     m_pQualProp->get_FramesDrawn(&m_iDrawn);
  65.     m_pQualProp->get_AvgFrameRate(&m_iFrameRate);
  66.     m_pQualProp->get_Jitter(&m_iFrameJitter);
  67.     m_pQualProp->get_AvgSyncOffset(&m_iSyncAvg);
  68.     m_pQualProp->get_DevSyncOffset(&m_iSyncDev);
  69.     return NOERROR;
  70. }
  71.  
  72.  
  73. // Release any IQualProp interface we have
  74.  
  75. HRESULT CQualityProperties::OnDisconnect()
  76. {
  77.     // Release the interface
  78.  
  79.     if (m_pQualProp == NULL) {
  80.         return E_UNEXPECTED;
  81.     }
  82.  
  83.     m_pQualProp->Release();
  84.     m_pQualProp = NULL;
  85.     return NOERROR;
  86. }
  87.  
  88.  
  89. // Set the text fields in the property page
  90.  
  91. HRESULT CQualityProperties::OnActivate()
  92. {
  93.     SetEditFieldData();
  94.     return NOERROR;
  95. }
  96.  
  97.  
  98. // Initialise the property page fields
  99.  
  100. void CQualityProperties::SetEditFieldData()
  101. {
  102.     ASSERT(m_pQualProp);
  103.     TCHAR buffer[50];
  104.  
  105.     wsprintf(buffer,"%d", m_iDropped);
  106.     SendDlgItemMessage(m_Dlg, IDD_QDROPPED, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  107.     wsprintf(buffer,"%d", m_iDrawn);
  108.     SendDlgItemMessage(m_Dlg, IDD_QDRAWN, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  109.     wsprintf(buffer,"%d.%02d", m_iFrameRate/100, m_iFrameRate%100);
  110.     SendDlgItemMessage(m_Dlg, IDD_QAVGFRM, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  111.     wsprintf(buffer,"%d", m_iFrameJitter);
  112.     SendDlgItemMessage(m_Dlg, IDD_QJITTER, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  113.     wsprintf(buffer,"%d", m_iSyncAvg);
  114.     SendDlgItemMessage(m_Dlg, IDD_QSYNCAVG, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  115.     wsprintf(buffer,"%d", m_iSyncDev);
  116.     SendDlgItemMessage(m_Dlg, IDD_QSYNCDEV, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
  117. }
  118.  
  119.