src/libtsduck/plugin/tsPluginSharedLibrary.cpp
ts::PluginSharedLibrary::PluginSharedLibrary(const UString& filename, Report& report) :
    ApplicationSharedLibrary(filename, u"tsplugin_", TS_PLUGINS_PATH, true, report),
    new_input(nullptr),
    new_output(nullptr),
    new_processor(nullptr)
{
    // If still not loaded, error
    if (!isLoaded()) {
        report.error(errorMessage());
        return;
    }

    // Locate and check the API version
    const UString path(fileName());
    const int* version = reinterpret_cast<const int*>(getSymbol("tspInterfaceVersion"));

    if (version == nullptr) {
        report.error(u"no symbol tspInterfaceVersion in " + path);
        unload();
        return;
    }

    if (*version != TSP::API_VERSION) {
        report.error(u"incompatible API version %d in %s, expected %d", {*version, path, TSP::API_VERSION});
        unload();
        return;
    }

    // Load the plugin entry points
    new_input = reinterpret_cast<NewInputProfile>(getSymbol("tspNewInput"));
    new_output = reinterpret_cast<NewOutputProfile>(getSymbol("tspNewOutput"));
    new_processor = reinterpret_cast<NewProcessorProfile>(getSymbol("tspNewProcessor"));
}
//----------------------------------------------------------------------------
// Constructor. The load order is the following:
// - Default system lookup using filename string.
// - If filename is a base name (no directory), search it into the
//   same directory as the executable.
// - Same as previous with "tsplugin_" prefix in base name.
// In all cases, if the filename does not contain a suffix, the standard
// system suffix (.so or .dll) is added.
// When the load is successful, locate tsp plugin API and check the API version.
//----------------------------------------------------------------------------
Constructor. The load order is the following:
Default system lookup using filename string.
If filename is a base name (no directory), search it into the
same directory as the executable.
Same as previous with "tsplugin_" prefix in base name.
In all cases, if the filename does not contain a suffix, the standard
system suffix (.so or .dll) is added.
When the load is successful, locate tsp plugin API and check the API version.
Constructor . The load order is the following : Default system lookup using filename string . If filename is a base name ( no directory ) search it into the same directory as the executable . Same as previous with " tsplugin_ " prefix in base name . In all cases if the filename does not contain a suffix the standard system suffix ( . so or . dll ) is added . When the load is successful locate tsp plugin API and check the API version .
ts::PluginSharedLibrary::PluginSharedLibrary(const UString& filename, Report& report) :
    ApplicationSharedLibrary(filename, u"tsplugin_", TS_PLUGINS_PATH, true, report),
    new_input(nullptr),
    new_output(nullptr),
    new_processor(nullptr)
{
    if (!isLoaded()) {
        report.error(errorMessage());
        return;
    }
    const UString path(fileName());
    const int* version = reinterpret_cast<const int*>(getSymbol("tspInterfaceVersion"));
    if (version == nullptr) {
        report.error(u"no symbol tspInterfaceVersion in " + path);
        unload();
        return;
    }
    if (*version != TSP::API_VERSION) {
        report.error(u"incompatible API version %d in %s, expected %d", {*version, path, TSP::API_VERSION});
        unload();
        return;
    }
    new_input = reinterpret_cast<NewInputProfile>(getSymbol("tspNewInput"));
    new_output = reinterpret_cast<NewOutputProfile>(getSymbol("tspNewOutput"));
    new_processor = reinterpret_cast<NewProcessorProfile>(getSymbol("tspNewProcessor"));
}
ts :: PluginSharedLibrary :: PluginSharedLibrary ( const UString & filename , Report & report ) : ApplicationSharedLibrary ( filename , u" " , TS_PLUGINS_PATH , true , report ) , new_input ( nullptr ) , new_output ( nullptr ) , new_processor ( nullptr ) { if ( ! isLoaded ( ) ) { report . error ( errorMessage ( ) ) ; return ; } const UString path ( fileName ( ) ) ; const int * version = reinterpret_cast < const int * > ( getSymbol ( " " ) ) ; if ( version == nullptr ) { report . error ( u" " + path ) ; unload ( ) ; return ; } if ( * version != TSP :: API_VERSION ) { report . error ( u" " , { * version , path , TSP :: API_VERSION } ) ; unload ( ) ; return ; } new_input = reinterpret_cast < NewInputProfile > ( getSymbol ( " " ) ) ; new_output = reinterpret_cast < NewOutputProfile > ( getSymbol ( " " ) ) ; new_processor = reinterpret_cast < NewProcessorProfile > ( getSymbol ( " " ) ) ; }
Constructor.
Constructor .
// If still not loaded, error // Locate and check the API version // Load the plugin entry points