blob: 7d31f88f68ef3c092387b74dfe5d4eec2340aea4 [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
hualing chen4b7c15d2020-04-07 16:13:48 +080038/**\brief Del all info of segment whose location is "*location"
39 * \param[in] location The record of need del file's location
40 * \return DVR_SUCCESS On success
41 * \return Error code On failure
42 */
43int dvr_segment_del_by_location(const char *location);
44
45
Pengfei Liub4734232020-01-17 18:25:10 +080046/**\brief Get the segment's information
Gong Ke497c4c22020-03-20 10:15:42 +080047 * \param[in] location The record file's location
48 * \param[in] segment_id The segment index
49 * \param[out] p_info Return the segment's information
Pengfei Liub4734232020-01-17 18:25:10 +080050 * \return DVR_SUCCESS On success
51 * \return Error code On failure
52 */
53int dvr_segment_get_info(const char *location, uint64_t segment_id, DVR_RecordSegmentInfo_t *p_info);
Pengfei Liuc181a982020-01-07 19:27:13 +080054
Pengfei Liub4734232020-01-17 18:25:10 +080055/**\brief Link a segment group as the record file's list
Gong Ke497c4c22020-03-20 10:15:42 +080056 * \param[in] location The record file's location
57 * \param[in] nb_segments The number of segments
58 * \param[in] p_segment_ids The segments index in the group
Pengfei Liub4734232020-01-17 18:25:10 +080059 * \return DVR_SUCCESS On success
60 * \return Error code On failure
61 */
Pengfei Liuc181a982020-01-07 19:27:13 +080062int dvr_segment_link(const char *location, uint32_t nb_segments, uint64_t *p_segment_ids);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080063
64#ifdef __cplusplus
65}
66#endif
67
68#endif /*END _DVR_SEGMENT_H_*/