diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am index f45ca5f20a..e7087e7384 100644 --- a/gst-libs/gst/rtsp/Makefile.am +++ b/gst-libs/gst/rtsp/Makefile.am @@ -44,6 +44,7 @@ glib_gen_prefix = __gst_rtsp glib_enum_define = gst_rtsp glib_enum_headers = $(libgstrtspinclude_HEADERS) glib_gen_basename = gstrtsp +glib_gen_decl_banner=GST_EXPORT include $(top_srcdir)/common/gst-glib-gen.mak diff --git a/gst-libs/gst/rtsp/gstrtspconnection.h b/gst-libs/gst/rtsp/gstrtspconnection.h index 43479ae6a1..11e0ac88b2 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.h +++ b/gst-libs/gst/rtsp/gstrtspconnection.h @@ -61,87 +61,159 @@ G_BEGIN_DECLS typedef struct _GstRTSPConnection GstRTSPConnection; /* opening/closing a connection */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_create_from_socket (GSocket * socket, const gchar * ip, guint16 port, const gchar * initial_buffer, GstRTSPConnection ** conn); +GST_EXPORT GstRTSPResult gst_rtsp_connection_accept (GSocket * socket, GstRTSPConnection ** conn, GCancellable * cancellable); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_connect_with_response (GstRTSPConnection * conn, GTimeVal * timeout, GstRTSPMessage * response); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn); /* TLS connections */ + +GST_EXPORT GTlsConnection * gst_rtsp_connection_get_tls (GstRTSPConnection * conn, GError ** error); + +GST_EXPORT gboolean gst_rtsp_connection_set_tls_validation_flags (GstRTSPConnection * conn, GTlsCertificateFlags flags); + +GST_EXPORT GTlsCertificateFlags gst_rtsp_connection_get_tls_validation_flags (GstRTSPConnection * conn); + +GST_EXPORT void gst_rtsp_connection_set_tls_database (GstRTSPConnection * conn, GTlsDatabase * database); + +GST_EXPORT GTlsDatabase * gst_rtsp_connection_get_tls_database (GstRTSPConnection * conn); + +GST_EXPORT void gst_rtsp_connection_set_tls_interaction (GstRTSPConnection * conn, GTlsInteraction * interaction); + +GST_EXPORT GTlsInteraction * gst_rtsp_connection_get_tls_interaction (GstRTSPConnection * conn); /* sending/receiving raw bytes */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data, guint size, GTimeVal * timeout); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data, guint size, GTimeVal * timeout); /* sending/receiving messages */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout); /* status management */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_poll (GstRTSPConnection *conn, GstRTSPEvent events, GstRTSPEvent *revents, GTimeVal *timeout); /* reset the timeout */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn); /* flushing state */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush); /* HTTP proxy support */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_set_proxy (GstRTSPConnection *conn, const gchar *host, guint port); /* configure authentication data */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method, const gchar *user, const gchar *pass); +GST_EXPORT void gst_rtsp_connection_set_auth_param (GstRTSPConnection *conn, const gchar * param, const gchar *value); + +GST_EXPORT void gst_rtsp_connection_clear_auth_params (GstRTSPConnection *conn); /* configure DSCP */ + +GST_EXPORT GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn, guint qos_dscp); /* accessors */ + +GST_EXPORT GstRTSPUrl * gst_rtsp_connection_get_url (const GstRTSPConnection *conn); + +GST_EXPORT const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn); + +GST_EXPORT void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip); +GST_EXPORT GSocket * gst_rtsp_connection_get_read_socket (const GstRTSPConnection *conn); + +GST_EXPORT GSocket * gst_rtsp_connection_get_write_socket (const GstRTSPConnection *conn); +GST_EXPORT void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn, gboolean enable); /* tunneling */ + +GST_EXPORT void gst_rtsp_connection_set_tunneled (GstRTSPConnection *conn, gboolean tunneled); + +GST_EXPORT gboolean gst_rtsp_connection_is_tunneled (const GstRTSPConnection *conn); +GST_EXPORT const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn); + +GST_EXPORT GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2); +GST_EXPORT void gst_rtsp_connection_set_remember_session_id (GstRTSPConnection *conn, gboolean remember); + +GST_EXPORT gboolean gst_rtsp_connection_get_remember_session_id (GstRTSPConnection *conn); /* async IO */ @@ -197,30 +269,45 @@ typedef struct { gpointer _gst_reserved[GST_PADDING-1]; } GstRTSPWatchFuncs; +GST_EXPORT GstRTSPWatch * gst_rtsp_watch_new (GstRTSPConnection *conn, GstRTSPWatchFuncs *funcs, gpointer user_data, GDestroyNotify notify); + +GST_EXPORT void gst_rtsp_watch_reset (GstRTSPWatch *watch); + +GST_EXPORT void gst_rtsp_watch_unref (GstRTSPWatch *watch); +GST_EXPORT guint gst_rtsp_watch_attach (GstRTSPWatch *watch, GMainContext *context); +GST_EXPORT void gst_rtsp_watch_set_send_backlog (GstRTSPWatch *watch, gsize bytes, guint messages); + +GST_EXPORT void gst_rtsp_watch_get_send_backlog (GstRTSPWatch *watch, gsize *bytes, guint *messages); +GST_EXPORT GstRTSPResult gst_rtsp_watch_write_data (GstRTSPWatch *watch, const guint8 *data, guint size, guint *id); + +GST_EXPORT GstRTSPResult gst_rtsp_watch_send_message (GstRTSPWatch *watch, GstRTSPMessage *message, guint *id); + +GST_EXPORT GstRTSPResult gst_rtsp_watch_wait_backlog (GstRTSPWatch * watch, GTimeVal *timeout); +GST_EXPORT void gst_rtsp_watch_set_flushing (GstRTSPWatch * watch, gboolean flushing); G_END_DECLS diff --git a/gst-libs/gst/rtsp/gstrtspdefs.h b/gst-libs/gst/rtsp/gstrtspdefs.h index dec6a1108c..743c4964be 100644 --- a/gst-libs/gst/rtsp/gstrtspdefs.h +++ b/gst-libs/gst/rtsp/gstrtspdefs.h @@ -43,8 +43,7 @@ #ifndef __GST_RTSP_DEFS_H__ #define __GST_RTSP_DEFS_H__ -#include -#include +#include G_BEGIN_DECLS @@ -390,21 +389,37 @@ typedef enum { GST_RTSP_STS_OPTION_NOT_SUPPORTED = 551 } GstRTSPStatusCode; +GST_EXPORT gchar* gst_rtsp_strresult (GstRTSPResult result); +GST_EXPORT const gchar* gst_rtsp_method_as_text (GstRTSPMethod method); + +GST_EXPORT const gchar* gst_rtsp_version_as_text (GstRTSPVersion version); + +GST_EXPORT const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field); + +GST_EXPORT const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code); +GST_EXPORT gchar* gst_rtsp_options_as_text (GstRTSPMethod options); + +GST_EXPORT GstRTSPMethod gst_rtsp_options_from_text (const gchar *options); +GST_EXPORT GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header); + +GST_EXPORT GstRTSPMethod gst_rtsp_find_method (const gchar *method); +GST_EXPORT gboolean gst_rtsp_header_allow_multiple (GstRTSPHeaderField field); +GST_EXPORT gchar * gst_rtsp_generate_digest_auth_response (const gchar *algorithm, const gchar *method, const gchar *realm, diff --git a/gst-libs/gst/rtsp/gstrtspextension.h b/gst-libs/gst/rtsp/gstrtspextension.h index 19d01a58bb..ffffd6a5af 100644 --- a/gst-libs/gst/rtsp/gstrtspextension.h +++ b/gst-libs/gst/rtsp/gstrtspextension.h @@ -71,24 +71,44 @@ struct _GstRTSPExtensionInterface { gpointer _gst_reserved[GST_PADDING]; }; +GST_EXPORT GType gst_rtsp_extension_get_type (void); /* invoke vfunction on interface */ + +GST_EXPORT gboolean gst_rtsp_extension_detect_server (GstRTSPExtension *ext, GstRTSPMessage *resp); +GST_EXPORT GstRTSPResult gst_rtsp_extension_before_send (GstRTSPExtension *ext, GstRTSPMessage *req); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_after_send (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_parse_sdp (GstRTSPExtension *ext, GstSDPMessage *sdp, GstStructure *s); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_setup_media (GstRTSPExtension *ext, GstSDPMedia *media); + +GST_EXPORT gboolean gst_rtsp_extension_configure_stream (GstRTSPExtension *ext, GstCaps *caps); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_get_transports (GstRTSPExtension *ext, GstRTSPLowerTrans protocols, gchar **transport); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_stream_select (GstRTSPExtension *ext, GstRTSPUrl *url); + +GST_EXPORT GstRTSPResult gst_rtsp_extension_receive_request (GstRTSPExtension *ext, GstRTSPMessage *req); /* signal emision */ + +GST_EXPORT GstRTSPResult gst_rtsp_extension_send (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp); diff --git a/gst-libs/gst/rtsp/gstrtspmessage.h b/gst-libs/gst/rtsp/gstrtspmessage.h index d6c5c67ce3..48316cb8bb 100644 --- a/gst-libs/gst/rtsp/gstrtspmessage.h +++ b/gst-libs/gst/rtsp/gstrtspmessage.h @@ -108,93 +108,142 @@ struct _GstRTSPMessage }; /* memory management */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg); + +GST_EXPORT GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg); + +GST_EXPORT GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg); + +GST_EXPORT GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg); +GST_EXPORT GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg); /* request */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg, GstRTSPMethod method, const gchar *uri); + +GST_EXPORT GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg, GstRTSPMethod method, const gchar *uri); + +GST_EXPORT GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg, GstRTSPMethod *method, const gchar **uri, GstRTSPVersion *version); /* response */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg, GstRTSPStatusCode code, const gchar *reason, const GstRTSPMessage *request); + +GST_EXPORT GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg, GstRTSPStatusCode code, const gchar *reason, const GstRTSPMessage *request); + +GST_EXPORT GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg, GstRTSPStatusCode *code, const gchar **reason, GstRTSPVersion *version); /* data */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg, guint8 channel); + +GST_EXPORT GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg, guint8 channel); + +GST_EXPORT GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg, guint8 *channel); /* headers */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg, GstRTSPHeaderField field, const gchar *value); + +GST_EXPORT GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg, GstRTSPHeaderField field, gchar *value); + +GST_EXPORT GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg, GstRTSPHeaderField field, gint indx); + +GST_EXPORT GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg, GstRTSPHeaderField field, gchar **value, gint indx); +GST_EXPORT GstRTSPResult gst_rtsp_message_add_header_by_name (GstRTSPMessage * msg, const gchar * header, const gchar * value); +GST_EXPORT GstRTSPResult gst_rtsp_message_take_header_by_name (GstRTSPMessage * msg, const gchar * header, gchar * value); +GST_EXPORT GstRTSPResult gst_rtsp_message_remove_header_by_name (GstRTSPMessage * msg, const gchar * header, gint index); +GST_EXPORT GstRTSPResult gst_rtsp_message_get_header_by_name (GstRTSPMessage * msg, const gchar * header, gchar ** value, gint index); /* header serialization */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg, GString *str); /* handling the body */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg, const guint8 *data, guint size); + +GST_EXPORT GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg, guint8 *data, guint size); + +GST_EXPORT GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg, guint8 **data, guint *size); + +GST_EXPORT GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg, guint8 **data, guint *size); @@ -218,18 +267,25 @@ struct _GstRTSPAuthParam { gchar *value; }; +GST_EXPORT GstRTSPAuthCredential ** gst_rtsp_message_parse_auth_credentials (GstRTSPMessage * msg, GstRTSPHeaderField field); + +GST_EXPORT void gst_rtsp_auth_credentials_free (GstRTSPAuthCredential ** credentials); #define GST_TYPE_RTSP_AUTH_CREDENTIAL gst_rtsp_auth_credential_get_type() +GST_EXPORT GType gst_rtsp_auth_credential_get_type (void); #define GST_TYPE_RTSP_AUTH_PARAM gst_rtsp_auth_param_get_type() +GST_EXPORT GType gst_rtsp_auth_param_get_type (void); /* debug */ + +GST_EXPORT GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg); G_END_DECLS diff --git a/gst-libs/gst/rtsp/gstrtsprange.h b/gst-libs/gst/rtsp/gstrtsprange.h index c80099bfb5..884f5cae1d 100644 --- a/gst-libs/gst/rtsp/gstrtsprange.h +++ b/gst-libs/gst/rtsp/gstrtsprange.h @@ -142,13 +142,20 @@ struct _GstRTSPTimeRange { GstRTSPTime2 max2; }; +GST_EXPORT GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range); + +GST_EXPORT gchar * gst_rtsp_range_to_string (const GstRTSPTimeRange *range); + +GST_EXPORT void gst_rtsp_range_free (GstRTSPTimeRange *range); +GST_EXPORT gboolean gst_rtsp_range_get_times (const GstRTSPTimeRange *range, GstClockTime *min, GstClockTime *max); +GST_EXPORT gboolean gst_rtsp_range_convert_units (GstRTSPTimeRange * range, GstRTSPRangeUnit unit); diff --git a/gst-libs/gst/rtsp/gstrtsptransport.h b/gst-libs/gst/rtsp/gstrtsptransport.h index 8918fc50b6..bdcbe088e7 100644 --- a/gst-libs/gst/rtsp/gstrtsptransport.h +++ b/gst-libs/gst/rtsp/gstrtsptransport.h @@ -171,18 +171,29 @@ struct _GstRTSPTransport { gpointer _gst_reserved[GST_PADDING]; }; +GST_EXPORT GstRTSPResult gst_rtsp_transport_new (GstRTSPTransport **transport); + +GST_EXPORT GstRTSPResult gst_rtsp_transport_init (GstRTSPTransport *transport); +GST_EXPORT GstRTSPResult gst_rtsp_transport_parse (const gchar *str, GstRTSPTransport *transport); + +GST_EXPORT gchar* gst_rtsp_transport_as_text (GstRTSPTransport *transport); +GST_EXPORT GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime); + +GST_EXPORT GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option); +GST_EXPORT GstRTSPResult gst_rtsp_transport_get_media_type (GstRTSPTransport *transport, const gchar **media_type); +GST_EXPORT GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport); G_END_DECLS diff --git a/gst-libs/gst/rtsp/gstrtspurl.h b/gst-libs/gst/rtsp/gstrtspurl.h index 7647c77858..7f686c6899 100644 --- a/gst-libs/gst/rtsp/gstrtspurl.h +++ b/gst-libs/gst/rtsp/gstrtspurl.h @@ -86,16 +86,28 @@ struct _GstRTSPUrl { gchar *query; }; +GST_EXPORT GType gst_rtsp_url_get_type (void); +GST_EXPORT GstRTSPResult gst_rtsp_url_parse (const gchar *urlstr, GstRTSPUrl **url); + +GST_EXPORT GstRTSPUrl* gst_rtsp_url_copy (const GstRTSPUrl *url); + +GST_EXPORT void gst_rtsp_url_free (GstRTSPUrl *url); + +GST_EXPORT gchar* gst_rtsp_url_get_request_uri (const GstRTSPUrl *url); + +GST_EXPORT gchar** gst_rtsp_url_decode_path_components (const GstRTSPUrl *url); - +GST_EXPORT GstRTSPResult gst_rtsp_url_set_port (GstRTSPUrl *url, guint16 port); + +GST_EXPORT GstRTSPResult gst_rtsp_url_get_port (const GstRTSPUrl *url, guint16 *port); #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC diff --git a/gst-libs/gst/rtsp/rtsp_mkenum.py b/gst-libs/gst/rtsp/rtsp_mkenum.py index 5cad36b489..0c5797e64d 100755 --- a/gst-libs/gst/rtsp/rtsp_mkenum.py +++ b/gst-libs/gst/rtsp/rtsp_mkenum.py @@ -9,11 +9,11 @@ import sys, os, shutil, subprocess h_array = [ '--fhead', - "#ifndef __gst_rtsp_ENUM_TYPES_H__\n#define __gst_rtsp_ENUM_TYPES_H__\n\n#include \n\nG_BEGIN_DECLS\n", + "#ifndef __gst_rtsp_ENUM_TYPES_H__\n#define __gst_rtsp_ENUM_TYPES_H__\n\n#include \n\nG_BEGIN_DECLS\n", '--fprod', "\n/* enumerations from \"@filename@\" */\n", '--vhead', - "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n", + "GST_EXPORT GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n", '--ftail', "G_END_DECLS\n\n#endif /* __gst_rtsp_ENUM_TYPES_H__ */" ]