ne0bot/dspack

Video Capture device driver settings form

Opened this issue · 3 comments

Hi.

I want to put a TButton to open the device settings of a video capture device 
(webcam,...) to change sensibility, exposition, saturation,... parameters. This 
settings form ins't the same ... It's depending of the driver and the device in 
use.

Here I put a screen-capture of what i'm looking for...

How I can to that?

Thanks for the help!

Regards.

Original issue reported on code.google.com by axeldeli...@gmail.com on 20 Jan 2014 at 8:01

Attachments:

I am too. I want to open "Capture Properties" of a video capture (webcam).

Thanks before ...

Original comment by tbadmia...@gmail.com on 5 Jul 2014 at 4:23

Attachments:

I did.

First, I changed the TFilter on the DSPack.pas, moving the private function 
"function GetFilter: IBaseFilter;" to the public area, like this:

// *****************************************************************************
//  TFilter
// *****************************************************************************

  { This component is an easy way to add a specific filter to a filter graph.
    You can retrieve an interface using the as operator whith D6 :)}
  TFilter = class(TComponent, IFilter)
  private
    FFilterGraph : TFilterGraph;
    FBaseFilter: TBaseFilter;
    FFilter: IBaseFilter;
    //function GetFilter: IBaseFilter;
    function GetName: string;
    procedure NotifyFilter(operation: TFilterOperation; Param: integer = 0);
    procedure SetFilterGraph(AFilterGraph: TFilterGraph);
  protected
    {@exclude}
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  public
    { Constructor method. }
    constructor Create(AOwner: TComponent); override;
    { Destructor method. }
    destructor Destroy; override;
    { Retrieve a filter interface. }
    function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
    function GetFilter: IBaseFilter;
  published
    { This is the Filter Editor .}
    property BaseFilter: TBaseFilter read FBaseFilter write FBaseFilter;
    { The filter must be connected to a TFilterGraph component.}
    property FilterGraph: TFilterGraph read FFilterGraph write SetFilterGraph;
  end;

{

Now, the example:

Add the functions below to a Unit.pas that can access your VideoFilter 
Component and the VideoWindow Component. Replace my "VideoFilter" and 
"VideoWindow" by your components names, and call the first function 
"ShowPropertyDialog" from a button or something else. Done, the code will 
display the Property Dialog of your device :-)

Off course, you can try to pass the VideoWindow and VideoFilter trought the 
functions or create a new VideoWindow component with this feature. But now, you 
have the idea how to do it.

The code below works fine on my DELPHI 5! So, certainly it will works on all 
the new versions ^^

}

function ShowPropertyDialog(): HResult;
var
  FilterInfo: FILTER_INFO;
begin
  Result := VideoFilter.GetFilter.QueryFilterInfo(FilterInfo);
  if not(Failed(Result)) then
    Result := ShowPropertyDialogEx(VideoFilter.GetFilter, FilterInfo.achName);
end;

function ShowPropertyDialogEx(const IBF: IUnknown;
  FilterName: PWideChar): HResult;
var
  pProp: ISpecifyPropertyPages;
  c: tagCAUUID;
begin
  pProp  := nil;
  Result := IBF.QueryInterface(ISpecifyPropertyPages, pProp);
  if Result = S_OK then
  begin
    Result := pProp.GetPages(c);
    if (Result = S_OK) and (c.cElems > 0) then
    begin
      Result := OleCreatePropertyFrame(VideoWindow.Handle, 0, 0,
        FilterName, 1, @IBF, c.cElems, c.pElems, 0, 0, nil);
      CoTaskMemFree(c.pElems);
    end;
  end;
end; 

Original comment by sylvio.r...@gmail.com on 14 Oct 2014 at 1:01

You can use function from DXSUtil

e.g. 
ShowFilterPropertyPage(Self.Handle, VideoFilter as IBaseFilter);

Original comment by kobylans...@gmail.com on 12 Nov 2014 at 3:48