Exemplo n.º 1
0
        /// <summary>
        /// This constructor internally build a DirectShow graph using the given file name parameter.
        /// </summary>
        /// <param name="filename">A media file.</param>
        /// <remarks>This constructor use the BlackListManager class to bane the use of the ffdshow Audio and Video decoders during the Intelligent Connect graph building.</remarks>
        public SimplePlayer(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            throw new ArgumentNullException("filename");

              if (!File.Exists(filename))
            throw new FileNotFoundException();

              this.graphBuilder = (IFilterGraph2)new FilterGraph();

            #if DEBUG
              this.rot = new DsROTEntry(this.graphBuilder);
            #endif

              this.blackListManager = new BlackListManager(this.graphBuilder);

              // blacklist the ffdshow Audio Decoder filter
              this.blackListManager.AddBlackListedFilter(new Guid("0F40E1E5-4F79-4988-B1A9-CC98794E6B55"));
              // blacklist the ffdshow Video Decoder filter
              this.blackListManager.AddBlackListedFilter(new Guid("04FE9017-F873-410E-871E-AB91661A4EF7"));

              int hr = this.graphBuilder.RenderFile(filename, null);
              DsError.ThrowExceptionForHR(hr);

              this.mediaControl = (IMediaControl)this.graphBuilder;
              this.mediaEvent = (IMediaEvent)this.graphBuilder;
        }
Exemplo n.º 2
0
        /// <summary>
        /// This constructor internally build a DirectShow graph using the given file name parameter.
        /// </summary>
        /// <param name="filename">A media file.</param>
        /// <remarks>This constructor use the BlackListManager class to bane the use of the ffdshow Audio and Video decoders during the Intelligent Connect graph building.</remarks>
        public SimplePlayer(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentNullException("filename");
            }

            if (!File.Exists(filename))
            {
                throw new FileNotFoundException();
            }

            this.graphBuilder = (IFilterGraph2) new FilterGraph();

#if DEBUG
            this.rot = new DsROTEntry(this.graphBuilder);
#endif

            this.blackListManager = new BlackListManager(this.graphBuilder);

            // blacklist the ffdshow Audio Decoder filter
            this.blackListManager.AddBlackListedFilter(new Guid("0F40E1E5-4F79-4988-B1A9-CC98794E6B55"));
            // blacklist the ffdshow Video Decoder filter
            this.blackListManager.AddBlackListedFilter(new Guid("04FE9017-F873-410E-871E-AB91661A4EF7"));

            int hr = this.graphBuilder.RenderFile(filename, null);
            DsError.ThrowExceptionForHR(hr);

            this.mediaControl = (IMediaControl)this.graphBuilder;
            this.mediaEvent   = (IMediaEvent)this.graphBuilder;
        }