• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define GST_TYPE_RTMP_STOP_COMMANDS (gst_rtmp_stop_commands_get_type ())
60 #define GST_RTMP_DEFAULT_STOP_COMMANDS (GST_RTMP_STOP_COMMANDS_FCUNPUBLISH | \
61     GST_RTMP_STOP_COMMANDS_DELETE_STREAM) /* FCUnpublish + deleteStream */
62 
63 /**
64  * GstRtmpStopCommands:
65  * @GST_RTMP_STOP_COMMANDS_NONE: Don't send any commands
66  * @GST_RTMP_STOP_COMMANDS_FCUNPUBLISH: Send FCUnpublish command
67  * @GST_RTMP_STOP_COMMANDS_CLOSE_STREAM: Send closeStream command
68  * @GST_RTMP_STOP_COMMANDS_DELETE_STREAM: Send deleteStream command
69  *
70  * Since: 1.18
71  */
72 typedef enum
73 {
74   GST_RTMP_STOP_COMMANDS_NONE = 0,
75   GST_RTMP_STOP_COMMANDS_FCUNPUBLISH = (1 << 0),
76   GST_RTMP_STOP_COMMANDS_CLOSE_STREAM = (1 << 1),
77   GST_RTMP_STOP_COMMANDS_DELETE_STREAM = (1 << 2)
78 } GstRtmpStopCommands;
79 
80 GType gst_rtmp_stop_commands_get_type (void);
81 
82 
83 
84 typedef struct _GstRtmpLocation
85 {
86   GstRtmpScheme scheme;
87   gchar *host;
88   guint port;
89   gchar *application;
90   gchar *stream;
91   gchar *username;
92   gchar *password;
93   gchar *secure_token;
94   GstRtmpAuthmod authmod;
95   gint timeout;
96   GTlsCertificateFlags tls_flags;
97   gchar *flash_ver;
98   gboolean publish;
99 } GstRtmpLocation;
100 
101 void gst_rtmp_location_copy (GstRtmpLocation * dest,
102     const GstRtmpLocation * src);
103 void gst_rtmp_location_clear (GstRtmpLocation * uri);
104 gchar *gst_rtmp_location_get_string (const GstRtmpLocation * location,
105     gboolean with_stream);
106 
107 
108 
109 void gst_rtmp_client_connect_async (const GstRtmpLocation * location,
110     GCancellable * cancellable, GAsyncReadyCallback callback,
111     gpointer user_data);
112 GstRtmpConnection *gst_rtmp_client_connect_finish (GAsyncResult * result,
113     GError ** error);
114 void gst_rtmp_client_start_publish_async (GstRtmpConnection * connection,
115     const gchar * stream, GCancellable * cancellable,
116     GAsyncReadyCallback callback, gpointer user_data);
117 gboolean gst_rtmp_client_start_publish_finish (GstRtmpConnection * connection,
118     GAsyncResult * result, guint * stream_id, GError ** error);
119 
120 void gst_rtmp_client_start_play_async (GstRtmpConnection * connection,
121     const gchar * stream, GCancellable * cancellable,
122     GAsyncReadyCallback callback, gpointer user_data);
123 gboolean gst_rtmp_client_start_play_finish (GstRtmpConnection * connection,
124     GAsyncResult * result, guint * stream_id, GError ** error);
125 
126 void gst_rtmp_client_stop_publish (GstRtmpConnection * connection,
127     const gchar * stream, const GstRtmpStopCommands stop_commands);
128 
129 G_END_DECLS
130 #endif
131