placard
      calendar
      comment
      newblog
      newmessage
      search

 

      login
      link
      info


 
 
   
 
 
VLC中网络数据流接收处理过程分析
[ 2007-11-25 19:45:00 | By: zyjzyj2000 ]
 

网络数据流接收处理分析

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、在下列函数中:

  1. 分离出access  , demux  , name字符串 ;
  2. 根据分离出的access  字符串通过module_Need函数找到acess 指针模块;
  3. 根据分离出的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_RunDecodersrc\input\input_dec.c->DecoderThread->DecoderDecode ->vout_DisplayPicture
 
 
 
Re:VLC中网络数据流接收处理过程分析
[ 2008-3-20 13:19:40 | By: ghoihjgoi(游客) ]
 
ghoihjgoi(游客)请问用的是哪个版本的代码?我这跟你的不一样,少文件,Run函数名也不同,我的是0.8.6版
 
个人主页 | 引用 | 返回 | 删除 | 回复
 
 
Re:VLC中网络数据流接收处理过程分析
[ 2007-12-15 14:39:13 | By: limlzm(游客) ]
 
limlzm(游客)我也是从事vlc的研究,不知道作者有没研究过vlc的组播?多udp流会影响vlc发送udp包的数量。access_output_udp发送的upd包会慢。
如:3台机器,发3条vlc 各发8M udp MPEGTS流,用的是组播地址。只要vlc发送udp包的间隔在0.001s内就能保证视频质量。但一去到0.01s就爆格了,而且3台机器发的流都会降到3M。网络会影响vlc发送的速度。不知道如何去解决。
 
个人主页 | 引用 | 返回 | 删除 | 回复
 
发表评论:
 
     
   
     
Powered by Oblog.