1 /* GStreamer RTMP Library
2 * Copyright (C) 2013 David Schleef <ds@schleef.org>
3 * Copyright (C) 2017 Make.TV, Inc. <info@make.tv>
4 * Contact: Jan Alexander Steffens (heftig) <jsteffens@make.tv>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef _GST_RTMP_CONNECTION_H_
23 #define _GST_RTMP_CONNECTION_H_
31 #define GST_TYPE_RTMP_CONNECTION (gst_rtmp_connection_get_type())
32 #define GST_RTMP_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTMP_CONNECTION,GstRtmpConnection))
33 #define GST_IS_RTMP_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTMP_CONNECTION))
35 #define GST_RTMP_DEFAULT_CHUNK_SIZE 128
36 #define GST_RTMP_MINIMUM_CHUNK_SIZE 1
37 #define GST_RTMP_MAXIMUM_CHUNK_SIZE 0x7FFFFFFF
40 #define GST_RTMP_DEFAULT_WINDOW_ACK_SIZE 2500000
42 typedef struct _GstRtmpConnection GstRtmpConnection;
44 typedef void (*GstRtmpConnectionFunc)
45 (GstRtmpConnection * connection, gpointer user_data);
46 typedef void (*GstRtmpConnectionMessageFunc)
47 (GstRtmpConnection * connection, GstBuffer * buffer, gpointer user_data);
49 typedef void (*GstRtmpCommandCallback) (const gchar * command_name,
50 GPtrArray * arguments, gpointer user_data);
52 GType gst_rtmp_connection_get_type (void);
54 GstRtmpConnection *gst_rtmp_connection_new (GSocketConnection * connection, GCancellable * cancellable);
56 GSocket *gst_rtmp_connection_get_socket (GstRtmpConnection * connection);
58 void gst_rtmp_connection_close (GstRtmpConnection * connection);
59 void gst_rtmp_connection_close_and_unref (gpointer ptr);
61 void gst_rtmp_connection_set_input_handler (GstRtmpConnection * connection,
62 GstRtmpConnectionMessageFunc callback, gpointer user_data,
63 GDestroyNotify user_data_destroy);
65 void gst_rtmp_connection_set_output_handler (GstRtmpConnection * connection,
66 GstRtmpConnectionFunc callback, gpointer user_data,
67 GDestroyNotify user_data_destroy);
69 void gst_rtmp_connection_queue_bytes (GstRtmpConnection *self,
71 void gst_rtmp_connection_queue_message (GstRtmpConnection * connection,
73 guint gst_rtmp_connection_get_num_queued (GstRtmpConnection * connection);
75 guint gst_rtmp_connection_send_command (GstRtmpConnection * connection,
76 GstRtmpCommandCallback response_command, gpointer user_data,
77 guint32 stream_id, const gchar * command_name, const GstAmfNode * argument,
78 ...) G_GNUC_NULL_TERMINATED;
80 void gst_rtmp_connection_expect_command (GstRtmpConnection * connection,
81 GstRtmpCommandCallback response_command, gpointer user_data,
82 guint32 stream_id, const gchar * command_name);
84 void gst_rtmp_connection_set_chunk_size (GstRtmpConnection * connection,
86 void gst_rtmp_connection_request_window_size (GstRtmpConnection * connection,
87 guint32 window_ack_size);
89 void gst_rtmp_connection_set_data_frame (GstRtmpConnection * connection,
92 GstStructure * gst_rtmp_connection_get_null_stats (void);
93 GstStructure * gst_rtmp_connection_get_stats (GstRtmpConnection * connection);