rsked/playermgr.cc
/// Retrieve the best available player for the source src.
///
/// If the src argument is null, or the src medium is "Off" then
/// return the silent player.
///
/// If no suitable player can be determined, or none is
/// usable, then return a *null* shared pointer.
///
/// Will precheck network sources.  This assumes that Internet is
/// required and might preclude playing fully functional LAN
/// streams. To get around this, adjust the external inet checker
/// to probe only the required network resources.
///
/// * Will NOT throw
///
Retrieve the best available player for the source src.
If the src argument is null, or the src medium is "Off" then
return the silent player.

If no suitable player can be determined, or none is
usable, then return a *null* shared pointer.

Will precheck network sources.  This assumes that Internet is
required and might preclude playing fully functional LAN
streams. To get around this, adjust the external inet checker
to probe only the required network resources.

Will NOT throw
Retrieve the best available player for the source src . If the src argument is null or the src medium is " Off " then return the silent player . If no suitable player can be determined or none is usable then return a * null * shared pointer . Will precheck network sources . This assumes that Internet is required and might preclude playing fully functional LAN streams . To get around this adjust the external inet checker to probe only the required network resources . Will NOT throw
spPlayer
Player_manager::get_player( spSource src )
{
    if (!src) { return m_players[SilentName]; }
    spPlayer pp {};
    Medium medium = src->medium();
    Encoding encoding = src->encoding();
    if ((medium == Medium::stream) and not c_ichecker.inet_ready()) {
            LOG_WARNING(Lgr) << "Internet seems unavailable, cannot play "
                          "stream "   << src->name();
            return pp;
    }
    unsigned np = m_prefs.player_count(medium,encoding);
    for (unsigned j=0; j<np; j++) {
        std::string pname;
        if (m_prefs.get_player(medium, encoding, j, pname )) {
            pp = m_players[ pname ];
            if (pp and pp->is_usable()) {
                return pp;
            }
        }
    }
    pp.reset();
    LOG_ERROR(Lgr) << "No usable players for " << media_name(medium)
                   << ":" << encoding_name(encoding);
    return pp;
}
spPlayer Player_manager :: get_player ( spSource src ) { if ( ! src ) { return m_players [ SilentName ] ; } spPlayer pp { } ; Medium medium = src -> medium ( ) ; Encoding encoding = src -> encoding ( ) ; if ( ( medium == Medium :: stream ) and not c_ichecker . inet_ready ( ) ) { LOG_WARNING ( Lgr ) << " " " " << src -> name ( ) ; return pp ; } unsigned np = m_prefs . player_count ( medium , encoding ) ; for ( unsigned j = 0 ; j < np ; j ++ ) { std :: string pname ; if ( m_prefs . get_player ( medium , encoding , j , pname ) ) { pp = m_players [ pname ] ; if ( pp and pp -> is_usable ( ) ) { return pp ; } } } pp . reset ( ) ; LOG_ERROR ( Lgr ) << " " << media_name ( medium ) << " " << encoding_name ( encoding ) ; return pp ; }
Retrieve the best available player for the source src.
Retrieve the best available player for the source src .
//LOG_DEBUG(Lgr) << np << " player options available";