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 */
gst_structure_set (video_structure, min_w = pin_mediatype->vscc.MinOutputSize.cx;
"width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, max_w = pin_mediatype->vscc.MaxOutputSize.cx;
pin_mediatype->vscc.MaxOutputSize.cx, "height", GST_TYPE_INT_RANGE, min_h = pin_mediatype->vscc.MinOutputSize.cy;
pin_mediatype->vscc.MinOutputSize.cy, max_h = pin_mediatype->vscc.MaxOutputSize.cy;
pin_mediatype->vscc.MaxOutputSize.cy, "framerate", min_fr = (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval);
GST_TYPE_FRACTION_RANGE, max_fr = (gint)(10000000 / pin_mediatype->vscc.MinFrameInterval);
(gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1,
(gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1, NULL); if (min_w == max_w)
gst_structure_set (video_structure, "width", G_TYPE_INT, min_w, NULL);
else
gst_structure_set (video_structure,
"width", GST_TYPE_INT_RANGE, min_w, max_w, NULL);
if (min_h == max_h)
gst_structure_set (video_structure, "height", G_TYPE_INT, min_h, NULL);
else
gst_structure_set (video_structure,
"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;
} }