Export (0) Print
Expand All

IAMStreamConfig::GetFormat method

The GetFormat method retrieves the current or preferred output format.

Syntax


HRESULT GetFormat(
  [out] AM_MEDIA_TYPE **pmt
);

Parameters

pmt [out]

Address of a pointer to an AM_MEDIA_TYPE structure.

Return value

Returns an HRESULT value. Possible values include the following.

Return codeDescription
S_OK

Success.

E_OUTOFMEMORY

Insufficient memory.

E_POINTER

NULL pointer value.

VFW_E_NOT_CONNECTED

The input pin is not connected.

 

Remarks

If the pin is connected, this method returns the format that the pin is currently using. Otherwise, the method returns the pin's preferred format for the next pin connection. If you have already called the IAMStreamConfig::SetFormat method to set the format, GetFormat returns the same format. If not, it returns the first format in the pin's list of preferred formats, as determined by the IPin::EnumMediaTypes method.

The method allocates the memory for the AM_MEDIA_TYPE structure, fills in the structure, and returns it in the pmt parameter. The caller must release the memory, including the format block. You can use the DeleteMediaType helper function in the base class library.

On some compression filters, the method fails if the filter's input pin is not connected.

Examples



IAMStreamConfig *pConfig = NULL;
// Query the output pin for IAMStreamConfig (not shown).
AM_MEDIA_TYPE *pmt = NULL;
hr = pConfig->GetFormat(&pmt);
if (SUCCEEDED(hr))
{
    /* Examine the media type for any information you need. */
    DeleteMediaType(pmt);
}
pConfig->Release();


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Strmif.h (include Dshow.h)

Library

Strmiids.lib

See also

Error and Success Codes
IAMStreamConfig Interface

 

 

Community Additions

ADD
Show:
© 2015 Microsoft