zoukankan      html  css  js  c++  java
  • vlc学习计划(6)网络数据流接收处理过程分析

    网络数据流接收处理分析
    1、在input.c(src\input)文件中的主线程循环
          Thread in charge of processing the network packets and demultiplexing
    RunThread( input_thread_t *p_input )
    {
              InitThread( p_input ) ;
    …………………………………………………….
         input_SelectES( p_input, p_input->stream.p_newly_selected_es );
                  …………………………………………………….
          /* Read and demultiplex some data. */
         i_count = p_input->pf_demux( p_input );
     
    }
    2、在下列函数中:
    分离出access  , demux  , name字符串 ; 
    根据分离出的access  字符串通过module_Need函数找到acess 指针模块; 
    根据分离出的demux  字符串通过module_Need函数找到demux  指针模块;
     static int InitThread( input_thread_t * p_input )
    {
         msg_Dbg( p_input, "access `%s', demux `%s', name `%s'",
                 p_input->psz_access, p_input->psz_demux, p_input->psz_name );
     
        /* Find and open appropriate access module */
        p_input->p_access = module_Need( p_input, "access",
                                         p_input->psz_access, VLC_TRUE );
     …………………………………………………….
      while( !input_FillBuffer( p_input ) )
      …………………………………………………….
        /* Find and open appropriate demux module */
        p_input->p_demux =
            module_Need( p_input, "demux",
                         (p_input->psz_demux && *p_input->psz_demux) ?
                         p_input->psz_demux : "$demux",
                         (p_input->psz_demux && *p_input->psz_demux) ?
                         VLC_TRUE : VLC_FALSE );
    …………………………………………………….
    }
    3、在ps.c (module\demux\mpeg)文件中
    a.通过消息映射宏赋值启动函数Activate;
    b.通过函数Activate赋值p_input->pf_demux = Demux;
    c. 通过函数module_Need( p_input, "mpeg-system", NULL, 0 ) 激活p_input->p_demux_data->mpeg.pf_read_ps( p_input, &p_data )函数(pf_read_ps);
    d.在InitThread函数中激活;
     
            static int Activate( vlc_object_t * p_this )
    {
          /* Set the demux function */
    p_input->pf_demux = Demux;
    p_input->p_private = (void*)&p_demux->mpeg;
        p_demux->p_module = module_Need( p_input, "mpeg-system", NULL, 0 );
    }
    4、在system.c (module\demux\mpeg)文件中
             赋值解码模块mpeg_demux_t的成员函数;
         static int Activate ( vlc_object_t *p_this )
    {
        static mpeg_demux_t mpeg_demux =
                        { NULL, ReadPS, ParsePS, DemuxPS, ReadTS, DemuxTS };
        mpeg_demux.cur_scr_time = -1;
        memcpy( p_this->p_private, &mpeg_demux, sizeof( mpeg_demux ) );
     
        return VLC_SUCCESS;
    }
    并且申明函数static ssize_t ReadPS( input_thread_t * p_input, data_packet_t ** pp_data );
     
    5、在ps.c (module\demux\mpeg)文件中
    Demux( input_thread_t * p_input )
    {
    i_result = p_input->p_demux_data->mpeg.pf_read_ps( p_input, &p_data );
          p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
    }
    进行读取数据和分离工作;
    6、在system.c (module\demux\mpeg)文件中
    数据走向图如下
    ReadPS-> PEEK-> input_Peek(src\input\input_ext-plugins.c)-> input_FillBuffert 通过 i_ret = p_input->pf_read( p_input,
                                  (byte_t *)p_buf + sizeof(data_buffer_t)
                                   + i_remains,
                                  p_input->i_bufsize );
    input_thread_t结构的pf_read函数成员如果是为udp.c(modules\access)的RTPChoose函数
    则在开启access(UDP 模块)时通过module_need 激活;
     激活网络读数据模块 RTPChoose(modules\access\ udp.c)->Read->net_Read(src\misc\net.c);
     
    7、在input_programs.c(src\input)文件中
             运行解码器对ES流解码
       int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
    {
          p_es->p_dec = input_RunDecoder( p_input, p_es );
       
    }
     input_SelectES(src\input\input_programs.c)->input_RunDecoder(src\input\input_dec.c)->DecoderThread->DecoderDecode ->vout_DisplayPicture 
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jsphuang/archive/2005/02/17/291346.aspx
  • 相关阅读:
    归并排序(Merge Sort)
    AtCoder AGC035D Add and Remove (状压DP)
    AtCoder AGC034D Manhattan Max Matching (费用流)
    AtCoder AGC033F Adding Edges (图论)
    AtCoder AGC031F Walk on Graph (图论、数论)
    AtCoder AGC031E Snuke the Phantom Thief (费用流)
    AtCoder AGC029F Construction of a Tree (二分图匹配)
    AtCoder AGC029E Wandering TKHS
    AtCoder AGC039F Min Product Sum (容斥原理、组合计数、DP)
    AtCoder AGC035E Develop (DP、图论、计数)
  • 原文地址:https://www.cnblogs.com/qq78292959/p/2077029.html
Copyright © 2011-2022 走看看