PROP_DUMP_IMAGE,
PROP_DEBUG_FLAGS,
PROP_DISABLE_LOW_RES_CROP,
+ PROP_DRAW_CORNER_MARKERS,
} GstV4L2CamSrcProperties;
"disable software crop on unsupported low resolution frame size", FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_DRAW_CORNER_MARKERS,
+ g_param_spec_boolean ("draw-corner-markers", "draw markers in frame corners",
+ "draw markers in frame corners", FALSE,
+ G_PARAM_READWRITE));
+
camera_class->is_open = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_is_open);
camera_class->open = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_open);
camera_class->close = GST_DEBUG_FUNCPTR (gst_v4l2camsrc_close);
v4l2camsrc->raw_output_size = 0;
v4l2camsrc->debug_flags = DEFAULT_DEBUG_FLAGS;
v4l2camsrc->disable_low_res_crop = FALSE;
+ v4l2camsrc->draw_corner_markers = FALSE;
v4l2camsrc->device_mutex = g_mutex_new ();
case PROP_DISABLE_LOW_RES_CROP:
v4l2camsrc->disable_low_res_crop = g_value_get_boolean (value);
break;
+ case PROP_DRAW_CORNER_MARKERS:
+ v4l2camsrc->draw_corner_markers = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_DISABLE_LOW_RES_CROP:
g_value_set_boolean (value, v4l2camsrc->disable_low_res_crop);
break;
+ case PROP_DRAW_CORNER_MARKERS:
+ g_value_set_boolean (value, v4l2camsrc->draw_corner_markers);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
return ret;
}
+static void draw_corner_markers_nv12(unsigned char *buf, unsigned w, unsigned h)
+{
+ int i,j;
+#define put_dot(x,y) buf[(x)+w*(y)] = (((x+y)&0x01)?0x00:0xff)
+
+ for(j = 0; j < 4; ++j)
+ for(i = 0; i < 8; ++i) {
+ put_dot(i, j); put_dot(w-1-i, j);
+ put_dot(j, i); put_dot(j, h-1-i);
+ put_dot(i, h-1-j); put_dot(w-1-i, h-1-j);
+ put_dot(w-1-j, i); put_dot(w-1-j, h-1-i);
+ }
+#undef put_dot
+}
+
/* Crop to upper left corner of NV12 frame. */
static gboolean crop_buffer_inplace_nv12(unsigned char *buf, unsigned in_w, unsigned in_h,
unsigned out_w, unsigned out_h)
in += in_w;
out += out_w;
}
-#if 0
- /* B/W Marker to top left corner */
-#define put_dot(x,y,c) buf[(y)*out_w+x] = c
- put_dot(0,0,0xff); put_dot(1,0,0x00); put_dot(2,0,0xff); put_dot(3,0,0x00); put_dot(4,0,0xff); put_dot(5,0,0x00); put_dot(6,0,0xff); put_dot(7,0,0x00);
- put_dot(0,1,0x00); put_dot(1,1,0xff); put_dot(2,1,0x00); put_dot(3,1,0xff); put_dot(4,1,0x00); put_dot(5,1,0xff); put_dot(6,1,0x00); put_dot(7,1,0xff);
- put_dot(0,2,0xff); put_dot(1,2,0x00);
- put_dot(0,3,0x00); put_dot(1,3,0xff);
- put_dot(0,4,0xff); put_dot(1,4,0x00);
- put_dot(0,5,0x00); put_dot(1,5,0xff);
- put_dot(0,6,0xff); put_dot(1,6,0x00);
- put_dot(0,7,0x00); put_dot(1,7,0xff);
-#undef put_dot
-#endif
return TRUE;
}
}
}
+ if(v4l2camsrc->draw_corner_markers)
+ draw_corner_markers_nv12(GST_BUFFER_DATA(pool_buffer),
+ v4l2camsrc->expected_capture_w, v4l2camsrc->expected_capture_h);
+
g_mutex_unlock (v4l2camsrc->pool->lock);
/* this can change at every frame, esp. with jpeg */