diff options
author | George Hazan <ghazan@miranda.im> | 2022-08-03 21:02:36 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-08-03 21:02:36 +0300 |
commit | 5323a782c4e8c42781f22ce2f488962a18f82554 (patch) | |
tree | f71537197b16f0f8fd0d6937f7120d018d220814 /include/gst/rtsp | |
parent | 50acf9d37183f86f6f623aad410003392b0af41f (diff) |
Jabber: initial version of Jingle support
Diffstat (limited to 'include/gst/rtsp')
-rw-r--r-- | include/gst/rtsp/gstrtsp-enumtypes.h | 82 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtsp.h | 33 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtspconnection.h | 395 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtspdefs.h | 453 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtspextension.h | 122 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtspmessage.h | 347 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtsprange.h | 164 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtsptransport.h | 201 | ||||
-rw-r--r-- | include/gst/rtsp/gstrtspurl.h | 121 | ||||
-rw-r--r-- | include/gst/rtsp/rtsp-prelude.h | 41 | ||||
-rw-r--r-- | include/gst/rtsp/rtsp.h | 37 |
11 files changed, 1996 insertions, 0 deletions
diff --git a/include/gst/rtsp/gstrtsp-enumtypes.h b/include/gst/rtsp/gstrtsp-enumtypes.h new file mode 100644 index 0000000000..47c84d5226 --- /dev/null +++ b/include/gst/rtsp/gstrtsp-enumtypes.h @@ -0,0 +1,82 @@ + +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ + +#pragma once + + #include <glib-object.h> + #include <gst/rtsp/rtsp-prelude.h> + + G_BEGIN_DECLS + +/* enumerations from "gstrtspdefs.h" */ + +GST_RTSP_API +GType gst_rtsp_result_get_type (void); +#define GST_TYPE_RTSP_RESULT (gst_rtsp_result_get_type()) + +GST_RTSP_API +GType gst_rtsp_event_get_type (void); +#define GST_TYPE_RTSP_EVENT (gst_rtsp_event_get_type()) + +GST_RTSP_API +GType gst_rtsp_family_get_type (void); +#define GST_TYPE_RTSP_FAMILY (gst_rtsp_family_get_type()) + +GST_RTSP_API +GType gst_rtsp_state_get_type (void); +#define GST_TYPE_RTSP_STATE (gst_rtsp_state_get_type()) + +GST_RTSP_API +GType gst_rtsp_version_get_type (void); +#define GST_TYPE_RTSP_VERSION (gst_rtsp_version_get_type()) + +GST_RTSP_API +GType gst_rtsp_method_get_type (void); +#define GST_TYPE_RTSP_METHOD (gst_rtsp_method_get_type()) + +GST_RTSP_API +GType gst_rtsp_auth_method_get_type (void); +#define GST_TYPE_RTSP_AUTH_METHOD (gst_rtsp_auth_method_get_type()) + +GST_RTSP_API +GType gst_rtsp_header_field_get_type (void); +#define GST_TYPE_RTSP_HEADER_FIELD (gst_rtsp_header_field_get_type()) + +GST_RTSP_API +GType gst_rtsp_status_code_get_type (void); +#define GST_TYPE_RTSP_STATUS_CODE (gst_rtsp_status_code_get_type()) + +/* enumerations from "gstrtspmessage.h" */ + +GST_RTSP_API +GType gst_rtsp_msg_type_get_type (void); +#define GST_TYPE_RTSP_MSG_TYPE (gst_rtsp_msg_type_get_type()) + +/* enumerations from "gstrtsprange.h" */ + +GST_RTSP_API +GType gst_rtsp_range_unit_get_type (void); +#define GST_TYPE_RTSP_RANGE_UNIT (gst_rtsp_range_unit_get_type()) + +GST_RTSP_API +GType gst_rtsp_time_type_get_type (void); +#define GST_TYPE_RTSP_TIME_TYPE (gst_rtsp_time_type_get_type()) + +/* enumerations from "gstrtsptransport.h" */ + +GST_RTSP_API +GType gst_rtsp_trans_mode_get_type (void); +#define GST_TYPE_RTSP_TRANS_MODE (gst_rtsp_trans_mode_get_type()) + +GST_RTSP_API +GType gst_rtsp_profile_get_type (void); +#define GST_TYPE_RTSP_PROFILE (gst_rtsp_profile_get_type()) + +GST_RTSP_API +GType gst_rtsp_lower_trans_get_type (void); +#define GST_TYPE_RTSP_LOWER_TRANS (gst_rtsp_lower_trans_get_type()) + +G_END_DECLS + +/* Generated data ends here */ + diff --git a/include/gst/rtsp/gstrtsp.h b/include/gst/rtsp/gstrtsp.h new file mode 100644 index 0000000000..eb1370e759 --- /dev/null +++ b/include/gst/rtsp/gstrtsp.h @@ -0,0 +1,33 @@ +/* GStreamer RTSP extension + * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com> + * + * rtsp.h: Generic include to pull in defs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#ifndef __GST_RTSP_H__ +#define __GST_RTSP_H__ + +#include <gst/rtsp/gstrtspconnection.h> +#include <gst/rtsp/gstrtspdefs.h> +#include <gst/rtsp/gstrtsp-enumtypes.h> +#include <gst/rtsp/gstrtspextension.h> +#include <gst/rtsp/gstrtspmessage.h> +#include <gst/rtsp/gstrtsprange.h> +#include <gst/rtsp/gstrtsptransport.h> +#include <gst/rtsp/gstrtspurl.h> + +#endif /* __GST_RTSP_H__ */ diff --git a/include/gst/rtsp/gstrtspconnection.h b/include/gst/rtsp/gstrtspconnection.h new file mode 100644 index 0000000000..2eeb462bda --- /dev/null +++ b/include/gst/rtsp/gstrtspconnection.h @@ -0,0 +1,395 @@ +/* GStreamer + * Copyright (C) <2005,2009> Wim Taymans <wim.taymans@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_CONNECTION_H__ +#define __GST_RTSP_CONNECTION_H__ + +#include <glib.h> + +#include <gst/gstconfig.h> +#include <gst/rtsp/gstrtspdefs.h> +#include <gst/rtsp/gstrtspurl.h> +#include <gst/rtsp/gstrtspmessage.h> +#include <gio/gio.h> + +G_BEGIN_DECLS + +/** + * GstRTSPConnection: + * + * Opaque RTSP connection object. + */ +typedef struct _GstRTSPConnection GstRTSPConnection; + +/* opening/closing a connection */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_create_from_socket (GSocket * socket, + const gchar * ip, + guint16 port, + const gchar * initial_buffer, + GstRTSPConnection ** conn); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_accept (GSocket * socket, GstRTSPConnection ** conn, GCancellable * cancellable); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_connect_usec (GstRTSPConnection * conn, gint64 timeout); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_connect_with_response_usec (GstRTSPConnection * conn, gint64 timeout, GstRTSPMessage * response); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn); + +/* TLS connections */ + +GST_RTSP_API +GTlsConnection * gst_rtsp_connection_get_tls (GstRTSPConnection * conn, GError ** error); + +GST_RTSP_API +gboolean gst_rtsp_connection_set_tls_validation_flags (GstRTSPConnection * conn, GTlsCertificateFlags flags); + +GST_RTSP_API +GTlsCertificateFlags gst_rtsp_connection_get_tls_validation_flags (GstRTSPConnection * conn); + +GST_RTSP_API +void gst_rtsp_connection_set_tls_database (GstRTSPConnection * conn, GTlsDatabase * database); + +GST_RTSP_API +GTlsDatabase * gst_rtsp_connection_get_tls_database (GstRTSPConnection * conn); + +GST_RTSP_API +void gst_rtsp_connection_set_tls_interaction (GstRTSPConnection * conn, GTlsInteraction * interaction); + +GST_RTSP_API +GTlsInteraction * gst_rtsp_connection_get_tls_interaction (GstRTSPConnection * conn); + +typedef gboolean (*GstRTSPConnectionAcceptCertificateFunc) (GTlsConnection *conn, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors, + gpointer user_data); +GST_RTSP_API +void gst_rtsp_connection_set_accept_certificate_func (GstRTSPConnection * conn, + GstRTSPConnectionAcceptCertificateFunc func, + gpointer user_data, + GDestroyNotify destroy_notify); + +/* sending/receiving raw bytes */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_read_usec (GstRTSPConnection * conn, guint8 * data, + guint size, gint64 timeout); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_write_usec (GstRTSPConnection * conn, const guint8 * data, + guint size, gint64 timeout); + +/* sending/receiving messages */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_send_usec (GstRTSPConnection *conn, GstRTSPMessage *message, + gint64 timeout); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_send_messages_usec (GstRTSPConnection *conn, GstRTSPMessage *messages, guint n_messages, + gint64 timeout); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_receive_usec (GstRTSPConnection *conn, GstRTSPMessage *message, + gint64 timeout); + +/* status management */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_poll_usec (GstRTSPConnection *conn, GstRTSPEvent events, + GstRTSPEvent *revents, gint64 timeout); + +/* reset the timeout */ + +GST_RTSP_API +gint64 gst_rtsp_connection_next_timeout_usec (GstRTSPConnection *conn); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn); + +/* flushing state */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush); + +/* HTTP proxy support */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_set_proxy (GstRTSPConnection *conn, + const gchar *host, guint port); + +/* configure authentication data */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method, + const gchar *user, const gchar *pass); + +GST_RTSP_API +void gst_rtsp_connection_set_auth_param (GstRTSPConnection *conn, + const gchar * param, + const gchar *value); + +GST_RTSP_API +void gst_rtsp_connection_clear_auth_params (GstRTSPConnection *conn); + +/* configure DSCP */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn, + guint qos_dscp); + +/* Content-Length limit */ +GST_RTSP_API +void gst_rtsp_connection_set_content_length_limit (GstRTSPConnection *conn, + guint limit); + +/* accessors */ + +GST_RTSP_API +GstRTSPUrl * gst_rtsp_connection_get_url (const GstRTSPConnection *conn); + +GST_RTSP_API +const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn); + +GST_RTSP_API +void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip); + +GST_RTSP_API +GSocket * gst_rtsp_connection_get_read_socket (const GstRTSPConnection *conn); + +GST_RTSP_API +GSocket * gst_rtsp_connection_get_write_socket (const GstRTSPConnection *conn); + +GST_RTSP_API +void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn, + gboolean enable); + +/* tunneling */ + +GST_RTSP_API +void gst_rtsp_connection_set_tunneled (GstRTSPConnection *conn, gboolean tunneled); + +GST_RTSP_API +gboolean gst_rtsp_connection_is_tunneled (const GstRTSPConnection *conn); + +GST_RTSP_API +const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn); + +GST_RTSP_API +GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2); + +GST_RTSP_API +void gst_rtsp_connection_set_remember_session_id (GstRTSPConnection *conn, gboolean remember); + +GST_RTSP_API +gboolean gst_rtsp_connection_get_remember_session_id (GstRTSPConnection *conn); + +GST_RTSP_API +void gst_rtsp_connection_set_ignore_x_server_reply (GstRTSPConnection *conn, gboolean ignore); + +GST_RTSP_API +gboolean gst_rtsp_connection_get_ignore_x_server_reply (const GstRTSPConnection *conn); + +/* async IO */ + +/** + * GstRTSPWatch: + * + * Opaque RTSP watch object that can be used for asynchronous RTSP + * operations. + */ +typedef struct _GstRTSPWatch GstRTSPWatch; + +/** + * GstRTSPWatchFuncs: + * @message_received: callback when a message was received + * @message_sent: callback when a message was sent + * @closed: callback when the connection is closed + * @error: callback when an error occurred + * @tunnel_start: a client started a tunneled connection. The tunnelid of the + * connection must be saved. + * @tunnel_complete: a client finished a tunneled connection. In this callback + * you usually pair the tunnelid of this connection with the saved one using + * gst_rtsp_connection_do_tunnel(). + * @error_full: callback when an error occurred with more information than + * the @error callback. + * @tunnel_lost: callback when the post connection of a tunnel is closed. + * @tunnel_http_response: callback when an HTTP response to the GET request + * is about to be sent for a tunneled connection. The response can be + * modified in the callback. Since: 1.4. + * + * Callback functions from a #GstRTSPWatch. + */ +typedef struct { + GstRTSPResult (*message_received) (GstRTSPWatch *watch, GstRTSPMessage *message, + gpointer user_data); + GstRTSPResult (*message_sent) (GstRTSPWatch *watch, guint id, + gpointer user_data); + GstRTSPResult (*closed) (GstRTSPWatch *watch, gpointer user_data); + GstRTSPResult (*error) (GstRTSPWatch *watch, GstRTSPResult result, + gpointer user_data); + GstRTSPStatusCode (*tunnel_start) (GstRTSPWatch *watch, gpointer user_data); + GstRTSPResult (*tunnel_complete) (GstRTSPWatch *watch, gpointer user_data); + GstRTSPResult (*error_full) (GstRTSPWatch *watch, GstRTSPResult result, + GstRTSPMessage *message, guint id, + gpointer user_data); + GstRTSPResult (*tunnel_lost) (GstRTSPWatch *watch, gpointer user_data); + GstRTSPResult (*tunnel_http_response) (GstRTSPWatch *watch, + GstRTSPMessage *request, + GstRTSPMessage *response, + gpointer user_data); + + /*< private >*/ + gpointer _gst_reserved[GST_PADDING-1]; +} GstRTSPWatchFuncs; + +GST_RTSP_API +GstRTSPWatch * gst_rtsp_watch_new (GstRTSPConnection *conn, + GstRTSPWatchFuncs *funcs, + gpointer user_data, + GDestroyNotify notify); + +GST_RTSP_API +void gst_rtsp_watch_reset (GstRTSPWatch *watch); + +GST_RTSP_API +void gst_rtsp_watch_unref (GstRTSPWatch *watch); + +GST_RTSP_API +guint gst_rtsp_watch_attach (GstRTSPWatch *watch, + GMainContext *context); + +GST_RTSP_API +void gst_rtsp_watch_set_send_backlog (GstRTSPWatch *watch, + gsize bytes, guint messages); + +GST_RTSP_API +void gst_rtsp_watch_get_send_backlog (GstRTSPWatch *watch, + gsize *bytes, guint *messages); + +GST_RTSP_API +GstRTSPResult gst_rtsp_watch_write_data (GstRTSPWatch *watch, + const guint8 *data, + guint size, guint *id); + +GST_RTSP_API +GstRTSPResult gst_rtsp_watch_send_message (GstRTSPWatch *watch, + GstRTSPMessage *message, + guint *id); + +GST_RTSP_API +GstRTSPResult gst_rtsp_watch_send_messages (GstRTSPWatch *watch, + GstRTSPMessage *messages, + guint n_messages, + guint *id); + +GST_RTSP_API +GstRTSPResult gst_rtsp_watch_wait_backlog_usec (GstRTSPWatch * watch, + gint64 timeout); + +GST_RTSP_API +void gst_rtsp_watch_set_flushing (GstRTSPWatch * watch, + gboolean flushing); + +#ifndef GST_DISABLE_DEPRECATED + +/* Deprecated */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_connect_usec) +GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_connect_with_response_usec) +GstRTSPResult gst_rtsp_connection_connect_with_response (GstRTSPConnection * conn, GTimeVal * timeout, GstRTSPMessage * response); + + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_read_usec) +GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data, + guint size, GTimeVal * timeout); + + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_write_usec) +GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data, + guint size, GTimeVal * timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_send_usec) +GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message, + GTimeVal *timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_send_messages_usec) +GstRTSPResult gst_rtsp_connection_send_messages (GstRTSPConnection *conn, GstRTSPMessage *messages, guint n_messages, + GTimeVal *timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_receive_usec) +GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message, + GTimeVal *timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_poll_usec) +GstRTSPResult gst_rtsp_connection_poll (GstRTSPConnection *conn, GstRTSPEvent events, + GstRTSPEvent *revents, GTimeVal *timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_connection_next_timeout_usec) +GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout); + +GST_RTSP_DEPRECATED_FOR (gst_rtsp_watch_wait_backlog_usec) +GstRTSPResult gst_rtsp_watch_wait_backlog (GstRTSPWatch * watch, + GTimeVal *timeout); + +G_GNUC_END_IGNORE_DEPRECATIONS + +#endif /* GST_DISABLE_DEPRECATED */ + +G_END_DECLS + +#endif /* __GST_RTSP_CONNECTION_H__ */ diff --git a/include/gst/rtsp/gstrtspdefs.h b/include/gst/rtsp/gstrtspdefs.h new file mode 100644 index 0000000000..8a028c381b --- /dev/null +++ b/include/gst/rtsp/gstrtspdefs.h @@ -0,0 +1,453 @@ +/* GStreamer + * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_DEFS_H__ +#define __GST_RTSP_DEFS_H__ + +#include <gst/gst.h> +#include <gst/rtsp/rtsp-prelude.h> + +G_BEGIN_DECLS + +/** + * GST_RTSP_CHECK: + * @stmt: a statement + * @label: a label + * + * Macro that checks the return value of @stmt and jumps to @label when it does + * not equal #GST_RTSP_OK. + */ +#define GST_RTSP_CHECK(stmt, label) \ +G_STMT_START { \ + if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \ + goto label; \ +} G_STMT_END + +/** + * GstRTSPResult: + * @GST_RTSP_OK: no error + * @GST_RTSP_ERROR: some unspecified error occurred + * @GST_RTSP_EINVAL: invalid arguments were provided to a function + * @GST_RTSP_EINTR: an operation was canceled + * @GST_RTSP_ENOMEM: no memory was available for the operation + * @GST_RTSP_ERESOLV: a host resolve error occurred + * @GST_RTSP_ENOTIMPL: function not implemented + * @GST_RTSP_ESYS: a system error occurred, errno contains more details + * @GST_RTSP_EPARSE: a parsing error occurred + * @GST_RTSP_EWSASTART: windows networking could not start + * @GST_RTSP_EWSAVERSION: windows networking stack has wrong version + * @GST_RTSP_EEOF: end-of-file was reached + * @GST_RTSP_ENET: a network problem occurred, h_errno contains more details + * @GST_RTSP_ENOTIP: the host is not an IP host + * @GST_RTSP_ETIMEOUT: a timeout occurred + * @GST_RTSP_ETGET: the tunnel GET request has been performed + * @GST_RTSP_ETPOST: the tunnel POST request has been performed + * @GST_RTSP_ELAST: last error + * + * Result codes from the RTSP functions. + */ +typedef enum { + GST_RTSP_OK = 0, + /* errors */ + GST_RTSP_ERROR = -1, + GST_RTSP_EINVAL = -2, + GST_RTSP_EINTR = -3, + GST_RTSP_ENOMEM = -4, + GST_RTSP_ERESOLV = -5, + GST_RTSP_ENOTIMPL = -6, + GST_RTSP_ESYS = -7, + GST_RTSP_EPARSE = -8, + GST_RTSP_EWSASTART = -9, + GST_RTSP_EWSAVERSION = -10, + GST_RTSP_EEOF = -11, + GST_RTSP_ENET = -12, + GST_RTSP_ENOTIP = -13, + GST_RTSP_ETIMEOUT = -14, + GST_RTSP_ETGET = -15, + GST_RTSP_ETPOST = -16, + + GST_RTSP_ELAST = -17 +} GstRTSPResult; + +/** + * GstRTSPEvent: + * @GST_RTSP_EV_READ: connection is readable + * @GST_RTSP_EV_WRITE: connection is writable + * + * The possible events for the connection. + */ +typedef enum { + GST_RTSP_EV_READ = (1 << 0), + GST_RTSP_EV_WRITE = (1 << 1) +} GstRTSPEvent; + +/** + * GstRTSPFamily: + * @GST_RTSP_FAM_NONE: unknown network family + * @GST_RTSP_FAM_INET: internet + * @GST_RTSP_FAM_INET6: internet V6 + * + * The possible network families. + */ +typedef enum { + GST_RTSP_FAM_NONE, + GST_RTSP_FAM_INET, + GST_RTSP_FAM_INET6 +} GstRTSPFamily; + +/** + * GstRTSPState: + * @GST_RTSP_STATE_INVALID: invalid state + * @GST_RTSP_STATE_INIT: initializing + * @GST_RTSP_STATE_READY: ready for operation + * @GST_RTSP_STATE_SEEKING: seeking in progress + * @GST_RTSP_STATE_PLAYING: playing + * @GST_RTSP_STATE_RECORDING: recording + * + * The different RTSP states. + */ +typedef enum { + GST_RTSP_STATE_INVALID, + GST_RTSP_STATE_INIT, + GST_RTSP_STATE_READY, + GST_RTSP_STATE_SEEKING, + GST_RTSP_STATE_PLAYING, + GST_RTSP_STATE_RECORDING +} GstRTSPState; + +/** + * GstRTSPVersion: + * @GST_RTSP_VERSION_INVALID: unknown/invalid version + * @GST_RTSP_VERSION_1_0: version 1.0 + * @GST_RTSP_VERSION_1_1: version 1.1. + * @GST_RTSP_VERSION_2_0: version 2.0. + * + * The supported RTSP versions. + */ +typedef enum { + GST_RTSP_VERSION_INVALID = 0x00, + GST_RTSP_VERSION_1_0 = 0x10, + GST_RTSP_VERSION_1_1 = 0x11, + GST_RTSP_VERSION_2_0 = 0x20 +} GstRTSPVersion; + +/** + * GstRTSPMethod: + * @GST_RTSP_INVALID: invalid method + * @GST_RTSP_DESCRIBE: the DESCRIBE method + * @GST_RTSP_ANNOUNCE: the ANNOUNCE method + * @GST_RTSP_GET_PARAMETER: the GET_PARAMETER method + * @GST_RTSP_OPTIONS: the OPTIONS method + * @GST_RTSP_PAUSE: the PAUSE method + * @GST_RTSP_PLAY: the PLAY method + * @GST_RTSP_RECORD: the RECORD method + * @GST_RTSP_REDIRECT: the REDIRECT method + * @GST_RTSP_SETUP: the SETUP method + * @GST_RTSP_SET_PARAMETER: the SET_PARAMETER method + * @GST_RTSP_TEARDOWN: the TEARDOWN method + * @GST_RTSP_GET: the GET method (HTTP). + * @GST_RTSP_POST: the POST method (HTTP). + * + * The different supported RTSP methods. + */ +typedef enum { + GST_RTSP_INVALID = 0, + GST_RTSP_DESCRIBE = (1 << 0), + GST_RTSP_ANNOUNCE = (1 << 1), + GST_RTSP_GET_PARAMETER = (1 << 2), + GST_RTSP_OPTIONS = (1 << 3), + GST_RTSP_PAUSE = (1 << 4), + GST_RTSP_PLAY = (1 << 5), + GST_RTSP_RECORD = (1 << 6), + GST_RTSP_REDIRECT = (1 << 7), + GST_RTSP_SETUP = (1 << 8), + GST_RTSP_SET_PARAMETER = (1 << 9), + GST_RTSP_TEARDOWN = (1 << 10), + GST_RTSP_GET = (1 << 11), + GST_RTSP_POST = (1 << 12) +} GstRTSPMethod; + +/** + * GstRTSPAuthMethod: + * @GST_RTSP_AUTH_NONE: no authentication + * @GST_RTSP_AUTH_BASIC: basic authentication + * @GST_RTSP_AUTH_DIGEST: digest authentication + * + * Authentication methods, ordered by strength + */ +typedef enum { + GST_RTSP_AUTH_NONE = 0x00, + GST_RTSP_AUTH_BASIC = 0x01, + GST_RTSP_AUTH_DIGEST = 0x02 +} GstRTSPAuthMethod; + +/** + * GST_RTSP_AUTH_MAX: + * + * Strongest available authentication method + */ +#define GST_RTSP_AUTH_MAX GST_RTSP_AUTH_DIGEST + +/** + * GstRTSPHeaderField: + * + * Enumeration of rtsp header fields + */ +typedef enum { + GST_RTSP_HDR_INVALID, + + /* + * R = Request + * r = response + * g = general + * e = entity + */ + GST_RTSP_HDR_ACCEPT, /* Accept R opt. entity */ + GST_RTSP_HDR_ACCEPT_ENCODING, /* Accept-Encoding R opt. entity */ + GST_RTSP_HDR_ACCEPT_LANGUAGE, /* Accept-Language R opt. all */ + GST_RTSP_HDR_ALLOW, /* Allow r opt. all */ + GST_RTSP_HDR_AUTHORIZATION, /* Authorization R opt. all */ + GST_RTSP_HDR_BANDWIDTH, /* Bandwidth R opt. all */ + GST_RTSP_HDR_BLOCKSIZE, /* Blocksize R opt. all but OPTIONS, TEARDOWN */ + GST_RTSP_HDR_CACHE_CONTROL, /* Cache-Control g opt. SETUP */ + GST_RTSP_HDR_CONFERENCE, /* Conference R opt. SETUP */ + GST_RTSP_HDR_CONNECTION, /* Connection g req. all */ + GST_RTSP_HDR_CONTENT_BASE, /* Content-Base e opt. entity */ + GST_RTSP_HDR_CONTENT_ENCODING, /* Content-Encoding e req. SET_PARAMETER, DESCRIBE, ANNOUNCE */ + GST_RTSP_HDR_CONTENT_LANGUAGE, /* Content-Language e req. DESCRIBE, ANNOUNCE */ + GST_RTSP_HDR_CONTENT_LENGTH, /* Content-Length e req. SET_PARAMETER, ANNOUNCE, entity */ + GST_RTSP_HDR_CONTENT_LOCATION, /* Content-Location e opt. entity */ + GST_RTSP_HDR_CONTENT_TYPE, /* Content-Type e req. SET_PARAMETER, ANNOUNCE, entity */ + GST_RTSP_HDR_CSEQ, /* CSeq g req. all */ + GST_RTSP_HDR_DATE, /* Date g opt. all */ + GST_RTSP_HDR_EXPIRES, /* Expires e opt. DESCRIBE, ANNOUNCE */ + GST_RTSP_HDR_FROM, /* From R opt. all */ + GST_RTSP_HDR_IF_MODIFIED_SINCE, /* If-Modified-Since R opt. DESCRIBE, SETUP */ + GST_RTSP_HDR_LAST_MODIFIED, /* Last-Modified e opt. entity */ + GST_RTSP_HDR_PROXY_AUTHENTICATE, /* Proxy-Authenticate */ + GST_RTSP_HDR_PROXY_REQUIRE, /* Proxy-Require R req. all */ + GST_RTSP_HDR_PUBLIC, /* Public r opt. all */ + GST_RTSP_HDR_RANGE, /* Range Rr opt. PLAY, PAUSE, RECORD */ + GST_RTSP_HDR_REFERER, /* Referrer R opt. all */ + GST_RTSP_HDR_REQUIRE, /* Require R req. all */ + GST_RTSP_HDR_RETRY_AFTER, /* Retry-After r opt. all */ + GST_RTSP_HDR_RTP_INFO, /* RTP-Info r req. PLAY */ + GST_RTSP_HDR_SCALE, /* Scale Rr opt. PLAY, RECORD */ + GST_RTSP_HDR_SESSION, /* Session Rr req. all but SETUP, OPTIONS */ + GST_RTSP_HDR_SERVER, /* Server r opt. all */ + GST_RTSP_HDR_SPEED, /* Speed Rr opt. PLAY */ + GST_RTSP_HDR_TRANSPORT, /* Transport Rr req. SETUP */ + GST_RTSP_HDR_UNSUPPORTED, /* Unsupported r req. all */ + GST_RTSP_HDR_USER_AGENT, /* User-Agent R opt. all */ + GST_RTSP_HDR_VIA, /* Via g opt. all */ + GST_RTSP_HDR_WWW_AUTHENTICATE, /* WWW-Authenticate r opt. all */ + + /* Real extensions */ + GST_RTSP_HDR_CLIENT_CHALLENGE, /* ClientChallenge */ + GST_RTSP_HDR_REAL_CHALLENGE1, /* RealChallenge1 */ + GST_RTSP_HDR_REAL_CHALLENGE2, /* RealChallenge2 */ + GST_RTSP_HDR_REAL_CHALLENGE3, /* RealChallenge3 */ + GST_RTSP_HDR_SUBSCRIBE, /* Subscribe */ + GST_RTSP_HDR_ALERT, /* Alert */ + GST_RTSP_HDR_CLIENT_ID, /* ClientID */ + GST_RTSP_HDR_COMPANY_ID, /* CompanyID */ + GST_RTSP_HDR_GUID, /* GUID */ + GST_RTSP_HDR_REGION_DATA, /* RegionData */ + GST_RTSP_HDR_MAX_ASM_WIDTH, /* SupportsMaximumASMBandwidth */ + GST_RTSP_HDR_LANGUAGE, /* Language */ + GST_RTSP_HDR_PLAYER_START_TIME, /* PlayerStarttime */ + + GST_RTSP_HDR_LOCATION, /* Location */ + + GST_RTSP_HDR_ETAG, /* ETag */ + GST_RTSP_HDR_IF_MATCH, /* If-Match */ + + /* WM extensions [MS-RTSP] */ + GST_RTSP_HDR_ACCEPT_CHARSET, /* Accept-Charset */ + GST_RTSP_HDR_SUPPORTED, /* Supported */ + GST_RTSP_HDR_VARY, /* Vary */ + GST_RTSP_HDR_X_ACCELERATE_STREAMING, /* X-Accelerate-Streaming */ + GST_RTSP_HDR_X_ACCEPT_AUTHENT, /* X-Accept-Authentication */ + GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT, /* X-Accept-Proxy-Authentication */ + GST_RTSP_HDR_X_BROADCAST_ID, /* X-Broadcast-Id */ + GST_RTSP_HDR_X_BURST_STREAMING, /* X-Burst-Streaming */ + GST_RTSP_HDR_X_NOTICE, /* X-Notice */ + GST_RTSP_HDR_X_PLAYER_LAG_TIME, /* X-Player-Lag-Time */ + GST_RTSP_HDR_X_PLAYLIST, /* X-Playlist */ + GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE, /* X-Playlist-Change-Notice */ + GST_RTSP_HDR_X_PLAYLIST_GEN_ID, /* X-Playlist-Gen-Id */ + GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, /* X-Playlist-Seek-Id */ + GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, /* X-Proxy-Client-Agent */ + GST_RTSP_HDR_X_PROXY_CLIENT_VERB, /* X-Proxy-Client-Verb */ + GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, /* X-Receding-PlaylistChange */ + GST_RTSP_HDR_X_RTP_INFO, /* X-RTP-Info */ + GST_RTSP_HDR_X_STARTUPPROFILE, /* X-StartupProfile */ + + GST_RTSP_HDR_TIMESTAMP, /* Timestamp */ + + GST_RTSP_HDR_AUTHENTICATION_INFO, /* Authentication-Info */ + GST_RTSP_HDR_HOST, /* Host */ + GST_RTSP_HDR_PRAGMA, /* Pragma */ + GST_RTSP_HDR_X_SERVER_IP_ADDRESS, /* X-Server-IP-Address */ + GST_RTSP_HDR_X_SESSIONCOOKIE, /* x-sessioncookie */ + + GST_RTSP_HDR_RTCP_INTERVAL, /* RTCP-Interval */ + + /* Since: 1.4 */ + GST_RTSP_HDR_KEYMGMT, /* KeyMgmt */ + + /* Since: 1.14 */ + GST_RTSP_HDR_PIPELINED_REQUESTS, /* Pipelined-Requests Rr opt. SETUP */ + GST_RTSP_HDR_MEDIA_PROPERTIES, /* Media-Properties Rr opt. SETUP */ + GST_RTSP_HDR_SEEK_STYLE, /* Seek-Type Rr opt. PLAY */ + GST_RTSP_HDR_ACCEPT_RANGES, /* Accept-Ranges Rr opt. SETUP, GET_PARAMETER */ + + /* Onvif extensions */ + GST_RTSP_HDR_FRAMES, /* Frames Rr opt. PLAY */ + GST_RTSP_HDR_RATE_CONTROL, /* Rate-control Rr opt. PLAY */ + + GST_RTSP_HDR_LAST +} GstRTSPHeaderField; + +/** + * GstRTSPStatusCode: + * + * Enumeration of rtsp status codes + */ +typedef enum { + GST_RTSP_STS_INVALID = 0, + GST_RTSP_STS_CONTINUE = 100, + GST_RTSP_STS_OK = 200, + GST_RTSP_STS_CREATED = 201, + GST_RTSP_STS_LOW_ON_STORAGE = 250, + GST_RTSP_STS_MULTIPLE_CHOICES = 300, + GST_RTSP_STS_MOVED_PERMANENTLY = 301, + GST_RTSP_STS_MOVE_TEMPORARILY = 302, + GST_RTSP_STS_SEE_OTHER = 303, + GST_RTSP_STS_NOT_MODIFIED = 304, + GST_RTSP_STS_USE_PROXY = 305, + GST_RTSP_STS_BAD_REQUEST = 400, + GST_RTSP_STS_UNAUTHORIZED = 401, + GST_RTSP_STS_PAYMENT_REQUIRED = 402, + GST_RTSP_STS_FORBIDDEN = 403, + GST_RTSP_STS_NOT_FOUND = 404, + GST_RTSP_STS_METHOD_NOT_ALLOWED = 405, + GST_RTSP_STS_NOT_ACCEPTABLE = 406, + GST_RTSP_STS_PROXY_AUTH_REQUIRED = 407, + GST_RTSP_STS_REQUEST_TIMEOUT = 408, + GST_RTSP_STS_GONE = 410, + GST_RTSP_STS_LENGTH_REQUIRED = 411, + GST_RTSP_STS_PRECONDITION_FAILED = 412, + GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE = 413, + GST_RTSP_STS_REQUEST_URI_TOO_LARGE = 414, + GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE = 415, + GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD = 451, + GST_RTSP_STS_CONFERENCE_NOT_FOUND = 452, + GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH = 453, + GST_RTSP_STS_SESSION_NOT_FOUND = 454, + GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE = 455, + GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE = 456, + GST_RTSP_STS_INVALID_RANGE = 457, + GST_RTSP_STS_PARAMETER_IS_READONLY = 458, + GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED = 459, + GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED = 460, + GST_RTSP_STS_UNSUPPORTED_TRANSPORT = 461, + GST_RTSP_STS_DESTINATION_UNREACHABLE = 462, + GST_RTSP_STS_KEY_MANAGEMENT_FAILURE = 463, /* since 1.4 */ + GST_RTSP_STS_INTERNAL_SERVER_ERROR = 500, + GST_RTSP_STS_NOT_IMPLEMENTED = 501, + GST_RTSP_STS_BAD_GATEWAY = 502, + GST_RTSP_STS_SERVICE_UNAVAILABLE = 503, + GST_RTSP_STS_GATEWAY_TIMEOUT = 504, + GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED = 505, + GST_RTSP_STS_OPTION_NOT_SUPPORTED = 551 +} GstRTSPStatusCode; + +GST_RTSP_API +gchar* gst_rtsp_strresult (GstRTSPResult result); + +GST_RTSP_API +const gchar* gst_rtsp_method_as_text (GstRTSPMethod method); + +GST_RTSP_API +const gchar* gst_rtsp_version_as_text (GstRTSPVersion version); + +GST_RTSP_API +const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field); + +GST_RTSP_API +const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code); + +GST_RTSP_API +gchar* gst_rtsp_options_as_text (GstRTSPMethod options); + +GST_RTSP_API +GstRTSPMethod gst_rtsp_options_from_text (const gchar *options); + +GST_RTSP_API +GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header); + +GST_RTSP_API +GstRTSPMethod gst_rtsp_find_method (const gchar *method); + +GST_RTSP_API +gboolean gst_rtsp_header_allow_multiple (GstRTSPHeaderField field); + +GST_RTSP_API +gchar * gst_rtsp_generate_digest_auth_response (const gchar *algorithm, + const gchar *method, + const gchar *realm, + const gchar *username, + const gchar *password, + const gchar *uri, + const gchar *nonce); + +GST_RTSP_API +gchar * gst_rtsp_generate_digest_auth_response_from_md5 (const gchar *algorithm, + const gchar * method, + const gchar * md5, + const gchar * uri, + const gchar * nonce); + +G_END_DECLS + +#endif /* __GST_RTSP_DEFS_H__ */ diff --git a/include/gst/rtsp/gstrtspextension.h b/include/gst/rtsp/gstrtspextension.h new file mode 100644 index 0000000000..60b129b46a --- /dev/null +++ b/include/gst/rtsp/gstrtspextension.h @@ -0,0 +1,122 @@ +/* GStreamer RTSP Extension + * Copyright (C) 2007 Wim Taymans <wim@fluendo.com> + * + * gstrtspextension.h: RTSP Extension interface. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_RTSP_EXTENSION_H__ +#define __GST_RTSP_EXTENSION_H__ + +#include <gst/gst.h> + +#include <gst/sdp/gstsdpmessage.h> +#include <gst/rtsp/gstrtsptransport.h> +#include <gst/rtsp/gstrtspmessage.h> +#include <gst/rtsp/gstrtspurl.h> + +G_BEGIN_DECLS + +#define GST_TYPE_RTSP_EXTENSION \ + (gst_rtsp_extension_get_type ()) +#define GST_RTSP_EXTENSION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_EXTENSION, GstRTSPExtension)) +#define GST_IS_RTSP_EXTENSION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_EXTENSION)) +#define GST_RTSP_EXTENSION_GET_INTERFACE(inst) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_RTSP_EXTENSION, GstRTSPExtensionInterface)) + +/** + * GstRTSPExtensionInterface: + * + * An interface representing RTSP extensions. + */ +typedef struct _GstRTSPExtension GstRTSPExtension; +typedef struct _GstRTSPExtensionInterface GstRTSPExtensionInterface; + +struct _GstRTSPExtensionInterface { + GTypeInterface parent; + + /* vfunctions */ + gboolean (*detect_server) (GstRTSPExtension *ext, GstRTSPMessage *resp); + + GstRTSPResult (*before_send) (GstRTSPExtension *ext, GstRTSPMessage *req); + GstRTSPResult (*after_send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp); + + GstRTSPResult (*parse_sdp) (GstRTSPExtension *ext, GstSDPMessage *sdp, GstStructure *s); + GstRTSPResult (*setup_media) (GstRTSPExtension *ext, GstSDPMedia *media); + + gboolean (*configure_stream) (GstRTSPExtension *ext, GstCaps *caps); + + GstRTSPResult (*get_transports) (GstRTSPExtension *ext, GstRTSPLowerTrans protocols, gchar **transport); + + GstRTSPResult (*stream_select) (GstRTSPExtension *ext, GstRTSPUrl *url); + + /* signals */ + GstRTSPResult (*send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp); + + /* ABI: more vfunctions added later */ + GstRTSPResult (*receive_request) (GstRTSPExtension *ext, GstRTSPMessage *req); + + /*< private >*/ + gpointer _gst_reserved[GST_PADDING]; +}; + +GST_RTSP_API +GType gst_rtsp_extension_get_type (void); + +/* invoke vfunction on interface */ + +GST_RTSP_API +gboolean gst_rtsp_extension_detect_server (GstRTSPExtension *ext, GstRTSPMessage *resp); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_before_send (GstRTSPExtension *ext, GstRTSPMessage *req); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_after_send (GstRTSPExtension *ext, GstRTSPMessage *req, + GstRTSPMessage *resp); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_parse_sdp (GstRTSPExtension *ext, GstSDPMessage *sdp, + GstStructure *s); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_setup_media (GstRTSPExtension *ext, GstSDPMedia *media); + +GST_RTSP_API +gboolean gst_rtsp_extension_configure_stream (GstRTSPExtension *ext, GstCaps *caps); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_get_transports (GstRTSPExtension *ext, GstRTSPLowerTrans protocols, + gchar **transport); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_stream_select (GstRTSPExtension *ext, GstRTSPUrl *url); + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_receive_request (GstRTSPExtension *ext, GstRTSPMessage *req); + +/* signal emission */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_extension_send (GstRTSPExtension *ext, GstRTSPMessage *req, + GstRTSPMessage *resp); + +G_END_DECLS + +#endif /* __GST_RTSP_EXTENSION_H__ */ diff --git a/include/gst/rtsp/gstrtspmessage.h b/include/gst/rtsp/gstrtspmessage.h new file mode 100644 index 0000000000..ed6a284c91 --- /dev/null +++ b/include/gst/rtsp/gstrtspmessage.h @@ -0,0 +1,347 @@ +/* GStreamer + * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_MESSAGE_H__ +#define __GST_RTSP_MESSAGE_H__ + +#include <gst/gst.h> +#include <gst/rtsp/gstrtspdefs.h> + +G_BEGIN_DECLS + +/** + * GstRTSPMsgType: + * @GST_RTSP_MESSAGE_INVALID: invalid message type + * @GST_RTSP_MESSAGE_REQUEST: RTSP request message + * @GST_RTSP_MESSAGE_RESPONSE: RTSP response message + * @GST_RTSP_MESSAGE_HTTP_REQUEST: HTTP request message. + * @GST_RTSP_MESSAGE_HTTP_RESPONSE: HTTP response message. + * @GST_RTSP_MESSAGE_DATA: data message + * + * The type of a message. + */ +typedef enum +{ + GST_RTSP_MESSAGE_INVALID, + GST_RTSP_MESSAGE_REQUEST, + GST_RTSP_MESSAGE_RESPONSE, + GST_RTSP_MESSAGE_HTTP_REQUEST, + GST_RTSP_MESSAGE_HTTP_RESPONSE, + GST_RTSP_MESSAGE_DATA +} GstRTSPMsgType; + +typedef struct _GstRTSPMessage GstRTSPMessage; + +/** + * GstRTSPMessage: + * @type: the message type + * + * An RTSP message containing request, response or data messages. Depending on + * the @type, the appropriate structure may be accessed. + */ +struct _GstRTSPMessage +{ + GstRTSPMsgType type; + + union { + struct { + GstRTSPMethod method; + gchar *uri; + GstRTSPVersion version; + } request; + struct { + GstRTSPStatusCode code; + gchar *reason; + GstRTSPVersion version; + } response; + struct { + guint8 channel; + } data; + } type_data; + + /*< private >*/ + GArray *hdr_fields; + + guint8 *body; + guint body_size; + + GstBuffer *body_buffer; + gpointer _gst_reserved[GST_PADDING-1]; +}; + +GST_RTSP_API +GType gst_rtsp_msg_get_type (void); + +#define GST_TYPE_RTSP_MESSAGE (gst_rtsp_msg_get_type()) +#define GST_RTSP_MESSAGE_CAST(object) ((GstRTSPMessage *)(object)) +#define GST_RTSP_MESSAGE(object) (GST_RTSP_MESSAGE_CAST(object)) + +/* memory management */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg); +GST_RTSP_API +GstRTSPResult gst_rtsp_message_copy (const GstRTSPMessage *msg, + GstRTSPMessage **copy); + +GST_RTSP_API +GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg); + +/* request */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg, + GstRTSPMethod method, + const gchar *uri); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg, + GstRTSPMethod method, + const gchar *uri); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg, + GstRTSPMethod *method, + const gchar **uri, + GstRTSPVersion *version); + +/* response */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg, + GstRTSPStatusCode code, + const gchar *reason, + const GstRTSPMessage *request); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg, + GstRTSPStatusCode code, + const gchar *reason, + const GstRTSPMessage *request); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg, + GstRTSPStatusCode *code, + const gchar **reason, + GstRTSPVersion *version); + +/* data */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg, + guint8 channel); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg, + guint8 channel); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg, + guint8 *channel); + +/* headers */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg, + GstRTSPHeaderField field, + const gchar *value); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg, + GstRTSPHeaderField field, + gchar *value); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg, + GstRTSPHeaderField field, + gint indx); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg, + GstRTSPHeaderField field, + gchar **value, + gint indx); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_add_header_by_name (GstRTSPMessage * msg, + const gchar * header, + const gchar * value); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_take_header_by_name (GstRTSPMessage * msg, + const gchar * header, + gchar * value); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_remove_header_by_name (GstRTSPMessage * msg, + const gchar * header, + gint index); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_get_header_by_name (GstRTSPMessage * msg, + const gchar * header, + gchar ** value, + gint index); + +/* header serialization */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg, + GString *str); + +/* handling the body */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg, + const guint8 *data, + guint size); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg, + guint8 *data, + guint size); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg, + guint8 **data, + guint *size); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg, + guint8 **data, + guint *size); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_set_body_buffer (GstRTSPMessage *msg, + GstBuffer * buffer); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_take_body_buffer(GstRTSPMessage *msg, + GstBuffer * buffer); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_get_body_buffer (const GstRTSPMessage *msg, + GstBuffer ** buffer); + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_steal_body_buffer(GstRTSPMessage *msg, + GstBuffer ** buffer); + +GST_RTSP_API +gboolean gst_rtsp_message_has_body_buffer(const GstRTSPMessage *msg); + +typedef struct _GstRTSPAuthCredential GstRTSPAuthCredential; +typedef struct _GstRTSPAuthParam GstRTSPAuthParam; + +/** + * GstRTSPAuthCredential: + * @scheme: a #GstRTSPAuthMethod + * @params: A NULL-terminated array of #GstRTSPAuthParam + * @authorization: The authorization for the basic schem + * + * RTSP Authentication credentials + * + * Since: 1.12 + */ +struct _GstRTSPAuthCredential { + GstRTSPAuthMethod scheme; + + /* For Basic/Digest WWW-Authenticate and Digest + * Authorization */ + GstRTSPAuthParam **params; /* NULL terminated */ + + /* For Basic Authorization */ + gchar *authorization; +}; + +/** + * GstRTSPAuthParam: + * @name: The name of the parameter + * @value: The value of the parameter + * + * RTSP Authentication parameter + * + * Since: 1.12 + */ +struct _GstRTSPAuthParam { + gchar *name; + gchar *value; +}; + +GST_RTSP_API +GstRTSPAuthParam * gst_rtsp_auth_param_copy (GstRTSPAuthParam * param); +GST_RTSP_API +void gst_rtsp_auth_param_free (GstRTSPAuthParam * param); + +GST_RTSP_API +GstRTSPAuthCredential ** gst_rtsp_message_parse_auth_credentials (GstRTSPMessage * msg, GstRTSPHeaderField field); + +GST_RTSP_API +void gst_rtsp_auth_credentials_free (GstRTSPAuthCredential ** credentials); + +#define GST_TYPE_RTSP_AUTH_CREDENTIAL gst_rtsp_auth_credential_get_type() + +GST_RTSP_API +GType gst_rtsp_auth_credential_get_type (void); + +#define GST_TYPE_RTSP_AUTH_PARAM gst_rtsp_auth_param_get_type() + +GST_RTSP_API +GType gst_rtsp_auth_param_get_type (void); + +/* debug */ + +GST_RTSP_API +GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg); + +G_END_DECLS + +#endif /* __GST_RTSP_MESSAGE_H__ */ diff --git a/include/gst/rtsp/gstrtsprange.h b/include/gst/rtsp/gstrtsprange.h new file mode 100644 index 0000000000..c14bf0f103 --- /dev/null +++ b/include/gst/rtsp/gstrtsprange.h @@ -0,0 +1,164 @@ +/* GStreamer + * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_RANGE_H__ +#define __GST_RTSP_RANGE_H__ + +#include <glib.h> +#include <gst/gst.h> + +#include <gst/rtsp/gstrtspdefs.h> + +G_BEGIN_DECLS + +/** + * GstRTSPRangeUnit: + * @GST_RTSP_RANGE_SMPTE: SMPTE timecode + * @GST_RTSP_RANGE_SMPTE_30_DROP: 29.97 frames per second + * @GST_RTSP_RANGE_SMPTE_25: 25 frames per second + * @GST_RTSP_RANGE_NPT: Normal play time + * @GST_RTSP_RANGE_CLOCK: Absolute time expressed as ISO 8601 timestamps + * + * Different possible time range units. + */ +typedef enum +{ + GST_RTSP_RANGE_SMPTE, + GST_RTSP_RANGE_SMPTE_30_DROP, + GST_RTSP_RANGE_SMPTE_25, + GST_RTSP_RANGE_NPT, + GST_RTSP_RANGE_CLOCK +} GstRTSPRangeUnit; + +typedef struct _GstRTSPTimeRange GstRTSPTimeRange; +typedef struct _GstRTSPTime GstRTSPTime; +typedef struct _GstRTSPTime2 GstRTSPTime2; + +/** + * GstRTSPTimeType: + * @GST_RTSP_TIME_SECONDS: seconds + * @GST_RTSP_TIME_NOW: now + * @GST_RTSP_TIME_END: end + * @GST_RTSP_TIME_FRAMES: frames and subframes + * @GST_RTSP_TIME_UTC: UTC time + * + * Possible time types. + */ +typedef enum { + GST_RTSP_TIME_SECONDS, + GST_RTSP_TIME_NOW, + GST_RTSP_TIME_END, + GST_RTSP_TIME_FRAMES, + GST_RTSP_TIME_UTC +} GstRTSPTimeType; + +/** + * GstRTSPTime: + * @type: the time of the time + * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS, + * GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES + * + * A time indication. + */ +struct _GstRTSPTime { + GstRTSPTimeType type; + gdouble seconds; +}; + +/** + * GstRTSPTime2: + * @frames: frames and subframes when type in GstRTSPTime is + * GST_RTSP_TIME_FRAMES + * @year: year when type is GST_RTSP_TIME_UTC + * @month: month when type is GST_RTSP_TIME_UTC + * @day: day when type is GST_RTSP_TIME_UTC + * + * Extra fields for a time indication. + * + * Since: 1.2 + */ +struct _GstRTSPTime2 { + gdouble frames; + guint year; + guint month; + guint day; +}; + +/** + * GstRTSPTimeRange: + * @unit: the time units used + * @min: the minimum interval + * @max: the maximum interval + * @min2: extra fields in the minimum interval (Since: 1.2) + * @max2: extra fields in the maximum interval (Since: 1.2) + * + * A time range. + */ +struct _GstRTSPTimeRange { + GstRTSPRangeUnit unit; + + GstRTSPTime min; + GstRTSPTime max; + GstRTSPTime2 min2; + GstRTSPTime2 max2; +}; + +GST_RTSP_API +GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range); + +GST_RTSP_API +gchar * gst_rtsp_range_to_string (const GstRTSPTimeRange *range); + +GST_RTSP_API +void gst_rtsp_range_free (GstRTSPTimeRange *range); + +GST_RTSP_API +gboolean gst_rtsp_range_get_times (const GstRTSPTimeRange *range, + GstClockTime *min, GstClockTime *max); + +GST_RTSP_API +gboolean gst_rtsp_range_convert_units (GstRTSPTimeRange * range, + GstRTSPRangeUnit unit); + +G_END_DECLS + +#endif /* __GST_RTSP_RANGE_H__ */ diff --git a/include/gst/rtsp/gstrtsptransport.h b/include/gst/rtsp/gstrtsptransport.h new file mode 100644 index 0000000000..909edecd7a --- /dev/null +++ b/include/gst/rtsp/gstrtsptransport.h @@ -0,0 +1,201 @@ +/* GStreamer + * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_TRANSPORT_H__ +#define __GST_RTSP_TRANSPORT_H__ + +#include <gst/gstconfig.h> +#include <gst/rtsp/gstrtspdefs.h> +#include <gst/rtsp/gstrtsp-enumtypes.h> + +G_BEGIN_DECLS + +/** + * GstRTSPTransMode: + * @GST_RTSP_TRANS_UNKNOWN: invalid tansport mode + * @GST_RTSP_TRANS_RTP: transfer RTP data + * @GST_RTSP_TRANS_RDT: transfer RDT (RealMedia) data + * + * The transfer mode to use. + */ +typedef enum { + GST_RTSP_TRANS_UNKNOWN = 0, + GST_RTSP_TRANS_RTP = (1 << 0), + GST_RTSP_TRANS_RDT = (1 << 1) +} GstRTSPTransMode; + +/** + * GstRTSPProfile: + * @GST_RTSP_PROFILE_UNKNOWN: invalid profile + * @GST_RTSP_PROFILE_AVP: the Audio/Visual profile (RFC 3551) + * @GST_RTSP_PROFILE_SAVP: the secure Audio/Visual profile (RFC 3711) + * @GST_RTSP_PROFILE_AVPF: the Audio/Visual profile with feedback (RFC 4585) + * @GST_RTSP_PROFILE_SAVPF: the secure Audio/Visual profile with feedback (RFC 5124) + * + * The transfer profile to use. + */ +/* FIXME 2.0: This should probably be an enum, not flags and maybe be replaced + * by GstRTPTransport */ +typedef enum { + GST_RTSP_PROFILE_UNKNOWN = 0, + GST_RTSP_PROFILE_AVP = (1 << 0), + GST_RTSP_PROFILE_SAVP = (1 << 1), + GST_RTSP_PROFILE_AVPF = (1 << 2), + GST_RTSP_PROFILE_SAVPF = (1 << 3), +} GstRTSPProfile; + +/** + * GstRTSPLowerTrans: + * @GST_RTSP_LOWER_TRANS_UNKNOWN: invalid transport flag + * @GST_RTSP_LOWER_TRANS_UDP: stream data over UDP + * @GST_RTSP_LOWER_TRANS_UDP_MCAST: stream data over UDP multicast + * @GST_RTSP_LOWER_TRANS_TCP: stream data over TCP + * @GST_RTSP_LOWER_TRANS_HTTP: stream data tunneled over HTTP. + * @GST_RTSP_LOWER_TRANS_TLS: encrypt TCP and HTTP with TLS + * + * The different transport methods. + */ +typedef enum { + GST_RTSP_LOWER_TRANS_UNKNOWN = 0, + GST_RTSP_LOWER_TRANS_UDP = (1 << 0), + GST_RTSP_LOWER_TRANS_UDP_MCAST = (1 << 1), + GST_RTSP_LOWER_TRANS_TCP = (1 << 2), + GST_RTSP_LOWER_TRANS_HTTP = (1 << 4), + GST_RTSP_LOWER_TRANS_TLS = (1 << 5) +} GstRTSPLowerTrans; + +typedef struct _GstRTSPRange GstRTSPRange; +typedef struct _GstRTSPTransport GstRTSPTransport; + +/** + * GstRTSPRange: + * @min: minimum value of the range + * @max: maximum value of the range + * + * A type to specify a range. + */ + +struct _GstRTSPRange { + gint min; + gint max; +}; + +/** + * GstRTSPTransport: + * @trans: the transport mode + * @profile: the tansport profile + * @lower_transport: the lower transport + * @destination: the destination ip/hostname + * @source: the source ip/hostname + * @layers: the number of layers + * @mode_play: if play mode was selected + * @mode_record: if record mode was selected + * @append: is append mode was selected + * @interleaved: the interleave range + * @ttl: the time to live for multicast UDP + * @port: the port pair for multicast sessions + * @client_port: the client port pair for receiving data. For TCP + * based transports, applications can use this field to store the + * sender and receiver ports of the client. + * @server_port: the server port pair for receiving data. For TCP + * based transports, applications can use this field to store the + * sender and receiver ports of the server. + * @ssrc: the ssrc that the sender/receiver will use + * + * A structure holding the RTSP transport values. + */ + +struct _GstRTSPTransport { + GstRTSPTransMode trans; + GstRTSPProfile profile; + GstRTSPLowerTrans lower_transport; + + gchar *destination; + gchar *source; + guint layers; + gboolean mode_play; + gboolean mode_record; + gboolean append; + GstRTSPRange interleaved; + + /* multicast specific */ + guint ttl; + GstRTSPRange port; + + /* UDP/TCP specific */ + GstRTSPRange client_port; + GstRTSPRange server_port; + /* RTP specific */ + guint ssrc; + + /*< private >*/ + gpointer _gst_reserved[GST_PADDING]; +}; + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_new (GstRTSPTransport **transport); + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_init (GstRTSPTransport *transport); + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_parse (const gchar *str, GstRTSPTransport *transport); + +GST_RTSP_API +gchar* gst_rtsp_transport_as_text (GstRTSPTransport *transport); + +GST_RTSP_DEPRECATED_FOR(gst_rtsp_transport_get_media_type) +GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime); + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option); + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_get_media_type (GstRTSPTransport *transport, + const gchar **media_type); + +GST_RTSP_API +GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport); + +G_END_DECLS + +#endif /* __GST_RTSP_TRANSPORT_H__ */ diff --git a/include/gst/rtsp/gstrtspurl.h b/include/gst/rtsp/gstrtspurl.h new file mode 100644 index 0000000000..8e95a1567f --- /dev/null +++ b/include/gst/rtsp/gstrtspurl.h @@ -0,0 +1,121 @@ +/* GStreamer + * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/* + * Unless otherwise indicated, Source Code is licensed under MIT license. + * See further explanation attached in License Statement (distributed in the file + * LICENSE). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __GST_RTSP_URL_H__ +#define __GST_RTSP_URL_H__ + +#include <glib.h> +#include <glib-object.h> + +#include <gst/rtsp/gstrtspdefs.h> +#include <gst/rtsp/gstrtsptransport.h> + +G_BEGIN_DECLS + +/** + * GST_RTSP_DEFAULT_PORT: + * + * The default RTSP port to connect to. + */ +#define GST_RTSP_DEFAULT_PORT 554 + +#define GST_TYPE_RTSP_URL (gst_rtsp_url_get_type()) + +typedef struct _GstRTSPUrl GstRTSPUrl; + +/** + * GstRTSPUrl: + * @transports: the transports allowed + * @family: the family + * @user: the user + * @passwd: the password + * @host: the host + * @port: the port + * @abspath: the absolute path + * @query: additional query parameters + * + * This structure contains the result of a parsed RTSP URL + */ +struct _GstRTSPUrl { + GstRTSPLowerTrans transports; + GstRTSPFamily family; + gchar *user; + gchar *passwd; + gchar *host; + guint16 port; + gchar *abspath; + gchar *query; +}; + +GST_RTSP_API +GType gst_rtsp_url_get_type (void); + +GST_RTSP_API +GstRTSPResult gst_rtsp_url_parse (const gchar *urlstr, GstRTSPUrl **url); + +GST_RTSP_API +GstRTSPUrl* gst_rtsp_url_copy (const GstRTSPUrl *url); + +GST_RTSP_API +void gst_rtsp_url_free (GstRTSPUrl *url); + +GST_RTSP_API +gchar* gst_rtsp_url_get_request_uri (const GstRTSPUrl *url); + +GST_RTSP_API +gchar * gst_rtsp_url_get_request_uri_with_control (const GstRTSPUrl * url, + const gchar * control_path); + +GST_RTSP_API +gchar** gst_rtsp_url_decode_path_components + (const GstRTSPUrl *url); +GST_RTSP_API +GstRTSPResult gst_rtsp_url_set_port (GstRTSPUrl *url, guint16 port); + +GST_RTSP_API +GstRTSPResult gst_rtsp_url_get_port (const GstRTSPUrl *url, guint16 *port); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPUrl, gst_rtsp_url_free) + +G_END_DECLS + +#endif /* __GST_RTSP_URL_H__ */ diff --git a/include/gst/rtsp/rtsp-prelude.h b/include/gst/rtsp/rtsp-prelude.h new file mode 100644 index 0000000000..1086091179 --- /dev/null +++ b/include/gst/rtsp/rtsp-prelude.h @@ -0,0 +1,41 @@ +/* GStreamer Rtsp Library + * Copyright (C) 2018 GStreamer developers + * + * rtsp-prelude.h: prelude include header for gst-rtsp library + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_RTSP_PRELUDE_H__ +#define __GST_RTSP_PRELUDE_H__ + +#include <gst/gst.h> + +#ifdef BUILDING_GST_RTSP +#define GST_RTSP_API GST_API_EXPORT /* from config.h */ +#else +#define GST_RTSP_API GST_API_IMPORT +#endif + +#ifndef GST_DISABLE_DEPRECATED +#define GST_RTSP_DEPRECATED GST_RTSP_API +#define GST_RTSP_DEPRECATED_FOR(f) GST_RTSP_API +#else +#define GST_RTSP_DEPRECATED G_DEPRECATED GST_RTSP_API +#define GST_RTSP_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_RTSP_API +#endif + +#endif /* __GST_RTSP_PRELUDE_H__ */ diff --git a/include/gst/rtsp/rtsp.h b/include/gst/rtsp/rtsp.h new file mode 100644 index 0000000000..a44b650b09 --- /dev/null +++ b/include/gst/rtsp/rtsp.h @@ -0,0 +1,37 @@ +/* GStreamer + * Copyright (C) 2012 GStreamer developers + * + * gstrtsp.h: single include header for gst-rtsp library + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_RTSP__H__ +#define __GST_RTSP__H__ + +#include <gst/rtsp/rtsp-prelude.h> + +#include <gst/rtsp/gstrtsp.h> +#include <gst/rtsp/gstrtspconnection.h> +#include <gst/rtsp/gstrtspdefs.h> +#include <gst/rtsp/gstrtsp-enumtypes.h> +#include <gst/rtsp/gstrtspextension.h> +#include <gst/rtsp/gstrtspmessage.h> +#include <gst/rtsp/gstrtsprange.h> +#include <gst/rtsp/gstrtsptransport.h> +#include <gst/rtsp/gstrtspurl.h> + +#endif /* __GST_RTSP__H__ */ |