The property page to configure a Video for Windows compliant compression codec. Most compressors support this property page rather than a DirectShow property page. Also, most compressors do not support the IAMVideoCompression interface so this property page is the only method to configure a compressor.
Наследование: PropertyPage
Пример #1
0
        // ------------------ Public Methods --------------------

        /// <summary> Populate the collection by looking for commonly implemented property pages. </summary>
        protected void addFromGraph(
            ICaptureGraphBuilder2 graphBuilder,
            IBaseFilter videoDeviceFilter, IBaseFilter audioDeviceFilter,
            IBaseFilter videoCompressorFilter, IBaseFilter audioCompressorFilter,
            SourceCollection videoSources, SourceCollection audioSources)
        {
            object filter = null;
            DsGuid cat;
            DsGuid med;
            Guid   iid;
            int    hr;

            Trace.Assert(graphBuilder != null);

            // 1. the video capture filter
            addIfSupported(videoDeviceFilter, "Video Capture Device");

            // 2. the video capture pin
            cat = new DsGuid(PinCategory.Capture);
            med = new DsGuid(MediaType.Interleaved);
            iid = typeof(IAMStreamConfig).GUID;
            hr  = graphBuilder.FindInterface(
                cat, med, videoDeviceFilter, iid, out filter);
            if (hr != 0)
            {
                med = MediaType.Video;
                hr  = graphBuilder.FindInterface(
                    cat, med, videoDeviceFilter, iid, out filter);
                if (hr != 0)
                {
                    filter = null;
                }
            }
            addIfSupported(filter, "Video Capture Pin");

            // 3. the video preview pin
            cat = PinCategory.Preview;
            med = MediaType.Interleaved;
            iid = typeof(IAMStreamConfig).GUID;
            hr  = graphBuilder.FindInterface(
                cat, med, videoDeviceFilter, iid, out filter);
            if (hr != 0)
            {
                med = MediaType.Video;
                hr  = graphBuilder.FindInterface(
                    cat, med, videoDeviceFilter, iid, out filter);
                if (hr != 0)
                {
                    filter = null;
                }
            }
            addIfSupported(filter, "Video Preview Pin");

            // 4. the video crossbar(s)
            ArrayList crossbars = new ArrayList();
            int       num       = 1;

            for (int c = 0; c < videoSources.Count; c++)
            {
                CrossbarSource s = videoSources[c] as CrossbarSource;
                if (s != null)
                {
                    if (crossbars.IndexOf(s.Crossbar) < 0)
                    {
                        crossbars.Add(s.Crossbar);
                        if (addIfSupported(s.Crossbar, "Video Crossbar " + (num == 1 ? "" : num.ToString())))
                        {
                            num++;
                        }
                    }
                }
            }
            crossbars.Clear();

            // 5. the video compressor
            addIfSupported(videoCompressorFilter, "Video Compressor");

            // 6. the video TV tuner
            cat = new DsGuid(PinCategory.Capture);
            med = new DsGuid(MediaType.Interleaved);
            iid = typeof(IAMTVTuner).GUID;
            hr  = graphBuilder.FindInterface(
                cat, med, videoDeviceFilter, iid, out filter);
            if (hr != 0)
            {
                med = MediaType.Video;
                hr  = graphBuilder.FindInterface(
                    cat, med, videoDeviceFilter, iid, out filter);
                if (hr != 0)
                {
                    filter = null;
                }
            }
            addIfSupported(filter, "TV Tuner");

            // 7. the video compressor (VFW)
            IAMVfwCompressDialogs compressDialog = videoCompressorFilter as IAMVfwCompressDialogs;

            if (compressDialog != null)
            {
                VfwCompressorPropertyPage page = new VfwCompressorPropertyPage("Video Compressor", compressDialog);
                InnerList.Add(page);
            }

            // 8. the audio capture filter
            addIfSupported(audioDeviceFilter, "Audio Capture Device");

            // 9. the audio capture pin
            cat = new DsGuid(PinCategory.Capture);
            med = new DsGuid(MediaType.Audio);
            iid = typeof(IAMStreamConfig).GUID;
            hr  = graphBuilder.FindInterface(
                cat, med, audioDeviceFilter, iid, out filter);
            if (hr != 0)
            {
                filter = null;
            }
            addIfSupported(filter, "Audio Capture Pin");

            // 9. the audio preview pin
            cat = new DsGuid(PinCategory.Preview);
            med = new DsGuid(MediaType.Audio);
            iid = typeof(IAMStreamConfig).GUID;
            hr  = graphBuilder.FindInterface(
                cat, med, audioDeviceFilter, iid, out filter);
            if (hr != 0)
            {
                filter = null;
            }
            addIfSupported(filter, "Audio Preview Pin");

            // 10. the audio crossbar(s)
            num = 1;
            for (int c = 0; c < audioSources.Count; c++)
            {
                CrossbarSource s = audioSources[c] as CrossbarSource;
                if (s != null)
                {
                    if (crossbars.IndexOf(s.Crossbar) < 0)
                    {
                        crossbars.Add(s.Crossbar);
                        if (addIfSupported(s.Crossbar, "Audio Crossbar " + (num == 1 ? "" : num.ToString())))
                        {
                            num++;
                        }
                    }
                }
            }
            crossbars.Clear();

            // 11. the audio compressor
            addIfSupported(audioCompressorFilter, "Audio Compressor");
        }
