1 /**
2  * @file lv_ffmpeg.h
3  *
4  */
5 #ifndef LV_FFMPEG_H
6 #define LV_FFMPEG_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /*********************
13  *      INCLUDES
14  *********************/
15 #include "../../lv_conf_internal.h"
16 #if LV_USE_FFMPEG != 0
17 #include "../../misc/lv_types.h"
18 
19 /*********************
20  *      DEFINES
21  *********************/
22 
23 /**********************
24  *      TYPEDEFS
25  **********************/
26 struct ffmpeg_context_s;
27 
28 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_ffmpeg_player_class;
29 
30 typedef enum {
31     LV_FFMPEG_PLAYER_CMD_START,
32     LV_FFMPEG_PLAYER_CMD_STOP,
33     LV_FFMPEG_PLAYER_CMD_PAUSE,
34     LV_FFMPEG_PLAYER_CMD_RESUME,
35     LV_FFMPEG_PLAYER_CMD_LAST
36 } lv_ffmpeg_player_cmd_t;
37 
38 /**********************
39  * GLOBAL PROTOTYPES
40  **********************/
41 
42 /**
43  * Register FFMPEG image decoder
44  */
45 void lv_ffmpeg_init(void);
46 
47 /**
48  * Get the number of frames contained in the file
49  * @param path image or video file name
50  * @return Number of frames, less than 0 means failed
51  */
52 int lv_ffmpeg_get_frame_num(const char * path);
53 
54 /**
55  * Create ffmpeg_player object
56  * @param parent pointer to an object, it will be the parent of the new player
57  * @return pointer to the created ffmpeg_player
58  */
59 lv_obj_t * lv_ffmpeg_player_create(lv_obj_t * parent);
60 
61 /**
62  * Set the path of the file to be played.
63  * @param obj pointer to a ffmpeg_player object
64  * @param path video file path
65  * @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't get the info.
66  */
67 lv_result_t lv_ffmpeg_player_set_src(lv_obj_t * obj, const char * path);
68 
69 /**
70  * Set command control video player
71  * @param obj pointer to a ffmpeg_player object
72  * @param cmd control commands
73  */
74 void lv_ffmpeg_player_set_cmd(lv_obj_t * obj, lv_ffmpeg_player_cmd_t cmd);
75 
76 /**
77  * Set the video to automatically replay
78  * @param obj pointer to a ffmpeg_player object
79  * @param en true: enable the auto restart
80  */
81 void lv_ffmpeg_player_set_auto_restart(lv_obj_t * obj, bool en);
82 
83 /*=====================
84  * Other functions
85  *====================*/
86 
87 /**********************
88  *      MACROS
89  **********************/
90 
91 #endif /*LV_USE_FFMPEG*/
92 
93 #ifdef __cplusplus
94 } /*extern "C"*/
95 #endif
96 
97 #endif /*LV_FFMPEG_H*/
98