标签:解码 for file track style code stat format read
本节主要介绍音视频读取和解码线程的创建及启动,代码流程例如以下:
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); } } } } } }
ijkplayer阅读笔记02-创建音视频读取,解码,播放线程
标签:解码 for file track style code stat format read
原文地址:http://www.cnblogs.com/llguanli/p/7239927.html