Beispiel #1
0
 /// <summary>
 /// Remove the specified filter from the graph and dispose it.
 /// </summary>
 /// <param name="fil"></param>
 private void RemoveAndDispose(Filter fil)
 {
     if ((fil != null) && (fil.BaseFilter != null)) {
         iFG.RemoveFilter(fil.BaseFilter);
         fil.Dispose();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Removes all filters from the graph, starting at the end and working
        /// back to but not including "start"
        /// </summary>
        public void RemoveFiltersDownstreamFrom(Filter start)
        {
            if(start == null)
            {
                string msg = Strings.NullStartError;

                Debug.Fail(msg);
                throw new ArgumentNullException(Strings.Start, msg);
            }

            Stop();

            List<IBaseFilter> toRemove = EnumerateDownstreamFromFilter(start.DownstreamBaseFilter);

            foreach(IBaseFilter iBF in toRemove)
            {
                iFG.RemoveFilter(iBF);
                if ((renderer != null) && (iBF == renderer.BaseFilter)) {
                    DisposeRenderer();
                }
                if ((Compressor != null) && (iBF == Compressor.BaseFilter)) {
                    DisposeCompressor();
                }
            }
        }
        protected void LogCurrentMediaType(Filter f)
        {
            if(f != null)
            {
                _AMMediaType mt;
                object fb;
                f.GetMediaType(out mt, out fb);

                Log(string.Format("\r\nCurrent media type for {0}...", f.FriendlyName) +
                    MediaType.Dump(mt) + MediaType.FormatType.Dump(fb));
            }
        }
        protected void LogCurrentMediaType(Filter f)
        {
            if(f != null)
            {
                _AMMediaType mt;
                object fb;
                if (f is MSR.LST.MDShow.OpusAudioCompressor) { 
                    //TODO: log something useful
                }
                else {
                    try {
                        f.GetMediaType(out mt, out fb);
                        Log(string.Format(CultureInfo.CurrentCulture, "\r\nCurrent media type for {0}...",
                            f.FriendlyName) + MediaType.Dump(mt) + MediaType.FormatType.Dump(fb));

                    }
                    catch { 
                        //TODO: log something useful
                    }
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Removes all filters from the graph, starting at the end and working
        /// back to but not including "start"
        /// </summary>
        public void RemoveFiltersDownstreamFrom(Filter start)
        {
            if(start == null)
            {
                string msg = "Null is not a valid value for parameter 'start'";

                Debug.Fail(msg);
                throw new ArgumentNullException("start", msg);
            }

            if(start != source && start != compressor)
            {
                string msg = "The 'start' parameter must be either the 'source' or 'compressor' filter";

                Debug.Fail(msg);
                throw new ArgumentOutOfRangeException("start", msg);
            }

            Stop();

            foreach(IBaseFilter iBF in FilterGraph.FiltersInGraph(iFG))
            {
                if(iBF == start.BaseFilter)
                {
                    // We're done if we are back to the start filter
                    break;
                }

                iFG.RemoveFilter(iBF);
            }

            DisposeRenderer();

            if(start == source)
            {
                DisposeCompressor();
            }
        }