zoukankan      html  css  js  c++  java
  • ijkplayer阅读笔记02-创建音视频读取,解码,播放线程

    本节主要介绍音视频读取和解码线程的创建及启动,代码流程例如以下:

    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);  
                   }
                }
            }
         }
       }
    }
    
    



  • 相关阅读:
    python-excel操作
    python-处理文件
    python-pandas应用总结
    python比较数组
    vue学习一(指令1.v-text,v-html,插值表达式{{msg}})
    博客园背景图页面定制css
    SpringBoot的yml文件报org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here in 'reader', line 11, column 16:
    python初学习一
    C#多线程
    API与WebApi
  • 原文地址:https://www.cnblogs.com/llguanli/p/7239927.html
Copyright © 2011-2022 走看看