queue: Cleanup properties are installed caching the pspecs in an array

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7486>
This commit is contained in:
Thibault Saunier 2024-09-09 19:00:57 -03:00 committed by GStreamer Marge Bot
parent 9a71fa1f4b
commit 319439a1c0

View file

@ -122,9 +122,12 @@ enum
PROP_MIN_THRESHOLD_TIME, PROP_MIN_THRESHOLD_TIME,
PROP_LEAKY, PROP_LEAKY,
PROP_SILENT, PROP_SILENT,
PROP_FLUSH_ON_EOS PROP_FLUSH_ON_EOS,
PROP_LAST
}; };
GParamSpec *properties[PROP_LAST];
/* default property values */ /* default property values */
#define DEFAULT_MAX_SIZE_BUFFERS 200 /* 200 buffers */ #define DEFAULT_MAX_SIZE_BUFFERS 200 /* 200 buffers */
#define DEFAULT_MAX_SIZE_BYTES (10 * 1024 * 1024) /* 10 MB */ #define DEFAULT_MAX_SIZE_BYTES (10 * 1024 * 1024) /* 10 MB */
@ -314,63 +317,62 @@ gst_queue_class_init (GstQueueClass * klass)
NULL, G_TYPE_NONE, 0); NULL, G_TYPE_NONE, 0);
/* properties */ /* properties */
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BYTES, properties[PROP_CUR_LEVEL_BYTES] =
g_param_spec_uint ("current-level-bytes", "Current level (kB)", g_param_spec_uint ("current-level-bytes", "Current level (kB)",
"Current amount of data in the queue (bytes)", "Current amount of data in the queue (bytes)",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); 0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BUFFERS,
properties[PROP_CUR_LEVEL_BUFFERS] =
g_param_spec_uint ("current-level-buffers", "Current level (buffers)", g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
"Current number of buffers in the queue", "Current number of buffers in the queue",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); 0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_TIME,
properties[PROP_CUR_LEVEL_TIME] =
g_param_spec_uint64 ("current-level-time", "Current level (ns)", g_param_spec_uint64 ("current-level-time", "Current level (ns)",
"Current amount of data in the queue (in ns)", "Current amount of data in the queue (in ns)",
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BYTES, properties[PROP_MAX_SIZE_BYTES] =
g_param_spec_uint ("max-size-bytes", "Max. size (kB)", g_param_spec_uint ("max-size-bytes", "Max. size (kB)",
"Max. amount of data in the queue (bytes, 0=disable)", "Max. amount of data in the queue (bytes, 0=disable)",
0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES, 0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BUFFERS, properties[PROP_MAX_SIZE_BUFFERS] =
g_param_spec_uint ("max-size-buffers", "Max. size (buffers)", g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
"Max. number of buffers in the queue (0=disable)", 0, G_MAXUINT, "Max. number of buffers in the queue (0=disable)", 0, G_MAXUINT,
DEFAULT_MAX_SIZE_BUFFERS, DEFAULT_MAX_SIZE_BUFFERS,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_TIME, properties[PROP_MAX_SIZE_TIME] =
g_param_spec_uint64 ("max-size-time", "Max. size (ns)", g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
"Max. amount of data in the queue (in ns, 0=disable)", 0, G_MAXUINT64, "Max. amount of data in the queue (in ns, 0=disable)", 0, G_MAXUINT64,
DEFAULT_MAX_SIZE_TIME, DEFAULT_MAX_SIZE_TIME,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_BYTES, properties[PROP_MIN_THRESHOLD_BYTES] =
g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)", g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)",
"Min. amount of data in the queue to allow reading (bytes, 0=disable)", "Min. amount of data in the queue to allow reading (bytes, 0=disable)",
0, G_MAXUINT, 0, 0, G_MAXUINT, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_BUFFERS,
g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)",
"Min. number of buffers in the queue to allow reading (0=disable)", 0,
G_MAXUINT, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MIN_THRESHOLD_TIME,
g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)",
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_LEAKY, properties[PROP_MIN_THRESHOLD_BUFFERS] =
g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)",
"Min. number of buffers in the queue to allow reading (0=disable)", 0,
G_MAXUINT, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
properties[PROP_MIN_THRESHOLD_TIME] =
g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)",
"Min. amount of data in the queue to allow reading (in ns, 0=disable)",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
properties[PROP_LEAKY] =
g_param_spec_enum ("leaky", "Leaky", g_param_spec_enum ("leaky", "Leaky",
"Where the queue leaks, if at all", "Where the queue leaks, if at all",
GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* GstQueue:silent * GstQueue:silent
@ -378,11 +380,10 @@ gst_queue_class_init (GstQueueClass * klass)
* Don't emit queue signals. Makes queues more lightweight if no signals are * Don't emit queue signals. Makes queues more lightweight if no signals are
* needed. * needed.
*/ */
g_object_class_install_property (gobject_class, PROP_SILENT, properties[PROP_SILENT] =
g_param_spec_boolean ("silent", "Silent", g_param_spec_boolean ("silent", "Silent",
"Don't emit queue signals", FALSE, "Don't emit queue signals", FALSE,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
/** /**
* queue:flush-on-eos: * queue:flush-on-eos:
@ -399,12 +400,12 @@ gst_queue_class_init (GstQueueClass * klass)
* *
* Since: 1.2 * Since: 1.2
*/ */
g_object_class_install_property (gobject_class, PROP_FLUSH_ON_EOS, properties[PROP_FLUSH_ON_EOS] =
g_param_spec_boolean ("flush-on-eos", "Flush on EOS", g_param_spec_boolean ("flush-on-eos", "Flush on EOS",
"Discard all data in the queue when an EOS event is received", FALSE, "Discard all data in the queue when an EOS event is received", FALSE,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (gobject_class, PROP_LAST, properties);
gobject_class->finalize = gst_queue_finalize; gobject_class->finalize = gst_queue_finalize;
gst_element_class_set_static_metadata (gstelement_class, gst_element_class_set_static_metadata (gstelement_class,