Beispiel #1
0
        public static bool ShowTunerPinDialog(ICaptureGraphBuilder2 bld, IBaseFilter flt, IntPtr hwnd)
        {
            int    hr;
            object comObj = null;
            ISpecifyPropertyPages spec = null;
            DsCAUUID cauuid            = new DsCAUUID();

            try {
                Guid cat  = PinCategory.Capture;
                Guid type = MediaType.Interleaved;
                Guid iid  = typeof(IAMTVTuner).GUID;
                hr = bld.FindInterface(ref cat, ref type, flt, ref iid, out comObj);
                if (hr != 0)
                {
                    type = MediaType.Video;
                    hr   = bld.FindInterface(ref cat, ref type, flt, ref iid, out comObj);
                    if (hr != 0)
                    {
                        return(false);
                    }
                }
                spec = comObj as ISpecifyPropertyPages;
                if (spec == null)
                {
                    return(false);
                }

                hr = spec.GetPages(out cauuid);
                hr = OleCreatePropertyFrame(hwnd, 30, 30, null, 1,
                                            ref comObj, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero);
                return(true);
            }
            catch (Exception ee)
            {
                Trace.WriteLine("!Ds.NET: ShowCapPinDialog " + ee.Message);
                return(false);
            }
            finally
            {
                if (cauuid.pElems != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(cauuid.pElems);
                }

                spec = null;
                if (comObj != null)
                {
                    Marshal.ReleaseComObject(comObj);
                }
                comObj = null;
            }
        }
Beispiel #2
0
 public static bool ShowCapPinDialog(ICaptureGraphBuilder2 bld, IBaseFilter flt, IntPtr hwnd)
 {
     object ppint = null;
     ISpecifyPropertyPages pages = null;
     bool flag;
     DsCAUUID pPages = new DsCAUUID();
     try
     {
         Guid capture = PinCategory.Capture;
         Guid interleaved = MediaType.Interleaved;
         Guid gUID = typeof(IAMStreamConfig).GUID;
         if (bld.FindInterface(ref capture, ref interleaved, flt, ref gUID, out ppint) != 0)
         {
             interleaved = MediaType.Video;
             if (bld.FindInterface(ref capture, ref interleaved, flt, ref gUID, out ppint) != 0)
             {
                 return false;
             }
         }
         pages = ppint as ISpecifyPropertyPages;
         if (pages == null)
         {
             return false;
         }
         int num = pages.GetPages(out pPages);
         num = OleCreatePropertyFrame(hwnd, 30, 30, null, 1, ref ppint, pPages.cElems, pPages.pElems, 0, 0, IntPtr.Zero);
         flag = true;
     }
     catch (Exception exception)
     {
         Trace.WriteLine("!Ds.NET: ShowCapPinDialog " + exception.Message);
         flag = false;
     }
     finally
     {
         if (pPages.pElems != IntPtr.Zero)
         {
             Marshal.FreeCoTaskMem(pPages.pElems);
         }
         pages = null;
         if (ppint != null)
         {
             Marshal.ReleaseComObject(ppint);
         }
         ppint = null;
     }
     return flag;
 }
		// ---------------- Public Methods --------------------

		/// <summary> 
		///  Show the property page. Some property pages cannot be displayed 
		///  while previewing and/or capturing. 
		/// </summary>
		public override void Show(Control owner)
		{
			DsCAUUID cauuid = new DsCAUUID();
			try
			{
				int hr = specifyPropertyPages.GetPages( out cauuid );
				//if ( hr != 0 ) Marshal.ThrowExceptionForHR( hr );

				object o = specifyPropertyPages;
				hr = OleCreatePropertyFrame( owner.Handle, 30, 30, null, 1,
					ref o, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero );
			}
			finally
			{
				if( cauuid.pElems != IntPtr.Zero )
					Marshal.FreeCoTaskMem( cauuid.pElems );
			}
		}
Beispiel #4
0
		public static bool ShowTunerPinDialog( ICaptureGraphBuilder2 bld, IBaseFilter flt, IntPtr hwnd )
		{
			int hr;
			object comObj = null;
			ISpecifyPropertyPages	spec = null;
			DsCAUUID cauuid = new DsCAUUID();

			try {
				Guid cat  = PinCategory.Capture;
				Guid type = MediaType.Interleaved;
				Guid iid = typeof(IAMTVTuner).GUID;
				hr = bld.FindInterface( ref cat, ref type, flt, ref iid, out comObj );
				if( hr != 0 )
				{
					type = MediaType.Video;
					hr = bld.FindInterface( ref cat, ref type, flt, ref iid, out comObj );
					if( hr != 0 )
						return false;
				}
				spec = comObj as ISpecifyPropertyPages;
				if( spec == null )
					return false;

				hr = spec.GetPages( out cauuid );
				hr = OleCreatePropertyFrame( hwnd, 30, 30, null, 1,
						ref comObj, cauuid.cElems, cauuid.pElems, 0, 0, IntPtr.Zero );
				return true;
			}
			catch( Exception ee )
			{
				Trace.WriteLine( "!Ds.NET: ShowCapPinDialog " + ee.Message );
				return false;
			}
			finally
			{
				if( cauuid.pElems != IntPtr.Zero )
					Marshal.FreeCoTaskMem( cauuid.pElems );
					
				spec = null;
				if( comObj != null )
					Marshal.ReleaseComObject( comObj ); comObj = null;
			}
		}
 public override void Show(Control owner)
 {
     DsCAUUID pPages = new DsCAUUID();
     try
     {
         int pages = this.specifyPropertyPages.GetPages(out pPages);
         if (pages != 0)
         {
             Marshal.ThrowExceptionForHR(pages);
         }
         object specifyPropertyPages = this.specifyPropertyPages;
         pages = OleCreatePropertyFrame(owner.Handle, 30, 30, null, 1, ref specifyPropertyPages, pPages.cElems, pPages.pElems, 0, 0, IntPtr.Zero);
     }
     finally
     {
         if (pPages.pElems != IntPtr.Zero)
         {
             Marshal.FreeCoTaskMem(pPages.pElems);
         }
     }
 }
		/// <summary> 
		///  Returns the object as an ISpecificPropertyPage
		///  if the object supports the ISpecificPropertyPage
		///  interface and has at least one property page.
		/// </summary>
		protected bool addIfSupported(object o, string name)
		{
			ISpecifyPropertyPages specifyPropertyPages = null;
			DsCAUUID cauuid = new DsCAUUID();
			bool wasAdded = false;

			// Determine if the object supports the interface
			// and has at least 1 property page
			try
			{
				specifyPropertyPages = o as ISpecifyPropertyPages;
				if ( specifyPropertyPages != null )
				{
					int hr = specifyPropertyPages.GetPages( out cauuid );
					if ( ( hr != 0 ) || ( cauuid.cElems <= 0 ) )
						specifyPropertyPages = null;
				}
			}
			finally
			{
				if( cauuid.pElems != IntPtr.Zero )
					Marshal.FreeCoTaskMem( cauuid.pElems );
			}
			
			// Add the page to the internal collection
			if ( specifyPropertyPages != null )
			{
				DirectShowPropertyPage p = new DirectShowPropertyPage( name, specifyPropertyPages );
				InnerList.Add( p );
				wasAdded = true;
			}
			return( wasAdded );
		}