diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2015-11-27 09:03:51 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-11-27 12:48:09 +0000 |
commit | 3026d1094b0041c9d43279cdb6a441391c6e6170 (patch) | |
tree | e6f52e860794605fb93bcc8e8ffa55a15585f10d | |
parent | a400d504ca25ba3812a563a4cac94ef2bf910b2a (diff) |
rtph264pay: change config-interval property type from uint to int
This way we can use -1 as special value, which is nicer than MAXUINT.
This is backwards compatible even with the GValue API, as shown by
a unit test.
https://bugzilla.gnome.org/show_bug.cgi?id=757892
-rw-r--r-- | gst/rtp/gstrtph264pay.c | 8 | ||||
-rw-r--r-- | gst/rtp/gstrtph264pay.h | 2 | ||||
-rw-r--r-- | tests/check/elements/rtp-payloading.c | 25 |
3 files changed, 30 insertions, 5 deletions
diff --git a/gst/rtp/gstrtph264pay.c b/gst/rtp/gstrtph264pay.c index ea1aa50c2..af25e739f 100644 --- a/gst/rtp/gstrtph264pay.c +++ b/gst/rtp/gstrtph264pay.c @@ -124,11 +124,11 @@ gst_rtp_h264_pay_class_init (GstRtpH264PayClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CONFIG_INTERVAL, - g_param_spec_uint ("config-interval", + g_param_spec_int ("config-interval", "SPS PPS Send Interval", "Send SPS and PPS Insertion Interval in seconds (sprop parameter sets " "will be multiplexed in the data stream when detected.) (0 = disabled)", - 0, 3600, DEFAULT_CONFIG_INTERVAL, + -1, 3600, DEFAULT_CONFIG_INTERVAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS) ); @@ -1373,7 +1373,7 @@ gst_rtp_h264_pay_set_property (GObject * object, guint prop_id, rtph264pay->update_caps = TRUE; break; case PROP_CONFIG_INTERVAL: - rtph264pay->spspps_interval = g_value_get_uint (value); + rtph264pay->spspps_interval = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1394,7 +1394,7 @@ gst_rtp_h264_pay_get_property (GObject * object, guint prop_id, g_value_set_string (value, rtph264pay->sprop_parameter_sets); break; case PROP_CONFIG_INTERVAL: - g_value_set_uint (value, rtph264pay->spspps_interval); + g_value_set_int (value, rtph264pay->spspps_interval); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/rtp/gstrtph264pay.h b/gst/rtp/gstrtph264pay.h index 44f7af440..c5a5e9fb6 100644 --- a/gst/rtp/gstrtph264pay.h +++ b/gst/rtp/gstrtph264pay.h @@ -71,7 +71,7 @@ struct _GstRtpH264Pay GstAdapter *adapter; - guint spspps_interval; + gint spspps_interval; gboolean send_spspps; GstClockTime last_spspps; diff --git a/tests/check/elements/rtp-payloading.c b/tests/check/elements/rtp-payloading.c index f19306be2..3af1d6cac 100644 --- a/tests/check/elements/rtp-payloading.c +++ b/tests/check/elements/rtp-payloading.c @@ -615,6 +615,31 @@ GST_START_TEST (rtp_h264) rtp_h264_frame_count, "video/x-h264,stream-format=(string)byte-stream,alignment=(string)nal", "rtph264pay", "rtph264depay", 0, 0, FALSE); + + /* config-interval property used to be of uint type, was changed to int, + * make sure old GValue stuff still works */ + { + GValue val = G_VALUE_INIT; + GstElement *rtph264pay; + GParamSpec *pspec; + + + rtph264pay = gst_element_factory_make ("rtph264pay", NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (rtph264pay), + "config-interval"); + fail_unless (pspec->value_type == G_TYPE_INT); + g_value_init (&val, G_TYPE_UINT); + g_value_set_uint (&val, 10); + g_object_set_property (G_OBJECT (rtph264pay), "config-interval", &val); + g_value_set_uint (&val, 0); + g_object_get_property (G_OBJECT (rtph264pay), "config-interval", &val); + fail_unless_equals_int (10, g_value_get_uint (&val)); + g_object_set (G_OBJECT (rtph264pay), "config-interval", -1, NULL); + g_object_get_property (G_OBJECT (rtph264pay), "config-interval", &val); + fail_unless (g_value_get_uint (&val) == G_MAXUINT); + g_value_unset (&val); + gst_object_unref (rtph264pay); + } } GST_END_TEST; |