mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
mfvideosrc: Check framerate for target IMediaFrameFormat selection
Not only resolution and format, but framerate needs to be checked for proper target IMediaFrameFormat selection. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
This commit is contained in:
parent
3fb8caf635
commit
479a67c1b7
1 changed files with 23 additions and 0 deletions
|
@ -787,6 +787,8 @@ MediaCaptureWrapper::mediaCaptureInitPost (ComPtr<IAsyncAction> init_async,
|
||||||
HString subtype;
|
HString subtype;
|
||||||
UINT32 width = 0;
|
UINT32 width = 0;
|
||||||
UINT32 height = 0;
|
UINT32 height = 0;
|
||||||
|
UINT32 fps_n = 0;
|
||||||
|
UINT32 fps_d = 1;
|
||||||
|
|
||||||
hr = formatList->GetAt (i, &fmt);
|
hr = formatList->GetAt (i, &fmt);
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
|
@ -813,6 +815,27 @@ MediaCaptureWrapper::mediaCaptureInitPost (ComPtr<IAsyncAction> init_async,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = fmt->get_FrameRate (&ratio);
|
||||||
|
if (!gst_mf_result (hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hr = ratio->get_Numerator (&fps_n);
|
||||||
|
if (!gst_mf_result (hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hr = ratio->get_Denominator (&fps_d);
|
||||||
|
if (!gst_mf_result (hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((gint) fps_n != GST_VIDEO_INFO_FPS_N (&videoInfo) ||
|
||||||
|
(gint) fps_d != GST_VIDEO_INFO_FPS_D (&videoInfo)) {
|
||||||
|
GST_DEBUG ("IMediaFrameFormat[%d], framerate %d/%d is not equal to "
|
||||||
|
"target framerate %d/%d", i, width, height,
|
||||||
|
GST_VIDEO_INFO_FPS_N (&videoInfo),
|
||||||
|
GST_VIDEO_INFO_FPS_D (&videoInfo));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: check major type for audio */
|
/* TODO: check major type for audio */
|
||||||
hr = fmt->get_Subtype (subtype.GetAddressOf ());
|
hr = fmt->get_Subtype (subtype.GetAddressOf ());
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
|
|
Loading…
Reference in a new issue