Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Rivermax version extraction for SDK 1.30.16 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmake/FindRivermax.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ endif()
# Identify Rivermax files and version
find_library_files(rivermax_api.h rivermax Rivermax_INCLUDE_DIR Rivermax_LIBRARY)
if (Rivermax_INCLUDE_DIR)
file(STRINGS ${Rivermax_INCLUDE_DIR}/rivermax_api.h _RMAX_DEFS REGEX "^#define[ \t]+RMAX_(RELEASE_VERSION|BUILD)[ \t]")
file(STRINGS ${Rivermax_INCLUDE_DIR}/rivermax_defs.h _RMAX_DEFS REGEX "^#define[ \t]+RMX_VERSION_(MAJOR|MINOR|PATCH)[ \t]")
if(_RMAX_DEFS)
foreach(_version_item "RELEASE_VERSION" "BUILD")
foreach(_version_item "VERSION_MAJOR" "VERSION_MINOR" "VERSION_PATCH")
string(REGEX REPLACE ".*${_version_item}[ \t]+([0-9]+).*" "\\1" Rivermax_${_version_item} "${_RMAX_DEFS}")
endforeach()
calculate_rivermax_version("${Rivermax_RELEASE_VERSION}" "${Rivermax_BUILD}" Rivermax_VERSION)
set(Rivermax_VERSION "${Rivermax_VERSION_MAJOR}.${Rivermax_VERSION_MINOR}.${Rivermax_VERSION_PATCH}")
mark_as_advanced(Rivermax_VERSION Rivermax_VERSION_MAJOR Rivermax_VERSION_MINOR Rivermax_VERSION_PATCH)
else()
message(WARNING "Failed to determine the version of Rivermax!")
Expand Down
17 changes: 6 additions & 11 deletions generic_receiver/generic_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,21 @@ int main(int argc, char *argv[])
// Print the library and app version.
const char *rmax_version = rmax_get_version_string();
static std::string app_version =
std::to_string(RMAX_API_MAJOR) + std::string(".") +
std::to_string(RMAX_API_MINOR) + std::string(".") +
std::to_string(RMAX_RELEASE_VERSION) + std::string(".") +
std::to_string(RMAX_BUILD);
std::to_string(RMX_VERSION_MAJOR) + std::string(".") +
std::to_string(RMX_VERSION_MINOR) + std::string(".") +
std::to_string(RMX_VERSION_PATCH);
std::cout << "#########################################\n";
std::cout << "## Rivermax library version: " << rmax_version << "\n";
std::cout << "## Application version: " << app_version << "\n";
std::cout << "#########################################\n";

// Verify Rivermax library version matches (or is compatible) with this application.
unsigned int api_major;
unsigned int api_minor;
unsigned int release;
unsigned int build;
rmax_get_version(&api_major, &api_minor, &release, &build);
if (api_major != RMAX_API_MAJOR || api_minor < RMAX_API_MINOR) {
const rmx_version* version = rmx_get_version_numbers();
if (version->major != RMX_VERSION_MAJOR || version->minor < RMX_VERSION_MINOR) {
std::cerr << "The current Rivermax version is not compatible with this application." << std::endl;
exit(-1);
}
if (api_minor > RMAX_API_MINOR || release != RMAX_RELEASE_VERSION || build != RMAX_BUILD) {
if (version->minor > RMX_VERSION_MINOR || version->patch != RMX_VERSION_PATCH) {
std::cout << "WARNING!!! Rivermax and application versions are not aligned" << std::endl;
}

Expand Down
18 changes: 7 additions & 11 deletions rivermax_player/rivermax_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2619,10 +2619,6 @@ static bool set_clock(rmax_clock_types clock_handler_type, std::vector<std::stri

int main(int argc, char *argv[])
{
unsigned int api_major;
unsigned int api_minor;
unsigned int release;
unsigned int build;
int ret = 0;

std::vector<std::string> sdp_files;
Expand Down Expand Up @@ -2756,23 +2752,23 @@ int main(int argc, char *argv[])
}
}

static std::string media_version = std::to_string(RMAX_API_MAJOR) + std::string(".") +
std::to_string(RMAX_API_MINOR)+ std::string(".") +
std::to_string(RMAX_RELEASE_VERSION) +
std::string(".") + std::to_string(RMAX_BUILD);
static std::string media_version =
std::to_string(RMX_VERSION_MAJOR) + std::string(".") +
std::to_string(RMX_VERSION_MINOR) + std::string(".") +
std::to_string(RMX_VERSION_PATCH);

std::cout<<"#############################################\n";
std::cout<<"## Rivermax library version: " << rmax_version << std::endl;
std::cout<<"## Rivermax player version: " << media_version << std::endl;
std::cout<<"#############################################\n";

/* Verify version mismatch */
rmax_get_version(&api_major, &api_minor, &release, &build);
if (api_major != RMAX_API_MAJOR || api_minor < RMAX_API_MINOR) {
const rmx_version* version = rmx_get_version_numbers();
if (version->major != RMX_VERSION_MAJOR || version->minor < RMX_VERSION_MINOR) {
std::cerr << "The current Rivermax version is not compatible with this version of rivermax player\n";
return -1;
}
if (api_minor > RMAX_API_MINOR || release != RMAX_RELEASE_VERSION || build != RMAX_BUILD) {
if (version->minor > RMX_VERSION_MINOR || version->patch != RMX_VERSION_PATCH) {
void *ctx;

ctx = color_set(COLOR_RED);
Expand Down