v4l2: use G_PARAM_STATIC_STRINGS to save a few bytes and strdups

This commit is contained in:
Stefan Kost 2010-06-21 12:15:14 +03:00
parent 5534c7d91d
commit f9fe85dbb2
3 changed files with 15 additions and 11 deletions

View File

@ -315,17 +315,19 @@ gst_v4l2_object_install_properties_helper (GObjectClass * gobject_class,
{ {
g_object_class_install_property (gobject_class, PROP_DEVICE, g_object_class_install_property (gobject_class, PROP_DEVICE,
g_param_spec_string ("device", "Device", "Device location", g_param_spec_string ("device", "Device", "Device location",
default_device, G_PARAM_READWRITE)); default_device, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DEVICE_NAME, g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
g_param_spec_string ("device-name", "Device name", g_param_spec_string ("device-name", "Device name",
"Name of the device", DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE)); "Name of the device", DEFAULT_PROP_DEVICE_NAME,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DEVICE_FD, g_object_class_install_property (gobject_class, PROP_DEVICE_FD,
g_param_spec_int ("device-fd", "File descriptor", g_param_spec_int ("device-fd", "File descriptor",
"File descriptor of the device", -1, G_MAXINT, DEFAULT_PROP_DEVICE_FD, "File descriptor of the device", -1, G_MAXINT, DEFAULT_PROP_DEVICE_FD,
G_PARAM_READABLE)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_FLAGS, g_object_class_install_property (gobject_class, PROP_FLAGS,
g_param_spec_flags ("flags", "Flags", "Device type flags", g_param_spec_flags ("flags", "Flags", "Device type flags",
GST_TYPE_V4L2_DEVICE_FLAGS, DEFAULT_PROP_FLAGS, G_PARAM_READABLE)); GST_TYPE_V4L2_DEVICE_FLAGS, DEFAULT_PROP_FLAGS,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
} }
GstV4l2Object * GstV4l2Object *

View File

@ -228,23 +228,25 @@ gst_v4l2sink_class_init (GstV4l2SinkClass * klass)
g_param_spec_uint ("queue-size", "Queue size", g_param_spec_uint ("queue-size", "Queue size",
"Number of buffers to be enqueud in the driver in streaming mode", "Number of buffers to be enqueud in the driver in streaming mode",
GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE,
G_PARAM_READWRITE)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_OVERLAY_TOP, g_object_class_install_property (gobject_class, PROP_OVERLAY_TOP,
g_param_spec_int ("overlay-top", "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", "The topmost (y) coordinate of the video overlay; top left corner of screen is 0,0",
0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); 0x80000000, 0x7fffffff, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_OVERLAY_LEFT, g_object_class_install_property (gobject_class, PROP_OVERLAY_LEFT,
g_param_spec_int ("overlay-left", "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", "The leftmost (x) coordinate of the video overlay; top left corner of screen is 0,0",
0x80000000, 0x7fffffff, 0, G_PARAM_READWRITE)); 0x80000000, 0x7fffffff, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH, g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH,
g_param_spec_uint ("overlay-width", "Overlay width", g_param_spec_uint ("overlay-width", "Overlay width",
"The width of the video overlay; default is equal to negotiated image width", "The width of the video overlay; default is equal to negotiated image width",
0, 0xffffffff, 0, G_PARAM_READWRITE)); 0, 0xffffffff, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT, g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT,
g_param_spec_uint ("overlay-height", "Overlay height", g_param_spec_uint ("overlay-height", "Overlay height",
"The height of the video overlay; default is equal to negotiated image height", "The height of the video overlay; default is equal to negotiated image height",
0, 0xffffffff, 0, G_PARAM_READWRITE)); 0, 0xffffffff, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_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->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps);

View File

@ -259,11 +259,11 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
g_param_spec_uint ("queue-size", "Queue size", g_param_spec_uint ("queue-size", "Queue size",
"Number of buffers to be enqueud in the driver in streaming mode", "Number of buffers to be enqueud in the driver in streaming mode",
GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE, GST_V4L2_MIN_BUFFERS, GST_V4L2_MAX_BUFFERS, PROP_DEF_QUEUE_SIZE,
G_PARAM_READWRITE)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ALWAYS_COPY, g_object_class_install_property (gobject_class, PROP_ALWAYS_COPY,
g_param_spec_boolean ("always-copy", "Always Copy", g_param_spec_boolean ("always-copy", "Always Copy",
"If the buffer will or not be used directly from mmap", "If the buffer will or not be used directly from mmap",
PROP_DEF_ALWAYS_COPY, G_PARAM_READWRITE)); PROP_DEF_ALWAYS_COPY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_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->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps);