static void gst_v4l2src_class_init (GstV4l2SrcClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSrcClass *basesrc_class; GstPushSrcClass *pushsrc_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesrc_class = GST_BASE_SRC_CLASS (klass); pushsrc_class = GST_PUSH_SRC_CLASS (klass); gobject_class->dispose = gst_v4l2src_dispose; gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2src_finalize; gobject_class->set_property = gst_v4l2src_set_property; gobject_class->get_property = gst_v4l2src_get_property; element_class->change_state = gst_v4l2src_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE, g_param_spec_uint ("queue-size", "Queue size", "Number of buffers to be enqueud in the driver in streaming mode", GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ALWAYS_COPY, g_param_spec_boolean ("always-copy", "Always Copy", "If the buffer will or not be used directly from mmap", PROP_DEF_ALWAYS_COPY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstV4l2Src:decimate * * Only use every nth frame * * Since: 0.10.26 */ g_object_class_install_property (gobject_class, PROP_DECIMATE, g_param_spec_int ("decimate", "Decimate", "Only use every nth frame", 1, G_MAXINT, PROP_DEF_DECIMATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); basesrc_class->start = GST_DEBUG_FUNCPTR (gst_v4l2src_start); basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock); basesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock_stop); basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_v4l2src_stop); basesrc_class->query = GST_DEBUG_FUNCPTR (gst_v4l2src_query); basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_v4l2src_fixate); basesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_v4l2src_negotiate); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_v4l2src_create); }
static void gst_v4l2sink_class_init (GstV4l2SinkClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSinkClass *basesink_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->dispose = gst_v4l2sink_dispose; gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2sink_finalize; gobject_class->set_property = gst_v4l2sink_set_property; gobject_class->get_property = gst_v4l2sink_get_property; element_class->change_state = gst_v4l2sink_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE, g_param_spec_uint ("queue-size", "Queue size", "Number of buffers to be enqueud in the driver in streaming mode", GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_TOP, g_param_spec_int ("overlay-top", "Overlay top", "The topmost (y) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_LEFT, g_param_spec_int ("overlay-left", "Overlay left", "The leftmost (x) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH, g_param_spec_uint ("overlay-width", "Overlay width", "The width of the video overlay; default is equal to negotiated image width", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT, g_param_spec_uint ("overlay-height", "Overlay height", "The height of the video overlay; default is equal to negotiated image height", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_PHYS_BASE, g_param_spec_uint ("phys-base", "Physical base", "The physical address base of the frame buffers", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); basesink_class->preroll = GST_DEBUG_FUNCPTR (gst_v4l2sink_preroll_frame); basesink_class->render = GST_DEBUG_FUNCPTR (gst_v4l2sink_show_frame); }
static void gst_v4l2src_class_init (GstV4l2SrcClass * klass) { GObjectClass *gobject_class; GstBaseSrcClass *basesrc_class; GstPushSrcClass *pushsrc_class; gobject_class = G_OBJECT_CLASS (klass); basesrc_class = GST_BASE_SRC_CLASS (klass); pushsrc_class = GST_PUSH_SRC_CLASS (klass); gobject_class->dispose = gst_v4l2src_dispose; gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2src_finalize; gobject_class->set_property = gst_v4l2src_set_property; gobject_class->get_property = gst_v4l2src_get_property; gst_v4l2_object_install_properties_helper (gobject_class); g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE, g_param_spec_uint ("queue-size", "Queue size", "Number of buffers to be enqueud in the driver", GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, GST_V4L2_MIN_BUFFERS, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_ALWAYS_COPY, g_param_spec_boolean ("always-copy", "Always Copy", "If the buffer will or not be used directly from mmap", DEFAULT_PROP_ALWAYS_COPY, G_PARAM_READWRITE)); basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); basesrc_class->start = GST_DEBUG_FUNCPTR (gst_v4l2src_start); basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_v4l2src_stop); basesrc_class->query = GST_DEBUG_FUNCPTR (gst_v4l2src_query); basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_v4l2src_fixate); basesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_v4l2src_negotiate); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_v4l2src_create); }
static void gst_v4l2src_class_init (GstV4l2SrcClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSrcClass *basesrc_class; GstPushSrcClass *pushsrc_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesrc_class = GST_BASE_SRC_CLASS (klass); pushsrc_class = GST_PUSH_SRC_CLASS (klass); gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2src_finalize; gobject_class->set_property = gst_v4l2src_set_property; gobject_class->get_property = gst_v4l2src_get_property; element_class->change_state = gst_v4l2src_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); /** * GstV4l2Src::prepare-format: * @v4l2src: the v4l2src instance * @fd: the file descriptor of the current device * @caps: the caps of the format being set * * This signal gets emitted before calling the v4l2 VIDIOC_S_FMT ioctl * (set format). This allows for any custom configuration of the device to * happen prior to the format being set. * This is mostly useful for UVC H264 encoding cameras which need the H264 * Probe & Commit to happen prior to the normal Probe & Commit. * * Since: 0.10.32 */ gst_v4l2_signals[SIGNAL_PRE_SET_FORMAT] = g_signal_new ("prepare-format", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, GST_TYPE_CAPS); gst_element_class_set_static_metadata (element_class, "Video (video4linux2) Source", "Source/Video", "Reads frames from a Video4Linux2 device", "Edgard Lima <*****@*****.**>, " "Stefan Kost <*****@*****.**>"); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, gst_v4l2_object_get_all_caps ())); basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); basesrc_class->start = GST_DEBUG_FUNCPTR (gst_v4l2src_start); basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock); basesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock_stop); basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_v4l2src_stop); basesrc_class->query = GST_DEBUG_FUNCPTR (gst_v4l2src_query); basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_v4l2src_fixate); basesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_v4l2src_negotiate); basesrc_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_v4l2src_decide_allocation); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_v4l2src_create); klass->v4l2_class_devices = NULL; GST_DEBUG_CATEGORY_INIT (v4l2src_debug, "v4l2src", 0, "V4L2 source element"); }
static void gst_v4l2sink_class_init (GstV4l2SinkClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSinkClass *basesink_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2sink_finalize; gobject_class->set_property = gst_v4l2sink_set_property; gobject_class->get_property = gst_v4l2sink_get_property; element_class->change_state = gst_v4l2sink_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); g_object_class_install_property (gobject_class, PROP_OVERLAY_TOP, g_param_spec_int ("overlay-top", "Overlay top", "The topmost (y) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_LEFT, g_param_spec_int ("overlay-left", "Overlay left", "The leftmost (x) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH, g_param_spec_uint ("overlay-width", "Overlay width", "The width of the video overlay; default is equal to negotiated image width", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT, g_param_spec_uint ("overlay-height", "Overlay height", "The height of the video overlay; default is equal to negotiated image height", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CROP_TOP, g_param_spec_int ("crop-top", "Crop top", "The topmost (y) coordinate of the video crop; top left corner of image is 0,0", 0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_LEFT, g_param_spec_int ("crop-left", "Crop left", "The leftmost (x) coordinate of the video crop; top left corner of image is 0,0", 0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_WIDTH, g_param_spec_uint ("crop-width", "Crop width", "The width of the video crop; default is equal to negotiated image width", 0, 0xffffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_HEIGHT, g_param_spec_uint ("crop-height", "Crop height", "The height of the video crop; default is equal to negotiated image height", 0, 0xffffffff, 0, G_PARAM_READWRITE)); gst_element_class_set_static_metadata (element_class, "Video (video4linux2) Sink", "Sink/Video", "Displays frames on a video4linux2 device", "Rob Clark <*****@*****.**>,"); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, gst_v4l2_object_get_all_caps ())); basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); basesink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_v4l2sink_propose_allocation); basesink_class->render = GST_DEBUG_FUNCPTR (gst_v4l2sink_show_frame); klass->v4l2_class_devices = NULL; GST_DEBUG_CATEGORY_INIT (v4l2sink_debug, "v4l2sink", 0, "V4L2 sink element"); }
static void gst_v4l2src_class_init (GstV4l2SrcClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSrcClass *basesrc_class; GstPushSrcClass *pushsrc_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesrc_class = GST_BASE_SRC_CLASS (klass); pushsrc_class = GST_PUSH_SRC_CLASS (klass); gobject_class->dispose = gst_v4l2src_dispose; gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2src_finalize; gobject_class->set_property = gst_v4l2src_set_property; gobject_class->get_property = gst_v4l2src_get_property; element_class->change_state = gst_v4l2src_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE, g_param_spec_uint ("queue-size", "Queue size", "Number of buffers to be enqueud in the driver in streaming mode", GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ALWAYS_COPY, g_param_spec_boolean ("always-copy", "Always Copy", "If the buffer will or not be used directly from mmap", PROP_DEF_ALWAYS_COPY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstV4l2Src:decimate * * Only use every nth frame * * Since: 0.10.26 */ g_object_class_install_property (gobject_class, PROP_DECIMATE, g_param_spec_int ("decimate", "Decimate", "Only use every nth frame", 1, G_MAXINT, PROP_DEF_DECIMATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstV4l2Src::prepare-format: * @v4l2src: the v4l2src instance * @fd: the file descriptor of the current device * @fourcc: the fourcc of the format being set * @width: The width of the video * @height: The height of the video * * This signal gets emitted before calling the v4l2 VIDIOC_S_FMT ioctl * (set format). This allows for any custom configuration of the device to * happen prior to the format being set. * This is mostly useful for UVC H264 encoding cameras which need the H264 * Probe & Commit to happen prior to the normal Probe & Commit. * * Since: 0.10.32 */ gst_v4l2_signals[SIGNAL_PRE_SET_FORMAT] = g_signal_new ("prepare-format", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, __gst_v4l2_marshal_VOID__INT_UINT_UINT_UINT, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); basesrc_class->start = GST_DEBUG_FUNCPTR (gst_v4l2src_start); basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock); basesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_v4l2src_unlock_stop); basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_v4l2src_stop); basesrc_class->query = GST_DEBUG_FUNCPTR (gst_v4l2src_query); basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_v4l2src_fixate); basesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_v4l2src_negotiate); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_v4l2src_create); }
static void gst_v4l2sink_class_init (GstV4l2SinkClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstBaseSinkClass *basesink_class; gobject_class = G_OBJECT_CLASS (klass); element_class = GST_ELEMENT_CLASS (klass); basesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->dispose = gst_v4l2sink_dispose; gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2sink_finalize; gobject_class->set_property = gst_v4l2sink_set_property; gobject_class->get_property = gst_v4l2sink_get_property; element_class->change_state = gst_v4l2sink_change_state; gst_v4l2_object_install_properties_helper (gobject_class, DEFAULT_PROP_DEVICE); g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE, g_param_spec_uint ("queue-size", "Queue size", "Number of buffers to be enqueud in the driver in streaming mode", GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MIN_QUEUED_BUFS, g_param_spec_uint ("min-queued-bufs", "Minimum queued bufs", "Minimum number of queued bufs; v4l2sink won't dqbuf if the driver " "doesn't have more than this number (which normally you shouldn't change)", 0, GST_V4L2_MAX_BUFFERS, PROP_DEF_MIN_QUEUED_BUFS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_TOP, g_param_spec_int ("overlay-top", "Overlay top", "The topmost (y) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_LEFT, g_param_spec_int ("overlay-left", "Overlay left", "The leftmost (x) coordinate of the video overlay; top left corner of screen is 0,0", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH, g_param_spec_uint ("overlay-width", "Overlay width", "The width of the video overlay; default is equal to negotiated image width", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT, g_param_spec_uint ("overlay-height", "Overlay height", "The height of the video overlay; default is equal to negotiated image height", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CROP_TOP, g_param_spec_int ("crop-top", "Crop top", "The topmost (y) coordinate of the video crop; top left corner of image is 0,0", 0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_LEFT, g_param_spec_int ("crop-left", "Crop left", "The leftmost (x) coordinate of the video crop; top left corner of image is 0,0", 0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_WIDTH, g_param_spec_uint ("crop-width", "Crop width", "The width of the video crop; default is equal to negotiated image width", 0, 0xffffffff, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_CROP_HEIGHT, g_param_spec_uint ("crop-height", "Crop height", "The height of the video crop; default is equal to negotiated image height", 0, 0xffffffff, 0, G_PARAM_READWRITE)); basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); basesink_class->render = GST_DEBUG_FUNCPTR (gst_v4l2sink_show_frame); }