summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2006-01-31 15:36:13 +0000
committerAndy Wingo <wingo@pobox.com>2006-01-31 15:36:13 +0000
commit1b35856376a04fa72c29c8850324437cb2a38d3c (patch)
tree573160f47d3033fcd140ed75059ba30671cf8b25 /sys
parentb017cd2588b782806b5373aa93e686b6d04d1c8f (diff)
sys/v4l/gstv4lsrc.c (gst_v4lsrc_set_caps): Don't segfault if the caps being set doesn't have a framerate value. Basic...
Original commit message from CVS: 2006-01-31 Andy Wingo <wingo@pobox.com> * sys/v4l/gstv4lsrc.c (gst_v4lsrc_set_caps): Don't segfault if the caps being set doesn't have a framerate value. Basically a stopgap measure. * ext/ogg/gstoggmux.c (GST_BUFFER_END_TIME): New macro. Not technically correct enough to put into core though. (gst_ogg_mux_dequeue_page): Use END_TIME instead of TIMESTAMP + DURATION. Fixes theoraenc ! oggmux. * sys/v4l/gstv4lsrc.c (gst_v4lsrc_fixate): Fixate to the nearest fraction, not double.
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l/gstv4lsrc.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c
index 012e1c01..71671292 100644
--- a/sys/v4l/gstv4lsrc.c
+++ b/sys/v4l/gstv4lsrc.c
@@ -236,7 +236,7 @@ gst_v4lsrc_fixate (GstPad * pad, GstCaps * caps)
gst_structure_fixate_field_nearest_int (structure, "width", targetwidth);
gst_structure_fixate_field_nearest_int (structure, "height", targetheight);
- gst_structure_fixate_field_nearest_double (structure, "framerate", 7.5);
+ gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);
v = gst_structure_get_value (structure, "format");
if (v && G_VALUE_TYPE (v) != GST_TYPE_FOURCC) {
@@ -496,26 +496,28 @@ gst_v4lsrc_set_caps (GstBaseSrc * src, GstCaps * caps)
gst_structure_get_int (structure, "height", &h);
new_fps = gst_structure_get_value (structure, "framerate");
- GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
- gst_value_get_fraction_numerator (new_fps),
- gst_value_get_fraction_denominator (new_fps));
-
/* set framerate if it's not already correct */
if (!gst_v4lsrc_get_fps (v4lsrc, &cur_fps_n, &cur_fps_d))
return FALSE;
- if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
- gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
- int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
- (gst_value_get_fraction_denominator (new_fps) * 15);
-
- GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
- /* set bits 16 to 21 to 0 */
- vwin->flags &= (0x3F00 - 1);
- /* set bits 16 to 21 to the index */
- vwin->flags |= fps_index << 16;
- if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
- return FALSE;
+ if (new_fps) {
+ GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
+ gst_value_get_fraction_numerator (new_fps),
+ gst_value_get_fraction_denominator (new_fps));
+
+ if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
+ gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
+ int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
+ (gst_value_get_fraction_denominator (new_fps) * 15);
+
+ GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
+ /* set bits 16 to 21 to 0 */
+ vwin->flags &= (0x3F00 - 1);
+ /* set bits 16 to 21 to the index */
+ vwin->flags |= fps_index << 16;
+ if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
+ return FALSE;
+ }
}
}