iam
iam

Reputation: 1713

Is IMFSourceReader::GetNativeMediaType equivalent to IMFMediaTypeHandler::GetMediaTypeByIndex?

Assuming they are from the same source etc is:

IMFMediaTypeHandler::GetMediaTypeByIndex(mediaTypeIndex, mediaType)

equivalent to:

IMFSourceReader::GetNativeMediaType(streamIndex, mediaTypeIndex, mediaType)

Is there correspondance between mediaTypeIndex parameters in both cases? And what does this mean with respect to using MFCreateSourceReaderFromMediaSource() with the following attribute set:

attributes->SetUINT32(MF_READWRITE_DISABLE_CONVERTERS, TRUE);

Upvotes: 1

Views: 449

Answers (2)

Roman Ryltsov
Roman Ryltsov

Reputation: 69642

The methods are likely to be equivalent even though they don't have to. If you are using a Source Reader on top of a media source, you delegate the control over media source to reader instance and, generally speaking, you are not supposed to access IMFMediaTypeHandler because source reader runs in assumption it has exclusive control over the thing.

It is unlikely that MF_READWRITE_DISABLE_CONVERTERS has effect on enumeration on native media types because converters jump in to match requested media type to one of the native media types.

Upvotes: 1

mofo77
mofo77

Reputation: 1515

I would says yes :

IMFMediaTypeHandler::GetMediaTypeByIndex

Retrieves a media type from the object's list of supported media types.

IMFSourceReader::GetNativeMediaType

but capture devices might offer several formats.

(I think "list of supported media types" == "might offer several formats", in the example of capture).

And because both implement GetCurrentMediaType. But I must admit that it is not guaranteed.

For MF_READWRITE_DISABLE_CONVERTERS, it will do some conversion when calling SetInput type, if necessary, and if FALSE. So no relationship with GetMediaTypeByIndex/GetNativeMediaType, but only with GetCurrentMediaType, from my point of view.

Upvotes: 1

Related Questions