福彩3D走势图

应用方案

Linux主板多通道视频采集方案作者:黄志超    发布时间:2019-6-20    被阅览数:次

福彩3D走势图  YINGCHUANGGONGSITUICHUDEESM7100ZHUBANDAZAILEI.MX7DLCHULIQI,ZHEIKUANCHULIQISHISHUANGHECortex-A7JIAGOU,BINGQIEZHUPINDADAO1GHz,BUJINYOUZHEQIANGJINGDECHULIXINGNENG,HAIJICHENGLECortext-A7DEDIGONGHAOTEXING,FEICHANGSHIYONGYUGONGYEYINGYONG。JINYIBU,ESM7100DEHAIPEIZHIGAOSUPCIeJIEKOU,SHIQIKEMANZUGONGYESHIPINJIANKONGDUIGAOSUSHUJUCAIJIDEXUQIU。BENWENZHUYAOJIESHAOJIYUYINGCHUANGGONGSIESM7100DEDUOTONGDAOSHIPINCAIJIYINGYONGFANGAN。


  ETA6869MOKUAISHIYINGCHUANGGONGSIKAIFADEJUYOUBIAOZHUNmini PCIeCHICUN,ZUIDUONENGGOUZHICHI8TONGDAOSHIPINCAIJIMOKUAI,HEXINXINPIANWEISHIPINJIEMAXINPIANtw6869。ETA6869MOKUAITONGGUOPCIe×1JIEKOUYUESM7100XIANGLIANJIE,BAOZHENGLESHUJUDEGAOSUCHUANSHU。BIAOZHUNDEmini-PCIeCHICUNMOKUAIDESHEJI,KEYIRANGMOKUAIFANGBIANDEQIANRUZAIDIBANSHANG,RUXIA:


Linux主板多通道视频采集方案.png


  ESM7100ZHUBANYIJINGYUZHUANGLEETA6869MOKUAIDEQUDONG,SHANGDIANHOUQUDONGHUIZIDONGJIAZAI,CHENGGONGJIAZAIHOUZAI/devMULUXIAHUISHENGCHENGvideoJIEDIAN,TONGGUOCAOZUOvideoJIEDIAN,JIUNENGGOUHUOQUSHIPINSHUJU,TONGGUOlsMINGLINGJIUNENGGOUCHAKANSHEBEIJIEDIAN,RUXIATU,/dev/vidoe0WEIESM7100ZHUBANDEXIANSHISHUCHUSHEBEIJIEDIAN,XITONGXIANSHIFUWUCHENGXUHUIDIAOYONGZHEIGESHEBEIJIEDIAN,KEHUYINGDANGBIMIANZHIJIECAOZUOTA,/dev/video1~/dev/video8JIUSHISHENGCHENGDESHIPINSHURUSHEBEIJIEDIAN,FENBIEDAIBIAOSHIPINSHURUDETONGDAO1-TONGDAO8:


Linux主板多通道视频采集方案.png

video节点


  在软件开发方面,ESM7100的文件系统中已经集成了gstreamer工具,这是一种跨平台的多媒体框架工具,而整个框架是基于模块化设计的,在框架中将提供不同功能的模块插件集合起来,就能够实现所需求的多媒体应用功能。关于gstreamer的资料在官网中有非常详细的文档介绍以及例程参考,这里就不再赘述,有兴趣的客户可以查看:了解详情。通过gstreamer可以方便快捷的处理视频数据,同时ESM7100板载了Qt5.8,能够使用Qt实现界面的设计,然后与gstreamer配合,让gstreamer将视频数据输出到Qt窗口控件上,采用这种方法就能够让整个多通道视频采集方案快速实现。


  KAOLVDAOBUFENKEHUKENENGDUIgstreamerBUSHUXI,YINGCHUANGGONGSIZAIgstreamerTIGONGDEAPIHANSHUJICHUSHANGZHONGXINFENGZHUANGLEYICENG,TONGGUOKUWENJIANlibemgst.soTIGONGSANGEJIANDANDEAPIHANSHU,LIYONGZHEISANGEAPIHANSHU,KEHUJIUKEYIJIANGSHIPINSHUJUXIANSHIZAIQtSHIXIANDEJIEMIANSHANG,ERBUXUYAOSHIYONGDAIMADUIgstreamerDANDUJINXINGCAOZUO,KEHUKEYIZHUANZHUYUQtCHENGXUDEKAIFA。XIAMIANJIUXIANGXIJIESHAOlibemgst.soDESANGEAPIHANSHU:



