You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mk_recorder.h 2.5KB

8 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MK_RECORDER_API_H_
  11. #define MK_RECORDER_API_H_
  12. #include "mk_common.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. ///////////////////////////////////////////flv录制/////////////////////////////////////////////
  17. typedef void* mk_flv_recorder;
  18. /**
  19. * 创建flv录制器
  20. * @return
  21. */
  22. API_EXPORT mk_flv_recorder API_CALL mk_flv_recorder_create();
  23. /**
  24. * 释放flv录制器
  25. * @param ctx
  26. */
  27. API_EXPORT void API_CALL mk_flv_recorder_release(mk_flv_recorder ctx);
  28. /**
  29. * 开始录制flv
  30. * @param ctx flv录制器
  31. * @param vhost 虚拟主机
  32. * @param app 绑定的RtmpMediaSource的 app名
  33. * @param stream 绑定的RtmpMediaSource的 stream名
  34. * @param file_path 文件存放地址
  35. * @return 0:开始超过,-1:失败,打开文件失败或该RtmpMediaSource不存在
  36. */
  37. 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);
  38. ///////////////////////////////////////////hls/mp4录制/////////////////////////////////////////////
  39. /**
  40. * 获取录制状态
  41. * @param type 0:hls,1:MP4
  42. * @param vhost 虚拟主机
  43. * @param app 应用名
  44. * @param stream 流id
  45. * @return 录制状态,0:未录制, 1:正在录制
  46. */
  47. API_EXPORT int API_CALL mk_recorder_is_recording(int type, const char *vhost, const char *app, const char *stream);
  48. /**
  49. * 开始录制
  50. * @param type 0:hls,1:MP4
  51. * @param vhost 虚拟主机
  52. * @param app 应用名
  53. * @param stream 流id
  54. * @param customized_path 录像文件保存自定义目录,默认为空或null则自动生成
  55. * @param max_second mp4录制最大切片时间,单位秒,置0则采用配置文件配置
  56. * @return 1代表成功,0代表失败
  57. */
  58. 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);
  59. /**
  60. * 停止录制
  61. * @param type 0:hls,1:MP4
  62. * @param vhost 虚拟主机
  63. * @param app 应用名
  64. * @param stream 流id
  65. * @return 1:成功,0:失败
  66. */
  67. API_EXPORT int API_CALL mk_recorder_stop(int type, const char *vhost, const char *app, const char *stream);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /* MK_RECORDER_API_H_ */