100 lines
2.3 KiB
C
100 lines
2.3 KiB
C
|
||
// e_player_list.h
|
||
#ifndef E_PLAYER_LIST_H
|
||
#define E_PLAYER_LIST_H
|
||
|
||
#include <stdint.h>
|
||
#include <stdbool.h>
|
||
#include <pthread.h>
|
||
#include "common/qua_sys_platform.h"
|
||
#include "system/qua_mm_system.h"
|
||
#include "player/qua_vppo_inf.h"
|
||
#include "player/qua_decoder_inf.h"
|
||
#include "player/qua_mm_player_common.h"
|
||
#include "../lvgl/lvgl.h"
|
||
#include "e_common.h"
|
||
|
||
#define MAX_PLAYLIST_ITEMS 50
|
||
|
||
|
||
|
||
typedef struct
|
||
{
|
||
|
||
int display_idx;
|
||
char display[14];
|
||
QUA_VOID *player;
|
||
|
||
e_player_area area; // 播放器位置
|
||
|
||
// 播放列表
|
||
// MediaItem media_list[MAX_PLAYLIST_ITEMS];
|
||
//MediaPath media_paths[MAX_PLAYLIST_ITEMS];
|
||
MediaPath **media_paths;
|
||
|
||
int media_count;
|
||
int current_index;
|
||
pthread_mutex_t playlist_mutex;
|
||
|
||
// 线程控制
|
||
pthread_t player_thread;
|
||
bool thread_running;
|
||
bool stop_requested;
|
||
bool first_play;// 是否是第一次播放(调用video_player_clear_playlist后)
|
||
|
||
// 同步播放新增字段
|
||
long long video_duration_ms; // 当前视频总时长(ms)
|
||
long long last_play_time_ms; // 视频上次播放时间(ms)
|
||
//long long actual_play_ms; // 实际播放耗时(ms)
|
||
|
||
// 新增条件变量和互斥锁
|
||
pthread_cond_t play_cond;
|
||
pthread_mutex_t play_mutex;
|
||
|
||
} VideoPlayer;
|
||
|
||
/**
|
||
* 初始化显示容器
|
||
*/
|
||
VideoPlayer *video_player_init(int display_idx);
|
||
//设置是否开启同步播放
|
||
void video_player_set_sync_play(bool sync);
|
||
|
||
/**
|
||
*设置播放器 位置及大小
|
||
*/
|
||
void video_player_set_size(VideoPlayer *video_player, e_player_area area);
|
||
|
||
void video_player_set_hole(VideoPlayer *video_player);
|
||
|
||
/**
|
||
* 播放列表添加元素
|
||
*/
|
||
void video_player_add_item(VideoPlayer *video_player, const MediaPath *local_path);
|
||
void video_player_clear_playlist(VideoPlayer *player);
|
||
|
||
|
||
/**
|
||
* 开启双缓冲。播放当前视频,直到调用video_player_add_mediaItem添加新元素时,清空历史播放列表
|
||
*/
|
||
void video_player_set_double_buffer(VideoPlayer *video_player);
|
||
/**
|
||
* 开始播放
|
||
*/
|
||
int video_player_play(VideoPlayer *player);
|
||
void video_player_next(VideoPlayer *player);
|
||
/**
|
||
* 临时 隐藏播放器
|
||
*/
|
||
void video_player_close(VideoPlayer *video_player);
|
||
/**
|
||
* 销毁播放器
|
||
*/
|
||
void video_player_destroy(VideoPlayer *video_player);
|
||
|
||
/*
|
||
* 检查播放器是否正常
|
||
*/
|
||
void video_check_play_state(VideoPlayer *player);
|
||
|
||
#endif // E_PLAYER_LIST_H
|