dshowvideosrc: don't make a range if min==max

Fixes bug #625138
This commit is contained in:
Andoni Morales 2010-07-29 16:08:03 +02:00 committed by Julien Isorce
parent c7b195740e
commit 0390f0d765

View file

@ -417,6 +417,9 @@ gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar * name,
{ {
GstCaps *video_caps = NULL; GstCaps *video_caps = NULL;
GstStructure *video_structure = NULL; GstStructure *video_structure = NULL;
gint min_w, max_w;
gint min_h, max_h;
gint min_fr, max_fr;
/* raw video format */ /* raw video format */
switch (video_format) { switch (video_format) {
@ -462,14 +465,31 @@ gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar * name,
/* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */ /* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */
/* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */ /* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
min_w = pin_mediatype->vscc.MinOutputSize.cx;
max_w = pin_mediatype->vscc.MaxOutputSize.cx;
min_h = pin_mediatype->vscc.MinOutputSize.cy;
max_h = pin_mediatype->vscc.MaxOutputSize.cy;
min_fr = (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval);
max_fr = (gint)(10000000 / pin_mediatype->vscc.MinFrameInterval);
if (min_w == max_w)
gst_structure_set (video_structure, "width", G_TYPE_INT, min_w, NULL);
else
gst_structure_set (video_structure, gst_structure_set (video_structure,
"width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, "width", GST_TYPE_INT_RANGE, min_w, max_w, NULL);
pin_mediatype->vscc.MaxOutputSize.cx, "height", GST_TYPE_INT_RANGE,
pin_mediatype->vscc.MinOutputSize.cy, if (min_h == max_h)
pin_mediatype->vscc.MaxOutputSize.cy, "framerate", gst_structure_set (video_structure, "height", G_TYPE_INT, min_h, NULL);
GST_TYPE_FRACTION_RANGE, else
(gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1, gst_structure_set (video_structure,
(gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1, NULL); "height", GST_TYPE_INT_RANGE, min_h, max_h, NULL);
if (min_fr == max_fr)
gst_structure_set (video_structure, "framerate",
GST_TYPE_FRACTION, min_fr, 1, NULL);
else
gst_structure_set (video_structure, "framerate",
GST_TYPE_FRACTION_RANGE, min_fr, 1, max_fr, 1, NULL);
return video_caps; return video_caps;
} }