rsked/oggplayer.cc
/// Play the given slot (if you can). Calling with src==nullptr stops
/// the player and resets the source member m_src.
/// Support for ogg streams is conjectural at this point.
///
/// * May throw Player_exceptions
///
Play the given slot (if you can). Calling with src==nullptr stops
the player and resets the source member m_src.
Support for ogg streams is conjectural at this point.


Play the given slot ( if you can ) . Calling with src == nullptr stops the player and resets the source member m_src . Support for ogg streams is conjectural at this point .
void Ogg_player::play( spSource src )
{
    if (!src) {
        m_src = src;
        stop();  
        return;
    }
    if (not has_cap(src->medium(),src->encoding())) {
        LOG_ERROR(Lgr) << m_name << "cannot play type of source in" << src->name();
        throw Player_media_exception();
    }
    m_src = src;
    LOG_INFO(Lgr) << m_name << " play: {" << m_src->name() << "}";
    m_cm->clear_args();
    m_cm->add_arg( "-q" );  
    if (not m_device_type.empty()) {
        m_cm->add_arg( "-d" );
        m_cm->add_arg( m_device_type );
    }
    if (m_src->repeatp()) {
        m_cm->add_arg( "--repeat" );  
        LOG_INFO(Lgr) << m_name << " will repeat the program for entire period";
    }
    if (m_src->medium()==Medium::playlist) {
        m_cm->add_arg("--list");      
    }
    if (m_src->medium()==Medium::stream) {
        m_cm->add_arg( m_src->resource().c_str() );
    } else {
        boost::filesystem::path path;
        m_src->res_path( path );       
        m_cm->add_arg( path.c_str() ); 
    }
    m_cm->start_child();
    m_pstate = PlayerState::Playing;
}
void Ogg_player :: play ( spSource src ) { if ( ! src ) { m_src = src ; stop ( ) ; return ; } if ( not has_cap ( src -> medium ( ) , src -> encoding ( ) ) ) { LOG_ERROR ( Lgr ) << m_name << " " << src -> name ( ) ; throw Player_media_exception ( ) ; } m_src = src ; LOG_INFO ( Lgr ) << m_name << " " << m_src -> name ( ) << " " ; m_cm -> clear_args ( ) ; m_cm -> add_arg ( " " ) ; if ( not m_device_type . empty ( ) ) { m_cm -> add_arg ( " " ) ; m_cm -> add_arg ( m_device_type ) ; } if ( m_src -> repeatp ( ) ) { m_cm -> add_arg ( " " ) ; LOG_INFO ( Lgr ) << m_name << " " ; } if ( m_src -> medium ( ) == Medium :: playlist ) { m_cm -> add_arg ( " " ) ; } if ( m_src -> medium ( ) == Medium :: stream ) { m_cm -> add_arg ( m_src -> resource ( ) . c_str ( ) ) ; } else { boost :: filesystem :: path path ; m_src -> res_path ( path ) ; m_cm -> add_arg ( path . c_str ( ) ) ; } m_cm -> start_child ( ) ; m_pstate = PlayerState :: Playing ; }
Play the given slot (if you can).
Play the given slot ( if you can ) .
// == exit() // Verify src is a valid type for Vlc // quietly -- no console play // repeat this indefinitely // for playlist // returns false if not exist... // might be expanded path