接口协议适用平台:(Windows&Linux&ARM)
1. SDK描述
EasyPusher RTSP推流SDK是一款推送流媒体音/视频流给标准RTSP流媒体服务器(如EasyDarwin、Wowza)的流媒体推送库,全平台支持(包括Windows/Linux(32 & 64),ARM各平台,Android、iOS),通过EasyPusher我们就可以避免接触到稍显复杂的RTSP/RTP/RTCP推送流程,只需要调用EasyPusher的几个API接口,就能轻松、稳定地把流媒体音视频数据推送给RTSP流媒体服务器进行处理和转发,EasyPusher经过长时间的企业用户体验,稳定性非常高;
2. API接口函数定义
2.1 数据、事件回调函数
函数:
typedef int (EasyPusher_Callback)(int _id, EASY_PUSH_STATE_T _state, EASY_AV_Frame _frame, void *_userptr);
参数:
_id: EasyPusher_SetEventCallback接口设置的id,用于区分每路视频流。也可用_userptr参数来区分和信息传递。
_state: 推流状态信息
_frame: 视频帧数据
_userPtr: 用户自定义数据
2.2 SDK激活
函数:
Easy_API Easy_I32 Easy_APICALL EasyPusher_Activate(char *license);
参数:
license: SDK激活码,可在 www.pvale.com 在线获取,或联系我们。
返回:
返回值为第三节的EASY_ACTIVATE_ERR_CODE_ENUM枚举类型
2.3 创建RTSP推送Session 返回推送句柄
函数:
Easy_API Easy_Pusher_Handle Easy_APICALL EasyPusher_Create();
返回:
本次RTSP Session的句柄
2.4 设置回调函数
函数:
Easy_API Easy_U32 Easy_APICALL EasyPusher_SetEventCallback(Easy_Pusher_Handle handle, EasyPusher_Callback callback, int id, void *userptr);
参数:
handle: EasyPusher_Create接口返回的句柄
id: 流id,用于区分每路视频流。也可用_userptr参数来区分和信息传递。
userptr: 设置用户自定义数据,每个Session对应一个userutr
2.5 开始RTSP推流
函数:
Easy_API Easy_U32 Easy_APICALL EasyPusher_StartStream(Easy_Pusher_Handle handle, char serverAddr, Easy_U16 port, char streamName, int rtpOverTcp, char username, char password, EASY_MEDIA_INFO_T* pstruStreamInfo, Easy_U32 bufferKSize, Easy_Bool createlogfile );
参数:
handle: EasyPusher_Create接口返回的句柄
serverAddr: RTSP服务器地址
port: RTSP服务器端口
streamName: 流名称,xxx.sdp
rtpOverTcp: 传输协议,1-tcp, 2-udp
username: 用户名,正常设置为空
password: 密码,正常设置为空
pstruStreamInfo:流媒体信息
bufferKSize: 缓冲队列大小,默认设置1024
createlogfile: 是否开启log,0-关闭,1-开启
2.6 推送流媒体帧数据
函数:
Easy_API Easy_U32 Easy_APICALL EasyPusher_PushFrame(Easy_Pusher_Handle handle, EASY_AV_Frame* frame );
参数:
handle: EasyPusher_Create接口返回的句柄
frame: 推送的流媒体帧数据
2.7 停止RTSP推流
函数:
Easy_API Easy_U32 Easy_APICALL EasyPusher_StopStream(Easy_Pusher_Handle handle);
参数:
handle: EasyPusher_Create接口返回的句柄
2.8 释放推送句柄
函数:
Easy_API Easy_U32 Easy_APICALL EasyPusher_Release(Easy_Pusher_Handle handle);
参数:
handle: EasyPusher_Create接口返回的句柄
3. 结构体描述
|