blob: e467885201de95ad2e78eaae9875980a9a2834bb [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 */
hualing chen31140872020-03-25 12:29:26 +080067 DVR_PLAYBACK_KERNEL_SUPPORT = 2, /**< kernel support mode */
Gong Ke3489c0f2020-01-16 18:11:44 +080068} DVR_PlaybackSpeedMode_t;
hualing chenb31a6c62020-01-13 17:27:00 +080069
hualing chen2aba4022020-03-02 13:49:55 +080070/**\brief playback speed*/
71typedef enum
72{
hualing chen2aba4022020-03-02 13:49:55 +080073 PLAYBACK_SPEED_S2 = 50, /**<slow 1/2 speed*/
74 PLAYBACK_SPEED_X1 = 100, /**< X 1 normal speed*/
75 PLAYBACK_SPEED_X2 = 200, /**< X 2 speed*/
76 PLAYBACK_SPEED_X4 = 400, /**< X 4 speed*/
77 PLAYBACK_SPEED_X8 = 800, /**< X 8 speed*/
hualing chen2aba4022020-03-02 13:49:55 +080078 PlayBack_Speed_MAX,
79} Playback_SpeedValue_t;
80
81typedef struct Playback_Speeds_s {
82 int speed; /**< playback speed*/
83} Playback_Speeds_t;
hualing chenb31a6c62020-01-13 17:27:00 +080084
Gong Ke3489c0f2020-01-16 18:11:44 +080085/**\brief playback play speed*/
hualing chenb31a6c62020-01-13 17:27:00 +080086typedef struct
87{
hualing chen2aba4022020-03-02 13:49:55 +080088 Playback_Speeds_t speed; /**< playback speed */
Gong Ke3489c0f2020-01-16 18:11:44 +080089 DVR_PlaybackSpeedMode_t mode; /**< playback 0: fast forword or 1: fast backword*/
90} DVR_PlaybackSpeed_t;
hualing chenb31a6c62020-01-13 17:27:00 +080091
hualing chen2aba4022020-03-02 13:49:55 +080092
Gong Ke3489c0f2020-01-16 18:11:44 +080093/**Maximum supported speed modes.*/
hualing chenb31a6c62020-01-13 17:27:00 +080094#define DVR_MAX_SUPPORTED_SPEEDS 32
Gong Ke3489c0f2020-01-16 18:11:44 +080095
hualing chenb31a6c62020-01-13 17:27:00 +080096/**\brief playback capability*/
97typedef struct
98{
hualing chen86e7d482020-01-16 15:13:33 +080099 int nb_supported_speeds; /**< support playback speed count*/
100 int supported_speeds[DVR_MAX_SUPPORTED_SPEEDS]; /**< support playback speed*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800101} DVR_PlaybackCapability_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800102
Gong Ke3489c0f2020-01-16 18:11:44 +0800103/**Playback handle.*/
104typedef void* DVR_PlaybackHandle_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800105
hualing chencc91e1c2020-02-28 13:26:17 +0800106
107/**\brief playback error reason*/
108typedef enum
109{
110 DVR_PLAYBACK_PID_ERROR, /**< uninit state */
111 DVR_PLAYBACK_FMT_ERROR /**< fmt not surport backword */
112} DVR_PlaybackError_t;
113
114
hualing chenb31a6c62020-01-13 17:27:00 +0800115/**\brief playback play state*/
116typedef enum
117{
Gong Ke3489c0f2020-01-16 18:11:44 +0800118 DVR_PLAYBACK_STATE_START, /**< start play */
119 DVR_PLAYBACK_STATE_STOP, /**< stop */
120 DVR_PLAYBACK_STATE_PAUSE, /**< pause */
121 DVR_PLAYBACK_STATE_FF, /**< fast forward */
122 DVR_PLAYBACK_STATE_FB /**< fast backword */
123} DVR_PlaybackPlayState_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800124
125/**\brief playback play status*/
126typedef struct
127{
Gong Ke3489c0f2020-01-16 18:11:44 +0800128 DVR_PlaybackPlayState_t state; /**< playback play state */
hualing chen5cbe1a62020-02-10 16:36:36 +0800129 uint64_t segment_id; /**< playback ongoing segment index */
hualing chencc91e1c2020-02-28 13:26:17 +0800130 uint32_t time_cur; /**< playback cur time,0 <--> time_end Ms*/
131 uint32_t time_end; /**< playback ongoing segment dur,Ms */
Gong Ke3489c0f2020-01-16 18:11:44 +0800132 DVR_PlaybackPids_t pids; /**< playback played pids */
hualing chen5cbe1a62020-02-10 16:36:36 +0800133 int speed; /**< playback speed */
134 DVR_PlaybackSegmentFlag_t flags; /**< playback played segment flag */
Gong Ke3489c0f2020-01-16 18:11:44 +0800135} DVR_PlaybackStatus_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800136
hualing chencc91e1c2020-02-28 13:26:17 +0800137/**\brief DVR playback event*/
138typedef enum {
139 DVR_PLAYBACK_EVENT_ERROR = 0x1000, /**< Signal a critical playback error*/
140 DVR_PLAYBACK_EVENT_TRANSITION_OK , /**< transition ok*/
141 DVR_PLAYBACK_EVENT_TRANSITION_FAILED, /**< transition failed*/
142 DVR_PLAYBACK_EVENT_KEY_FAILURE, /**< key failure*/
143 DVR_PLAYBACK_EVENT_NO_KEY, /**< no key*/
144 DVR_PLAYBACK_EVENT_REACHED_BEGIN , /**< reached begin*/
hualing chen2aba4022020-03-02 13:49:55 +0800145 DVR_PLAYBACK_EVENT_REACHED_END, /**< reached end*/
hualing chen6e4bfa52020-03-13 14:37:11 +0800146 DVR_PLAYBACK_EVENT_NOTIFY_PLAYTIME, /**< notify play cur segmeng time ms*/
hualing chen2aba4022020-03-02 13:49:55 +0800147 DVR_PLAYBACK_EVENT_FIRST_FRAME /**< first frame*/
hualing chencc91e1c2020-02-28 13:26:17 +0800148} DVR_PlaybackEvent_t;
149
150/**\brief DVR playback event notify function*/
151typedef struct
152{
153 DVR_PlaybackEvent_t event; /**< event type*/
154 DVR_PlaybackStatus_t play_status; /**< play status*/
155 union
156 {
157 uint8_t unused;
158 uint8_t error_reason; /**< error reason*/
159 struct
160 {
161 uint64_t segment_id; /**< error segment id*/
162 uint32_t key_data_id; /**< key data id*/
163 uint8_t error; /**< error*/
164 } transition_failed_data;
165 } info;
166} DVR_Play_Notify_t;
167
168/**\brief DVR playback event notify function*/
169typedef DVR_Result_t (*DVR_PlaybackEventFunction_t) (DVR_PlaybackEvent_t event, void *params, void *userdata);
170
171
hualing chenb31a6c62020-01-13 17:27:00 +0800172/**\brief playback open params*/
173typedef struct
174{
Gong Ke3489c0f2020-01-16 18:11:44 +0800175 int dmx_dev_id; /**< playback used dmx device index*/
176 int block_size; /**< playback inject block size*/
177 DVR_Bool_t is_timeshift; /**< 0:playback mode, 1 : is timeshift mode*/
hualing chen2aba4022020-03-02 13:49:55 +0800178 am_tsplayer_handle player_handle; /**< am tsplayer handle.*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800179 DVR_CryptoFunction_t crypto_fn; /**< Crypto function.*/
180 void *crypto_data; /**< Crypto function's user data.*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800181 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
hualing chencc91e1c2020-02-28 13:26:17 +0800182 DVR_PlaybackEventFunction_t event_fn; /**< playback event callback function*/
183 void *event_userdata; /**< event userdata*/
Gong Ke3489c0f2020-01-16 18:11:44 +0800184} DVR_PlaybackOpenParams_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800185
186/**\brief playback play state*/
187typedef enum
188{
hualing chen040df222020-01-17 13:35:02 +0800189 DVR_PLAYBACK_CMD_START, /**< start av */
190 DVR_PLAYBACK_CMD_STOP, /**< stop av */
191 DVR_PLAYBACK_CMD_VSTART, /**< v start */
192 DVR_PLAYBACK_CMD_ASTART , /**< a start */
193 DVR_PLAYBACK_CMD_VSTOP , /**< v stop */
194 DVR_PLAYBACK_CMD_ASTOP, /**< a stop */
195 DVR_PLAYBACK_CMD_VRESTART, /**< v restart */
196 DVR_PLAYBACK_CMD_ARESTART, /**< a restart */
hualing chen5cbe1a62020-02-10 16:36:36 +0800197 DVR_PLAYBACK_CMD_AVRESTART, /**< av restart */
hualing chen040df222020-01-17 13:35:02 +0800198 DVR_PLAYBACK_CMD_VSTOPASTART, /**< v stop a start*/
199 DVR_PLAYBACK_CMD_ASTOPVSTART, /**< a stop vstart */
200 DVR_PLAYBACK_CMD_VSTOPARESTART, /**<v stop a restart*/
201 DVR_PLAYBACK_CMD_ASTOPVRESTART, /**<a stop v restart*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800202 DVR_PLAYBACK_CMD_VSTARTARESTART, /**<v start a restart*/
203 DVR_PLAYBACK_CMD_ASTARTVRESTART, /**<a start v restart*/
hualing chen040df222020-01-17 13:35:02 +0800204 DVR_PLAYBACK_CMD_PAUSE, /**< pause */
205 DVR_PLAYBACK_CMD_RESUME, /**< resume */
206 DVR_PLAYBACK_CMD_SEEK, /**< seek */
207 DVR_PLAYBACK_CMD_FF, /**< fast forward */
208 DVR_PLAYBACK_CMD_FB, /**< fast backword */
hualing chen5cbe1a62020-02-10 16:36:36 +0800209 DVR_PLAYBACK_CMD_NONE, /**< none */
hualing chen040df222020-01-17 13:35:02 +0800210} DVR_PlaybackCmd_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800211
212
213/**\brief playback struct*/
214typedef struct
215{
hualing chen5cbe1a62020-02-10 16:36:36 +0800216 DVR_PlaybackSpeed_t speed; /**< play speed */
217 DVR_PlaybackPlayState_t state; /**< play state */
hualing chen040df222020-01-17 13:35:02 +0800218 DVR_PlaybackCmd_t cur_cmd; /**< cur send cmd */
219 DVR_PlaybackCmd_t last_cmd; /**< last cmd */
220 int pos; /**< seek pos at cur segment*/
221} DVR_PlaybackCmdInfo_t;
hualing chenb31a6c62020-01-13 17:27:00 +0800222
223
224/**\brief playback struct*/
225typedef struct
226{
hualing chen2aba4022020-03-02 13:49:55 +0800227 am_tsplayer_handle handle; /**< tsplayer handle */
hualing chencc91e1c2020-02-28 13:26:17 +0800228 DVR_Bool_t segment_is_open; /**<segment is opend*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800229 uint64_t cur_segment_id; /**< Current segment id*/
hualing chen040df222020-01-17 13:35:02 +0800230 DVR_PlaybackSegmentInfo_t cur_segment; /**< Current playing segment*/
hualing chencc91e1c2020-02-28 13:26:17 +0800231 uint64_t last_segment_id; /**< last segment id*/
232 DVR_PlaybackSegmentInfo_t last_segment; /**< last playing segment*/
hualing chen040df222020-01-17 13:35:02 +0800233 struct list_head segment_list; /**< segment list head*/
234 pthread_t playback_thread; /**< playback thread*/
235 pthread_mutex_t lock; /**< playback lock*/
hualing chen2aba4022020-03-02 13:49:55 +0800236 pthread_mutex_t segment_lock; /**< playback segment lock*/
hualing chen040df222020-01-17 13:35:02 +0800237 pthread_cond_t cond; /**< playback cond*/
238 void *user_data; /**< playback userdata, used to send event*/
hualing chen6d24aa92020-03-23 18:43:47 +0800239 float speed; /**< playback speed*/
hualing chen040df222020-01-17 13:35:02 +0800240 DVR_PlaybackPlayState_t state; /**< playback state*/
241 DVR_PlaybackFlag_t play_flag; /**< playback play flag*/
hualing chen86e7d482020-01-16 15:13:33 +0800242 int is_running; /**< playback htread is runing*/
hualing chen040df222020-01-17 13:35:02 +0800243 DVR_PlaybackCmdInfo_t cmd; /**< playback cmd*/
244 int offset; /**< segment read offset*/
hualing chencc91e1c2020-02-28 13:26:17 +0800245 uint32_t dur; /**< segment dur*/
hualing chen86e7d482020-01-16 15:13:33 +0800246 Segment_Handle_t r_handle; /**< playback current segment handle*/
hualing chen040df222020-01-17 13:35:02 +0800247 DVR_PlaybackOpenParams_t openParams; /**< playback openParams*/
hualing chen86e7d482020-01-16 15:13:33 +0800248 DVR_Bool_t has_video; /**< has video playing*/
249 DVR_Bool_t has_audio; /**< has audio playing*/
hualing chen5cbe1a62020-02-10 16:36:36 +0800250 DVR_Bool_t has_pids; /**< has video audo pid fmt info*/
251 int fffb_start; /**< fffb start time ms*/
252 int fffb_current; /**< fffb current time*/
253 int fffb_start_pcr; /**< fffb start pcr time*/
hualing chen2aba4022020-03-02 13:49:55 +0800254 int next_fffb_time;
hualing chen5cbe1a62020-02-10 16:36:36 +0800255 int seek_time;
hualing chen87072a82020-03-12 16:20:12 +0800256 DVR_Bool_t auto_pause;
hualing chen6e4bfa52020-03-13 14:37:11 +0800257 event_callback player_callback_func;
258 void *player_callback_userdata;
259 int send_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
hualing chen31140872020-03-25 12:29:26 +0800368/**\brief resume play
369 * \param[in] handle playback handle
370 * \retval DVR_SUCCESS On success
371 * \return Error code
372 */
373int dvr_playback_resume(DVR_PlaybackHandle_t handle);
hualing chenb31a6c62020-01-13 17:27:00 +0800374
375/**\brief seek
376 * \param[in] handle playback handle
hualing chen040df222020-01-17 13:35:02 +0800377 * \param[in] time_offset time offset base cur segment
hualing chenb31a6c62020-01-13 17:27:00 +0800378 * \retval DVR_SUCCESS On success
379 * \return Error code
380 */
hualing chencc91e1c2020-02-28 13:26:17 +0800381int dvr_playback_seek(DVR_PlaybackHandle_t handle, uint64_t segment_id, uint32_t time_offset);
hualing chenb31a6c62020-01-13 17:27:00 +0800382
383/**\brief Set play speed
384 * \param[in] handle playback handle
385 * \param[in] speed playback speed
386 * \retval DVR_SUCCESS On success
387 * \return Error code
388 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800389int dvr_playback_set_speed(DVR_PlaybackHandle_t handle, DVR_PlaybackSpeed_t speed);
hualing chenb31a6c62020-01-13 17:27:00 +0800390
391/**\brief Get playback status
392 * \param[in] handle playback handle
393 * \param[out] p_status playback status
394 * \retval DVR_SUCCESS On success
395 * \return Error code
396 */
hualing chen040df222020-01-17 13:35:02 +0800397int dvr_playback_get_status(DVR_PlaybackHandle_t handle, DVR_PlaybackStatus_t *p_status);
hualing chenb31a6c62020-01-13 17:27:00 +0800398
399/**\brief Get playback capabilities
400 * \param[out] p_capability playback capability
401 * \retval DVR_SUCCESS On success
402 * \return Error code
403 */
hualing chen040df222020-01-17 13:35:02 +0800404int dvr_playback_get_capabilities(DVR_PlaybackCapability_t *p_capability);
hualing chenb31a6c62020-01-13 17:27:00 +0800405
hualing chen040df222020-01-17 13:35:02 +0800406/**\brief dump segmentinfo throw print log
hualing chenb31a6c62020-01-13 17:27:00 +0800407 * \param[int] handle playback
hualing chen040df222020-01-17 13:35:02 +0800408 * \param[int] segment_id if segment_id > 0, only dump this log. else dump all segment info
hualing chenb31a6c62020-01-13 17:27:00 +0800409 * \retval DVR_SUCCESS On success
410 * \return Error code
411 */
hualing chen5cbe1a62020-02-10 16:36:36 +0800412int dvr_dump_segmentinfo(DVR_PlaybackHandle_t handle, uint64_t segment_id);
hualing chenb31a6c62020-01-13 17:27:00 +0800413
414#ifdef __cplusplus
415}
416#endif
417
418#endif /*END DVR_PLAYBACK_H_*/