添加hls/mp4录制相关接口

This commit is contained in:
xiongziliang 2019-12-24 16:19:33 +08:00
parent a3c482c1ef
commit aa03d7d0bb
3 changed files with 68 additions and 5 deletions

View File

@ -31,7 +31,7 @@
#include "httpdownloader.h" #include "httpdownloader.h"
#include "media.h" #include "media.h"
#include "proxyplayer.h" #include "proxyplayer.h"
#include "flvrecorder.h" #include "recorder.h"
#include "player.h" #include "player.h"
#include "pusher.h" #include "pusher.h"
#include "events.h" #include "events.h"

View File

@ -24,8 +24,8 @@
* SOFTWARE. * SOFTWARE.
*/ */
#ifndef MK_FLV_RECORDER_API_H_ #ifndef MK_RECORDER_API_H_
#define MK_FLV_RECORDER_API_H_ #define MK_RECORDER_API_H_
#include "common.h" #include "common.h"
@ -33,6 +33,8 @@
extern "C" { extern "C" {
#endif #endif
///////////////////////////////////////////flv录制/////////////////////////////////////////////
typedef void* mk_flv_recorder; typedef void* mk_flv_recorder;
/** /**
@ -57,8 +59,48 @@ API_EXPORT void API_CALL mk_flv_recorder_release(mk_flv_recorder ctx);
*/ */
API_EXPORT int API_CALL mk_flv_recorder_start(mk_flv_recorder ctx, const char *app, const char *stream, const char *file_path); API_EXPORT int API_CALL mk_flv_recorder_start(mk_flv_recorder ctx, const char *app, const char *stream, const char *file_path);
///////////////////////////////////////////hls/mp4录制/////////////////////////////////////////////
/**
*
* @param type 0:hls,1:MP4
* @param vhost
* @param app
* @param stream id
* @return ,0:,1:MediaSource注册,2:MediaSource已注册
*/
API_EXPORT int mk_recorder_status(int type, const char *vhost, const char *app, const char *stream);
/**
*
* @param type 0:hls,1:MP4
* @param vhost
* @param app
* @param stream id
* @param wait_for_record false将返回失败
* @param continue_record
* @return 0
*/
API_EXPORT int mk_recorder_start(int type, const char *vhost, const char *app, const char *stream,bool wait_for_record, bool continue_record);
/**
*
* @param type 0:hls,1:MP4
* @param vhost
* @param app
* @param stream id
* @return 1:0
*/
API_EXPORT int mk_recorder_stop(int type, const char *vhost, const char *app, const char *stream);
/**
* 退
*/
API_EXPORT void mk_recorder_stop_all();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* MK_FLV_RECORDER_API_H_ */ #endif /* MK_RECORDER_API_H_ */

View File

@ -24,8 +24,9 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include "flvrecorder.h" #include "recorder.h"
#include "Rtmp/FlvMuxer.h" #include "Rtmp/FlvMuxer.h"
#include "Record/Recorder.h"
using namespace toolkit; using namespace toolkit;
using namespace mediakit; using namespace mediakit;
@ -49,3 +50,23 @@ API_EXPORT int API_CALL mk_flv_recorder_start(mk_flv_recorder ctx, const char *a
return -1; return -1;
} }
} }
///////////////////////////////////////////hls/mp4录制/////////////////////////////////////////////
API_EXPORT int mk_recorder_status(int type, const char *vhost, const char *app, const char *stream){
assert(vhost && app && stream);
return Recorder::getRecordStatus((Recorder::type)type,vhost,app,stream);
}
API_EXPORT int mk_recorder_start(int type, const char *vhost, const char *app, const char *stream,bool wait_for_record, bool continue_record){
assert(vhost && app && stream);
return Recorder::startRecord((Recorder::type)type,vhost,app,stream,wait_for_record,continue_record);
}
API_EXPORT int mk_recorder_stop(int type, const char *vhost, const char *app, const char *stream){
assert(vhost && app && stream);
return Recorder::stopRecord((Recorder::type)type,vhost,app,stream);
}
API_EXPORT void mk_recorder_stop_all(){
Recorder::stopAll();
}