Jump to content

DShow capture filter


Recommended Posts

I tried to insert the $_GUID and $_SIZE in the structure as plain variables

Local $_VIDEO_STREAM_CONFIG_CAPS = $_GUID & _
     "ULONG VideoStandard;" & _
     $_SIZE & _
     $_SIZE & _
     $_SIZE & _
     "int     CropGranularityX;" & _
     "int     CropGranularityY;" & _
     "int     CropAlignX;" & _
                         ........

In both way I loose the identification names 'guid', 'InputSize' etc:

"GUID guid;" & _

"ULONG VideoStandard;" & _

"SIZE InputSize;" & _

"SIZE MinCroppingSize;" & _

The struct's size is 128, so it's correct.

After the object call the struct is correctly filled.

But I don't get a correct answer in the other struct AM_MEDIA:

Local $pConfig
    $hr = $oBuild.FindInterface($PIN_CATEGORY_CAPTURE,$MEDIATYPE_Video,$oCapture,$sIID_IAMStreamConfig,$pConfig)
    $oStreamConfig = ObjCreateInterface($pConfig, $sIID_IAMStreamConfig, $tagIAMStreamConfig)

    Local $_GUID = "DWORD Data1;" & _
      "WORD  Data2;" & _
      "WORD  Data3;" & _
      "BYTE  Data4[8];"
    Local $tGuid = DllStructCreate($_GUID)
    
    Local $_SIZE = "LONG cx;" & _
      "LONG cy;"
    Local $tSize = DllStructCreate($_SIZE)
    
    Local $_VIDEO_STREAM_CONFIG_CAPS = $_GUID & _
      "ULONG    VideoStandard;" & _
      $_SIZE & _
      $_SIZE & _
      $_SIZE & _
      "int    CropGranularityX;" & _
      "int    CropGranularityY;" & _
      "int    CropAlignX;" & _
      "int    CropAlignY;" & _
      $_SIZE & _
      $_SIZE & _
      "int    OutputGranularityX;" & _
      "int    OutputGranularityY;" & _
      "int    StretchTapsX;" & _
      "int    StretchTapsY;" & _
      "int    ShrinkTapsX;" & _
      "int    ShrinkTapsY;" & _
      "int64     MinFrameInterval;" & _
      "int64     MaxFrameInterval;" & _
      "LONG  MinBitsPerSecond;" & _
      "LONG  MaxBitsPerSecond;"
    ;VIDEO_STREAM_CONFIG_CAPS;  
    Local $tVideoStream = DllStructCreate($_VIDEO_STREAM_CONFIG_CAPS)
    Local $size = DllStructGetSize($tVideoStream)
                
    local $iCount=0,$iSize=0
  $oStreamConfig.GetNumberOfCapabilities($iCount,$iSize)
    ;~ // Check the size to make sure we pass in the correct structure. 
  ConsoleWrite('oCount: ' & $iCount & ' size:' & $iSize & @CRLF)
  if DllStructGetSize($tVideoStream) == $iSize Then

    For $iFormat = 0 To $iCount step 1

        local $scc= DllStructGetPtr($tVideoStream), $pmtConfig
         $hr = $oStreamConfig.GetStreamCaps($iFormat, $pmtConfig, $scc); this returns, 0 so it's ok
      
    Next

  EndIf

$scc is filled correctly.

The object as an answer, it should give me $pmtConfig as a pointer (in fact I get a number) to the struct AM_MEDIA, so I

created a struct:

Local $_AM_MEDIA =   $_GUID & _
    $_GUID  & _
    'BOOL    bFixedSizeSamples;' & _
    'BOOL    bTemporalCompression;' & _
    'ULONG    lSampleSize;' & _
    $_GUID & _
    'ptr pUnk;' & _
    'ULONG    cbFormat;' & _
    'BYTE    pbFormat'
  Local $t_AM_MEDIA = DllStructCreate($_AM_MEDIA)

and call it :

ConsoleWrite(DllStructGetData($t_AM_MEDIA,1,$pmtConfig)

but it gives me @error = 3 (index would be outside of the struct) ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...