rsked/vlcplayer.cc
/// If needed, start the child process and verify it is responsive.
/// On success, it will return with m_usable set to true.
/// The player will begin in stopped, with an empty play list.
///
/// * May throw a Player_exception or CM_exception.
///
If needed, start the child process and verify it is responsive.
On success, it will return with m_usable set to true.
The player will begin in stopped, with an empty play list.


If needed start the child process and verify it is responsive . On success it will return with m_usable set to true . The player will begin in stopped with an empty play list .
void Vlc_player::try_start()
{
    constexpr const unsigned MAX_RETRIES=3;
    constexpr const long VLC_WAIT_USEC = 1'000'000;
    if (not m_cm->running()) {
        LOG_INFO(Lgr) << "Launching VLC child process";
        m_cm->set_name("vlc");
        set_pty_timeout();
        m_cm->set_wdir( m_library_path ); 
        m_cm->clear_args();
        m_cm->add_arg( "-Icli" );  command line interface
        m_cm->add_arg( "--no-playlist-autostart" );  don't autostart
        m_cm->start_child();       may throw
    }
     VLC is nominally running if we get here. Attempt a status check.
    for (unsigned i=1; i<=MAX_RETRIES; i++) {
        really_sleep( VLC_WAIT_USEC );   give it time to fire up
        if (CmdRes::completed == do_status()) {      success
            m_usable = true;
            LOG_INFO(Lgr) << "VLC running ";
            set_volume();
            stop();
            return;
        }
    }
    mark_unusable();
    throw Player_startup_exception();
}
void Vlc_player :: try_start ( ) { constexpr const unsigned MAX_RETRIES = 3 ; constexpr const long VLC_WAIT_USEC = 1'000'000 ; if ( not m_cm -> running ( ) ) { LOG_INFO ( Lgr ) << " " ; m_cm -> set_name ( " " ) ; set_pty_timeout ( ) ; m_cm -> set_wdir ( m_library_path ) ; m_cm -> clear_args ( ) ; m_cm -> add_arg ( " " ) ; m_cm -> add_arg ( " " ) ; m_cm -> start_child ( ) ; } for ( unsigned i = 1 ; i <= MAX_RETRIES ; i ++ ) { really_sleep ( VLC_WAIT_USEC ) ; if ( CmdRes :: completed == do_status ( ) ) { m_usable = true ; LOG_INFO ( Lgr ) << " " ; set_volume ( ) ; stop ( ) ; return ; } } mark_unusable ( ) ; throw Player_startup_exception ( ) ; }
If needed, start the child process and verify it is responsive.
If needed start the child process and verify it is responsive .
// We run VLC as a child: start it now. // relative paths of music files // // command line interface // don't autostart // may throw // VLC is nominally running if we get here. Attempt a status check. // give it time to fire up // success