当前位置: 首页>>代码示例>>C++>>正文


C++ Globals::setStream方法代码示例

本文整理汇总了C++中Globals::setStream方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::setStream方法的具体用法?C++ Globals::setStream怎么用?C++ Globals::setStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::setStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main( int ac, char** av )
{
    ControllerPi* controller = nullptr;
    Stream* stream = nullptr;
    Link* controller_link = nullptr;
    Link* stream_link = nullptr;

    if ( ac <= 1 ) {
        gDebug() << "FATAL ERROR : No config file specified !\n";
        return -1;
    }

    bcm_host_init();
    signal( SIGSEGV, segv_handler );

    Instance* instance = Instance::Create( "flight::control", 1, true, "framebuffer" );
    Font* font = new Font( "data/FreeMonoBold.ttf", 28 );
    Font* font_hud = new Font( "data/RobotoCondensed-Bold.ttf", 28, 0xFF000000 );

    Config* config = new Config( av[1] );
    config->Reload();

    Globals* globals = new Globals( instance, font );

    if ( config->string( "controller.link.link_type" ) == "Socket" ) {
        controller_link = new ::Socket( config->string( "controller.link.address", "192.168.32.1" ), config->integer( "controller.link.port", 2020 ) );
    } else if ( config->string( "controller.link.link_type" ) == "RawWifi" ) {
        controller_link = new RawWifi( config->string( "controller.link.device", "wlan0" ), config->integer( "controller.link.output_port", 0 ), config->integer( "controller.link.input_port", 1 ) );
    }

    if ( config->string( "stream.link.link_type" ) == "Socket" ) {
        stream_link = new ::Socket( config->string( "stream.link.address", "192.168.32.1" ), config->integer( "stream.link.port", 2020 ) );
    } else if ( config->string( "stream.link.link_type" ) == "RawWifi" ) {
        stream_link = new RawWifi( config->string( "stream.link.device", "wlan0" ), config->integer( "stream.link.output_port", 10 ), config->integer( "stream.link.input_port", 11 ) );
        dynamic_cast< RawWifi* >( stream_link )->setBlocking( config->boolean( "stream.link.blocking", true ) );
        dynamic_cast< RawWifi* >( stream_link )->setCECMode( config->string( "stream.link.cec_mode", "none" ) );
    }

    if ( controller_link ) {
        controller = new ControllerPi( controller_link );
    }
    if ( stream_link ) {
        stream = new Stream( controller, font_hud, stream_link, config->integer( "stream.width", 1920 ), config->integer( "stream.height", 1080 ), config->boolean( "stream.stereo", true ) );
        stream->setStereo( config->boolean( "stream.stereo", true ) );
        stream->setRenderHUD( config->boolean( "stream.hud", true ) );
    }

    globals->setStream( stream );
    globals->setController( controller );

    if ( config->boolean( "touchscreen.enabled", true ) ) {
        globals->setCurrentPage( "PageMain" );
        globals->Run();
    } else {
        while ( 1 ) {
            usleep( 1000 * 1000 );
        }
    }

    gDebug() << "Exiting\n";
    globals->instance()->Exit( 0 );

    return 0;
}
开发者ID:dridri,项目名称:bcflight,代码行数:64,代码来源:main.cpp


注:本文中的Globals::setStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。