大概跟了一下代码 里面比较只要的有五个线程 四个队列
1 video_thread 从pkt queue里面取到pkt解码然后放到frame queue里面
stream_component_open-->
SDL_CreateThread-->
video_thread-->
get_video_frame-->
decoder_decode_frame
packet_queue_get is->videoq-->
avcodec_send_packet
avcodec_receive_frame
queue_picture
frame_queue_push(&is->pictq)
2 audio_thread 从pkt queue里面取到pkt解码然后放到frame queue里面
audio_thread-->
decoder_decode_frame
packet_queue_get is->audioq -->
avcodec_send_packet
avcodec_receive_frame
frame_queue_push(&is->sampq)
3 把文件或者流里面的pkt放到pkt queue
stream_open-->
SDL_CreateThread
read_thread
av_read_frame
packet_queue_put is->videoq
packet_queue_put is->audioq
4 显示线程 从frame queue里面取到图像显示
event_loop-->
refresh_loop_wait_event-->
video_refresh
frame_queue_peek (&is->pictq)
video_display
5 由sdl设备调用 frame queue 里面的声音数据 is->audio_buf
sdl_audio_callback --> //the function to call when the audio device needs more data
audio_decode_frame
frame_queue_next &is->sampq is->audio_buf