summaryrefslogtreecommitdiff
authorAndoni Morales <ylatuya@gmail.com>2010-07-29 14:08:03 (GMT)
committer Julien Isorce <julien.isorce@gmail.com>2010-07-29 14:08:03 (GMT)
commit0390f0d765545dcf4669b1e9592a133b223f6a8a (patch) (side-by-side diff)
treef392a063726d315877042c7d7cdceb6eb4e79a28
parentc7b195740ec07c6d3849970a008ffa479c055d16 (diff)
downloadgst-plugins-bad-0390f0d765545dcf4669b1e9592a133b223f6a8a.zip
gst-plugins-bad-0390f0d765545dcf4669b1e9592a133b223f6a8a.tar.gz
dshowvideosrc: don't make a range if min==max
Fixes bug #625138
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--sys/dshowsrcwrapper/gstdshow.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/sys/dshowsrcwrapper/gstdshow.cpp b/sys/dshowsrcwrapper/gstdshow.cpp
index b916dcc..b2d577b 100644
--- a/sys/dshowsrcwrapper/gstdshow.cpp
+++ b/sys/dshowsrcwrapper/gstdshow.cpp
@@ -417,6 +417,9 @@ gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar * name,
{
GstCaps *video_caps = NULL;
GstStructure *video_structure = NULL;
+ gint min_w, max_w;
+ gint min_h, max_h;
+ gint min_fr, max_fr;
/* raw 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 */
/* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
- gst_structure_set (video_structure,
- "width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx,
- pin_mediatype->vscc.MaxOutputSize.cx, "height", GST_TYPE_INT_RANGE,
- pin_mediatype->vscc.MinOutputSize.cy,
- pin_mediatype->vscc.MaxOutputSize.cy, "framerate",
- GST_TYPE_FRACTION_RANGE,
- (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1,
- (gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1, NULL);
+ 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,
+ "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;
}