rtmp2: Add gst_rtmp_connection_set_data_frame

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/878
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-11-27 15:38:20 +01:00
parent 8f1ae04ac5
commit e07a1bb48f
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5
2 changed files with 33 additions and 1 deletions

View file

@ -179,12 +179,30 @@ enum
static guint signals[N_SIGNALS] = { 0, };
/* singletons */
static GstMemory *set_data_frame_value;
static void
init_set_data_frame_value (void)
{
GstAmfNode *node = gst_amf_node_new_string ("@setDataFrame", -1);
GBytes *bytes = gst_amf_node_serialize (node);
gsize size;
const gchar *data = g_bytes_get_data (bytes, &size);
set_data_frame_value = gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY,
(gpointer) data, size, 0, size, bytes, (GDestroyNotify) g_bytes_unref);
gst_amf_node_free (node);
}
/* class initialization */
G_DEFINE_TYPE_WITH_CODE (GstRtmpConnection, gst_rtmp_connection,
G_TYPE_OBJECT,
GST_DEBUG_CATEGORY_INIT (gst_rtmp_connection_debug_category,
"rtmpconnection", 0, "debug category for GstRtmpConnection class"));
"rtmpconnection", 0, "debug category for GstRtmpConnection class");
init_set_data_frame_value ());
static void
gst_rtmp_connection_class_init (GstRtmpConnectionClass * klass)
@ -999,3 +1017,14 @@ gst_rtmp_connection_request_window_size (GstRtmpConnection * connection,
gst_rtmp_connection_queue_message (connection,
gst_rtmp_message_new_protocol_control (&pc));
}
void
gst_rtmp_connection_set_data_frame (GstRtmpConnection * connection,
GstBuffer * buffer)
{
g_return_if_fail (GST_IS_RTMP_CONNECTION (connection));
g_return_if_fail (GST_IS_BUFFER (buffer));
gst_buffer_prepend_memory (buffer, gst_memory_ref (set_data_frame_value));
gst_rtmp_connection_queue_message (connection, buffer);
}

View file

@ -77,6 +77,9 @@ void gst_rtmp_connection_expect_command (GstRtmpConnection * connection,
void gst_rtmp_connection_request_window_size (GstRtmpConnection * connection,
guint32 window_ack_size);
void gst_rtmp_connection_set_data_frame (GstRtmpConnection * connection,
GstBuffer * buffer);
G_END_DECLS
#endif