Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
adb3be70
Commit
adb3be70
authored
Sep 20, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加GB28181相关c api: #491
parent
08a5891b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
100 行增加
和
0 行删除
+100
-0
api/include/mk_mediakit.h
+1
-0
api/include/mk_rtp_server.h
+59
-0
api/source/mk_rtp_server.cpp
+40
-0
没有找到文件。
api/include/mk_mediakit.h
查看文件 @
adb3be70
...
...
@@ -22,5 +22,6 @@
#include "mk_tcp.h"
#include "mk_util.h"
#include "mk_thread.h"
#include "mk_rtp_server.h"
#endif
/* MK_API_H_ */
api/include/mk_rtp_server.h
0 → 100644
查看文件 @
adb3be70
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* 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
void
*
mk_rtp_server
;
/**
* 创建GB28181 RTP 服务器
* @param port 监听端口,0则为随机
* @param enable_tcp 创建udp端口时是否同时监听tcp端口
* @param stream_id 该端口绑定的流id
* @return
*/
API_EXPORT
mk_rtp_server
API_CALL
mk_rtp_server_create
(
uint16_t
port
,
int
enable_tcp
,
const
char
*
stream_id
);
/**
* 销毁GB28181 RTP 服务器
* @param ctx 服务器对象
*/
API_EXPORT
void
API_CALL
mk_rtp_server_release
(
mk_rtp_server
ctx
);
/**
* 获取本地监听的端口号
* @param ctx 服务器对象
* @return 端口号
*/
API_EXPORT
uint16_t
API_CALL
mk_rtp_server_port
(
mk_rtp_server
ctx
);
/**
* GB28181 RTP 服务器接收流超时时触发
* @param user_data 用户数据指针
*/
typedef
void
(
API_CALL
*
on_mk_rtp_server_detach
)(
void
*
user_data
);
/**
* 监听B28181 RTP 服务器接收流超时事件
* @param ctx 服务器对象
* @param cb 回调函数
* @param user_data 回调函数用户数据指针
*/
API_EXPORT
void
API_CALL
mk_rtp_server_set_on_detach
(
mk_rtp_server
ctx
,
on_mk_rtp_server_detach
cb
,
void
*
user_data
);
#ifdef __cplusplus
}
#endif
\ No newline at end of file
api/source/mk_rtp_server.cpp
0 → 100644
查看文件 @
adb3be70
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* 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_rtp_server.h"
#include "Rtp/RtpServer.h"
using
namespace
mediakit
;
API_EXPORT
mk_rtp_server
API_CALL
mk_rtp_server_create
(
uint16_t
port
,
int
enable_tcp
,
const
char
*
stream_id
){
RtpServer
::
Ptr
*
server
=
new
RtpServer
::
Ptr
(
new
RtpServer
);
(
*
server
)
->
start
(
port
,
stream_id
,
enable_tcp
);
return
server
;
}
API_EXPORT
void
API_CALL
mk_rtp_server_release
(
mk_rtp_server
ctx
){
RtpServer
::
Ptr
*
server
=
(
RtpServer
::
Ptr
*
)
ctx
;
delete
server
;
}
API_EXPORT
uint16_t
API_CALL
mk_rtp_server_port
(
mk_rtp_server
ctx
){
RtpServer
::
Ptr
*
server
=
(
RtpServer
::
Ptr
*
)
ctx
;
return
(
*
server
)
->
getPort
();
}
API_EXPORT
void
API_CALL
mk_rtp_server_set_on_detach
(
mk_rtp_server
ctx
,
on_mk_rtp_server_detach
cb
,
void
*
user_data
){
RtpServer
::
Ptr
*
server
=
(
RtpServer
::
Ptr
*
)
ctx
;
if
(
cb
)
{
(
*
server
)
->
setOnDetach
([
cb
,
user_data
]()
{
cb
(
user_data
);
});
}
else
{
(
*
server
)
->
setOnDetach
(
nullptr
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论