Media Foundation Core APIs
This section provides detailed documentation for the core interfaces, structures, and enumerations that form the foundation of the Media Foundation framework. These components are essential for understanding and implementing media playback, encoding, and processing capabilities in Windows applications.
Key Concepts
Understanding the following concepts is crucial for working with Media Foundation:
- Media Sources: Components responsible for reading media data from various sources (files, network streams, capture devices).
- Media Sinks: Components responsible for writing media data to destinations (files, network streams, display devices).
- Media Session: The central orchestrator that manages the pipeline of media sources, transformations, and sinks.
- Topology: A graph representing the data flow within the Media Foundation pipeline.
- Attributes: A key-value pair system used to configure and query objects within Media Foundation.
Core Interfaces
-
IMFMediaSource
Represents a source of media data.
-
IMFMediaSink
Represents a destination for media data.
-
IMFMediaSession
Manages the playback of media.
-
IMFTopology
Represents the structure of the media processing graph.
-
IMFAttributes
Provides access to an object's attributes.
-
IMFTransform
Represents a media transformation component (e.g., decoder, encoder, effect).
-
IMFMediaType
Describes the format of media data.
Core Structures and Enumerations
-
MFPINT
Structure representing a time interval.
-
MFTIME
Represents time values in Media Foundation.
-
MFVideoArea
Defines a rectangular area within a video frame.
-
D3D11_VIDEO_PROCESSOR_CONTENT_DESC
Describes the content being processed by a D3D11 video processor.
-
MF_ATTRIBUTES_MATCH_TYPE
Enumeration for attribute matching.
-
MF_OBJECT_TYPE
Enumeration for identifying object types.
Related Topics
- Media Foundation Architecture
- Creating a Media Foundation Pipeline
- Working with Media Types
- Event Handling in Media Foundation
Code Example Snippet
Here's a basic C++ snippet demonstrating how to query for an interface:
Microsoft::WRL::ComPtr<IMFMediaSource> pSource;
HRESULT hr = pUnknown->QueryInterface(__uuidof(IMFMediaSource), (void**)&pSource);
if (SUCCEEDED(hr))
{
// Successfully obtained IMFMediaSource interface
}