📄 video_dec_glb.h
字号:
MP4_Parser_Status PARSE_STATUS;
} VIDEO_DEC_STATUS_STRUCT;
/*Input struct: Start*/
typedef struct
{
STMp4Parser *pstMp4Parser;
STFSAL *pstFSAL;
kal_uint32 start_frame_no;
void (*video_dec_callback)(kal_uint8 event);
kal_uint16 max_width;
kal_uint16 max_height;
kal_bool incall;
kal_bool audio_enable;
} MP4DEC_COMM_INIT_STRUCT;
/*Input struct: for function input ==END*/
///////////////////////////////////////////////////////////////////////////////////
// upper layer interface definition //
///////////////////////////////////////////////////////////////////////////////////
/* Video Event for upper layer */
typedef enum
{
// Buffer empty event, upper layer should fill up the buffer
VIDEO_DEC_EVENT_BUFFER_EMPTY = 0,
// Decode complete event
VIDEO_DEC_EVENT_COMPLETE,
// Partial Seek ready event, because long file seek
VIDEO_DEC_EVENT_SEEK_PARTIAL_DONE,
// Seek ready event
VIDEO_DEC_EVENT_SEEK_DONE,
// No Video track event
VIDEO_DEC_EVENT_NO_TRACK,
// Someting wrong in video driver, upper layer should call function
// to obtain error casue.
VIDEO_DEC_EVENT_FAIL,
// MCU is too busy to run this video.
// When upper layer receive this event, call video_dec_recover to pause/resume/recover this video.
VIDEO_DEC_RECOVER,
// audio complete event for seek
VIDEO_DEC_SEEK_AUDIO_EVENT_COMPLETE,
// video seek handler.
VIDEO_DEC_DRV_SEEK_ACTION,
// Total Events
VIDEO_DEC_MAX_EVENT
}VIDEO_DEC_EVENT;
/*Input struct: Start*/
typedef struct
{
STMp4Parser *pstMp4Parser;
STFSAL *pstFSAL;
kal_uint32 start_frame_no;
void (*video_dec_callback)(kal_uint8 event);
} MP4DEC_INIT_STRUCT;
typedef struct
{
STMp4Parser *pstMp4Parser;
STFSAL *pstFSAL;
void (*video_dec_callback)(kal_uint8 event);
kal_uint16 max_width;
kal_uint16 max_height;
kal_bool audio_enable;
} MP4DEC_CLIP_INIT_STRUCT;
typedef struct
{
kal_uint32 disp_width;
kal_uint32 disp_height;
kal_uint32 lcd_buf_addr;
kal_uint8 contrast_level; /* IPP contrast gain level */
kal_uint8 brightness_level; /* IPP brightness level */
#if ( (!defined(MT6219)) && (!defined(MT6226)) && (!defined(MT6227)) && (!defined(MT6226M)) )
/*MT6228, MT6229, MT6230*/
kal_bool image_pitch_mode; /* KAL_TRUE or KAL_FALSE for block mode of decoded image */
kal_uint8 image_data_format; /* IMGDMA_IBW_OUTPUT_RGB565 or IMGDMA_IBW_OUTPUT_RGB888 */
kal_uint16 image_pitch_bytes; /* pitch width */
kal_bool tv_output;
#endif
} MP4DEC_MEMMODE_STRUCT;
/*Input struct: for function input ==END*/
typedef struct
{
lcd_frame_update_struct *lcd_data;
kal_uint32 lcd_buf_addr;
kal_uint16 disp_width;
kal_uint16 disp_height;
kal_uint16 video_display_offset_x;
kal_uint16 video_display_offset_y;
kal_uint8 contrast_level; /* IPP contrast gain level */
kal_uint8 brightness_level; /* IPP brightness level */
kal_bool force_lcd_hw_trigger;
#if ( (!defined(MT6219)) && (!defined(MT6226)) && (!defined(MT6227)) && (!defined(MT6226M)) )
/*MT6228, MT6229, MT6230*/
kal_bool image_pitch_mode; /* KAL_TRUE or KAL_FALSE for block mode of decoded image */
kal_uint8 image_data_format; /* IMGDMA_IBW_OUTPUT_RGB565 or IMGDMA_IBW_OUTPUT_RGB888 */
kal_uint16 image_pitch_bytes; /* pitch width */
kal_bool tv_output;
kal_uint32 tv_output_frame_buffer1_address;
kal_uint32 tv_output_frame_buffer2_address;
kal_uint32 tv_output_frame_buffer_size;
#endif
} MP4DEC_IMGPATH_STRUCT;
/// Maximum VIDEO GPT re-flash time, Unit: ms
///
extern kal_uint16 VIDEO_MAX_GPT_REFRESH_TIME;
///////////////////////////////////////////////////////////////////////////////////
// Internal functions //
///////////////////////////////////////////////////////////////////////////////////
/* Start refresh function.
* @param None
* @return None
*/
extern void video_dec_start_refresh(void);
/* Stop refresh function.
* @param None
* @return None
*/
extern void video_dec_stop_refresh(void);
/* Check whether it needs to be refresh. If yes, it will refresh automatically in this function
* @param None
* @return None
*/
extern void video_dec_check_refresh(kal_uint32 frame_time);
/* This function initialize the video decode module.
* @param init_input MP4DEC_INIT_STRUCT
* @param max_width maximum width that application wishes ti support
* @param max_height maximum height that application wishes ti support
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_decoder_initialize(MP4DEC_INIT_STRUCT * init_input, kal_uint32 max_width, kal_uint32 max_height);
/* Open the video decode process.
* When call "video_dec_initialize" API, this function is also called.
* @param pstMp4Parser The handle of mp4 parser
* @param pstFSAL The handle of file abstract layer
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_open(STMp4Parser * pstMp4Parser, STFSAL * pstFSAL, kal_uint32 max_width, kal_uint32 max_height);
/* Initialize the video decode av process
* When call "video_dec_initialize" API, this function is also called.
* @param b_audio_enable enable audio or not
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_init_av(kal_bool b_audio_enable);
/* Decode process is done. Notify upper layer and refresh when needed.
* @param frame_no the frame that should be seek
* @param callback video callback function when driver want to notify MED or upper layer.
* @param seek_from_current_frame_mode. application can decide whether to seek from current frame or not
* @return None
*/
extern MEDIA_STATUS_CODE video_dec_seek_by_frame(kal_uint32 frame_no, void (*callback)(kal_uint8 event),
kal_bool seek_from_current_frame_mode);
/* Decode process is done. Notify upper layer and refresh when needed.
* @param None
* @return None
*/
extern void video_dec_complete(void);
/* Set stop frame
* @param disp_width video display width in LCD
* @param disp_height video LCD display height in LCD.
* @return None.
*
*/
extern void video_dec_set_stop_frame(kal_uint32 frame_number);
///////////////////////////////////////////////////////////////////////////////////
// upper layer interface functions //
///////////////////////////////////////////////////////////////////////////////////
/* Open the image path(Resizer+LCD+ImageDMA+ImgProc), then this path will be conrolled by driver.
* @param data_input MP4DEC_IMGPATH_STRUCT parameter should be prepared by MMI
* @return None.
*/
extern void video_image_path_open(MP4DEC_IMGPATH_STRUCT * data_input);
/* Close the image path(Resizer+LCD+ImageDMA+ImgProc)
* @param None
* @return None.
*/
extern void video_image_path_close(void);
/* Display the current frame that is decoded done.
* @param None
* @return None
*/
extern void video_dec_display(void);
/* Display the previous frame.
* @param None
* @return None
*/
extern void video_dec_prev_display(void);
/* Open the image path(Resizer+ImageDMA+ImgProc), then this path will be conrolled by MED/MMI.
* @param data_input MP4DEC_MEMMODE_STRUCT be prepared by MMI
* @return None.
*/
extern void video_memorymode_open(MP4DEC_MEMMODE_STRUCT * data_input);
/* Close the image data path
* @param None
* @return None.
*/
extern void video_memorymode_close(void);
/* This function should be called after video_swmode_open is called.
* This function will copy the last decoded frame to another memory buffer.
* @param None
* @return None.
*/
extern void video_dec_frame_to_memory(void);
/* This function is used to obtain the play time according to frame number
* @param frame frame number
* @param time time ptr. (Unit: ms)
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_frame2time(kal_uint32 frame, kal_uint32 * time);
/* This function is used to obtain the frame number according to the play time.
* @param time play time(Unit: ms)
* @param frame Frame number.
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_time2frame(kal_uint32 time, kal_uint32 * frame);
/*This function is for snapshot scenario when video play
* @param memory_addr resizer working memory addr;
* @return NULL
*/
extern void video_dec_set_snapshot_resize_mem(kal_uint32 memory_addr);
/* This function is for snapshot scenario when video play
* @param None
* @return resizer working memory addr;
*/
extern kal_uint32 video_dec_get_snapshot_resize_mem(void);
/* This function is for snapshot scenario when video play
* @param memory_addr imgdma working memory addr;
* @return NULL
*/
extern void video_dec_set_snapshot_imgdma_mem(kal_uint32 memory_addr);
/* This function is for snapshot scenario when video play
* @param None
* @return imgdma working memory addr;
*/
extern kal_uint32 video_dec_get_snapshot_imgdma_mem(void);
/* This function can set different speed for video
* final play speed = normal play speed * (play_speed/100)
* @param play_speed play speed ratio.
* @return NULL
*/
extern void video_dec_set_play_speed(kal_uint16 play_speed);
/* Get total video frames
* @param None
* @return total video frames
*/
extern kal_uint32 video_dec_get_total_frame(void);
/* Get the last decoded frame number.
* @param None
* @return the last decoded frame number.
*/
extern kal_uint32 video_dec_get_current_frame_no(void);
/* Get current total play time in video
* @param total_play_time obtain the current total play time. (Unit: ms)
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_get_total_play_time(kal_uint64 * total_play_time);
/* This function will obtain audio and video total duration.
* @param audio_time audio total duration
* @param video_time video total duration.
* @return None
*/
extern void video_dec_get_total_time(kal_uint64 * audio_time, kal_uint64 * video_time);
/* Get current play time
* @param current_time current play time(Unit: ms)
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_get_play_time(kal_uint64 * current_time);
/* This function can obtain the total duration from 1 to frame_no-1.
* @param frame_no frame number.
* @param decode_time the decode time
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE Video_GetDecodeTime(kal_uint32 frame_no, kal_uint64 * decode_time);
/* This function is used to set the stop frame that video will auto-stop at this frame.
* @param play_stop_time stop time, (unit: ms)
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_set_stop_time(kal_uint32 play_stop_time);
/* This function can obtain the original frame widht/height.
* @param width original video frame width
* @param height original video frame height
* @return None
*/
extern void video_dec_get_frame_size(kal_uint16 * width, kal_uint16 * height);
/* This function is enable LCD display or not, when video decode.
* @param enable enable or not
* @return None
*/
extern void video_dec_set_display(kal_bool enable);
/* This function is get whether current video file is finised or not
* @param None
* @return finished status
*/
extern kal_bool video_dec_is_play_finished(void);
/* This function initialize the video decode module.
* @init_input MP4DEC_INIT_STRUCT prepared by upper layer
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_initialize(MP4DEC_INIT_STRUCT * init_input);
/* This function will open the video clip decode initialize
* @param clip_input MP4DEC_CLIP_INIT_STRUCT prepared by upper layer
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_clip_initialize(MP4DEC_CLIP_INIT_STRUCT * clip_input);
/* This function should be called after video_dec_seek.
* This function can play video sequently.
* @param audio_frame_no The related audio frame that related to seek video frame.
* @param video_dec_callback video callback function when driver want to notify MED or upper layer.
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_play(kal_uint32 * audio_frame_no, void (*video_dec_callback)(kal_uint8 event));
/* This function should be called after video_dec_clip_initialize.
* This function can play video clip sequently.
* @param audio_frame_no The related audio frame that related to seek video frame. If audio is not enable, don't care "audio_frame_no" parameter!!
* @param video_dec_callback video callback function when driver want to notify MED or upper layer.
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_clip_play(kal_uint32 * audio_frame_no, void (*video_dec_callback)(kal_uint8 event));
/* This function can recover when error happens
* @param audio_frame_no the related audio frame that is related recovered video frame number.
* @param callback video callback function when driver want to notify MED or upper layer.
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_recover(kal_uint32 * audio_frame_no, void (*callback)(kal_uint8 event));
/* This function will seek to the request frame time.
* @param seek_time seek time
* @param callback it is callback function when video driver want to notify upper layer.
* @return Media status, which is based MEDIA_STATUS_CODE structure.
*/
extern MEDIA_STATUS_CODE video_dec_seek(kal_uint64 seek_time, void (*callback)(kal_uint8 event));
/* Seek action during seek procedure
* This function is to replace the HISR action.
* @param None
* @return None
*/
extern void video_seek_action(void);
/* This function stop the video driver, but not release the resource.
* @param None
* @return None
*/
extern void video_dec_stop(void);
/* Close the video decode process.
* @param None
* @return None
*/
extern void video_dec_close(void);
#endif /*VIDEO_DEC_GLB_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -