Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 1 | /** |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 2 | * \file |
Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 3 | * \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 Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 10 | */ |
| 11 | |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 12 | #ifndef _DVR_SEGMENT_H_ |
| 13 | #define _DVR_SEGMENT_H_ |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
Gong Ke | 3489c0f | 2020-01-16 18:11:44 +0800 | [diff] [blame] | 19 | #include "dvr_types.h" |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 20 | |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 21 | /**\brief Delete a segment |
Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 22 | * \param[in] location The record file's location |
| 23 | * \param[in] segment_id The segment's index |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 24 | * \return DVR_SUCCESS On success |
| 25 | * \return Error code On failure |
| 26 | */ |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 27 | int dvr_segment_delete(const char *location, uint64_t segment_id); |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 28 | |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 29 | /**\brief Get the segment list of a record file |
Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 30 | * \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 Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 33 | * \return DVR_SUCCESS On success |
| 34 | * \return Error code On failure |
| 35 | */ |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 36 | int dvr_segment_get_list(const char *location, uint32_t *p_segment_nb, uint64_t **pp_segment_ids); |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 37 | |
hualing chen | 4b7c15d | 2020-04-07 16:13:48 +0800 | [diff] [blame] | 38 | /**\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 | */ |
| 43 | int dvr_segment_del_by_location(const char *location); |
| 44 | |
| 45 | |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 46 | /**\brief Get the segment's information |
Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 47 | * \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 Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 50 | * \return DVR_SUCCESS On success |
| 51 | * \return Error code On failure |
| 52 | */ |
| 53 | int dvr_segment_get_info(const char *location, uint64_t segment_id, DVR_RecordSegmentInfo_t *p_info); |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 54 | |
Pengfei Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 55 | /**\brief Link a segment group as the record file's list |
Gong Ke | 497c4c2 | 2020-03-20 10:15:42 +0800 | [diff] [blame] | 56 | * \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 Liu | b473423 | 2020-01-17 18:25:10 +0800 | [diff] [blame] | 59 | * \return DVR_SUCCESS On success |
| 60 | * \return Error code On failure |
| 61 | */ |
Pengfei Liu | c181a98 | 2020-01-07 19:27:13 +0800 | [diff] [blame] | 62 | int dvr_segment_link(const char *location, uint32_t nb_segments, uint64_t *p_segment_ids); |
Pengfei Liu | 2afc35d | 2020-01-07 10:47:39 +0800 | [diff] [blame] | 63 | |
| 64 | #ifdef __cplusplus |
| 65 | } |
| 66 | #endif |
| 67 | |
| 68 | #endif /*END _DVR_SEGMENT_H_*/ |