2 * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
3 * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
28 #include <gst/rtp/gstrtpbuffer.h>
29 #include <gst/pbutils/pbutils.h>
30 #include <gst/video/video.h>
32 /* Included to not duplicate gst_rtp_h265_add_vps_sps_pps () */
33 #include "gstrtph265depay.h"
35 #include "gstrtph265pay.h"
38 GST_DEBUG_CATEGORY_STATIC (rtph265pay_debug);
39 #define GST_CAT_DEFAULT (rtph265pay_debug)
43 * Internet Draft RTP Payload Format for High Efficiency Video Coding
45 * draft-ietf-payload-rtp-h265-03.txt
47 * This draft will be replaced with an RFC, so some details may change.
51 static GstStaticPadTemplate gst_rtp_h265_pay_sink_template =
52 GST_STATIC_PAD_TEMPLATE ("sink",
56 /* Only bytestream format supported for now */
58 "stream-format = (string) hvc1, alignment = (string) au; "
60 "stream-format = (string) hev1, alignment = (string) au; " */
62 "stream-format = (string) byte-stream, alignment = (string) { nal, au }")
65 static GstStaticPadTemplate gst_rtp_h265_pay_src_template =
66 GST_STATIC_PAD_TEMPLATE ("src",
69 GST_STATIC_CAPS ("application/x-rtp, "
70 "media = (string) \"video\", "
71 "payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
72 "clock-rate = (int) 90000, " "encoding-name = (string) \"H265\"")
73 /** optional parameters **/
74 /* "profile-space = (int) [ 0, 3 ], " */
75 /* "profile-id = (int) [ 0, 31 ], " */
76 /* "tier-flag = (int) [ 0, 1 ], " */
77 /* "level-id = (int) [ 0, 255 ], " */
78 /* "interop-constraints = (string) ANY, " */
79 /* "profile-compatibility-indicator = (string) ANY, " */
80 /* "sprop-sub-layer-id = (int) [ 0, 6 ], " */
81 /* "recv-sub-layer-id = (int) [ 0, 6 ], " */
82 /* "max-recv-level-id = (int) [ 0, 255 ], " */
83 /* "tx-mode = (string) {MST , SST}, " */
84 /* "sprop-vps = (string) ANY, " */
85 /* "sprop-sps = (string) ANY, " */
86 /* "sprop-pps = (string) ANY, " */
87 /* "sprop-sei = (string) ANY, " */
88 /* "max-lsr = (int) ANY, " *//* MUST be in the range of MaxLumaSR to 16 * MaxLumaSR, inclusive */
89 /* "max-lps = (int) ANY, " *//* MUST be in the range of MaxLumaPS to 16 * MaxLumaPS, inclusive */
90 /* "max-cpb = (int) ANY, " *//* MUST be in the range of MaxCPB to 16 * MaxCPB, inclusive */
91 /* "max-dpb = (int) [1, 16], " */
92 /* "max-br = (int) ANY, " *//* MUST be in the range of MaxBR to 16 * MaxBR, inclusive, for the highest level */
93 /* "max-tr = (int) ANY, " *//* MUST be in the range of MaxTileRows to 16 * MaxTileRows, inclusive, for the highest level */
94 /* "max-tc = (int) ANY, " *//* MUST be in the range of MaxTileCols to 16 * MaxTileCols, inclusive, for the highest level */
95 /* "max-fps = (int) ANY, " */
96 /* "sprop-max-don-diff = (int) [0, 32767], " */
97 /* "sprop-depack-buf-nalus = (int) [0, 32767], " */
98 /* "sprop-depack-buf-nalus = (int) [0, 4294967295], " */
99 /* "depack-buf-cap = (int) [1, 4294967295], " */
100 /* "sprop-segmentation-id = (int) [0, 3], " */
101 /* "sprop-spatial-segmentation-idc = (string) ANY, " */
102 /* "dec-parallel-cap = (string) ANY, " */
105 #define DEFAULT_SPROP_PARAMETER_SETS NULL
106 #define DEFAULT_CONFIG_INTERVAL 0
111 PROP_SPROP_PARAMETER_SETS,
115 #define IS_ACCESS_UNIT(x) (((x) > 0x00) && ((x) < 0x06))
117 static void gst_rtp_h265_pay_finalize (GObject * object);
119 static void gst_rtp_h265_pay_set_property (GObject * object, guint prop_id,
120 const GValue * value, GParamSpec * pspec);
121 static void gst_rtp_h265_pay_get_property (GObject * object, guint prop_id,
122 GValue * value, GParamSpec * pspec);
124 static GstCaps *gst_rtp_h265_pay_getcaps (GstRTPBasePayload * payload,
125 GstPad * pad, GstCaps * filter);
126 static gboolean gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload,
128 static GstFlowReturn gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * pad,
130 static gboolean gst_rtp_h265_pay_sink_event (GstRTPBasePayload * payload,
132 static GstStateChangeReturn gst_rtp_h265_pay_change_state (GstElement *
133 element, GstStateChange transition);
135 #define gst_rtp_h265_pay_parent_class parent_class
136 G_DEFINE_TYPE (GstRtpH265Pay, gst_rtp_h265_pay, GST_TYPE_RTP_BASE_PAYLOAD);
139 gst_rtp_h265_pay_class_init (GstRtpH265PayClass * klass)
141 GObjectClass *gobject_class;
142 GstElementClass *gstelement_class;
143 GstRTPBasePayloadClass *gstrtpbasepayload_class;
145 gobject_class = (GObjectClass *) klass;
146 gstelement_class = (GstElementClass *) klass;
147 gstrtpbasepayload_class = (GstRTPBasePayloadClass *) klass;
149 gobject_class->set_property = gst_rtp_h265_pay_set_property;
150 gobject_class->get_property = gst_rtp_h265_pay_get_property;
152 g_object_class_install_property (G_OBJECT_CLASS (klass),
153 PROP_SPROP_PARAMETER_SETS, g_param_spec_string ("sprop-parameter-sets",
154 "sprop-parameter-sets",
155 "The base64 sprop-parameter-sets to set in out caps (set to NULL to "
156 "extract from stream)",
157 DEFAULT_SPROP_PARAMETER_SETS,
158 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
160 g_object_class_install_property (G_OBJECT_CLASS (klass),
161 PROP_CONFIG_INTERVAL,
162 g_param_spec_int ("config-interval",
163 "VPS SPS PPS Send Interval",
164 "Send VPS, SPS and PPS Insertion Interval in seconds (sprop parameter sets "
165 "will be multiplexed in the data stream when detected.) (0 = disabled)",
166 -1, 3600, DEFAULT_CONFIG_INTERVAL,
167 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
170 gobject_class->finalize = gst_rtp_h265_pay_finalize;
172 gst_element_class_add_pad_template (gstelement_class,
173 gst_static_pad_template_get (&gst_rtp_h265_pay_src_template));
174 gst_element_class_add_pad_template (gstelement_class,
175 gst_static_pad_template_get (&gst_rtp_h265_pay_sink_template));
177 gst_element_class_set_static_metadata (gstelement_class, "RTP H265 payloader",
178 "Codec/Payloader/Network/RTP",
179 "Payload-encode H265 video into RTP packets (based on draft-ietf-payload-rtp-h265-03.txt)",
180 "Jurgen Slowack <jurgenslowack@gmail.com>");
182 gstelement_class->change_state =
183 GST_DEBUG_FUNCPTR (gst_rtp_h265_pay_change_state);
185 gstrtpbasepayload_class->get_caps = gst_rtp_h265_pay_getcaps;
186 gstrtpbasepayload_class->set_caps = gst_rtp_h265_pay_setcaps;
187 gstrtpbasepayload_class->handle_buffer = gst_rtp_h265_pay_handle_buffer;
188 gstrtpbasepayload_class->sink_event = gst_rtp_h265_pay_sink_event;
190 GST_DEBUG_CATEGORY_INIT (rtph265pay_debug, "rtph265pay", 0,
191 "H265 RTP Payloader");
195 gst_rtp_h265_pay_init (GstRtpH265Pay * rtph265pay)
197 rtph265pay->queue = g_array_new (FALSE, FALSE, sizeof (guint));
198 rtph265pay->profile = 0;
199 rtph265pay->sps = g_ptr_array_new_with_free_func (
200 (GDestroyNotify) gst_buffer_unref);
201 rtph265pay->pps = g_ptr_array_new_with_free_func (
202 (GDestroyNotify) gst_buffer_unref);
203 rtph265pay->vps = g_ptr_array_new_with_free_func (
204 (GDestroyNotify) gst_buffer_unref);
205 rtph265pay->last_vps_sps_pps = -1;
206 rtph265pay->vps_sps_pps_interval = DEFAULT_CONFIG_INTERVAL;
208 rtph265pay->adapter = gst_adapter_new ();
212 gst_rtp_h265_pay_clear_vps_sps_pps (GstRtpH265Pay * rtph265pay)
214 g_ptr_array_set_size (rtph265pay->vps, 0);
215 g_ptr_array_set_size (rtph265pay->sps, 0);
216 g_ptr_array_set_size (rtph265pay->pps, 0);
220 gst_rtp_h265_pay_finalize (GObject * object)
222 GstRtpH265Pay *rtph265pay;
224 rtph265pay = GST_RTP_H265_PAY (object);
226 g_array_free (rtph265pay->queue, TRUE);
228 g_ptr_array_free (rtph265pay->sps, TRUE);
229 g_ptr_array_free (rtph265pay->pps, TRUE);
230 g_ptr_array_free (rtph265pay->vps, TRUE);
232 g_free (rtph265pay->sprop_parameter_sets);
234 g_object_unref (rtph265pay->adapter);
236 G_OBJECT_CLASS (parent_class)->finalize (object);
239 static const gchar all_levels[][4] = {
256 gst_rtp_h265_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
259 GstCaps *template_caps;
260 GstCaps *allowed_caps;
263 gboolean append_unrestricted;
267 gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), NULL);
269 if (allowed_caps == NULL)
273 gst_static_pad_template_get_caps (&gst_rtp_h265_pay_sink_template);
275 if (gst_caps_is_any (allowed_caps)) {
276 caps = gst_caps_ref (template_caps);
280 if (gst_caps_is_empty (allowed_caps)) {
281 caps = gst_caps_ref (allowed_caps);
285 caps = gst_caps_new_empty ();
287 append_unrestricted = FALSE;
288 for (i = 0; i < gst_caps_get_size (allowed_caps); i++) {
289 GstStructure *s = gst_caps_get_structure (allowed_caps, i);
290 GstStructure *new_s = gst_structure_new_empty ("video/x-h265");
291 const gchar *profile_level_id;
293 profile_level_id = gst_structure_get_string (s, "profile-level-id");
295 if (profile_level_id && strlen (profile_level_id) == 6) { /* Code taken from gstrtph264pay.c, needs to be revised for H.265 */
296 const gchar *profile;
301 spsint = strtol (profile_level_id, NULL, 16);
302 sps[0] = spsint >> 16;
303 sps[1] = spsint >> 8;
306 profile = gst_codec_utils_h265_get_profile (sps, 3);
307 level = gst_codec_utils_h265_get_level (sps, 3);
309 if (profile && level) {
310 GST_LOG_OBJECT (payload, "In caps, have profile %s and level %s",
313 if (!strcmp (profile, "main"))
314 gst_structure_set (new_s, "profile", G_TYPE_STRING, profile, NULL);
317 GValue profiles = { 0, };
319 g_value_init (&profiles, GST_TYPE_LIST);
320 g_value_init (&val, G_TYPE_STRING);
322 g_value_set_static_string (&val, profile);
323 gst_value_list_append_value (&profiles, &val);
325 g_value_set_static_string (&val, "main");
326 gst_value_list_append_value (&profiles, &val);
328 gst_structure_take_value (new_s, "profile", &profiles);
331 if (!strcmp (level, "1"))
332 gst_structure_set (new_s, "level", G_TYPE_STRING, level, NULL);
334 GValue levels = { 0, };
338 g_value_init (&levels, GST_TYPE_LIST);
339 g_value_init (&val, G_TYPE_STRING);
341 for (j = 0; j < G_N_ELEMENTS (all_levels); j++) {
342 g_value_set_static_string (&val, all_levels[j]);
343 gst_value_list_prepend_value (&levels, &val);
344 if (!strcmp (level, all_levels[j]))
347 gst_structure_take_value (new_s, "level", &levels);
350 /* Invalid profile-level-id means main */
352 gst_structure_set (new_s, "profile", G_TYPE_STRING, "main", NULL);
355 /* No profile-level-id means main or unrestricted */
357 gst_structure_set (new_s, "profile", G_TYPE_STRING, "main", NULL);
358 append_unrestricted = TRUE;
361 caps = gst_caps_merge_structure (caps, new_s);
364 if (append_unrestricted) {
366 gst_caps_merge_structure (caps, gst_structure_new ("video/x-h265", NULL,
370 icaps = gst_caps_intersect (caps, template_caps);
371 gst_caps_unref (caps);
376 gst_caps_unref (template_caps);
377 gst_caps_unref (allowed_caps);
379 GST_LOG_OBJECT (payload, "returning caps %" GST_PTR_FORMAT, caps);
383 /* take the currently configured VPS, SPS and PPS lists and set them on the caps as
384 * sprop-parameter-sets */
386 gst_rtp_h265_pay_set_vps_sps_pps (GstRTPBasePayload * basepayload)
388 GstRtpH265Pay *payloader = GST_RTP_H265_PAY (basepayload);
397 sprops = g_string_new ("");
400 GST_DEBUG_OBJECT (payloader,
401 "Entering function gst_rtp_h265_pay_set_vps_sps_pps");
403 /* build the sprop-parameter-sets */
404 for (i = 0; i < payloader->vps->len; i++) {
406 GST_BUFFER_CAST (g_ptr_array_index (payloader->vps, i));
408 gst_buffer_map (vps_buf, &map, GST_MAP_READ);
409 set = g_base64_encode (map.data, map.size);
410 gst_buffer_unmap (vps_buf, &map);
412 g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
416 for (i = 0; i < payloader->sps->len; i++) {
418 GST_BUFFER_CAST (g_ptr_array_index (payloader->sps, i));
420 gst_buffer_map (sps_buf, &map, GST_MAP_READ);
421 set = g_base64_encode (map.data, map.size);
422 gst_buffer_unmap (sps_buf, &map);
424 g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
428 for (i = 0; i < payloader->pps->len; i++) {
430 GST_BUFFER_CAST (g_ptr_array_index (payloader->pps, i));
432 gst_buffer_map (pps_buf, &map, GST_MAP_READ);
433 set = g_base64_encode (map.data, map.size);
434 gst_buffer_unmap (pps_buf, &map);
436 g_string_append_printf (sprops, "%s%s", count ? "," : "", set);
441 if (G_LIKELY (count)) {
442 /* profile is 24 bit. Force it to respect the limit */
443 profile = g_strdup_printf ("%06x", payloader->profile & 0xffffff);
444 /* combine into output caps */
445 res = gst_rtp_base_payload_set_outcaps (basepayload,
446 "sprop-parameter-sets", G_TYPE_STRING, sprops->str, NULL);
449 res = gst_rtp_base_payload_set_outcaps (basepayload, NULL);
451 g_string_free (sprops, TRUE);
458 gst_rtp_h265_pay_setcaps (GstRTPBasePayload * basepayload, GstCaps * caps)
460 GstRtpH265Pay *rtph265pay;
467 const gchar *alignment, *stream_format;
470 rtph265pay = GST_RTP_H265_PAY (basepayload);
472 str = gst_caps_get_structure (caps, 0);
474 /* we can only set the output caps when we found the sprops and profile
476 gst_rtp_base_payload_set_options (basepayload, "video", TRUE, "H265", 90000);
478 rtph265pay->alignment = GST_H265_ALIGNMENT_UNKNOWN;
479 alignment = gst_structure_get_string (str, "alignment");
481 if (g_str_equal (alignment, "au"))
482 rtph265pay->alignment = GST_H265_ALIGNMENT_AU;
483 if (g_str_equal (alignment, "nal"))
484 rtph265pay->alignment = GST_H265_ALIGNMENT_NAL;
487 rtph265pay->stream_format = GST_H265_STREAM_FORMAT_UNKNOWN;
488 stream_format = gst_structure_get_string (str, "stream-format");
490 if (g_str_equal (stream_format, "hvc1"))
491 rtph265pay->stream_format = GST_H265_STREAM_FORMAT_HVC1;
492 if (g_str_equal (stream_format, "hev1"))
493 rtph265pay->stream_format = GST_H265_STREAM_FORMAT_HEV1;
494 if (g_str_equal (stream_format, "byte-stream"))
495 rtph265pay->stream_format = GST_H265_STREAM_FORMAT_BYTESTREAM;
498 /* packetized HEVC video has a codec_data */
499 if ((value = gst_structure_get_value (str, "codec_data"))) {
500 guint num_vps, num_sps, num_pps;
503 GST_DEBUG_OBJECT (rtph265pay, "have packetized h265");
505 buffer = gst_value_get_buffer (value);
507 gst_buffer_map (buffer, &map, GST_MAP_READ);
511 /* parse the hevcC data */
513 goto hevcc_too_small;
514 /* HEVCDecoderConfigurationVersion (must be 1) */
518 /* profile_space | tier_flag | profile_idc */
519 rtph265pay->profile = data[1];
520 GST_DEBUG_OBJECT (rtph265pay, "profile %06x", rtph265pay->profile);
522 /* profile_compatibility_flags */
523 for (i = 2; i < 6; i++) {
524 for (j = 7; j >= 0; j--) {
525 GST_DEBUG_OBJECT (rtph265pay, "profile_compatibility_flag %06x",
530 GST_DEBUG_OBJECT (rtph265pay, "progressive_source_flag %06x",
532 GST_DEBUG_OBJECT (rtph265pay, "interlaced_source_flag %06x",
534 GST_DEBUG_OBJECT (rtph265pay, "non_packed_constraint_flag %06x",
536 GST_DEBUG_OBJECT (rtph265pay, "frame_only_constraint_flag %06x",
539 GST_DEBUG_OBJECT (rtph265pay, "level_idc %06x", data[12]);
541 GST_DEBUG_OBJECT (rtph265pay, "min_spatial_segmentation_idc %06x",
542 ((data[13] ^ 0xf0) << 8) + data[14]);
543 GST_DEBUG_OBJECT (rtph265pay, "parrallelismType %06x (ignored by paloader)",
546 GST_DEBUG_OBJECT (rtph265pay, "sps_chroma_format_idc %06x",
548 GST_DEBUG_OBJECT (rtph265pay, "bit_depth_luma_minus8 %06x",
550 GST_DEBUG_OBJECT (rtph265pay, "bit_depth_chroma_minus8 %06x",
552 GST_DEBUG_OBJECT (rtph265pay, "avgFrameRate %06x", data[19]);
553 GST_DEBUG_OBJECT (rtph265pay, "avgFrameRate %06x", data[20]);
555 /* constFrameRate(2 bits): 0, stream may or may not be of constant framerate
556 * numTemporalLayers (3 bits): number of temporal layers, value from SPS
557 * TemporalIdNested (1 bit): sps_temporal_id_nesting_flag from SPS
558 * lengthSizeMinusOne (2 bits): plus 1 indicates the length of the NALUnitLength */
559 GST_DEBUG_OBJECT (rtph265pay, "constFrameRate %06x",
560 (data[21] >> 6) & 0x03);
561 GST_DEBUG_OBJECT (rtph265pay, "numTemporalLayers %06x",
562 (data[21] >> 3) & 0x07);
563 GST_DEBUG_OBJECT (rtph265pay, "temporal_id_nesting_flag %06x",
564 (data[21] >> 2) & 0x01);
566 rtph265pay->nal_length_size = (data[21] & 0x3) + 1;
567 GST_DEBUG_OBJECT (rtph265pay, "nal length %u", rtph265pay->nal_length_size);
569 num_arrays = GST_READ_UINT8 (data + 22);
574 if (num_arrays > 0) {
575 if (data[0] == (0x00 | 0x20)) { /* VPS */
578 num_vps = data[0] << 8 | data[1];
582 for (i = 0; i < num_vps; i++) {
589 nal_size = (data[0] << 8) | data[1];
593 GST_LOG_OBJECT (rtph265pay, "VPS %d size %d", i, nal_size);
598 /* make a buffer out of it and add to VPS list */
599 vps_buf = gst_buffer_new_and_alloc (nal_size);
600 gst_buffer_fill (vps_buf, 0, data, nal_size);
601 gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
602 rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, vps_buf);
611 if (num_arrays > 0) {
612 if (data[0] == (0x00 | 0x21)) { /* SPS */
615 num_sps = data[0] << 8 | data[1];
619 for (i = 0; i < num_sps; i++) {
626 nal_size = (data[0] << 8) | data[1];
630 GST_LOG_OBJECT (rtph265pay, "SPS %d size %d", i, nal_size);
635 /* make a buffer out of it and add to SPS list */
636 sps_buf = gst_buffer_new_and_alloc (nal_size);
637 gst_buffer_fill (sps_buf, 0, data, nal_size);
638 gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
639 rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, sps_buf);
648 if (num_arrays > 0) {
649 if (data[0] == (0x00 | 0x22)) { /* PPS */
652 num_pps = data[0] << 8 | data[1];
656 for (i = 0; i < num_pps; i++) {
663 nal_size = (data[0] << 8) | data[1];
667 GST_LOG_OBJECT (rtph265pay, "PPS %d size %d", i, nal_size);
672 /* make a buffer out of it and add to PPS list */
673 pps_buf = gst_buffer_new_and_alloc (nal_size);
674 gst_buffer_fill (pps_buf, 0, data, nal_size);
675 gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay),
676 rtph265pay->vps, rtph265pay->sps, rtph265pay->pps, pps_buf);
685 /* and update the caps with the collected data */
686 if (!gst_rtp_h265_pay_set_vps_sps_pps (basepayload))
687 goto set_vps_sps_pps_failed;
689 GST_DEBUG_OBJECT (rtph265pay, "Caps have been set");
691 gst_buffer_unmap (buffer, &map);
693 GST_DEBUG_OBJECT (rtph265pay, "have bytestream h265");
700 GST_ERROR_OBJECT (rtph265pay, "hevcC size %" G_GSIZE_FORMAT " < 7", size);
705 GST_ERROR_OBJECT (rtph265pay, "wrong hevcC version");
710 GST_ERROR_OBJECT (rtph265pay, "hevcC too small ");
713 set_vps_sps_pps_failed:
715 GST_ERROR_OBJECT (rtph265pay, "failed to set vps/sps/pps");
720 gst_buffer_unmap (buffer, &map);
726 gst_rtp_h265_pay_parse_sprop_parameter_sets (GstRtpH265Pay * rtph265pay)
734 ps = rtph265pay->sprop_parameter_sets;
738 gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
740 params = g_strsplit (ps, ",", 0);
741 len = g_strv_length (params);
743 GST_DEBUG_OBJECT (rtph265pay, "we have %d params", len);
745 for (i = 0; params[i]; i++) {
752 nal_len = strlen (params[i]);
753 buf = gst_buffer_new_and_alloc (nal_len);
755 gst_buffer_map (buf, &map, GST_MAP_WRITE);
757 nal_len = g_base64_decode_step (params[i], nal_len, nalp, &state, &save);
758 gst_buffer_unmap (buf, &map);
759 gst_buffer_resize (buf, 0, nal_len);
762 gst_buffer_unref (buf);
766 gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (rtph265pay), rtph265pay->vps,
767 rtph265pay->sps, rtph265pay->pps, buf);
773 next_start_code (const guint8 * data, guint size)
775 /* Boyer-Moore string matching algorithm, in a degenerative
776 * sense because our search 'alphabet' is binary - 0 & 1 only.
777 * This allow us to simplify the general BM algorithm to a very
779 /* assume 1 is in the 3th byte */
782 while (offset < size) {
783 if (1 == data[offset]) {
784 unsigned int shift = offset;
786 if (0 == data[--shift]) {
787 if (0 == data[--shift]) {
791 /* The jump is always 3 because of the 1 previously matched.
792 * All the 0's must be after this '1' matched at offset */
794 } else if (0 == data[offset]) {
795 /* maybe next byte is 1? */
798 /* can jump 3 bytes forward */
801 /* at each iteration, we rescan in a backward manner until
802 * we match 0.0.1 in reverse order. Since our search string
803 * has only 2 'alpabets' (i.e. 0 & 1), we know that any
804 * mismatch will force us to shift a fixed number of steps */
806 GST_DEBUG ("Cannot find next NAL start code. returning %u", size);
812 gst_rtp_h265_pay_decode_nal (GstRtpH265Pay * payloader,
813 const guint8 * data, guint size, GstClockTime dts, GstClockTime pts)
818 /* default is no update */
821 GST_DEBUG ("NAL payload len=%u", size);
824 type = header & 0x3f;
826 /* We record the timestamp of the last SPS/PPS so
827 * that we can insert them at regular intervals and when needed. */
828 if (GST_H265_NAL_VPS == type || GST_H265_NAL_SPS == type
829 || GST_H265_NAL_PPS == type) {
832 /* encode the entire NAL in base64 */
833 GST_DEBUG ("Found %s %x %x %x Len=%u",
834 type == GST_H265_NAL_VPS ? "VPS" : type ==
835 GST_H265_NAL_SPS ? "SPS" : "PPS", (header >> 7), (header >> 5) & 3,
838 nal = gst_buffer_new_allocate (NULL, size, NULL);
839 gst_buffer_fill (nal, 0, data, size);
841 updated = gst_rtp_h265_add_vps_sps_pps (GST_ELEMENT (payloader),
842 payloader->vps, payloader->sps, payloader->pps, nal);
844 /* remember when we last saw VPS */
845 if (updated && pts != -1)
846 payloader->last_vps_sps_pps = pts;
848 GST_DEBUG ("NAL: %x %x %x Len = %u", (header >> 7),
849 (header >> 5) & 3, type, size);
856 gst_rtp_h265_pay_payload_nal (GstRTPBasePayload * basepayload,
857 GstBuffer * paybuf, GstClockTime dts, GstClockTime pts, gboolean end_of_au);
860 gst_rtp_h265_pay_send_vps_sps_pps (GstRTPBasePayload * basepayload,
861 GstRtpH265Pay * rtph265pay, GstClockTime dts, GstClockTime pts)
863 GstFlowReturn ret = GST_FLOW_OK;
864 gboolean sent_all_vps_sps_pps = TRUE;
867 for (i = 0; i < rtph265pay->vps->len; i++) {
869 GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->vps, i));
871 GST_DEBUG_OBJECT (rtph265pay, "inserting VPS in the stream");
873 ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (vps_buf),
875 /* Not critical here; but throw a warning */
876 if (ret != GST_FLOW_OK) {
877 sent_all_vps_sps_pps = FALSE;
878 GST_WARNING_OBJECT (basepayload, "Problem pushing VPS");
881 for (i = 0; i < rtph265pay->sps->len; i++) {
883 GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->sps, i));
885 GST_DEBUG_OBJECT (rtph265pay, "inserting SPS in the stream");
887 ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (sps_buf),
889 /* Not critical here; but throw a warning */
890 if (ret != GST_FLOW_OK) {
891 sent_all_vps_sps_pps = FALSE;
892 GST_WARNING_OBJECT (basepayload, "Problem pushing SPS");
895 for (i = 0; i < rtph265pay->pps->len; i++) {
897 GST_BUFFER_CAST (g_ptr_array_index (rtph265pay->pps, i));
899 GST_DEBUG_OBJECT (rtph265pay, "inserting PPS in the stream");
901 ret = gst_rtp_h265_pay_payload_nal (basepayload, gst_buffer_ref (pps_buf),
903 /* Not critical here; but throw a warning */
904 if (ret != GST_FLOW_OK) {
905 sent_all_vps_sps_pps = FALSE;
906 GST_WARNING ("Problem pushing PPS");
910 if (pts != -1 && sent_all_vps_sps_pps)
911 rtph265pay->last_vps_sps_pps = pts;
917 gst_rtp_h265_pay_payload_nal (GstRTPBasePayload * basepayload,
918 GstBuffer * paybuf, GstClockTime dts, GstClockTime pts, gboolean end_of_au)
920 GstRtpH265Pay *rtph265pay;
924 guint packet_len, payload_len, mtu;
927 GstBufferList *list = NULL;
928 gboolean send_vps_sps_pps;
929 GstRTPBuffer rtp = { NULL };
930 guint size = gst_buffer_get_size (paybuf);
932 rtph265pay = GST_RTP_H265_PAY (basepayload);
933 mtu = GST_RTP_BASE_PAYLOAD_MTU (rtph265pay);
935 gst_buffer_extract (paybuf, 0, nalHeader, 2);
936 nalType = (nalHeader[0] >> 1) & 0x3f;
938 GST_DEBUG_OBJECT (rtph265pay, "Processing Buffer with NAL TYPE=%d", nalType);
940 /* should set src caps before pushing stuff,
941 * and if we did not see enough VPS/SPS/PPS, that may not be the case */
942 if (G_UNLIKELY (!gst_pad_has_current_caps (GST_RTP_BASE_PAYLOAD_SRCPAD
944 gst_rtp_h265_pay_set_vps_sps_pps (basepayload);
946 send_vps_sps_pps = FALSE;
948 /* check if we need to emit an VPS/SPS/PPS now */
949 if (((nalType == GST_H265_NAL_SLICE_TRAIL_N)
950 || (nalType == GST_H265_NAL_SLICE_TRAIL_R)
951 || (nalType == GST_H265_NAL_SLICE_TSA_N)
952 || (nalType == GST_H265_NAL_SLICE_TSA_R)
953 || (nalType == GST_H265_NAL_SLICE_STSA_N)
954 || (nalType == GST_H265_NAL_SLICE_STSA_R)
955 || (nalType == GST_H265_NAL_SLICE_RASL_N)
956 || (nalType == GST_H265_NAL_SLICE_RASL_R)
957 || (nalType == GST_H265_NAL_SLICE_BLA_W_LP)
958 || (nalType == GST_H265_NAL_SLICE_BLA_W_RADL)
959 || (nalType == GST_H265_NAL_SLICE_BLA_N_LP)
960 || (nalType == GST_H265_NAL_SLICE_IDR_W_RADL)
961 || (nalType == GST_H265_NAL_SLICE_IDR_N_LP)
962 || (nalType == GST_H265_NAL_SLICE_CRA_NUT))
963 && rtph265pay->vps_sps_pps_interval > 0) {
965 if (rtph265pay->last_vps_sps_pps != -1) {
968 GST_LOG_OBJECT (rtph265pay,
969 "now %" GST_TIME_FORMAT ", last VPS/SPS/PPS %" GST_TIME_FORMAT,
970 GST_TIME_ARGS (pts), GST_TIME_ARGS (rtph265pay->last_vps_sps_pps));
972 /* calculate diff between last SPS/PPS in milliseconds */
973 if (pts > rtph265pay->last_vps_sps_pps)
974 diff = pts - rtph265pay->last_vps_sps_pps;
978 GST_DEBUG_OBJECT (rtph265pay,
979 "interval since last VPS/SPS/PPS %" GST_TIME_FORMAT,
980 GST_TIME_ARGS (diff));
982 /* bigger than interval, queue SPS/PPS */
983 if (GST_TIME_AS_SECONDS (diff) >= rtph265pay->vps_sps_pps_interval) {
984 GST_DEBUG_OBJECT (rtph265pay, "time to send VPS/SPS/PPS");
985 send_vps_sps_pps = TRUE;
988 /* no known previous SPS/PPS time, send now */
989 GST_DEBUG_OBJECT (rtph265pay, "no previous VPS/SPS/PPS time, send now");
990 send_vps_sps_pps = TRUE;
994 if (send_vps_sps_pps || rtph265pay->send_vps_sps_pps) {
995 /* we need to send SPS/PPS now first. FIXME, don't use the pts for
996 * checking when we need to send SPS/PPS but convert to running_time first. */
997 rtph265pay->send_vps_sps_pps = FALSE;
998 ret = gst_rtp_h265_pay_send_vps_sps_pps (basepayload, rtph265pay, dts, pts);
999 if (ret != GST_FLOW_OK) {
1000 gst_buffer_unref (paybuf);
1005 packet_len = gst_rtp_buffer_calc_packet_len (size, 0, 0);
1007 GST_FIXME_OBJECT (rtph265pay, "Set RTP marker bit appropriately");
1009 if (packet_len < mtu) {
1010 GST_DEBUG_OBJECT (rtph265pay,
1011 "NAL Unit fit in one packet datasize=%d mtu=%d", size, mtu);
1012 /* will fit in one packet */
1015 * create buffer without payload containing only the RTP header
1016 * (memory block at index 0) */
1017 outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
1019 gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
1021 /* FIXME : only set the marker bit on packets containing access units */
1022 /* if (IS_ACCESS_UNIT (nalType) && end_of_au) {
1023 gst_rtp_buffer_set_marker (&rtp, 1);
1026 /* timestamp the outbuffer */
1027 GST_BUFFER_PTS (outbuf) = pts;
1028 GST_BUFFER_DTS (outbuf) = dts;
1030 /* insert payload memory block */
1031 gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph265pay), outbuf, paybuf,
1032 g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
1033 outbuf = gst_buffer_append (outbuf, paybuf);
1035 list = gst_buffer_list_new ();
1037 /* add the buffer to the buffer list */
1038 gst_buffer_list_add (list, outbuf);
1040 gst_rtp_buffer_unmap (&rtp);
1042 /* push the list to the next element in the pipe */
1043 ret = gst_rtp_base_payload_push_list (basepayload, list);
1045 /* fragmentation Units */
1047 int ii = 0, start = 1, end = 0, pos = 0;
1049 GST_DEBUG_OBJECT (basepayload,
1050 "NAL Unit DOES NOT fit in one packet datasize=%d mtu=%d", size, mtu);
1055 GST_DEBUG_OBJECT (basepayload, "Using FU fragmentation for data size=%d",
1058 /* We keep 3 bytes for PayloadHdr and FU Header */
1059 payload_len = gst_rtp_buffer_calc_payload_len (mtu - 3, 0, 0);
1061 list = gst_buffer_list_new ();
1064 limitedSize = size < payload_len ? size : payload_len;
1065 GST_DEBUG_OBJECT (basepayload,
1066 "Inside FU fragmentation limitedSize=%d iteration=%d", limitedSize,
1070 * create buffer without payload containing only the RTP header
1071 * (memory block at index 0), and with space for PayloadHdr and FU header */
1072 outbuf = gst_rtp_buffer_new_allocate (3, 0, 0);
1074 gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
1076 GST_BUFFER_DTS (outbuf) = dts;
1077 GST_BUFFER_PTS (outbuf) = pts;
1078 payload = gst_rtp_buffer_get_payload (&rtp);
1080 if (limitedSize == size) {
1081 GST_DEBUG_OBJECT (basepayload, "end size=%d iteration=%d", size, ii);
1085 /* PayloadHdr (type = 49) */
1086 payload[0] = (nalHeader[0] & 0x81) | (49 << 1);
1087 payload[1] = nalHeader[1];
1089 /* FIXME - set RTP marker bit appropriately */
1090 /* if (IS_ACCESS_UNIT (nalType)) {
1091 gst_rtp_buffer_set_marker (&rtp, end && end_of_au);
1095 payload[2] = (start << 7) | (end << 6) | (nalType & 0x3f);
1097 gst_rtp_buffer_unmap (&rtp);
1099 /* insert payload memory block */
1100 gst_rtp_copy_meta (GST_ELEMENT_CAST (rtph265pay), outbuf, paybuf,
1101 g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
1102 gst_buffer_copy_into (outbuf, paybuf, GST_BUFFER_COPY_MEMORY, pos,
1104 /* add the buffer to the buffer list */
1105 gst_buffer_list_add (list, outbuf);
1107 size -= limitedSize;
1113 ret = gst_rtp_base_payload_push_list (basepayload, list);
1114 gst_buffer_unref (paybuf);
1119 static GstFlowReturn
1120 gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
1123 GstRtpH265Pay *rtph265pay;
1129 GstClockTime dts, pts;
1132 GstBuffer *paybuf = NULL;
1135 rtph265pay = GST_RTP_H265_PAY (basepayload);
1137 /* the input buffer contains one or more NAL units */
1139 hevc = (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HEV1)
1140 || (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HVC1);
1143 /* In hevc mode, there is no adapter, so nothing to flush */
1146 gst_buffer_map (buffer, &map, GST_MAP_READ);
1149 pts = GST_BUFFER_PTS (buffer);
1150 dts = GST_BUFFER_DTS (buffer);
1151 GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
1153 dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
1154 pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
1156 if (!GST_CLOCK_TIME_IS_VALID (dts))
1157 dts = GST_BUFFER_DTS (buffer);
1158 if (!GST_CLOCK_TIME_IS_VALID (pts))
1159 pts = GST_BUFFER_PTS (buffer);
1161 gst_adapter_push (rtph265pay->adapter, buffer);
1163 size = gst_adapter_available (rtph265pay->adapter);
1164 /* Nothing to do here if the adapter is empty, e.g. on EOS */
1167 data = gst_adapter_map (rtph265pay->adapter, size);
1168 GST_DEBUG_OBJECT (basepayload,
1169 "got %" G_GSIZE_FORMAT " bytes (%" G_GSIZE_FORMAT ")", size,
1170 buffer ? gst_buffer_get_size (buffer) : 0);
1175 /* now loop over all NAL units and put them in a packet
1176 * FIXME, we should really try to pack multiple NAL units into one RTP packet
1177 * if we can, especially for the config packets that wont't cause decoder
1180 guint nal_length_size;
1183 nal_length_size = rtph265pay->nal_length_size;
1185 while (size > nal_length_size) {
1187 gboolean end_of_au = FALSE;
1190 for (i = 0; i < nal_length_size; i++) {
1191 nal_len = ((nal_len << 8) + data[i]);
1194 /* skip the length bytes, make sure we don't run past the buffer size */
1195 data += nal_length_size;
1196 offset += nal_length_size;
1197 size -= nal_length_size;
1199 if (size >= nal_len) {
1200 GST_DEBUG_OBJECT (basepayload, "got NAL of size %u", nal_len);
1203 GST_DEBUG_OBJECT (basepayload, "got incomplete NAL of size %u",
1207 /* If we're at the end of the buffer, then we're at the end of the
1210 if (rtph265pay->alignment == GST_H265_ALIGNMENT_AU
1211 && size - nal_len <= nal_length_size) {
1215 paybuf = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset,
1219 gst_rtp_h265_pay_payload_nal (basepayload, paybuf, dts, pts,
1221 if (ret != GST_FLOW_OK)
1230 gboolean update = FALSE;
1232 /* get offset of first start code */
1233 next = next_start_code (data, size);
1235 /* skip to start code, if no start code is found, next will be size and we
1236 * will not collect data. */
1239 nal_queue = rtph265pay->queue;
1242 /* array must be empty when we get here */
1243 g_assert (nal_queue->len == 0);
1245 GST_DEBUG_OBJECT (basepayload,
1246 "found first start at %u, bytes left %" G_GSIZE_FORMAT, next, size);
1248 /* first pass to locate NALs and parse SPS/PPS */
1250 /* skip start code */
1254 /* use next_start_code() to scan buffer.
1255 * next_start_code() returns the offset in data,
1256 * starting from zero to the first byte of 0.0.0.1
1257 * If no start code is found, it returns the value of the
1259 * data is unchanged by the call to next_start_code()
1261 next = next_start_code (data, size);
1263 if (next == size && buffer != NULL) {
1264 /* Didn't find the start of next NAL and it's not EOS,
1265 * handle it next time */
1269 /* nal length is distance to next start code */
1272 GST_DEBUG_OBJECT (basepayload, "found next start at %u of size %u", next,
1275 if (rtph265pay->sprop_parameter_sets != NULL) {
1276 /* explicitly set profile and sprop, use those */
1277 if (rtph265pay->update_caps) {
1278 if (!gst_rtp_base_payload_set_outcaps (basepayload,
1279 "sprop-parameter-sets", G_TYPE_STRING,
1280 rtph265pay->sprop_parameter_sets, NULL))
1283 /* parse SPS and PPS from provided parameter set (for insertion) */
1284 gst_rtp_h265_pay_parse_sprop_parameter_sets (rtph265pay);
1286 rtph265pay->update_caps = FALSE;
1288 GST_DEBUG ("outcaps update: sprop-parameter-sets=%s",
1289 rtph265pay->sprop_parameter_sets);
1292 /* We know our stream is a valid H265 NAL packet,
1293 * go parse it for SPS/PPS to enrich the caps */
1294 /* order: make sure to check nal */
1296 gst_rtp_h265_pay_decode_nal (rtph265pay, data, nal_len, dts, pts)
1299 /* move to next NAL packet */
1303 g_array_append_val (nal_queue, nal_len);
1306 /* if has new VPS, SPS & PPS, update the output caps */
1307 if (G_UNLIKELY (update))
1308 if (!gst_rtp_h265_pay_set_vps_sps_pps (basepayload))
1311 /* second pass to payload and push */
1313 if (nal_queue->len != 0)
1314 gst_adapter_flush (rtph265pay->adapter, skip);
1316 for (i = 0; i < nal_queue->len; i++) {
1318 gboolean end_of_au = FALSE;
1320 nal_len = g_array_index (nal_queue, guint, i);
1321 /* skip start code */
1322 gst_adapter_flush (rtph265pay->adapter, 3);
1324 /* Trim the end unless we're the last NAL in the stream.
1325 * In case we're not at the end of the buffer we know the next block
1326 * starts with 0x000001 so all the 0x00 bytes at the end of this one are
1327 * trailing 0x0 that can be discarded */
1329 data = gst_adapter_map (rtph265pay->adapter, size);
1330 if (i + 1 != nal_queue->len || buffer != NULL)
1331 for (; size > 1 && data[size - 1] == 0x0; size--)
1335 /* If it's the last nal unit we have in non-bytestream mode, we can
1336 * assume it's the end of an access-unit
1338 * FIXME: We need to wait until the next packet or EOS to
1339 * actually payload the NAL so we can know if the current NAL is
1340 * the last one of an access unit or not if we are in bytestream mode
1342 if ((rtph265pay->alignment == GST_H265_ALIGNMENT_AU || buffer == NULL) &&
1343 i == nal_queue->len - 1)
1345 paybuf = gst_adapter_take_buffer (rtph265pay->adapter, size);
1348 /* put the data in one or more RTP packets */
1350 gst_rtp_h265_pay_payload_nal (basepayload, paybuf, dts, pts,
1352 if (ret != GST_FLOW_OK) {
1356 /* move to next NAL packet */
1357 /* Skips the trailing zeros */
1358 gst_adapter_flush (rtph265pay->adapter, nal_len - size);
1360 g_array_set_size (nal_queue, 0);
1365 gst_buffer_unmap (buffer, &map);
1366 gst_buffer_unref (buffer);
1368 gst_adapter_unmap (rtph265pay->adapter);
1375 GST_WARNING_OBJECT (basepayload, "Could not set outcaps");
1376 g_array_set_size (nal_queue, 0);
1377 ret = GST_FLOW_NOT_NEGOTIATED;
1383 gst_rtp_h265_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event)
1386 const GstStructure *s;
1387 GstRtpH265Pay *rtph265pay = GST_RTP_H265_PAY (payload);
1389 switch (GST_EVENT_TYPE (event)) {
1390 case GST_EVENT_FLUSH_STOP:
1391 gst_adapter_clear (rtph265pay->adapter);
1393 case GST_EVENT_CUSTOM_DOWNSTREAM:
1394 s = gst_event_get_structure (event);
1395 if (gst_structure_has_name (s, "GstForceKeyUnit")) {
1396 gboolean resend_codec_data;
1398 if (gst_structure_get_boolean (s, "all-headers",
1399 &resend_codec_data) && resend_codec_data)
1400 rtph265pay->send_vps_sps_pps = TRUE;
1405 /* call handle_buffer with NULL to flush last NAL from adapter
1406 * in byte-stream mode
1408 gst_rtp_h265_pay_handle_buffer (payload, NULL);
1411 case GST_EVENT_STREAM_START:
1412 GST_DEBUG_OBJECT (rtph265pay,
1413 "New stream detected => Clear VPS, SPS and PPS");
1414 gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
1420 res = GST_RTP_BASE_PAYLOAD_CLASS (parent_class)->sink_event (payload, event);
1425 static GstStateChangeReturn
1426 gst_rtp_h265_pay_change_state (GstElement * element, GstStateChange transition)
1428 GstStateChangeReturn ret;
1429 GstRtpH265Pay *rtph265pay = GST_RTP_H265_PAY (element);
1431 switch (transition) {
1432 case GST_STATE_CHANGE_READY_TO_PAUSED:
1433 rtph265pay->send_vps_sps_pps = FALSE;
1434 gst_adapter_clear (rtph265pay->adapter);
1440 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
1442 switch (transition) {
1443 case GST_STATE_CHANGE_PAUSED_TO_READY:
1444 rtph265pay->last_vps_sps_pps = -1;
1445 gst_rtp_h265_pay_clear_vps_sps_pps (rtph265pay);
1455 gst_rtp_h265_pay_set_property (GObject * object, guint prop_id,
1456 const GValue * value, GParamSpec * pspec)
1458 GstRtpH265Pay *rtph265pay;
1460 rtph265pay = GST_RTP_H265_PAY (object);
1463 case PROP_SPROP_PARAMETER_SETS:
1464 g_free (rtph265pay->sprop_parameter_sets);
1465 rtph265pay->sprop_parameter_sets = g_value_dup_string (value);
1466 rtph265pay->update_caps = TRUE;
1468 case PROP_CONFIG_INTERVAL:
1469 rtph265pay->vps_sps_pps_interval = g_value_get_int (value);
1472 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1478 gst_rtp_h265_pay_get_property (GObject * object, guint prop_id,
1479 GValue * value, GParamSpec * pspec)
1481 GstRtpH265Pay *rtph265pay;
1483 rtph265pay = GST_RTP_H265_PAY (object);
1486 case PROP_SPROP_PARAMETER_SETS:
1487 g_value_set_string (value, rtph265pay->sprop_parameter_sets);
1489 case PROP_CONFIG_INTERVAL:
1490 g_value_set_int (value, rtph265pay->vps_sps_pps_interval);
1493 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1499 gst_rtp_h265_pay_plugin_init (GstPlugin * plugin)
1501 return gst_element_register (plugin, "rtph265pay",
1502 GST_RANK_SECONDARY, GST_TYPE_RTP_H265_PAY);