src/libtsduck/dtv/tsService.cpp
void ts::Service::set(const UString& desc)
{
    clear();

    uint16_t id = 0;
    uint16_t minor = 0;

    if (desc.toInteger(id)) {
        // Found a service id.
        _id = id;
    }
    else if (desc.scan(u"%d.%d", {&id, &minor})) {
        // Found an ATSC major.minor id.
        _major_id_atsc = id;
        _minor_id_atsc = minor;
    }
    else if (!desc.empty()) {
        // Finally, just a service name.
        _name = desc;
    }
}
//----------------------------------------------------------------------------
// Reset using a string description.
// If the string evaluates to an integer (decimal or hexa),
// this is a service id, otherwise this is a service name.
//----------------------------------------------------------------------------
Reset using a string description.
If the string evaluates to an integer (decimal or hexa),
this is a service id, otherwise this is a service name.
Reset using a string description . If the string evaluates to an integer ( decimal or hexa ) this is a service id otherwise this is a service name .
void ts::Service::set(const UString& desc)
{
    clear();
    uint16_t id = 0;
    uint16_t minor = 0;
    if (desc.toInteger(id)) {
        _id = id;
    }
    else if (desc.scan(u"%d.%d", {&id, &minor})) {
        _major_id_atsc = id;
        _minor_id_atsc = minor;
    }
    else if (!desc.empty()) {
        _name = desc;
    }
}
void ts :: Service :: set ( const UString & desc ) { clear ( ) ; uint16_t id = 0 ; uint16_t minor = 0 ; if ( desc . toInteger ( id ) ) { _id = id ; } else if ( desc . scan ( u" " , { & id , & minor } ) ) { _major_id_atsc = id ; _minor_id_atsc = minor ; } else if ( ! desc . empty ( ) ) { _name = desc ; } }
Reset using a string description.
Reset using a string description .
// Found a service id. // Found an ATSC major.minor id. // Finally, just a service name.