Player Example#
Overview#
This sample demonstrates the K230 player module, which is a higher-level wrapper for synchronized audio and video playback.
Functional Description#
Player Functions#
video playback
audio playback
audio/video synchronization
connector-based output selection
Supported Formats#
Supported formats in this sample include:
container format: MP4
codecs: H.264, H.265, G711, OPUS, and related supported paths
Main APIs#
kd_player_init()kd_player_deinit()kd_player_start()kd_player_stop()kd_player_pause()kd_player_resume()kd_player_register_event_cb()
Player Events#
Event |
Description |
|---|---|
|
end of playback |
|
playback error |
Source Location#
src/rtsmart/examples/mpp/sample_player
Usage#
Build Method#
Enable the player sample in make menuconfig, then rebuild the firmware.
Run Example#
./sample_player.elf <file_path> <connect_type>
Parameter Description#
file_path: media file pathconnect_type: connector type such as20for LCD or101for HDMI
Expected Result#
The player initializes the media subsystem, opens the file, parses audio and video streams, starts playback, reports progress and events, and exits after playback finishes.
Representative output:
./sample_player.elf ./test_800x480.mp4 20
file pathname:./test_800x480.mp4
connector type:20
video track info:type:96,track_id:1,width:800,height:480
input_pool_id 0
output_pool_id 1
VDEC: pool_id 1, frame_buf_pool_id 1
sample_vo_init>vo init width 800 height 480
sample_vo_init: layer_id 1, width 800, height 480, pixel_format 31, func 2,buf_nr:3
VDEC: first pts 5940, frame_interval 0
VDEC: first pts 5940, frame_interval 12060
kd_mp4_get_frame: demuxer has finished.
demuxer finished.
5941 pictures decoded. Average FrameRate = 99 Fps
vpu report fps 99
disp_play>ch 0, receive eos
vpu_exit>q_wm 16
Tip
The player module is built on K230 MPP and codec components, and provides a simpler interface than direct MPI usage. For API details, refer to Multimedia Middleware API.
