ijkplayer阅读笔记02
1.在这一章主要介绍音视频解码和显示线程的创建和启动,直接贴代码如下:
IjkMediaPlayer_prepareAsync{
ijkmp_prepare_async_l{
ijkmp_change_state_l(mp, MP_STATE_ASYNC_PREPARING);
msg_queue_start(&mp->ffplayer->msg_queue);
SDL_CreateThreadEx(&mp->_msg_thread, mp->msg_loop, mp, "ff_msg_loop");
ffp_prepare_async_l(mp->ffplayer, mp->data_source);
stream_open{
frame_queue_init(&is->pictq, &is->videoq, ffp->pictq_size, 1)
frame_queue_init(&is->sampq, &is->audioq, SAMPLE_QUEUE_SIZE, 1)
packet_queue_init(&is->videoq);
packet_queue_init(&is->audioq);
SDL_CreateThreadEx(&is->_video_refresh_tid, video_refresh_thread, ffp, "ff_vout")
SDL_CreateThreadEx(&is->_read_tid, read_thread, ffp, "ff_read"){
read_thread {
stream_component_open(ffp, st_index[AVMEDIA_TYPE_AUDIO]);{
SDL_CreateThreadEx(&is->_audio_tid, audio_thread, ffp, "ff_audio_dec");
}
stream_component_open(ffp, st_index[AVMEDIA_TYPE_VIDEO]);{
ffp->node_vdec = ffpipeline_open_video_decoder(ffp->pipeline, ffp);
SDL_CreateThreadEx(&is->_video_tid, video_thread, ffp, "ff_video_dec");
}
for (;;) {
if (is->seek_req) {
avformat_seek_file();
}
ret = av_read_frame(ic, pkt);
packet_queue_put(&is->audioq, pkt); or packet_queue_put(&is->videoq, pkt);
}
}
}
}
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/peckjerry/article/details/47664151