Пример #2
0
		// ------------------ Public Methods --------------------

		/// <summary> Populate the collection by looking for commonly implemented property pages. </summary>
		protected void addFromGraph(
			ICaptureGraphBuilder2 graphBuilder,
			IBaseFilter videoDeviceFilter, IBaseFilter audioDeviceFilter,
			IBaseFilter videoCompressorFilter, IBaseFilter audioCompressorFilter, 
			SourceCollection videoSources, SourceCollection audioSources)
		{
			object filter = null;
			Guid cat;
			Guid med;
			Guid iid;
			int hr;

			Trace.Assert( graphBuilder != null );

			// 1. the video capture filter
			addIfSupported( videoDeviceFilter, "Video Capture Device" );

			// 2. the video capture pin
			cat = PinCategory.Capture;
			med = MediaType.Interleaved; 
			iid = typeof(IAMStreamConfig).GUID;
#if DSHOWNET
			hr = graphBuilder.FindInterface( 
				ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				med = MediaType.Video ;
#if DSHOWNET
				hr = graphBuilder.FindInterface( 
					ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
                hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
				if ( hr != 0 )
					filter = null;
			}
			addIfSupported( filter, "Video Capture Pin" );

			// 3. the video preview pin
			cat = PinCategory.Preview;
			med = MediaType.Interleaved; 
			iid = typeof(IAMStreamConfig).GUID;
#if DSHOWNET
			hr = graphBuilder.FindInterface( 
				ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				med = MediaType.Video ;
#if DSHOWNET
				hr = graphBuilder.FindInterface( 
					ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
                hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
				if ( hr != 0 )
					filter = null;
			}
			addIfSupported( filter, "Video Preview Pin" );

			// 4. the video crossbar(s)
			ArrayList crossbars = new ArrayList();
			int num = 1;
			for ( int c = 0; c < videoSources.Count; c++ )
			{
				CrossbarSource s = videoSources[c] as CrossbarSource;
				if ( s != null )
				{
					if ( crossbars.IndexOf( s.Crossbar ) < 0 )
					{
						crossbars.Add( s.Crossbar );
						if ( addIfSupported( s.Crossbar, "Video Crossbar " + ( num==1 ? "" : num.ToString() ) ) )
							num++;
					}
				}
			}
			crossbars.Clear();

			// 5. the video compressor
			addIfSupported( videoCompressorFilter, "Video Compressor" );

			// 6. the video TV tuner
			cat = PinCategory.Capture;
			med = MediaType.Interleaved; 
			iid = typeof(IAMTVTuner).GUID;
#if DSHOWNET 
			hr = graphBuilder.FindInterface(
				ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				med = MediaType.Video ;
#if DSHOWNET
				hr = graphBuilder.FindInterface( 
					ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
				if ( hr != 0 )
					filter = null;
			}
			addIfSupported( filter, "TV Tuner" );

//#if NEWCODE
			cat = PinCategory.Capture;
			med = MediaType.Interleaved; 
#if DSHOWNET
			iid = typeof(DirectX.Capture.Capture.IAMTVAudio).GUID;
			hr = graphBuilder.FindInterface( 
				ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
			iid = typeof(IAMTVAudio).GUID;
			hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				med = MediaType.Video ;
#if DSHOWNET
				hr = graphBuilder.FindInterface( 
					ref cat, ref med, videoDeviceFilter, ref iid, out filter );
#else
                hr = graphBuilder.FindInterface(cat, med, videoDeviceFilter, iid, out filter);
#endif
				if ( hr != 0 )
				{
					filter = null;
				}
			}
			addIfSupported( filter, "TV Audio" );
//#endif

			// 7. the video compressor (VFW)
			IAMVfwCompressDialogs compressDialog = videoCompressorFilter as IAMVfwCompressDialogs;
			if ( compressDialog != null )
			{
				VfwCompressorPropertyPage page = new VfwCompressorPropertyPage( "Video Compressor", compressDialog );
				InnerList.Add( page );
			}

			// 8. the audio capture filter
			addIfSupported( audioDeviceFilter, "Audio Capture Device" );

			// 9. the audio capture pin
			cat = PinCategory.Capture;
			med = MediaType.Audio; 
			iid = typeof(IAMStreamConfig).GUID;
#if DSHOWNET
			hr = graphBuilder.FindInterface( 
				ref cat, ref med, audioDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, audioDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				filter = null;
			}
			addIfSupported( filter, "Audio Capture Pin" );

			// 9. the audio preview pin
			cat = PinCategory.Preview;
			med = MediaType.Audio; 
			iid = typeof(IAMStreamConfig).GUID;
#if DSHOWNET
			hr = graphBuilder.FindInterface( 
				ref cat, ref med, audioDeviceFilter, ref iid, out filter );
#else
            hr = graphBuilder.FindInterface(cat, med, audioDeviceFilter, iid, out filter);
#endif
			if ( hr != 0 )
			{
				filter = null;
			}
			addIfSupported( filter, "Audio Preview Pin" );

			// 10. the audio crossbar(s)
			num = 1;
			for ( int c = 0; c < audioSources.Count; c++ )
			{
				CrossbarSource s = audioSources[c] as CrossbarSource;
				if ( s != null )
				{
					if ( crossbars.IndexOf( s.Crossbar ) < 0 )
					{
						crossbars.Add( s.Crossbar );
						if ( addIfSupported( s.Crossbar, "Audio Crossbar " + ( num==1 ? "" : num.ToString() ) ) )
							num++;
					}
				}
			}
			crossbars.Clear();

			// 11. the audio compressor
			addIfSupported( audioCompressorFilter, "Audio Compressor" );

		}