blob: ab07382184e7afceb908410996b583f282303da3 [file] [log] [blame]
Gong Ke3489c0f2020-01-16 18:11:44 +08001/**
2 * \file
3 * Playback module.
4 */
5
hualing chenb31a6c62020-01-13 17:27:00 +08006#ifndef DVR_PLAYBACK_H_
7#define DVR_PLAYBACK_H_
hualing chenb31a6c62020-01-13 17:27:00 +08008#include "list.h"
Gong Ke3489c0f2020-01-16 18:11:44 +08009#include "dvr_types.h"
hualing chen86e7d482020-01-16 15:13:33 +080010#include "segment.h"
hualing chen2aba4022020-03-02 13:49:55 +080011#include "AmTsPlayer.h"
hualing chen040df222020-01-17 13:35:02 +080012#include "dvr_types.h"
13#include "dvr_crypto.h"
14
hualing chenb31a6c62020-01-13 17:27:00 +080015#ifdef __cplusplus
16extern "C" {
17#endif
Gong Ke3489c0f2020-01-16 18:11:44 +080018
hualing chen040df222020-01-17 13:35:02 +080019/**\brief dvr play segment flag */
hualing chenb31a6c62020-01-13 17:27:00 +080020typedef enum
21{
Gong Ke3489c0f2020-01-16 18:11:44 +080022 DVR_PLAYBACK_SEGMENT_ENCRYPTED = (1 << 0), /**< encrypted stream */
23 DVR_PLAYBACK_SEGMENT_DISPLAYABLE = (1 << 1), /**< displayable stream */
hualing chen5cbe1a62020-02-10 16:36:36 +080024 DVR_PLAYBACK_SEGMENT_CONTINUOUS = (1 << 2)/**< continuous stream with pre one */
Gong Ke3489c0f2020-01-16 18:11:44 +080025} DVR_PlaybackSegmentFlag_t;
hualing chenb31a6c62020-01-13 17:27:00 +080026
27/**\brief dvr pid type*/
28typedef enum
29{
Gong Ke3489c0f2020-01-16 18:11:44 +080030 DVR_PLAYBACK_SYNC, /**< sync play mode */
31 DVR_PLAYBACK_ASYNC /**< out of sync play mode */
32} DVR_PlaybackSyncMode_t;
hualing chenb31a6c62020-01-13 17:27:00 +080033
34
35/**\brief dvr play pids */
36typedef struct
37{
Gong Ke3489c0f2020-01-16 18:11:44 +080038 DVR_StreamInfo_t video; /**< Video.*/
39 DVR_StreamInfo_t audio; /**< Audio.*/
40 DVR_StreamInfo_t ad; /**< AD.*/
41 DVR_StreamInfo_t subtitle; /**< Subtitle.*/
42 DVR_StreamInfo_t pcr; /**< PCR.*/
43} DVR_PlaybackPids_t;
hualing chenb31a6c62020-01-13 17:27:00 +080044
Gong Ke3489c0f2020-01-16 18:11:44 +080045/**\brief dvr segments info */
hualing chenb31a6c62020-01-13 17:27:00 +080046typedef struct
47{
Gong Ke3489c0f2020-01-16 18:11:44 +080048 struct list_head head; /**< Segment node.*/
hualing chen5cbe1a62020-02-10 16:36:36 +080049 uint64_t segment_id; /**< Segment's index.*/
50 char location[DVR_MAX_LOCATION_SIZE]; /**< chunk location */
Gong Ke3489c0f2020-01-16 18:11:44 +080051 DVR_PlaybackPids_t pids; /**< Streams' PIDs.*/
hualing chen040df222020-01-17 13:35:02 +080052 DVR_PlaybackSegmentFlag_t flags; /**< Segment's flag */
Gong Ke3489c0f2020-01-16 18:11:44 +080053 int key_data_id; /**< ??? */
54} DVR_PlaybackSegmentInfo_t;
hualing chenb31a6c62020-01-13 17:27:00 +080055
56/**\brief play flag, if set this flag, player need pause when decode first frame */
57typedef enum
58{
Gong Ke3489c0f2020-01-16 18:11:44 +080059 DVR_PLAYBACK_STARTED_PAUSEDLIVE = (1 << 0) /**< dvr play stat,need change to pause state if set */
60} DVR_PlaybackFlag_t;
hualing chen86e7d482020-01-16 15:13:33 +080061
62/**\brief playback speed mode*/
hualing chenb31a6c62020-01-13 17:27:00 +080063typedef enum
64{
Gong Ke3489c0f2020-01-16 18:11:44 +080065 DVR_PLAYBACK_FAST_FORWARD = 0, /**< fast forward */
66 DVR_PLAYBACK_FAST_BACKWARD = 1, /**< fast backward */
67} DVR_PlaybackSpeedMode_t;
hualing chenb31a6c62020-01-13 17:27:00 +080068
hualing chen2aba4022020-03-02 13:49:55 +080069/**\brief playback speed*/
70typedef enum
71{
hualing chen2aba4022020-03-02 13:49:55 +080072 PLAYBACK_SPEED_S2 = 50, /**<slow 1/2 speed*/
73 PLAYBACK_SPEED_X1 = 100, /**< X 1 normal speed*/
74 PLAYBACK_SPEED_X2 = 200, /**< X 2 speed*/
75 PLAYBACK_SPEED_X4 = 400, /**< X 4 speed*/
76 PLAYBACK_SPEED_X8 = 800, /**< X 8 speed*/
hualing chen2aba4022020-03-02 13:49:55 +080077 PlayBack_Speed_MAX,
78} Playback_SpeedValue_t;
79
80typedef struct Playback_Speeds_s {
81 int speed; /**< playback speed*/
82} Playback_Speeds_t;
hualing chenb31a6c62020-01-13 17:27:00 +080083
Gong Ke3489c0f2020-01-16 18:11:44 +080084/**\brief playback play speed*/
hualing chenb31a6c62020-01-13 17:27:00 +080085typedef struct
86{
hualing chen2aba4022020-03-02 13:49:55 +080087 Playback_Speeds_t speed; /**< playback speed */
Gong Ke3489c0f2020-01-16 18:11:44 +080088 DVR_PlaybackSpeedMode_t mode; /**< playback 0: fast forword or 1: fast backword*/
89} DVR_PlaybackSpeed_t;
hualing chenb31a6c62020-01-13 17:27:00 +080090
hualing chen2aba4022020-03-02 13:49:55 +080091
Gong Ke3489c0f2020-01-16 18:11:44 +080092/**Maximum supported speed modes.*/
hualing chenb31a6c62020-01-13 17:27:00 +080093#define DVR_MAX_SUPPORTED_SPEEDS 32
Gong Ke3489c0f2020-01-16 18:11:44 +080094
hualing chenb31a6c62020-01-13 17:27:00 +080095/**\brief playback capability*/
96typedef struct
97{
hualing chen86e7d482020-01-16 15:13:33 +080098 int nb_supported_speeds; /**< support playback speed count*/
99 int supported_speeds[DVR_MAX_SUPPORTED_SPEEDS]; /**< support playback speed*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800100} DVR_PlaybackCapability_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800101
Gong Ke3489c0f2020-01-16 18:11:44 +0800102/**Playback handle.*/
103typedef void* DVR_PlaybackHandle_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800104
hualing chencc91e1c2020-02-28 13:26:17 +0800105
106/**\brief playback error reason*/
107typedef enum
108{
109 DVR_PLAYBACK_PID_ERROR, /**< uninit state */
110 DVR_PLAYBACK_FMT_ERROR /**< fmt not surport backword */
111} DVR_PlaybackError_t;
112
113
hualing chenb31a6c62020-01-13 17:27:00 +0800114/**\brief playback play state*/
115typedef enum
116{
Gong Ke3489c0f2020-01-16 18:11:44 +0800117 DVR_PLAYBACK_STATE_START, /**< start play */
118 DVR_PLAYBACK_STATE_STOP, /**< stop */
119 DVR_PLAYBACK_STATE_PAUSE, /**< pause */
120 DVR_PLAYBACK_STATE_FF, /**< fast forward */
121 DVR_PLAYBACK_STATE_FB /**< fast backword */
122} DVR_PlaybackPlayState_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800123
124/**\brief playback play status*/
125typedef struct
126{
Gong Ke3489c0f2020-01-16 18:11:44 +0800127 DVR_PlaybackPlayState_t state; /**< playback play state */
hualing chen5cbe1a62020-02-10 16:36:36 +0800128 uint64_t segment_id; /**< playback ongoing segment index */
hualing chencc91e1c2020-02-28 13:26:17 +0800129 uint32_t time_cur; /**< playback cur time,0 <--> time_end Ms*/
130 uint32_t time_end; /**< playback ongoing segment dur,Ms */
Gong Ke3489c0f2020-01-16 18:11:44 +0800131 DVR_PlaybackPids_t pids; /**< playback played pids */
hualing chen5cbe1a62020-02-10 16:36:36 +0800132 int speed; /**< playback speed */
133 DVR_PlaybackSegmentFlag_t flags; /**< playback played segment flag */
Gong Ke3489c0f2020-01-16 18:11:44 +0800134} DVR_PlaybackStatus_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800135
hualing chencc91e1c2020-02-28 13:26:17 +0800136/**\brief DVR playback event*/
137typedef enum {
138 DVR_PLAYBACK_EVENT_ERROR = 0x1000, /**< Signal a critical playback error*/
139 DVR_PLAYBACK_EVENT_TRANSITION_OK , /**< transition ok*/
140 DVR_PLAYBACK_EVENT_TRANSITION_FAILED, /**< transition failed*/
141 DVR_PLAYBACK_EVENT_KEY_FAILURE, /**< key failure*/
142 DVR_PLAYBACK_EVENT_NO_KEY, /**< no key*/
143 DVR_PLAYBACK_EVENT_REACHED_BEGIN , /**< reached begin*/
hualing chen2aba4022020-03-02 13:49:55 +0800144 DVR_PLAYBACK_EVENT_REACHED_END, /**< reached end*/
145 DVR_PLAYBACK_EVENT_FIRST_FRAME /**< first frame*/
hualing chencc91e1c2020-02-28 13:26:17 +0800146} DVR_PlaybackEvent_t;
147
148/**\brief DVR playback event notify function*/
149typedef struct
150{
151 DVR_PlaybackEvent_t event; /**< event type*/
152 DVR_PlaybackStatus_t play_status; /**< play status*/
153 union
154 {
155 uint8_t unused;
156 uint8_t error_reason; /**< error reason*/
157 struct
158 {
159 uint64_t segment_id; /**< error segment id*/
160 uint32_t key_data_id; /**< key data id*/
161 uint8_t error; /**< error*/
162 } transition_failed_data;
163 } info;
164} DVR_Play_Notify_t;
165
166/**\brief DVR playback event notify function*/
167typedef DVR_Result_t (*DVR_PlaybackEventFunction_t) (DVR_PlaybackEvent_t event, void *params, void *userdata);
168
169
hualing chenb31a6c62020-01-13 17:27:00 +0800170/**\brief playback open params*/
171typedef struct
172{
Gong Ke3489c0f2020-01-16 18:11:44 +0800173 int dmx_dev_id; /**< playback used dmx device index*/
174 int block_size; /**< playback inject block size*/
175 DVR_Bool_t is_timeshift; /**< 0:playback mode, 1 : is timeshift mode*/
hualing chen2aba4022020-03-02 13:49:55 +0800176 am_tsplayer_handle player_handle; /**< am tsplayer handle.*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800177 DVR_CryptoFunction_t crypto_fn; /**< Crypto function.*/
178 void *crypto_data; /**< Crypto function's user data.*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800179 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
hualing chencc91e1c2020-02-28 13:26:17 +0800180 DVR_PlaybackEventFunction_t event_fn; /**< playback event callback function*/
181 void *event_userdata; /**< event userdata*/
182 size_t notification_size; /**< playback notification size, playback moudle would send a notifaction when the size of current segment is multiple of this value. Put 0 in this argument if you don't want to receive the notification*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800183} DVR_PlaybackOpenParams_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800184
185/**\brief playback play state*/
186typedef enum
187{
hualing chen040df222020-01-17 13:35:02 +0800188 DVR_PLAYBACK_CMD_START, /**< start av */
189 DVR_PLAYBACK_CMD_STOP, /**< stop av */
190 DVR_PLAYBACK_CMD_VSTART, /**< v start */
191 DVR_PLAYBACK_CMD_ASTART , /**< a start */
192 DVR_PLAYBACK_CMD_VSTOP , /**< v stop */
193 DVR_PLAYBACK_CMD_ASTOP, /**< a stop */
194 DVR_PLAYBACK_CMD_VRESTART, /**< v restart */
195 DVR_PLAYBACK_CMD_ARESTART, /**< a restart */
hualing chen5cbe1a62020-02-10 16:36:36 +0800196 DVR_PLAYBACK_CMD_AVRESTART, /**< av restart */
hualing chen040df222020-01-17 13:35:02 +0800197 DVR_PLAYBACK_CMD_VSTOPASTART, /**< v stop a start*/
198 DVR_PLAYBACK_CMD_ASTOPVSTART, /**< a stop vstart */
199 DVR_PLAYBACK_CMD_VSTOPARESTART, /**<v stop a restart*/
200 DVR_PLAYBACK_CMD_ASTOPVRESTART, /**<a stop v restart*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800201 DVR_PLAYBACK_CMD_VSTARTARESTART, /**<v start a restart*/
202 DVR_PLAYBACK_CMD_ASTARTVRESTART, /**<a start v restart*/
hualing chen040df222020-01-17 13:35:02 +0800203 DVR_PLAYBACK_CMD_PAUSE, /**< pause */
204 DVR_PLAYBACK_CMD_RESUME, /**< resume */
205 DVR_PLAYBACK_CMD_SEEK, /**< seek */
206 DVR_PLAYBACK_CMD_FF, /**< fast forward */
207 DVR_PLAYBACK_CMD_FB, /**< fast backword */
hualing chen5cbe1a62020-02-10 16:36:36 +0800208 DVR_PLAYBACK_CMD_NONE, /**< none */
hualing chen040df222020-01-17 13:35:02 +0800209} DVR_PlaybackCmd_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800210
211
212/**\brief playback struct*/
213typedef struct
214{
hualing chen5cbe1a62020-02-10 16:36:36 +0800215 DVR_PlaybackSpeed_t speed; /**< play speed */
216 DVR_PlaybackPlayState_t state; /**< play state */
hualing chen040df222020-01-17 13:35:02 +0800217 DVR_PlaybackCmd_t cur_cmd; /**< cur send cmd */
218 DVR_PlaybackCmd_t last_cmd; /**< last cmd */
219 int pos; /**< seek pos at cur segment*/
220} DVR_PlaybackCmdInfo_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800221
222
223/**\brief playback struct*/
224typedef struct
225{
hualing chen2aba4022020-03-02 13:49:55 +0800226 am_tsplayer_handle handle; /**< tsplayer handle */
hualing chencc91e1c2020-02-28 13:26:17 +0800227 DVR_Bool_t segment_is_open; /**<segment is opend*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800228 uint64_t cur_segment_id; /**< Current segment id*/
hualing chen040df222020-01-17 13:35:02 +0800229 DVR_PlaybackSegmentInfo_t cur_segment; /**< Current playing segment*/
hualing chencc91e1c2020-02-28 13:26:17 +0800230 uint64_t last_segment_id; /**< last segment id*/
231 DVR_PlaybackSegmentInfo_t last_segment; /**< last playing segment*/
hualing chen040df222020-01-17 13:35:02 +0800232 struct list_head segment_list; /**< segment list head*/
233 pthread_t playback_thread; /**< playback thread*/
234 pthread_mutex_t lock; /**< playback lock*/
hualing chen2aba4022020-03-02 13:49:55 +0800235 pthread_mutex_t segment_lock; /**< playback segment lock*/
hualing chen040df222020-01-17 13:35:02 +0800236 pthread_cond_t cond; /**< playback cond*/
237 void *user_data; /**< playback userdata, used to send event*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800238 int speed; /**< playback speed*/
hualing chen040df222020-01-17 13:35:02 +0800239 DVR_PlaybackPlayState_t state; /**< playback state*/
240 DVR_PlaybackFlag_t play_flag; /**< playback play flag*/
hualing chen86e7d482020-01-16 15:13:33 +0800241 int is_running; /**< playback htread is runing*/
hualing chen040df222020-01-17 13:35:02 +0800242 DVR_PlaybackCmdInfo_t cmd; /**< playback cmd*/
243 int offset; /**< segment read offset*/
hualing chencc91e1c2020-02-28 13:26:17 +0800244 uint32_t dur; /**< segment dur*/
hualing chen86e7d482020-01-16 15:13:33 +0800245 Segment_Handle_t r_handle; /**< playback current segment handle*/
hualing chen040df222020-01-17 13:35:02 +0800246 DVR_PlaybackOpenParams_t openParams; /**< playback openParams*/
hualing chen86e7d482020-01-16 15:13:33 +0800247 DVR_Bool_t has_video; /**< has video playing*/
248 DVR_Bool_t has_audio; /**< has audio playing*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800249 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
250 int fffb_start; /**< fffb start time ms*/
251 int fffb_current; /**< fffb current time*/
252 int fffb_start_pcr; /**< fffb start pcr time*/
hualing chen2aba4022020-03-02 13:49:55 +0800253 int next_fffb_time;
hualing chen5cbe1a62020-02-10 16:36:36 +0800254 int seek_time;
hualing chen87072a82020-03-12 16:20:12 +0800255 DVR_Bool_t auto_pause;
hualing chen040df222020-01-17 13:35:02 +0800256} DVR_Playback_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800257
258/**\brief Open an dvr palyback
259 * \param[out] p_handle dvr playback addr
260 * \param[in] params dvr playback open parameters
261 * \retval DVR_SUCCESS On success
262 * \return Error code
263 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800264int dvr_playback_open(DVR_PlaybackHandle_t *p_handle, DVR_PlaybackOpenParams_t *params);
hualing chenb31a6c62020-01-13 17:27:00 +0800265
266/**\brief Close an dvr palyback
267 * \param[in] handle playback handle
268 * \retval DVR_SUCCESS On success
269 * \return Error code
270 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800271int dvr_playback_close(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800272
273
274/**\brief Start play audio and video, used start auido api and start video api
275 * \param[in] handle playback handle
276 * \param[in] params audio playback params,contains fmt and pid...
277 * \retval DVR_SUCCESS On success
278 * \return Error code
279 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800280int dvr_playback_start(DVR_PlaybackHandle_t handle, DVR_PlaybackFlag_t flag);
hualing chenb31a6c62020-01-13 17:27:00 +0800281
hualing chen040df222020-01-17 13:35:02 +0800282/**\brief dvr play back add segment info to segment list
hualing chenb31a6c62020-01-13 17:27:00 +0800283 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800284 * \param[in] info added segment info,con vpid fmt apid fmt.....
hualing chenb31a6c62020-01-13 17:27:00 +0800285 * \retval DVR_SUCCESS On success
286 * \return Error code
287 */
hualing chen040df222020-01-17 13:35:02 +0800288int dvr_playback_add_segment(DVR_PlaybackHandle_t handle, DVR_PlaybackSegmentInfo_t *info);
hualing chenb31a6c62020-01-13 17:27:00 +0800289
hualing chen040df222020-01-17 13:35:02 +0800290/**\brief dvr play back remove segment info by segmentkid
hualing chenb31a6c62020-01-13 17:27:00 +0800291 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800292 * \param[in] segmentid need removed segment id
hualing chenb31a6c62020-01-13 17:27:00 +0800293 * \retval DVR_SUCCESS On success
294 * \return Error code
295 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800296int dvr_playback_remove_segment(DVR_PlaybackHandle_t handle, uint64_t segmentid);
hualing chenb31a6c62020-01-13 17:27:00 +0800297
hualing chen040df222020-01-17 13:35:02 +0800298/**\brief dvr play back add segment info
hualing chenb31a6c62020-01-13 17:27:00 +0800299 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800300 * \param[in] info added segment info,con vpid fmt apid fmt.....
hualing chenb31a6c62020-01-13 17:27:00 +0800301 * \retval DVR_SUCCESS On success
302 * \return Error code
303 */
hualing chen040df222020-01-17 13:35:02 +0800304int dvr_playback_update_segment_flags(DVR_PlaybackHandle_t handle,
hualing chen5cbe1a62020-02-10 16:36:36 +0800305 uint64_t segment_id,
hualing chen040df222020-01-17 13:35:02 +0800306 DVR_PlaybackSegmentFlag_t flags);
307/**\brief dvr play back up1date segment pids
308 * if updated segment is ongoing segment, we need start new
hualing chenb31a6c62020-01-13 17:27:00 +0800309 * add pid stream and stop remove pid stream.
310 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800311 * \param[in] segment_id need updated pids segment id
hualing chenb31a6c62020-01-13 17:27:00 +0800312 * \retval DVR_SUCCESS On success
313 * \return Error code
314 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800315int dvr_playback_update_segment_pids(DVR_PlaybackHandle_t handle, uint64_t segmentid,
hualing chen040df222020-01-17 13:35:02 +0800316DVR_PlaybackPids_t *p_pids);
hualing chenb31a6c62020-01-13 17:27:00 +0800317
318/**\brief Stop play, will stop video and audio
319 * \param[in] handle playback handle
320 * \param[in] clear is clear last frame
321 * \retval DVR_SUCCESS On success
322 * \return Error code
323 */
hualing chen040df222020-01-17 13:35:02 +0800324int dvr_playback_stop(DVR_PlaybackHandle_t handle, DVR_Bool_t clear);
hualing chenb31a6c62020-01-13 17:27:00 +0800325
326/**\brief Start play audio
327 * \param[in] handle playback handle
328 * \param[in] params audio playback params,contains fmt and pid...
329 * \retval DVR_SUCCESS On success
330 * \return Error code
331 */
hualing chen2aba4022020-03-02 13:49:55 +0800332int dvr_playback_audio_start(DVR_PlaybackHandle_t handle, am_tsplayer_audio_params *param);
hualing chenb31a6c62020-01-13 17:27:00 +0800333
334/**\brief Stop play audio
335 * \param[in] handle playback handle
336 * \retval DVR_SUCCESS On success
337 * \return Error code
338 */
hualing chen040df222020-01-17 13:35:02 +0800339int dvr_playback_audio_stop(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800340
341/**\brief Start play video
342 * \param[in] handle playback handle
343 * \param[in] params video playback params,contains fmt and pid...
344 * \retval DVR_SUCCESS On success
345 * \return Error code
346 */
hualing chen2aba4022020-03-02 13:49:55 +0800347int dvr_playback_video_start(DVR_PlaybackHandle_t handle, am_tsplayer_video_params *param);
hualing chenb31a6c62020-01-13 17:27:00 +0800348
349/**\brief Stop play video
350 * \param[in] handle playback handle
351 * \retval DVR_SUCCESS On success
352 * \return Error code
353 */
hualing chen040df222020-01-17 13:35:02 +0800354int dvr_playback_video_stop(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800355
356/**\brief Pause play
357 * \param[in] handle playback handle
358 * \param[in] flush whether its internal buffers should be flushed
359 * \retval DVR_SUCCESS On success
360 * \return Error code
361 */
hualing chen040df222020-01-17 13:35:02 +0800362int dvr_playback_pause(DVR_PlaybackHandle_t handle, DVR_Bool_t flush);
hualing chenb31a6c62020-01-13 17:27:00 +0800363
364
365/**\brief seek
366 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800367 * \param[in] time_offset time offset base cur segment
hualing chenb31a6c62020-01-13 17:27:00 +0800368 * \retval DVR_SUCCESS On success
369 * \return Error code
370 */
hualing chencc91e1c2020-02-28 13:26:17 +0800371int dvr_playback_seek(DVR_PlaybackHandle_t handle, uint64_t segment_id, uint32_t time_offset);
hualing chenb31a6c62020-01-13 17:27:00 +0800372
373/**\brief Set play speed
374 * \param[in] handle playback handle
375 * \param[in] speed playback speed
376 * \retval DVR_SUCCESS On success
377 * \return Error code
378 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800379int dvr_playback_set_speed(DVR_PlaybackHandle_t handle, DVR_PlaybackSpeed_t speed);
hualing chenb31a6c62020-01-13 17:27:00 +0800380
381/**\brief Get playback status
382 * \param[in] handle playback handle
383 * \param[out] p_status playback status
384 * \retval DVR_SUCCESS On success
385 * \return Error code
386 */
hualing chen040df222020-01-17 13:35:02 +0800387int dvr_playback_get_status(DVR_PlaybackHandle_t handle, DVR_PlaybackStatus_t *p_status);
hualing chenb31a6c62020-01-13 17:27:00 +0800388
389/**\brief Get playback capabilities
390 * \param[out] p_capability playback capability
391 * \retval DVR_SUCCESS On success
392 * \return Error code
393 */
hualing chen040df222020-01-17 13:35:02 +0800394int dvr_playback_get_capabilities(DVR_PlaybackCapability_t *p_capability);
hualing chenb31a6c62020-01-13 17:27:00 +0800395
hualing chen040df222020-01-17 13:35:02 +0800396/**\brief dump segmentinfo throw print log
hualing chenb31a6c62020-01-13 17:27:00 +0800397 * \param[int] handle playback
hualing chen040df222020-01-17 13:35:02 +0800398 * \param[int] segment_id if segment_id > 0, only dump this log. else dump all segment info
hualing chenb31a6c62020-01-13 17:27:00 +0800399 * \retval DVR_SUCCESS On success
400 * \return Error code
401 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800402int dvr_dump_segmentinfo(DVR_PlaybackHandle_t handle, uint64_t segment_id);
hualing chenb31a6c62020-01-13 17:27:00 +0800403
404#ifdef __cplusplus
405}
406#endif
407
408#endif /*END DVR_PLAYBACK_H_*/