/**

 *    初始化gstreamer

*

*    本函数在C的main函数中调用,将会初始化gstreamer库

*

*    参数说明:

*    使用main函数的两个参数填入,gstramer初始化时需要读取main函数的两个参数

*

*      返回值说明:

*    无返回值

*

 */

void init_emgst(int argc, char **argv);

 

/**

 *    配置gstreamer,并显示到指定Qt窗口

*

*    函数会配置gstreamer,显示多个通道的视频到xwinid所指定的窗口,窗口的大小通过

*    参数width和height来确定,而视频的设备节点由指针devlist传入,listsize指定同时显示

*    的通道数量

*

*    参数说明:

*  xwinid:Qt窗口的id号,每一个窗口类中都包含这个成员变量。

*    width:显示视频数据所使用的窗口控件的宽度,单位pixel

*    height:显示视频数据所使用的窗口控件的高度,单位pixel

*devlist:指向设备列表的指针,通常是一个包含设备号的数组,比如需要显示

*    /dev/video1和/dev/video2,那么devlist就应该指向一个长度为2的数组,其中

*    devlist[0]=1,devlist[1]=2

*  listsize:显示的视频通道数。支持1,2,4,6,8这五个值,函数会按照固定模式对显

*    示进行排列

*

 *    返回值说明:

*    0表示正常启动gstreamer

*  -1 表示填入参数出现错误,启动gstreamer失败

*

 */

  int config_emgst(unsignedint xwinid, int width,int height, char *devlist, int listsize);

 

/**

*    关闭gstreamer,释放资源

*

*    函数会关闭gstreamer输出,并释放相关资源

*

*    返回值说明:

*    无返回值

*

*/

void release_emgst(void);


  init_emgstHANSHUJINXINGgstreamerDECHUSHIHUA,ZAIQIDONGgstreamerGONGNENGZHIQIANXUYAODIAOYONGYICI,KEHUPEIHEQtSHIYONGSHIZAImainHANSHUZHONGDIAOYONGJIKE:



int main(intargc, char *argv[])

