Method of set advanced properties for video capture device in DirectShow

Description

Problem Description

When using the Microsoft DirectShow SDK Developer capture card application software, the application is usually required to be able to set the interface of the input signal which comes from the video capture device, scale method of output image, and the de-interlacing method of output image. The following describes the method of set in DirectShow.
(If you use the SDK to develop, Correlation function can be called directly, Specifically refer to the development of the SDK documentation)

 Solutions

Advanced Properties settings for video equipment, mainly through the Video Capture Filter IKsPropertySet Interface Set () function to achieve it.

  1. #define STATIC_PROPSETID_XISTREAM_HDCAPTURE \
  2. 0xb445b920, 0xff5c, 0x42aa, 0xa5, 0xa2, 0×43, 0×77, 0x1b, 0×93, 0xeb, 0xef

    DEFINE_GUIDSTRUCT(“B445B920-FF5C-42aa-A5A2-43771B93EBEF”, PROPSETID_XISTREAM_HDCAPTURE);

  3. #define PROPSETID_XISTREAM_HDCAPTURE DEFINE_GUIDNAMED(PROPSETID_XISTREAM_HDCAPTURE)
  1. Set whether detect the input type automatically.

    1. KSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE = 13
    2. typedef struct
    3. {
    4.   BOOL bAutoDetectMode;
    5. } KSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE_S, *PKSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE_S;
    6. IKsPropertySet :: Set(
    7.   PROPSETID_XISTREAM_HDCAPTURE ,
    8.   KSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE,
    9.   NULL,
    10.   0,
    11.   &KSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE_S,
    12.   sizeof(KSPROPERTY_XISTREAM_HDCAPTURE_AUTO_DETECT_MODE_S));
  2. Screen zoom mode

    1. KSPROPERTY_XISTREAM_HDCAPTURE_SCALE = 9
    2. typedef enum
    3. {
    4.   XISTREAM_SCALE_DO_NOT_KEEP_ASPECT,
    5.   XISTREAM_SCALE_FILL_TO_KEEP_ASPECT,
    6.   XISTREAM_SCALE_ZOOM_TO_KEEP_ASPECT,
    7. } XISTREAM_SCALE_TYPE;
    • XICVBS(HD)_SCALE_DO_NOT_KEEP_ASPECT : Fill the output screen, not to protect the original aspect ratio.
    • XICVBS(HD)_SCALE_FILL_TO_KEEP_ASPECT : Maintain the original aspect ratio to fill the screen up and down or left and right black edges, if necessary, in the output.
    • XICVBS(HD)_SCALE_ZOOM_TO_KEEP_ASPECT : Maintain the original aspect ratio, if necessary, cut up and down or left and right pixels of the original picture.
    1. typedef struct
    2. {
    3.   DWORD dwSupportMasks; // Set properties fill 0
    4.   XISTREAM_SCALE_TYPE scaleType;
    5. } KSPROPERTY_XISTREAM_HDCAPTURE_SCALE_S, *PKSPROPERTY_XISTREAM_HDCAPTURE_SCALE_S;
    6. IKsPropertySet :: Set(
    7.    PROPSETID_XISTREAM_HDCAPTURE ,
    8.    KSPROPERTY_XISTREAM_HDCAPTURE_SCALE,
    9.    NULL,
    10.    0,
    11.    &KSPROPERTY_XISTREAM_HDCAPTURE_SCALE_S,
    12.    sizeof(KSPROPERTY_XISTREAM_HDCAPTURE_SCALE_S));
  3. Set the screen from interlaced to non-interlaced

    1. KSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE = 10
    2. typedef enum
    3. {
    4.  XISTREAM_DEINTERLACE_NONE,
    5.  XISTREAM_DEINTERLACE_BLEND,
    6.  XISTREAM_DEINTERLACE_MOTION_ADAPTIVE,
    7. } XISTREAM_DEINTERLACE_TYPE;
    • XIPCVBS(HD)_DEINTERLACE_NONE : do nothing.
    • XIPCVBS(HD)_DEINTERLACE_BLEND : Using Means algorithm to get signals from interlaced into non-interlaced.
    • XIPCVBS(HD)_DEINTERLACE_MOTION_ADAPTIVE : Using 3D motion-adaptive algorithm to get signals from interlaced into non-interlaced.
    1. typedef struct
    2. {
    3.   DWORD dwSupportMasks; // Set properties fill 0
    4.   XISTREAM_DEINTERLACE_TYPE deinterlaceType;
    5. } KSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE_S, *PKSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE_S;
    6. IKsPropertySet :: Set(
    7.    PROPSETID_XISTREAM_HDCAPTURE ,
    8.    KSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE,
    9.    NULL,
    10.    0,
    11.    &KSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE_S,
    12.    sizeof(KSPROPERTY_XISTREAM_HDCAPTURE_DEINTERLACE_S));

Share this product

forefront imaging product catalog

Forefront Imaging Product Catalog

We welcome you to download our latest catalog in .PDF format. (Please note: Adobe Acrobat reader is required to view .PDF files. Don't have Adobe Acrobat (Download for free!)