blob: 7117be09750ee07b88d8cd308806a82359f7f1e1 [file] [log] [blame]
Gong Ke497c4c22020-03-20 10:15:42 +08001/**
Pengfei Liub4734232020-01-17 18:25:10 +08002 * \file
Gong Ke497c4c22020-03-20 10:15:42 +08003 * \brief Segment operation module
4 *
5 * A record is separated to several segments.
6 * Each segment contains many files.
7 * \li TS file: stored the TS data.
8 * \li Information file: stored the information of this segment.
9 * \li Index file: stored the timestamp lookup table of this segment.
Pengfei Liub4734232020-01-17 18:25:10 +080010 */
11
Pengfei Liu2afc35d2020-01-07 10:47:39 +080012#ifndef _DVR_SEGMENT_H_
13#define _DVR_SEGMENT_H_
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
Gong Ke3489c0f2020-01-16 18:11:44 +080019#include "dvr_types.h"
Pengfei Liu2afc35d2020-01-07 10:47:39 +080020
Pengfei Liub4734232020-01-17 18:25:10 +080021/**\brief Delete a segment
Gong Ke497c4c22020-03-20 10:15:42 +080022 * \param[in] location The record file's location
23 * \param[in] segment_id The segment's index
Pengfei Liub4734232020-01-17 18:25:10 +080024 * \return DVR_SUCCESS On success
25 * \return Error code On failure
26 */
Pengfei Liuc181a982020-01-07 19:27:13 +080027int dvr_segment_delete(const char *location, uint64_t segment_id);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080028
Pengfei Liub4734232020-01-17 18:25:10 +080029/**\brief Get the segment list of a record file
Gong Ke497c4c22020-03-20 10:15:42 +080030 * \param[in] location The record file's location
31 * \param[out] p_segment_nb Return the segments number
32 * \param[out] pp_segment_ids Return the segments index
Pengfei Liub4734232020-01-17 18:25:10 +080033 * \return DVR_SUCCESS On success
34 * \return Error code On failure
35 */
Pengfei Liuc181a982020-01-07 19:27:13 +080036int dvr_segment_get_list(const char *location, uint32_t *p_segment_nb, uint64_t **pp_segment_ids);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080037
Pengfei Liub4734232020-01-17 18:25:10 +080038/**\brief Get the segment's information
Gong Ke497c4c22020-03-20 10:15:42 +080039 * \param[in] location The record file's location
40 * \param[in] segment_id The segment index
41 * \param[out] p_info Return the segment's information
Pengfei Liub4734232020-01-17 18:25:10 +080042 * \return DVR_SUCCESS On success
43 * \return Error code On failure
44 */
45int dvr_segment_get_info(const char *location, uint64_t segment_id, DVR_RecordSegmentInfo_t *p_info);
Pengfei Liuc181a982020-01-07 19:27:13 +080046
Pengfei Liub4734232020-01-17 18:25:10 +080047/**\brief Link a segment group as the record file's list
Gong Ke497c4c22020-03-20 10:15:42 +080048 * \param[in] location The record file's location
49 * \param[in] nb_segments The number of segments
50 * \param[in] p_segment_ids The segments index in the group
Pengfei Liub4734232020-01-17 18:25:10 +080051 * \return DVR_SUCCESS On success
52 * \return Error code On failure
53 */
Pengfei Liuc181a982020-01-07 19:27:13 +080054int dvr_segment_link(const char *location, uint32_t nb_segments, uint64_t *p_segment_ids);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080055
56#ifdef __cplusplus
57}
58#endif
59
60#endif /*END _DVR_SEGMENT_H_*/