summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales <ylatuya@gmail.com>2010-07-29 16:08:03 +0200
committerJulien Isorce <julien.isorce@gmail.com>2010-07-29 16:08:03 +0200
commit0390f0d765545dcf4669b1e9592a133b223f6a8a (patch)
treef392a063726d315877042c7d7cdceb6eb4e79a28
parentc7b195740ec07c6d3849970a008ffa479c055d16 (diff)
dshowvideosrc: don't make a range if min==max
Fixes bug #625138
-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 b916dccf6..b2d577b71 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,
417{ 417{
418 GstCaps *video_caps = NULL; 418 GstCaps *video_caps = NULL;
419 GstStructure *video_structure = NULL; 419 GstStructure *video_structure = NULL;
420 gint min_w, max_w;
421 gint min_h, max_h;
422 gint min_fr, max_fr;
420 423
421 /* raw video format */ 424 /* raw video format */
422 switch (video_format) { 425 switch (video_format) {
@@ -462,14 +465,31 @@ gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar * name,
462 /* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */ 465 /* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */
463 /* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */ 466 /* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
464 467
465 gst_structure_set (video_structure, 468 min_w = pin_mediatype->vscc.MinOutputSize.cx;
466 "width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, 469 max_w = pin_mediatype->vscc.MaxOutputSize.cx;
467 pin_mediatype->vscc.MaxOutputSize.cx, "height", GST_TYPE_INT_RANGE, 470 min_h = pin_mediatype->vscc.MinOutputSize.cy;
468 pin_mediatype->vscc.MinOutputSize.cy, 471 max_h = pin_mediatype->vscc.MaxOutputSize.cy;
469 pin_mediatype->vscc.MaxOutputSize.cy, "framerate", 472 min_fr = (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval);
470 GST_TYPE_FRACTION_RANGE, 473 max_fr = (gint)(10000000 / pin_mediatype->vscc.MinFrameInterval);
471 (gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1, 474
472 (gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1, NULL); 475 if (min_w == max_w)
476 gst_structure_set (video_structure, "width", G_TYPE_INT, min_w, NULL);
477 else
478 gst_structure_set (video_structure,
479 "width", GST_TYPE_INT_RANGE, min_w, max_w, NULL);
480
481 if (min_h == max_h)
482 gst_structure_set (video_structure, "height", G_TYPE_INT, min_h, NULL);
483 else
484 gst_structure_set (video_structure,
485 "height", GST_TYPE_INT_RANGE, min_h, max_h, NULL);
486
487 if (min_fr == max_fr)
488 gst_structure_set (video_structure, "framerate",
489 GST_TYPE_FRACTION, min_fr, 1, NULL);
490 else
491 gst_structure_set (video_structure, "framerate",
492 GST_TYPE_FRACTION_RANGE, min_fr, 1, max_fr, 1, NULL);
473 493
474 return video_caps; 494 return video_caps;
475} 495}