{

        //初始化英创主板gstreamer功能

        init_emgst(argc, argv);

                   

        //Qt窗口初始化,由QtCreator自动生成

        QApplicationa(argc, argv);

        MainWindow w;

        w.show();

 

        returna.exec();


福彩3D走势图  config_emgstHANSHUHUIPEIZHIBINGQIDONGgstreamer,KEHUZHIYAODEDAOYONGLAIXIANSHISHIPINDECHUANGKOUKONGJIANDEidJIUKEYILE,ZAIMEIYIGEQtCHUANGKOUKONGJIANLEIZHONGDOUYOUDUIYINGDECHENGYUANBIANLIANG,KEYIHENJIANDANDEHUOQUDAO。config_emgstHANSHUHUIGENJUwidthHEheightDEZHIZIDONGFENPEIXIANSHIQUYU。TONGGUOdevlistKEYISHEZHIXUYAOCAOZUODESHEBEIJIEDIANSUOYINHAO,listsizeZHIDINGTONGSHIXIANSHIDETONGDAOSHU,ZHICHIDEZHIWEI1、2、4、6、8,XIANSHIDEFANGSHIRUXIATU:


Linux主板多通道视频采集方案.png

视频数据显示排列方式


  HANSHUDIAOYONGHOUgstreamerHUIJIANGDUIYINGTONGDAOSHUDESHIPINXIANSHIZAIZHIDINGDEQtCHUANGKOUKONGJIANZHONG,MEIYIGEQUYUSUOXIANSHIDESHIPINSHUJUSHITONGGUOZHIZHENdevlistZHIDINGDE,XIAMIANSHIBUFENCANKAODAIMA,JIANGgraphicsViewKONGJIANDEidCHUANJIgstreamer,BINGXIANSHI/dev/video1DESHUJU:



MainWindow::MainWindow(QWidget *parent) :

QMainWindow(parent),

ui(new Ui::MainWindow)

{

       ui->setupUi(this);

      

  //初始化设备列表

       devlist = (char*)malloc(sizeof(char));

       devlist[0] = 1;

 

       //获取窗口控件id,并赋值给成员变量xwinid

       xwinid = ui->graphicsView->winId();

 

       //将参数传入函数中初始化gstreamer,并开始输出视频数据

       config_emgst(xwinid, 640, 480, devlist, 1);

}


福彩3D走势图  release_emgstHANSHUHUITINGZHIgstreamerSHUCHU,BINGSHIFANGZIYUAN,ZAICHENGXUTUICHUHUOZHEXUYAOQIEHUANXIANSHIDESHIHOUDIAOYONG,XIAMIANDEDAIMASHITONGGUOJIANCEQtANNIUKONGJIANDEDIANJISHIJIAN,SHIXIANQIEHUANXIANSHITONGDAOSHU:



voidMainWindow::on_channel_4_released()

{

  //初始化设备列表,填入四个通道的值

  devlist = (char *)malloc(4*sizeof(char));

  devlist[0] = 1;

  devlist[1] = 2;

  devlist[2] = 3;

  devlist[3] = 4;

 

  //关闭原来的输出并释放资源

  release_emgst();

 

  //将参数传入函数中初始化gstreamer,并开始输出视频数据

       config_emgst(xwinid, 640, 480, devlist, 4);

}


  KUWENJIANlibemgst.soYIJINGYUZHUANGZAIESM7100ZHUBANDEWENJIANXITONGZHONGLE,KEHUBUXUYAOZHENDUIZHUBANZAIZUORENHESHEZHI。ZAIKAIFACHENGXUDESHIHOU,QtGONGCHENGZHONGXUYAOJIANGYINGCHUANGGONGSITIGONGDEemgst.hTOUWENJIANHElibemgst.soKUWENJIANTIANJIAJINQU。TOUWENJIANTIANJIADEFANGFASHIFENJIANDAN,ZENGJIAYIGEXINDETOUWENJIANJIKE。GUANYUWAIBUKUDETIANJIA,QtDEKAIFAGONGJUQtCreatorTIGONGLEFEICHANGJIANBIANDEFANGFA,KEHUZHIXUYAOJIANGlibemgst.soKAOBEIDAOGONGCHENGMULUXIA,RANHOUZAIQtCreatorZHONGDEXIANGMULANYONGSHUBIAOYOUJIANDANJIGONGCHENG,XUANZETIANJIAKU(WAIBUKU),RUXIATU:


Linux主板多通道视频采集方案.png

添加库操作界面


  选择外部库后,点击下一步,按照下图设置,在库文件一栏中选择到工程下的libemgst.so文件,如下图:


Linux主板多通道视频采集方案.png

选择库文件


  福彩3D走势图这样就完成了外部库的设置,客户可以在代码中调用libemgst.so提供的API函数了。英创公司提供了一个通过按钮切换显示视频通道数的例程,效果如下:


Linux主板多通道视频采集方案.png

例程截图


  通过这种方式,英创公司希望能够帮助客户缩短开发周期,让客户可以专注于Qt程序的开发,而不用花时间去学习并在代码中设置gstreamer。对于例程感兴趣的客户可以和工程师联系,索取相关代码。

Go Top