none
Enumerating supported Video Capture output sizes RRS feed

  • Question

  • Hello,


    I am trying to enumerate all the supported output sizes of my video capture card.

     

    My code is based on the following MSDN sample:

    http://msdn.microsoft.com/en-us/library/ms787898(VS.85).aspx

     

    I am using the OutputGranularityX and OutputGranularityY properties to build the resolutions list from the MinOutputSize to the MaxOutputSize as described in that article. This is what i do:

     

    for(int w = scc.MinOutputSize.cx; w <= scc.MaxOutputSize.cx; w += scc.OutputGranularityX)
    {
        for(int h = scc.MinOutputSize.cy; h <= scc.MaxOutputSize.cy; h += scc.OutputGranularityY)  

        {
            ...
        }
    }

     

    However i am ending up with a very long list (over 5000)  and obviously this is not the correct way.

    The params that are returned from my first call to GetStreamCaps are:

     

    scc.MinOutputSize.cx : 80
    scc.MinOutputSize.cy : 60
    scc.MaxOutputSize.cx : 720
    scc.MaxOutputSize.cy : 480

    scc.OutputGranularityX : 1
    scc.OutputGranularityY : 60


    I ran AmCap and looked at the Output Size dropdown of the property page of the Video Capture Pin but i see only 9 supported resolutions:

     

    80x60
    160x120
    240x180
    320x240
    352x240
    640x240
    640x480
    720x240
    720x480

     

    What am i doing wrong?

    Monday, October 6, 2008 12:28 AM

Answers

  • When you run AMCap you see the resolution list in a property page for a capture pin of the video source filter. Note that this code of outside AMCap project and in your project you can either offer the same [stock] property page or build up your own list of resolutions using IAMStreamConfig the way you did it (e.g. use well known resolutions that fit into obtained VIDEO_STREAM_CONFIG_CAPS).

    PS. For a list of available frame rates you can use
    IAMVideoControl:: GetFrameRateList
    Monday, October 6, 2008 8:55 AM

All replies

  • When you run AMCap you see the resolution list in a property page for a capture pin of the video source filter. Note that this code of outside AMCap project and in your project you can either offer the same [stock] property page or build up your own list of resolutions using IAMStreamConfig the way you did it (e.g. use well known resolutions that fit into obtained VIDEO_STREAM_CONFIG_CAPS).

    PS. For a list of available frame rates you can use
    IAMVideoControl:: GetFrameRateList
    Monday, October 6, 2008 8:55 AM
  • So the only way to build that list is to use a set of standard resolutions and to make sure that they "fit" according to the params of VIDEO_STREAM_CONFIG_CAPS?

     

    I know that AmCap is using a stock property page for that purpose. But i need to make my own custom dialog box.

     

    Thanx.

     

     Roman Ryltsov wrote:
    When you run AMCap you see the resolution list in a property page for a capture pin of the video source filter. Note that this code of outside AMCap project and in your project you can either offer the same [stock] property page or build up your own list of resolutions using IAMStreamConfig the way you did it (e.g. use well known resolutions that fit into obtained VIDEO_STREAM_CONFIG_CAPS).

    PS. For a list of available frame rates you can use
    IAMVideoControl:: GetFrameRateList

    Monday, October 6, 2008 1:02 PM
  • Could that help you? 

     IAMStreamConfig *pConfig = NULL;
        int iCount = 0, iSize = 0;
        hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
        hr = pCaptureGraph2->FindInterface(
            &PIN_CATEGORY_CAPTURE, // capture pin
            NULL, //  all media typ
            pCap, // Pointer of video capture filter
            IID_IAMStreamConfig, (void**)&pConfig);
        hr = pConfig->GetNumberOfCapabilities(
            &iCount, // Number of supported formats
            &iSize); // Size of configuration structure
        // test of configuration size to avoid errors
        if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
            hr = ConfigureVideoOuputPin(pConfig, iCount, iSize);
    Monday, October 6, 2008 1:38 PM
  • Well not really. My question was related to what is after your part of code.

    Also, i wanted to list the supported resolutions, not to configure my video pin.

    Thanx anyway.

     

     Mister-Zorg wrote:
    Could that help you? 

     IAMStreamConfig *pConfig = NULL;
        int iCount = 0, iSize = 0;
        hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
        hr = pCaptureGraph2->FindInterface(
            &PIN_CATEGORY_CAPTURE, // capture pin
            NULL, //  all media typ
            pCap, // Pointer of video capture filter
            IID_IAMStreamConfig, (void**)&pConfig);
        hr = pConfig->GetNumberOfCapabilities(
            &iCount, // Number of supported formats
            &iSize); // Size of configuration structure
        // test of configuration size to avoid errors
        if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
            hr = ConfigureVideoOuputPin(pConfig, iCount, iSize);

    Monday, October 6, 2008 1:44 PM
  • I see, then it´s better I give you the link of the full code.

    It´s looking for all your devices, then it prints out the supported resolution of the choosen device on an output file.

    Hope you don´t have problems with the french language:

    http://mathinfo.univ-reims.fr/Image/mmVideo/codes/04-CaptureWebcamMicro/16-IAMStreamConfig.cpp.html
    Monday, October 6, 2008 1:50 PM
  • No problems with french, but it seems that you are printing the input, not the output sizes:

     

    fprintf(fic, "Taille de sortie : %d %d\n", scc.InputSize.cx, scc.InputSize.cy);

     

     

     Mister-Zorg wrote:
    I see, then it´s better I give you the link of the full code.

    It´s looking for all your devices, then it prints out the supported resolution of the choosen device on an output file.

    Hope you don´t have problems with the french language:

    http://mathinfo.univ-reims.fr/Image/mmVideo/codes/04-CaptureWebcamMicro/16-IAMStreamConfig.cpp.html

    Monday, October 6, 2008 2:08 PM
  • Hope that do not mean with "it seems" "I don´t tried it".

    At least you have to adapte the code for your how needs.
    Monday, October 6, 2008 2:32 PM