1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/examples/libs/ffmpeg/lv_example_ffmpeg_2.c
_VIFEXTech a97ac7ec8e
feat(lib) add ffmpeg video and image decoder (#2805)
* add ffmpeg decoder to extra/libs

* fix(Kconfig) add ffmpeg configuration

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

* feat(example) add ffmpeg decoder example

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

* update lv_conf_template.h

* feat(example) add picture and video to ffmpeg example

* docs(libs) update FFMpeg introduction

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

* fix(ffmpeg) replace with new videos and examples

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

* fix(ffmpeg) remove the include of lv_img_cache.h

* fix(ffmpeg) add LV_ASSERT_OBJ

* Update examples/libs/ffmpeg/lv_example_ffmpeg_2.c

Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2021-11-19 08:49:39 +01:00

31 lines
842 B
C

#include "../../lv_examples.h"
#if LV_USE_FFMPEG && LV_BUILD_EXAMPLES
/**
* Open a video from a file
*/
void lv_example_ffmpeg_2(void)
{
/*birds.mp4 is downloaded from http://www.videezy.com (Free Stock Footage by Videezy!)
*https://www.videezy.com/abstract/44864-silhouettes-of-birds-over-the-sunset*/
lv_obj_t * player = lv_ffmpeg_player_create(lv_scr_act());
lv_ffmpeg_player_set_src(player, "./lvgl/examples/libs/ffmpeg/birds.mp4");
lv_ffmpeg_player_set_auto_restart(player, true);
lv_ffmpeg_player_set_cmd(player, LV_FFMPEG_PLAYER_CMD_START);
lv_obj_center(player);
}
#else
void lv_example_ffmpeg_2(void)
{
/*TODO
*fallback for online examples*/
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "FFmpeg is not installed");
lv_obj_center(label);
}
#endif