blob: a8714973d2074fd5c0ce549b3822ac187fb2a8cc [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{
72 PLAYBACK_SPEED_S16 = 6, /**<slow 1/16 speed*/
73 PLAYBACK_SPEED_S8 = 12, /**<slow 1/8 speed*/
74 PLAYBACK_SPEED_S4 = 26, /**<slow 1/4 speed*/
75 PLAYBACK_SPEED_S2 = 50, /**<slow 1/2 speed*/
76 PLAYBACK_SPEED_X1 = 100, /**< X 1 normal speed*/
77 PLAYBACK_SPEED_X2 = 200, /**< X 2 speed*/
78 PLAYBACK_SPEED_X4 = 400, /**< X 4 speed*/
79 PLAYBACK_SPEED_X8 = 800, /**< X 8 speed*/
80 PLAYBACK_SPEED_X16 = 1600, /**< X 16 speed*/
81 PLAYBACK_SPEED_X32 = 3200, /**< X 32 speed*/
82 PlayBack_Speed_MAX,
83} Playback_SpeedValue_t;
84
85typedef struct Playback_Speeds_s {
86 int speed; /**< playback speed*/
87} Playback_Speeds_t;
hualing chenb31a6c62020-01-13 17:27:00 +080088
Gong Ke3489c0f2020-01-16 18:11:44 +080089/**\brief playback play speed*/
hualing chenb31a6c62020-01-13 17:27:00 +080090typedef struct
91{
hualing chen2aba4022020-03-02 13:49:55 +080092 Playback_Speeds_t speed; /**< playback speed */
Gong Ke3489c0f2020-01-16 18:11:44 +080093 DVR_PlaybackSpeedMode_t mode; /**< playback 0: fast forword or 1: fast backword*/
94} DVR_PlaybackSpeed_t;
hualing chenb31a6c62020-01-13 17:27:00 +080095
hualing chen2aba4022020-03-02 13:49:55 +080096
Gong Ke3489c0f2020-01-16 18:11:44 +080097/**Maximum supported speed modes.*/
hualing chenb31a6c62020-01-13 17:27:00 +080098#define DVR_MAX_SUPPORTED_SPEEDS 32
Gong Ke3489c0f2020-01-16 18:11:44 +080099
hualing chenb31a6c62020-01-13 17:27:00 +0800100/**\brief playback capability*/
101typedef struct
102{
hualing chen86e7d482020-01-16 15:13:33 +0800103 int nb_supported_speeds; /**< support playback speed count*/
104 int supported_speeds[DVR_MAX_SUPPORTED_SPEEDS]; /**< support playback speed*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800105} DVR_PlaybackCapability_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800106
Gong Ke3489c0f2020-01-16 18:11:44 +0800107/**Playback handle.*/
108typedef void* DVR_PlaybackHandle_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800109
hualing chencc91e1c2020-02-28 13:26:17 +0800110
111/**\brief playback error reason*/
112typedef enum
113{
114 DVR_PLAYBACK_PID_ERROR, /**< uninit state */
115 DVR_PLAYBACK_FMT_ERROR /**< fmt not surport backword */
116} DVR_PlaybackError_t;
117
118
hualing chenb31a6c62020-01-13 17:27:00 +0800119/**\brief playback play state*/
120typedef enum
121{
Gong Ke3489c0f2020-01-16 18:11:44 +0800122 DVR_PLAYBACK_STATE_START, /**< start play */
123 DVR_PLAYBACK_STATE_STOP, /**< stop */
124 DVR_PLAYBACK_STATE_PAUSE, /**< pause */
125 DVR_PLAYBACK_STATE_FF, /**< fast forward */
126 DVR_PLAYBACK_STATE_FB /**< fast backword */
127} DVR_PlaybackPlayState_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800128
129/**\brief playback play status*/
130typedef struct
131{
Gong Ke3489c0f2020-01-16 18:11:44 +0800132 DVR_PlaybackPlayState_t state; /**< playback play state */
hualing chen5cbe1a62020-02-10 16:36:36 +0800133 uint64_t segment_id; /**< playback ongoing segment index */
hualing chencc91e1c2020-02-28 13:26:17 +0800134 uint32_t time_cur; /**< playback cur time,0 <--> time_end Ms*/
135 uint32_t time_end; /**< playback ongoing segment dur,Ms */
Gong Ke3489c0f2020-01-16 18:11:44 +0800136 DVR_PlaybackPids_t pids; /**< playback played pids */
hualing chen5cbe1a62020-02-10 16:36:36 +0800137 int speed; /**< playback speed */
138 DVR_PlaybackSegmentFlag_t flags; /**< playback played segment flag */
Gong Ke3489c0f2020-01-16 18:11:44 +0800139} DVR_PlaybackStatus_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800140
hualing chencc91e1c2020-02-28 13:26:17 +0800141/**\brief DVR playback event*/
142typedef enum {
143 DVR_PLAYBACK_EVENT_ERROR = 0x1000, /**< Signal a critical playback error*/
144 DVR_PLAYBACK_EVENT_TRANSITION_OK , /**< transition ok*/
145 DVR_PLAYBACK_EVENT_TRANSITION_FAILED, /**< transition failed*/
146 DVR_PLAYBACK_EVENT_KEY_FAILURE, /**< key failure*/
147 DVR_PLAYBACK_EVENT_NO_KEY, /**< no key*/
148 DVR_PLAYBACK_EVENT_REACHED_BEGIN , /**< reached begin*/
hualing chen2aba4022020-03-02 13:49:55 +0800149 DVR_PLAYBACK_EVENT_REACHED_END, /**< reached end*/
150 DVR_PLAYBACK_EVENT_FIRST_FRAME /**< first frame*/
hualing chencc91e1c2020-02-28 13:26:17 +0800151} DVR_PlaybackEvent_t;
152
153/**\brief DVR playback event notify function*/
154typedef struct
155{
156 DVR_PlaybackEvent_t event; /**< event type*/
157 DVR_PlaybackStatus_t play_status; /**< play status*/
158 union
159 {
160 uint8_t unused;
161 uint8_t error_reason; /**< error reason*/
162 struct
163 {
164 uint64_t segment_id; /**< error segment id*/
165 uint32_t key_data_id; /**< key data id*/
166 uint8_t error; /**< error*/
167 } transition_failed_data;
168 } info;
169} DVR_Play_Notify_t;
170
171/**\brief DVR playback event notify function*/
172typedef DVR_Result_t (*DVR_PlaybackEventFunction_t) (DVR_PlaybackEvent_t event, void *params, void *userdata);
173
174
hualing chenb31a6c62020-01-13 17:27:00 +0800175/**\brief playback open params*/
176typedef struct
177{
Gong Ke3489c0f2020-01-16 18:11:44 +0800178 int dmx_dev_id; /**< playback used dmx device index*/
179 int block_size; /**< playback inject block size*/
180 DVR_Bool_t is_timeshift; /**< 0:playback mode, 1 : is timeshift mode*/
hualing chen2aba4022020-03-02 13:49:55 +0800181 am_tsplayer_handle player_handle; /**< am tsplayer handle.*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800182 DVR_CryptoFunction_t crypto_fn; /**< Crypto function.*/
183 void *crypto_data; /**< Crypto function's user data.*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800184 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
hualing chencc91e1c2020-02-28 13:26:17 +0800185 DVR_PlaybackEventFunction_t event_fn; /**< playback event callback function*/
186 void *event_userdata; /**< event userdata*/
187 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 +0800188} DVR_PlaybackOpenParams_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800189
190/**\brief playback play state*/
191typedef enum
192{
hualing chen040df222020-01-17 13:35:02 +0800193 DVR_PLAYBACK_CMD_START, /**< start av */
194 DVR_PLAYBACK_CMD_STOP, /**< stop av */
195 DVR_PLAYBACK_CMD_VSTART, /**< v start */
196 DVR_PLAYBACK_CMD_ASTART , /**< a start */
197 DVR_PLAYBACK_CMD_VSTOP , /**< v stop */
198 DVR_PLAYBACK_CMD_ASTOP, /**< a stop */
199 DVR_PLAYBACK_CMD_VRESTART, /**< v restart */
200 DVR_PLAYBACK_CMD_ARESTART, /**< a restart */
hualing chen5cbe1a62020-02-10 16:36:36 +0800201 DVR_PLAYBACK_CMD_AVRESTART, /**< av restart */
hualing chen040df222020-01-17 13:35:02 +0800202 DVR_PLAYBACK_CMD_VSTOPASTART, /**< v stop a start*/
203 DVR_PLAYBACK_CMD_ASTOPVSTART, /**< a stop vstart */
204 DVR_PLAYBACK_CMD_VSTOPARESTART, /**<v stop a restart*/
205 DVR_PLAYBACK_CMD_ASTOPVRESTART, /**<a stop v restart*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800206 DVR_PLAYBACK_CMD_VSTARTARESTART, /**<v start a restart*/
207 DVR_PLAYBACK_CMD_ASTARTVRESTART, /**<a start v restart*/
hualing chen040df222020-01-17 13:35:02 +0800208 DVR_PLAYBACK_CMD_PAUSE, /**< pause */
209 DVR_PLAYBACK_CMD_RESUME, /**< resume */
210 DVR_PLAYBACK_CMD_SEEK, /**< seek */
211 DVR_PLAYBACK_CMD_FF, /**< fast forward */
212 DVR_PLAYBACK_CMD_FB, /**< fast backword */
hualing chen5cbe1a62020-02-10 16:36:36 +0800213 DVR_PLAYBACK_CMD_NONE, /**< none */
hualing chen040df222020-01-17 13:35:02 +0800214} DVR_PlaybackCmd_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800215
216
217/**\brief playback struct*/
218typedef struct
219{
hualing chen5cbe1a62020-02-10 16:36:36 +0800220 DVR_PlaybackSpeed_t speed; /**< play speed */
221 DVR_PlaybackPlayState_t state; /**< play state */
hualing chen040df222020-01-17 13:35:02 +0800222 DVR_PlaybackCmd_t cur_cmd; /**< cur send cmd */
223 DVR_PlaybackCmd_t last_cmd; /**< last cmd */
224 int pos; /**< seek pos at cur segment*/
225} DVR_PlaybackCmdInfo_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800226
227
228/**\brief playback struct*/
229typedef struct
230{
hualing chen2aba4022020-03-02 13:49:55 +0800231 am_tsplayer_handle handle; /**< tsplayer handle */
hualing chencc91e1c2020-02-28 13:26:17 +0800232 DVR_Bool_t segment_is_open; /**<segment is opend*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800233 uint64_t cur_segment_id; /**< Current segment id*/
hualing chen040df222020-01-17 13:35:02 +0800234 DVR_PlaybackSegmentInfo_t cur_segment; /**< Current playing segment*/
hualing chencc91e1c2020-02-28 13:26:17 +0800235 uint64_t last_segment_id; /**< last segment id*/
236 DVR_PlaybackSegmentInfo_t last_segment; /**< last playing segment*/
hualing chen040df222020-01-17 13:35:02 +0800237 struct list_head segment_list; /**< segment list head*/
238 pthread_t playback_thread; /**< playback thread*/
239 pthread_mutex_t lock; /**< playback lock*/
hualing chen2aba4022020-03-02 13:49:55 +0800240 pthread_mutex_t segment_lock; /**< playback segment lock*/
hualing chen040df222020-01-17 13:35:02 +0800241 pthread_cond_t cond; /**< playback cond*/
242 void *user_data; /**< playback userdata, used to send event*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800243 int speed; /**< playback speed*/
hualing chen040df222020-01-17 13:35:02 +0800244 DVR_PlaybackPlayState_t state; /**< playback state*/
245 DVR_PlaybackFlag_t play_flag; /**< playback play flag*/
hualing chen86e7d482020-01-16 15:13:33 +0800246 int is_running; /**< playback htread is runing*/
hualing chen040df222020-01-17 13:35:02 +0800247 DVR_PlaybackCmdInfo_t cmd; /**< playback cmd*/
248 int offset; /**< segment read offset*/
hualing chencc91e1c2020-02-28 13:26:17 +0800249 uint32_t dur; /**< segment dur*/
hualing chen86e7d482020-01-16 15:13:33 +0800250 Segment_Handle_t r_handle; /**< playback current segment handle*/
hualing chen040df222020-01-17 13:35:02 +0800251 DVR_PlaybackOpenParams_t openParams; /**< playback openParams*/
hualing chen86e7d482020-01-16 15:13:33 +0800252 DVR_Bool_t has_video; /**< has video playing*/
253 DVR_Bool_t has_audio; /**< has audio playing*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800254 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
255 int fffb_start; /**< fffb start time ms*/
256 int fffb_current; /**< fffb current time*/
257 int fffb_start_pcr; /**< fffb start pcr time*/
hualing chen2aba4022020-03-02 13:49:55 +0800258 int next_fffb_time;
hualing chen5cbe1a62020-02-10 16:36:36 +0800259 int seek_time;
hualing chen040df222020-01-17 13:35:02 +0800260} DVR_Playback_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800261
262/**\brief Open an dvr palyback
263 * \param[out] p_handle dvr playback addr
264 * \param[in] params dvr playback open parameters
265 * \retval DVR_SUCCESS On success
266 * \return Error code
267 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800268int dvr_playback_open(DVR_PlaybackHandle_t *p_handle, DVR_PlaybackOpenParams_t *params);
hualing chenb31a6c62020-01-13 17:27:00 +0800269
270/**\brief Close an dvr palyback
271 * \param[in] handle playback handle
272 * \retval DVR_SUCCESS On success
273 * \return Error code
274 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800275int dvr_playback_close(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800276
277
278/**\brief Start play audio and video, used start auido api and start video api
279 * \param[in] handle playback handle
280 * \param[in] params audio playback params,contains fmt and pid...
281 * \retval DVR_SUCCESS On success
282 * \return Error code
283 */
Gong Ke3489c0f2020-01-16 18:11:44 +0800284int dvr_playback_start(DVR_PlaybackHandle_t handle, DVR_PlaybackFlag_t flag);
hualing chenb31a6c62020-01-13 17:27:00 +0800285
hualing chen040df222020-01-17 13:35:02 +0800286/**\brief dvr play back add segment info to segment list
hualing chenb31a6c62020-01-13 17:27:00 +0800287 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800288 * \param[in] info added segment info,con vpid fmt apid fmt.....
hualing chenb31a6c62020-01-13 17:27:00 +0800289 * \retval DVR_SUCCESS On success
290 * \return Error code
291 */
hualing chen040df222020-01-17 13:35:02 +0800292int dvr_playback_add_segment(DVR_PlaybackHandle_t handle, DVR_PlaybackSegmentInfo_t *info);
hualing chenb31a6c62020-01-13 17:27:00 +0800293
hualing chen040df222020-01-17 13:35:02 +0800294/**\brief dvr play back remove segment info by segmentkid
hualing chenb31a6c62020-01-13 17:27:00 +0800295 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800296 * \param[in] segmentid need removed segment id
hualing chenb31a6c62020-01-13 17:27:00 +0800297 * \retval DVR_SUCCESS On success
298 * \return Error code
299 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800300int dvr_playback_remove_segment(DVR_PlaybackHandle_t handle, uint64_t segmentid);
hualing chenb31a6c62020-01-13 17:27:00 +0800301
hualing chen040df222020-01-17 13:35:02 +0800302/**\brief dvr play back add segment info
hualing chenb31a6c62020-01-13 17:27:00 +0800303 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800304 * \param[in] info added segment info,con vpid fmt apid fmt.....
hualing chenb31a6c62020-01-13 17:27:00 +0800305 * \retval DVR_SUCCESS On success
306 * \return Error code
307 */
hualing chen040df222020-01-17 13:35:02 +0800308int dvr_playback_update_segment_flags(DVR_PlaybackHandle_t handle,
hualing chen5cbe1a62020-02-10 16:36:36 +0800309 uint64_t segment_id,
hualing chen040df222020-01-17 13:35:02 +0800310 DVR_PlaybackSegmentFlag_t flags);
311/**\brief dvr play back up1date segment pids
312 * if updated segment is ongoing segment, we need start new
hualing chenb31a6c62020-01-13 17:27:00 +0800313 * add pid stream and stop remove pid stream.
314 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800315 * \param[in] segment_id need updated pids segment id
hualing chenb31a6c62020-01-13 17:27:00 +0800316 * \retval DVR_SUCCESS On success
317 * \return Error code
318 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800319int dvr_playback_update_segment_pids(DVR_PlaybackHandle_t handle, uint64_t segmentid,
hualing chen040df222020-01-17 13:35:02 +0800320DVR_PlaybackPids_t *p_pids);
hualing chenb31a6c62020-01-13 17:27:00 +0800321
322/**\brief Stop play, will stop video and audio
323 * \param[in] handle playback handle
324 * \param[in] clear is clear last frame
325 * \retval DVR_SUCCESS On success
326 * \return Error code
327 */
hualing chen040df222020-01-17 13:35:02 +0800328int dvr_playback_stop(DVR_PlaybackHandle_t handle, DVR_Bool_t clear);
hualing chenb31a6c62020-01-13 17:27:00 +0800329
330/**\brief Start play audio
331 * \param[in] handle playback handle
332 * \param[in] params audio playback params,contains fmt and pid...
333 * \retval DVR_SUCCESS On success
334 * \return Error code
335 */
hualing chen2aba4022020-03-02 13:49:55 +0800336int dvr_playback_audio_start(DVR_PlaybackHandle_t handle, am_tsplayer_audio_params *param);
hualing chenb31a6c62020-01-13 17:27:00 +0800337
338/**\brief Stop play audio
339 * \param[in] handle playback handle
340 * \retval DVR_SUCCESS On success
341 * \return Error code
342 */
hualing chen040df222020-01-17 13:35:02 +0800343int dvr_playback_audio_stop(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800344
345/**\brief Start play video
346 * \param[in] handle playback handle
347 * \param[in] params video playback params,contains fmt and pid...
348 * \retval DVR_SUCCESS On success
349 * \return Error code
350 */
hualing chen2aba4022020-03-02 13:49:55 +0800351int dvr_playback_video_start(DVR_PlaybackHandle_t handle, am_tsplayer_video_params *param);
hualing chenb31a6c62020-01-13 17:27:00 +0800352
353/**\brief Stop play video
354 * \param[in] handle playback handle
355 * \retval DVR_SUCCESS On success
356 * \return Error code
357 */
hualing chen040df222020-01-17 13:35:02 +0800358int dvr_playback_video_stop(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800359
360/**\brief Pause play
361 * \param[in] handle playback handle
362 * \param[in] flush whether its internal buffers should be flushed
363 * \retval DVR_SUCCESS On success
364 * \return Error code
365 */
hualing chen040df222020-01-17 13:35:02 +0800366int dvr_playback_pause(DVR_PlaybackHandle_t handle, DVR_Bool_t flush);
hualing chenb31a6c62020-01-13 17:27:00 +0800367
368
369/**\brief seek
370 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800371 * \param[in] time_offset time offset base cur segment
hualing chenb31a6c62020-01-13 17:27:00 +0800372 * \retval DVR_SUCCESS On success
373 * \return Error code
374 */
hualing chencc91e1c2020-02-28 13:26:17 +0800375int dvr_playback_seek(DVR_PlaybackHandle_t handle, uint64_t segment_id, uint32_t time_offset);
hualing chenb31a6c62020-01-13 17:27:00 +0800376
377/**\brief Set play speed
378 * \param[in] handle playback handle
379 * \param[in] speed playback speed
380 * \retval DVR_SUCCESS On success
381 * \return Error code
382 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800383int dvr_playback_set_speed(DVR_PlaybackHandle_t handle, DVR_PlaybackSpeed_t speed);
hualing chenb31a6c62020-01-13 17:27:00 +0800384
385/**\brief Get playback status
386 * \param[in] handle playback handle
387 * \param[out] p_status playback status
388 * \retval DVR_SUCCESS On success
389 * \return Error code
390 */
hualing chen040df222020-01-17 13:35:02 +0800391int dvr_playback_get_status(DVR_PlaybackHandle_t handle, DVR_PlaybackStatus_t *p_status);
hualing chenb31a6c62020-01-13 17:27:00 +0800392
393/**\brief Get playback capabilities
394 * \param[out] p_capability playback capability
395 * \retval DVR_SUCCESS On success
396 * \return Error code
397 */
hualing chen040df222020-01-17 13:35:02 +0800398int dvr_playback_get_capabilities(DVR_PlaybackCapability_t *p_capability);
hualing chenb31a6c62020-01-13 17:27:00 +0800399
hualing chen040df222020-01-17 13:35:02 +0800400/**\brief dump segmentinfo throw print log
hualing chenb31a6c62020-01-13 17:27:00 +0800401 * \param[int] handle playback
hualing chen040df222020-01-17 13:35:02 +0800402 * \param[int] segment_id if segment_id > 0, only dump this log. else dump all segment info
hualing chenb31a6c62020-01-13 17:27:00 +0800403 * \retval DVR_SUCCESS On success
404 * \return Error code
405 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800406int dvr_dump_segmentinfo(DVR_PlaybackHandle_t handle, uint64_t segment_id);
hualing chenb31a6c62020-01-13 17:27:00 +0800407
408#ifdef __cplusplus
409}
410#endif
411
412#endif /*END DVR_PLAYBACK_H_*/