2019-12-18 11:47:49 +08:00
|
|
|
|
/*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
|
2019-12-17 18:45:31 +08:00
|
|
|
|
*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
|
2019-12-17 18:45:31 +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-04-04 20:30:09 +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.
|
2019-12-17 18:45:31 +08:00
|
|
|
|
*/
|
|
|
|
|
|
2019-12-24 16:19:33 +08:00
|
|
|
|
#ifndef MK_RECORDER_API_H_
|
|
|
|
|
#define MK_RECORDER_API_H_
|
2019-12-17 18:45:31 +08:00
|
|
|
|
|
2019-12-27 10:10:31 +08:00
|
|
|
|
#include "mk_common.h"
|
2024-10-18 21:48:42 +08:00
|
|
|
|
#include "mk_util.h"
|
2019-12-17 18:45:31 +08:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-09-19 14:53:50 +08:00
|
|
|
|
// /////////////////////////////////////////flv录制///////////////////////////////////////////// [AUTO-TRANSLATED:a084663f]
|
|
|
|
|
// /////////////////////////////////////////flv录制/////////////////////////////////////////////
|
2019-12-24 16:19:33 +08:00
|
|
|
|
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_flv_recorder_t *mk_flv_recorder;
|
2019-12-17 18:45:31 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建flv录制器
|
|
|
|
|
* @return
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Create flv recorder
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:7582cde1]
|
2019-12-17 18:45:31 +08:00
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_flv_recorder API_CALL mk_flv_recorder_create();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 释放flv录制器
|
|
|
|
|
* @param ctx
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Release flv recorder
|
|
|
|
|
* @param ctx
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:c33c76bb]
|
2019-12-17 18:45:31 +08:00
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_flv_recorder_release(mk_flv_recorder ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开始录制flv
|
|
|
|
|
* @param ctx flv录制器
|
2019-12-27 13:56:02 +08:00
|
|
|
|
* @param vhost 虚拟主机
|
2019-12-17 18:45:31 +08:00
|
|
|
|
* @param app 绑定的RtmpMediaSource的 app名
|
|
|
|
|
* @param stream 绑定的RtmpMediaSource的 stream名
|
|
|
|
|
* @param file_path 文件存放地址
|
|
|
|
|
* @return 0:开始超过,-1:失败,打开文件失败或该RtmpMediaSource不存在
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Start recording flv
|
|
|
|
|
* @param ctx flv recorder
|
|
|
|
|
* @param vhost virtual host
|
|
|
|
|
* @param app app name of the bound RtmpMediaSource
|
|
|
|
|
* @param stream stream name of the bound RtmpMediaSource
|
|
|
|
|
* @param file_path file storage address
|
|
|
|
|
* @return 0: start exceeds, -1: failure, file opening fails or the RtmpMediaSource does not exist
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:194cf3de]
|
2019-12-17 18:45:31 +08:00
|
|
|
|
*/
|
2019-12-27 13:56:02 +08:00
|
|
|
|
API_EXPORT int API_CALL mk_flv_recorder_start(mk_flv_recorder ctx, const char *vhost, const char *app, const char *stream, const char *file_path);
|
2019-12-17 18:45:31 +08:00
|
|
|
|
|
2024-09-19 14:53:50 +08:00
|
|
|
|
// /////////////////////////////////////////hls/mp4录制///////////////////////////////////////////// [AUTO-TRANSLATED:99c61c68]
|
|
|
|
|
// /////////////////////////////////////////hls/mp4录制/////////////////////////////////////////////
|
2020-04-05 09:26:29 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取录制状态
|
|
|
|
|
* @param type 0:hls,1:MP4
|
|
|
|
|
* @param vhost 虚拟主机
|
|
|
|
|
* @param app 应用名
|
|
|
|
|
* @param stream 流id
|
|
|
|
|
* @return 录制状态,0:未录制, 1:正在录制
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Get recording status
|
|
|
|
|
* @param type 0: hls, 1: MP4
|
|
|
|
|
* @param vhost virtual host
|
|
|
|
|
* @param app application name
|
|
|
|
|
* @param stream stream id
|
|
|
|
|
* @return recording status, 0: not recording, 1: recording
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:0b1d374a]
|
2020-04-05 09:26:29 +08:00
|
|
|
|
*/
|
|
|
|
|
API_EXPORT int API_CALL mk_recorder_is_recording(int type, const char *vhost, const char *app, const char *stream);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开始录制
|
2023-07-08 22:12:56 +08:00
|
|
|
|
* @param type 0:hls-ts,1:MP4,2:hls-fmp4,3:http-fmp4,4:http-ts
|
2020-04-05 09:26:29 +08:00
|
|
|
|
* @param vhost 虚拟主机
|
|
|
|
|
* @param app 应用名
|
|
|
|
|
* @param stream 流id
|
|
|
|
|
* @param customized_path 录像文件保存自定义目录,默认为空或null则自动生成
|
2021-03-07 10:41:57 +08:00
|
|
|
|
* @param max_second mp4录制最大切片时间,单位秒,置0则采用配置文件配置
|
2020-04-05 09:26:29 +08:00
|
|
|
|
* @return 1代表成功,0代表失败
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Start recording
|
|
|
|
|
* @param type 0: hls-ts, 1: MP4, 2: hls-fmp4, 3: http-fmp4, 4: http-ts
|
|
|
|
|
* @param vhost virtual host
|
|
|
|
|
* @param app application name
|
|
|
|
|
* @param stream stream id
|
|
|
|
|
* @param customized_path custom directory for saving recording files, defaults to empty or null, automatically generated
|
|
|
|
|
* @param max_second maximum slice time for mp4 recording, in seconds, set to 0 to use the configuration file configuration
|
|
|
|
|
* @return 1 represents success, 0 represents failure
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:0a1c8c3e]
|
2020-04-05 09:26:29 +08:00
|
|
|
|
*/
|
2021-03-07 10:41:57 +08:00
|
|
|
|
API_EXPORT int API_CALL mk_recorder_start(int type, const char *vhost, const char *app, const char *stream, const char *customized_path, size_t max_second);
|
2020-04-05 09:26:29 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 停止录制
|
2023-07-08 22:12:56 +08:00
|
|
|
|
* @param type 0:hls-ts,1:MP4,2:hls-fmp4,3:http-fmp4,4:http-ts
|
2020-04-05 09:26:29 +08:00
|
|
|
|
* @param vhost 虚拟主机
|
|
|
|
|
* @param app 应用名
|
|
|
|
|
* @param stream 流id
|
|
|
|
|
* @return 1:成功,0:失败
|
2024-09-19 14:53:50 +08:00
|
|
|
|
* Stop recording
|
|
|
|
|
* @param type 0: hls-ts, 1: MP4, 2: hls-fmp4, 3: http-fmp4, 4: http-ts
|
|
|
|
|
* @param vhost virtual host
|
|
|
|
|
* @param app application name
|
|
|
|
|
* @param stream stream id
|
|
|
|
|
* @return 1: success, 0: failure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* [AUTO-TRANSLATED:df1638e7]
|
2020-04-05 09:26:29 +08:00
|
|
|
|
*/
|
|
|
|
|
API_EXPORT int API_CALL mk_recorder_stop(int type, const char *vhost, const char *app, const char *stream);
|
|
|
|
|
|
2024-10-18 21:48:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 加载mp4列表
|
|
|
|
|
* @param vhost 虚拟主机
|
|
|
|
|
* @param app app
|
|
|
|
|
* @param stream 流id
|
|
|
|
|
* @param file_path 文件路径
|
|
|
|
|
* @param file_repeat 循环解复用
|
|
|
|
|
* @param ini 配置
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_load_mp4_file(const char *vhost, const char *app, const char *stream, const char *file_path, int file_repeat);
|
|
|
|
|
API_EXPORT void API_CALL mk_load_mp4_file2(const char *vhost, const char *app, const char *stream, const char *file_path, int file_repeat, mk_ini ini);
|
|
|
|
|
|
2019-12-17 18:45:31 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-12-24 16:19:33 +08:00
|
|
|
|
#endif /* MK_RECORDER_API_H_ */
|