示例#1
0
        private void TestMarkerCount()
        {
            int hr;
            int i;

            hr = m_es.get_MarkerCount(out i);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(i == 3, "Count");
        }
示例#2
0
        protected virtual void EnumerateChapters(bool forceRefresh)
        {
            if (_graphBuilder == null || !_initialized || !forceRefresh && _chapterTimestamps != null)
            {
                return;
            }

            // Try to find a filter implementing IAMExtendSeeking for chapter support
            IAMExtendedSeeking extendSeeking = FilterGraphTools.FindFilterByInterface <IAMExtendedSeeking>(_graphBuilder);

            if (extendSeeking == null)
            {
                return;
            }
            try
            {
                int markerCount;
                if (extendSeeking.get_MarkerCount(out markerCount) != 0 || markerCount <= 0)
                {
                    return;
                }

                _chapterTimestamps = new double[markerCount];
                _chapterNames      = new string[markerCount];
                for (int i = 1; i <= markerCount; i++)
                {
                    double markerTime;
                    string markerName;
                    extendSeeking.GetMarkerTime(i, out markerTime);
                    extendSeeking.GetMarkerName(i, out markerName);

                    _chapterTimestamps[i - 1] = markerTime;
                    _chapterNames[i - 1]      = !string.IsNullOrEmpty(markerName) ? markerName : GetChapterName(i);
                }
            }
            finally
            {
                Marshal.ReleaseComObject(extendSeeking);
            }
        }