Changeset 103


Ignore:
Timestamp:
Aug 26, 2012, 6:21:32 AM (11 years ago)
Author:
roman
Message:
 
Location:
trunk/Utilities/CaptureClock
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/CaptureClock/CaptureClock_i.c

    r102 r103  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sun Aug 26 15:46:09 2012
     9/* at Sun Aug 26 16:17:50 2012
    1010 */
    1111/* Compiler settings for CaptureClock.idl:
  • trunk/Utilities/CaptureClock/CaptureClock_i.h

    r102 r103  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Aug 26 15:46:09 2012
     7/* at Sun Aug 26 16:17:50 2012
    88 */
    99/* Compiler settings for CaptureClock.idl:
  • trunk/Utilities/CaptureClock/MainDialog.h

    r102 r103  
    470470                                const BOOL bLog = ++m_nTimerEventIndex % 30 == 0;
    471471                                CRoArrayT<CString> Array;
     472                                REFERENCE_TIME nSystemTime;
     473                                if(m_pReferenceClock)
     474                                {
     475                                        _V(m_pReferenceClock->GetTime(&nSystemTime));
     476                                        nSystemTime -= m_nAnchorTime;
     477                                        m_SystemTimeEdit.SetValue(AtlFormatString(_T("%s"), _FilterGraphHelper::FormatReferenceTime(nSystemTime)));
     478                                        if(bLog)
     479                                                Array.Add(AtlFormatString(_T("%I64d"), (nSystemTime + 5000i64 - 1) / 10000i64));
     480                                }
    472481                                if(m_pVideoRendererFilter)
    473482                                {
     
    480489                                                Array.Add(AtlFormatString(_T("%d"), nCount));
    481490                                                Array.Add(AtlFormatString(_T("%I64d"), (nTime + 5000i64 - 1) / 10000i64));
     491                                                Array.Add(AtlFormatString(_T("%I64d"), ((nTime - nSystemTime) + 5000i64 - 1) / 10000i64));
    482492                                        }
    483493                                }
     
    492502                                                Array.Add(AtlFormatString(_T("%d"), nCount));
    493503                                                Array.Add(AtlFormatString(_T("%I64d"), (nTime + 5000i64 - 1) / 10000i64));
     504                                                Array.Add(AtlFormatString(_T("%I64d"), ((nTime - nSystemTime) + 5000i64 - 1) / 10000i64));
    494505                                        }
    495506                                }
    496                                 if(m_pReferenceClock)
    497                                 {
    498                                         REFERENCE_TIME nTime;
    499                                         _V(m_pReferenceClock->GetTime(&nTime));
    500                                         nTime -= m_nAnchorTime;
    501                                         m_SystemTimeEdit.SetValue(AtlFormatString(_T("%s"), _FilterGraphHelper::FormatReferenceTime(nTime)));
    502                                         if(bLog)
    503                                                 Array.InsertAt(0, AtlFormatString(_T("%I64d"), (nTime + 5000i64 - 1) / 10000i64));
    504                                 }
    505                                 if(bLog && Array.GetCount() == 5)
     507                                if(bLog && Array.GetCount() == 1 + 3 + 3)
    506508                                {
    507509                                        if(m_sLog.IsEmpty())
     
    512514                                                        _T("Video Sample Count"),
    513515                                                        _T("Video Sample Time"),
     516                                                        _T("Relative Video Sample Time"),
    514517                                                        _T("Audio Sample Count"),
    515518                                                        _T("Audio Sample Time"),
     519                                                        _T("Relative Audio Sample Time"),
    516520                                                };
    517521                                                m_sLog.Append(_StringHelper::Join(g_ppszHeader, _T("\t")) + _T("\r\n"));
     
    579583                                pRendererFilter->Initialize(MEDIATYPE_Audio);
    580584                                __C(m_FilterGraph->AddFilter(pRendererFilter, CT2CW(_T("Audio Renderer"))));
    581                                 __C(m_FilterGraph->Connect(GetCapturePin(pSourceBaseFilter), pRendererFilter->GetInputPin()));
     585                                const CComPtr<IPin> pCapturePin = GetCapturePin(pSourceBaseFilter);
     586                                _ATLTRY
     587                                {
     588                                        const CComQIPtr<IAMBufferNegotiation> pAmBufferNegotiation = pCapturePin;
     589                                        __D(pAmBufferNegotiation, E_NOINTERFACE);
     590                                        const CComQIPtr<IAMStreamConfig> pAmStreamConfig = pCapturePin;
     591                                        __D(pAmStreamConfig, E_NOINTERFACE);
     592                                        CMediaType pMediaType;
     593                                        __C(pAmStreamConfig->GetFormat(&pMediaType));
     594                                        const CWaveFormatEx* pWaveFormatEx = pMediaType.GetWaveFormatEx();
     595                                        __D(pWaveFormatEx, E_UNNAMED);
     596                                        ALLOCATOR_PROPERTIES Properties;
     597                                        Properties.cbAlign = -1;
     598                                        Properties.cbBuffer = pWaveFormatEx->nAvgBytesPerSec / 10; // 100 millisecond
     599                                        Properties.cbPrefix = -1;
     600                                        Properties.cBuffers = 50; // 50 buffers (5 seconds in total)
     601                                        __C(pAmBufferNegotiation->SuggestAllocatorProperties(&Properties));
     602                                }
     603                                _ATLCATCHALL()
     604                                {
     605                                        _Z_EXCEPTION();
     606                                }
     607                                __C(m_FilterGraph->Connect(pCapturePin, pRendererFilter->GetInputPin()));
    582608                                m_pAudioRendererFilter = pRendererFilter;
    583609                        }
     
    616642                if(!m_sLog.IsEmpty())
    617643                {
    618                         SetClipboardText(m_hWnd, m_sLog);
     644                        CString sLog;
     645                        OSVERSIONINFO VersionInformation = { sizeof VersionInformation };
     646                        _W(GetVersionEx(&VersionInformation));
     647                        _A(VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT);
     648                        sLog += AtlFormatString(_T("Windows Version") _T("\t") _T("%d.%d.%d %s") _T("\r\n"), VersionInformation.dwMajorVersion, VersionInformation.dwMinorVersion, VersionInformation.dwBuildNumber, VersionInformation.szCSDVersion);
     649                        CFilterData& VideoFilterData = m_VideoDeviceComboBox.GetItemData(m_VideoDeviceComboBox.GetCurSel());
     650                        sLog += AtlFormatString(_T("Video Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), VideoFilterData.GetFriendlyName(), VideoFilterData.GetMonikerDisplayName());
     651                        CFilterData& AudioFilterData = m_AudioDeviceComboBox.GetItemData(m_AudioDeviceComboBox.GetCurSel());
     652                        sLog += AtlFormatString(_T("Audio Device") _T("\t") _T("%ls") _T("\t") _T("%ls") _T("\r\n"), AudioFilterData.GetFriendlyName(), AudioFilterData.GetMonikerDisplayName());
     653                        sLog += _T("\r\n");
     654                        sLog += m_sLog;
     655                        SetClipboardText(m_hWnd, sLog);
    619656                        MessageBeep(MB_OK);
    620657                }
Note: See TracChangeset for help on using the changeset viewer.