ZLMediaKit/api/include/mk_rtp_server.h

115 lines
3.9 KiB
C++
Raw Permalink Normal View History

2020-09-20 21:23:33 +08:00
/*
2023-12-09 16:23:51 +08:00
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
2020-09-20 21:23:33 +08:00
*
2023-12-09 16:23:51 +08:00
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
2020-09-20 21:23:33 +08:00
*
2023-12-09 16:23:51 +08:00
* Use of this source code is governed by MIT-like license that can be found in the
2020-09-20 21:23:33 +08:00
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#include "mk_common.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct mk_rtp_server_t *mk_rtp_server;
2020-09-20 21:23:33 +08:00
/**
* GB28181 RTP
* @param port 0
* @param tcp_mode tcp模式(0: 1: 2: )
2020-09-20 21:23:33 +08:00
* @param stream_id id
* @return
* Create GB28181 RTP server
* @param port Listening port, 0 for random
* @param tcp_mode tcp mode (0: not listening to port 1: listening to port 2: actively connect to the server)
* @param stream_id Stream id bound to this port
* @return
* [AUTO-TRANSLATED:0c5fd548]
2020-09-20 21:23:33 +08:00
*/
API_EXPORT mk_rtp_server API_CALL mk_rtp_server_create(uint16_t port, int tcp_mode, const char *stream_id);
API_EXPORT mk_rtp_server API_CALL mk_rtp_server_create2(uint16_t port, int tcp_mode, const char *vhost, const char *app, const char *stream_id);
/**
* TCP
* Callback for whether the connection to the server is successful in TCP active mode
* [AUTO-TRANSLATED:752e915a]
*/
typedef void(API_CALL *on_mk_rtp_server_connected)(void *user_data, int err, const char *what, int sys_err);
/**
* TCP
* @param @param ctx
* @param dst_url
* @param dst_port
* @param cb
* @param user_data
* @return
* Connect to the server in TCP active mode
* @param @param ctx Server object
* @param dst_url Server address
* @param dst_port Server port
* @param cb Callback for whether the connection to the server is successful
* @param user_data User data pointer
* @return
* [AUTO-TRANSLATED:e827d45a]
*/
API_EXPORT void API_CALL mk_rtp_server_connect(mk_rtp_server ctx, const char *dst_url, uint16_t dst_port, on_mk_rtp_server_connected cb, void *user_data);
API_EXPORT void API_CALL mk_rtp_server_connect2(mk_rtp_server ctx, const char *dst_url, uint16_t dst_port, on_mk_rtp_server_connected cb, void *user_data, on_user_data_free user_data_free);
2020-09-20 21:23:33 +08:00
/**
* GB28181 RTP
* @param ctx
* Destroy GB28181 RTP server
* @param ctx Server object
* [AUTO-TRANSLATED:828e02f0]
2020-09-20 21:23:33 +08:00
*/
API_EXPORT void API_CALL mk_rtp_server_release(mk_rtp_server ctx);
/**
*
* @param ctx
* @return
* Get the local listening port number
* @param ctx Server object
* @return Port number
* [AUTO-TRANSLATED:90fe5d22]
2020-09-20 21:23:33 +08:00
*/
API_EXPORT uint16_t API_CALL mk_rtp_server_port(mk_rtp_server ctx);
/**
* GB28181 RTP
* @param user_data
* Triggered when the GB28181 RTP server receives a stream timeout
* @param user_data User data pointer
* [AUTO-TRANSLATED:04d56f24]
2020-09-20 21:23:33 +08:00
*/
typedef void(API_CALL *on_mk_rtp_server_detach)(void *user_data);
/**
* B28181 RTP
* @param ctx
* @param cb
* @param user_data
* Listen for B28181 RTP server receiving stream timeout events
* @param ctx Server object
* @param cb Callback function
* @param user_data Callback function user data pointer
* [AUTO-TRANSLATED:a88c239f]
2020-09-20 21:23:33 +08:00
*/
API_EXPORT void API_CALL mk_rtp_server_set_on_detach(mk_rtp_server ctx, on_mk_rtp_server_detach cb, void *user_data);
API_EXPORT void API_CALL mk_rtp_server_set_on_detach2(mk_rtp_server ctx, on_mk_rtp_server_detach cb, void *user_data, on_user_data_free user_data_free);
2020-09-20 21:23:33 +08:00
#ifdef __cplusplus
}
#endif