Add files from gst-rtmp
[platform/upstream/gstreamer.git] / gst / rtmp2 / rtmp / rtmpclient.h
1 /* GStreamer RTMP Library
2  * Copyright (C) 2017 Make.TV, Inc. <info@make.tv>
3  *   Contact: Jan Alexander Steffens (heftig) <jsteffens@make.tv>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef _GST_RTMP_CLIENT_H_
22 #define _GST_RTMP_CLIENT_H_
23
24 #include "rtmpconnection.h"
25
26 G_BEGIN_DECLS
27
28 #define GST_TYPE_RTMP_SCHEME (gst_rtmp_scheme_get_type ())
29
30 typedef enum
31 {
32   GST_RTMP_SCHEME_RTMP = 0,
33   GST_RTMP_SCHEME_RTMPS,
34 } GstRtmpScheme;
35
36 GType gst_rtmp_scheme_get_type (void);
37
38 GstRtmpScheme gst_rtmp_scheme_from_string (const gchar * string);
39 GstRtmpScheme gst_rtmp_scheme_from_uri (const GstUri * uri);
40 const gchar * gst_rtmp_scheme_to_string (GstRtmpScheme scheme);
41 const gchar * const * gst_rtmp_scheme_get_strings (void);
42 guint gst_rtmp_scheme_get_default_port (GstRtmpScheme scheme);
43
44
45
46 #define GST_TYPE_RTMP_AUTHMOD (gst_rtmp_authmod_get_type ())
47
48 typedef enum
49 {
50   GST_RTMP_AUTHMOD_NONE = 0,
51   GST_RTMP_AUTHMOD_AUTO,
52   GST_RTMP_AUTHMOD_ADOBE,
53 } GstRtmpAuthmod;
54
55 GType gst_rtmp_authmod_get_type (void);
56
57
58
59 typedef struct _GstRtmpLocation
60 {
61   GstRtmpScheme scheme;
62   gchar *host;
63   guint port;
64   gchar *application;
65   gchar *stream;
66   gchar *username;
67   gchar *password;
68   gchar *secure_token;
69   GstRtmpAuthmod authmod;
70   gint timeout;
71   GTlsCertificateFlags tls_flags;
72   gchar *flash_ver;
73 } GstRtmpLocation;
74
75 void gst_rtmp_location_copy (GstRtmpLocation * dest,
76     const GstRtmpLocation * src);
77 void gst_rtmp_location_clear (GstRtmpLocation * uri);
78 gchar *gst_rtmp_location_get_string (const GstRtmpLocation * location,
79     gboolean with_stream);
80
81
82
83 void gst_rtmp_client_connect_async (const GstRtmpLocation * location,
84     GCancellable * cancellable, GAsyncReadyCallback callback,
85     gpointer user_data);
86 GstRtmpConnection *gst_rtmp_client_connect_finish (GAsyncResult * result,
87     GError ** error);
88 void gst_rtmp_client_start_publish_async (GstRtmpConnection * connection,
89     const gchar * stream, GCancellable * cancellable,
90     GAsyncReadyCallback callback, gpointer user_data);
91 gboolean gst_rtmp_client_start_publish_finish (GstRtmpConnection * connection,
92     GAsyncResult * result, guint * stream_id, GError ** error);
93
94 void gst_rtmp_client_start_play_async (GstRtmpConnection * connection,
95     const gchar * stream, GCancellable * cancellable,
96     GAsyncReadyCallback callback, gpointer user_data);
97 gboolean gst_rtmp_client_start_play_finish (GstRtmpConnection * connection,
98     GAsyncResult * result, guint * stream_id, GError ** error);
99
100 G_END_DECLS
101 #endif