Ignore:
Timestamp:
Sep 20, 2013, 6:30:04 AM (10 years ago)
Author:
roman
Message:

Custom graph loading option (made earlier) and stub to CSV print sample times

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/DumpMediaSamples/DumpMediaSamples.cpp

    r152 r217  
    172172                CMediaType m_pMediaType;
    173173                CComPtr<CAbstractHandler> m_pHandler;
     174                DWORD m_nPreviousFlags;
     175                REFERENCE_TIME m_nPreviousStartTime;
     176                REFERENCE_TIME m_nPreviousStopTime;
    174177
    175178        public:
     
    188191                        _A(!m_pModule && pModule);
    189192                        m_pModule = pModule;
     193                        m_nPreviousFlags = 0;
    190194                }
    191195                VOID SetName(const CString& sName)
     
    268272                                CMediaSampleProperties Properties(pMediaSample);
    269273                                _A(!Properties.pMediaType);
     274                                CRoArrayT<CString> TimeArray;
     275                                if(Properties.dwSampleFlags & AM_SAMPLE_TIMEVALID)
     276                                {
     277                                        CRoCriticalSectionLock DataLock(m_DataCriticalSection);
     278                                        TimeArray.Add(_FilterGraphHelper::FormatReferenceTime(Properties.tStart));
     279                                        if(m_nPreviousFlags & AM_SAMPLE_TIMEVALID)
     280                                                TimeArray.Add(_FilterGraphHelper::FormatReferenceTime(Properties.tStart - m_nPreviousStartTime));
     281                                        else
     282                                                TimeArray.Add(_T(""));
     283                                        if(m_nPreviousFlags & AM_SAMPLE_STOPVALID)
     284                                                TimeArray.Add(_FilterGraphHelper::FormatReferenceTime(Properties.tStart - m_nPreviousStopTime));
     285                                        else
     286                                                TimeArray.Add(_T(""));
     287                                        if(Properties.dwSampleFlags & AM_SAMPLE_STOPVALID)
     288                                        {
     289                                                TimeArray.Add(_FilterGraphHelper::FormatReferenceTime(Properties.tStop));
     290                                                TimeArray.Add(_FilterGraphHelper::FormatReferenceTime(Properties.tStop - Properties.tStart));
     291                                        }
     292                                }
    270293                                CRoCriticalSectionLock PrintLock(m_pModule->m_PrintCriticalSection);
    271294                                _tprintf(_T("%s") _T("fSampleTime %s, .dwTypeSpecificFlags 0x%08x%s, .dwSampleFlags 0x%08x%s, .tStart %s, .tStop %s, .dwStreamId %d\n"),
     
    275298                                        Properties.dwSampleFlags, Properties.dwSampleFlags ? (LPCTSTR) AtlFormatString(_T(" (%s)"), StringFromSampleFlags(Properties.dwSampleFlags)) : _T(""),
    276299                                        _FilterGraphHelper::FormatReferenceTime(Properties.tStart),
    277                                         _FilterGraphHelper::FormatReferenceTime(Properties.tStop),
     300                                        _FilterGraphHelper::FormatReferenceTime(Properties.tStop), 
    278301                                        Properties.dwStreamId,
    279302                                        0);
     
    296319                                                0);
    297320                                }
     321                                //_tprintf(_T("%s") _T("Time, %s") _T("\n"),
     322                                //      m_sNamePrefix,
     323                                //      _StringHelper::Join(TimeArray, _T(", ")),
     324                                //      0);
    298325                                if(m_pHandler)
    299326                                        m_pHandler->HandleSample(Properties);
    300327                                _tprintf(_T("\n"));
     328                                m_nPreviousFlags = Properties.dwSampleFlags;
     329                                m_nPreviousStartTime = Properties.tStart;
     330                                m_nPreviousStopTime = Properties.tStop;
     331
    301332                        }
    302333                        _ATLCATCH(Exception)
     
    317348        CPath m_sPath;
    318349        BOOL m_bNoReferenceClock;
     350        BOOL m_bSuppressLoadFailure;
    319351        mutable CRoCriticalSection m_PrintCriticalSection;
    320352
     
    347379                //m_sPath = GetDefaultPath();
    348380                m_bNoReferenceClock = FALSE;
     381                m_bSuppressLoadFailure = FALSE;
    349382        }
    350383        ~CModule()
     
    360393                CGenericFilterGraph FilterGraph;
    361394                FilterGraph.CoCreateInstance();
    362                 LoadGraphBuilderFromFile(FilterGraph.m_pFilterGraph, m_sPath);
     395                _ATLTRY
     396                {
     397                        LoadGraphBuilderFromFile(FilterGraph.m_pFilterGraph, m_sPath);
     398                }
     399                _ATLCATCH(Exception)
     400                {
     401                        _tprintf(_T("Error loading filter graph: %s\n"), Ds::FormatResult(Exception));
     402                        if(!m_bSuppressLoadFailure)
     403                                _ATLRETHROW;
     404                }
    363405                #pragma region Sample Grabbers
    364406                _FilterGraphHelper::CFilterArray FilterArray;
     
    493535                                {
    494536                                        Module.m_bNoReferenceClock = TRUE;
     537                                } else
     538                                if(_tcschr(_T("Ee"), sArgument[0])) // Suppress Load Failure
     539                                {
     540                                        Module.m_bSuppressLoadFailure = TRUE;
    495541                                }
    496542                                continue;
Note: See TracChangeset for help on using the changeset viewer.