From a874c158cd4b647e3c4a7171c613b7d6026a9e4c Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Wed, 9 Jan 2019 12:18:36 +0100 Subject: [PATCH] rtmp: add rtmp_set_handlers --- include/re_rtmp.h | 2 ++ src/rtmp/conn.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/re_rtmp.h b/include/re_rtmp.h index b7fc8fc..4def1d1 100644 --- a/include/re_rtmp.h +++ b/include/re_rtmp.h @@ -81,6 +81,8 @@ int rtmp_accept(struct rtmp_conn **connp, struct tcp_sock *ts, rtmp_command_h *cmdh, rtmp_close_h *closeh, void *arg); int rtmp_control(const struct rtmp_conn *conn, enum rtmp_packet_type type, ...); +void rtmp_set_handlers(struct rtmp_conn *conn, rtmp_command_h *cmdh, + rtmp_close_h *closeh, void *arg); struct tcp_conn *rtmp_conn_tcpconn(const struct rtmp_conn *conn); const char *rtmp_conn_stream(const struct rtmp_conn *conn); int rtmp_conn_debug(struct re_printf *pf, const struct rtmp_conn *conn); diff --git a/src/rtmp/conn.c b/src/rtmp/conn.c index 1ea7758..623193d 100644 --- a/src/rtmp/conn.c +++ b/src/rtmp/conn.c @@ -960,6 +960,18 @@ const char *rtmp_conn_stream(const struct rtmp_conn *conn) } +void rtmp_set_handlers(struct rtmp_conn *conn, rtmp_command_h *cmdh, + rtmp_close_h *closeh, void *arg) +{ + if (!conn) + return; + + conn->cmdh = cmdh; + conn->closeh = closeh; + conn->arg = arg; +} + + static const char *rtmp_handshake_name(enum rtmp_handshake_state state) { switch (state) {