home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
-
- #include <streams.h>
- #include <sampvid.h>
- #include <vidprop.h>
-
-
- // This class implements a property page dialog for the video renderer. We
- // expose certain statistics from the quality management implementation. In
- // particular we have two edit fields that show the number of frames we have
- // actually drawn and the number of frames that we dropped. The number of
- // frames we dropped does NOT represent the total number dropped in any play
- // back sequence (as expressed through MCI status frames skipped) since the
- // quality management protocol may have negotiated with the source filter for
- // it to send fewer frames in the first place. Dropping frames in the source
- // filter is nearly always a more efficient mechanism when we are flooded
-
-
- // Constructor
-
- CQualityProperties::CQualityProperties(LPUNKNOWN pUnk,HRESULT *phr) :
- CBasePropertyPage(NAME("Quality Page"),pUnk,phr,IDD_QUALITY,IDS_NAME),
- m_pQualProp(NULL)
- {
- ASSERT(phr);
- }
-
-
- // Create a quality properties object
-
- CUnknown *CQualityProperties::CreateInstance(LPUNKNOWN lpUnk, HRESULT *phr)
- {
- return new CQualityProperties(lpUnk, phr);
- }
-
-
- // Give us the filter to communicate with
-
- HRESULT CQualityProperties::OnConnect(IUnknown *pUnknown)
- {
- ASSERT(m_pQualProp == NULL);
-
- // Ask the renderer for it's IQualProp interface
-
- HRESULT hr = pUnknown->QueryInterface(IID_IQualProp,(void **)&m_pQualProp);
- if (FAILED(hr)) {
- return E_NOINTERFACE;
- }
-
- ASSERT(m_pQualProp);
-
- // Get quality data for our page
-
- m_pQualProp->get_FramesDroppedInRenderer(&m_iDropped);
- m_pQualProp->get_FramesDrawn(&m_iDrawn);
- m_pQualProp->get_AvgFrameRate(&m_iFrameRate);
- m_pQualProp->get_Jitter(&m_iFrameJitter);
- m_pQualProp->get_AvgSyncOffset(&m_iSyncAvg);
- m_pQualProp->get_DevSyncOffset(&m_iSyncDev);
- return NOERROR;
- }
-
-
- // Release any IQualProp interface we have
-
- HRESULT CQualityProperties::OnDisconnect()
- {
- // Release the interface
-
- if (m_pQualProp == NULL) {
- return E_UNEXPECTED;
- }
-
- m_pQualProp->Release();
- m_pQualProp = NULL;
- return NOERROR;
- }
-
-
- // Set the text fields in the property page
-
- HRESULT CQualityProperties::OnActivate()
- {
- SetEditFieldData();
- return NOERROR;
- }
-
-
- // Initialise the property page fields
-
- void CQualityProperties::SetEditFieldData()
- {
- ASSERT(m_pQualProp);
- TCHAR buffer[50];
-
- wsprintf(buffer,"%d", m_iDropped);
- SendDlgItemMessage(m_Dlg, IDD_QDROPPED, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- wsprintf(buffer,"%d", m_iDrawn);
- SendDlgItemMessage(m_Dlg, IDD_QDRAWN, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- wsprintf(buffer,"%d.%02d", m_iFrameRate/100, m_iFrameRate%100);
- SendDlgItemMessage(m_Dlg, IDD_QAVGFRM, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- wsprintf(buffer,"%d", m_iFrameJitter);
- SendDlgItemMessage(m_Dlg, IDD_QJITTER, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- wsprintf(buffer,"%d", m_iSyncAvg);
- SendDlgItemMessage(m_Dlg, IDD_QSYNCAVG, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- wsprintf(buffer,"%d", m_iSyncDev);
- SendDlgItemMessage(m_Dlg, IDD_QSYNCDEV, WM_SETTEXT, 0, (DWORD) (LPSTR) buffer);
- }
-