NEW: release DJI Payload-SDK version 3.8.1

This commit is contained in:
Dji-Tom
2024-04-07 16:23:51 +08:00
parent db9d05ee2b
commit b96c87f4bb
53 changed files with 6743 additions and 33576 deletions

View File

@ -71,13 +71,6 @@ if (OpenCV_FOUND)
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
add_definitions(-DOPEN_CV_INSTALLED)
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
add_definitions(-DOPEN_CV_VERSION_3)
else ()
add_definitions(-DOPEN_CV_VERSION_4)
endif ()
else ()
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
endif ()
@ -89,10 +82,10 @@ if (FFMPEG_FOUND)
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
EXECUTE_PROCESS(COMMAND ffmpeg -version
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
OUTPUT_VARIABLE ffmpeg_version_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_psdk_libput})
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_output})
string(REGEX MATCH " .* " ffmpeg_version ${ffmpeg_version_line})
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version ${ffmpeg_version})

View File

@ -31,7 +31,6 @@
#include <dji_aircraft_info.h>
#include <csignal>
#include "dji_sdk_config.h"
#include "dji_config_manager.h"
#include "../common/osal/osal.h"
#include "../common/osal/osal_fs.h"
@ -40,6 +39,7 @@
#include "../manifold2/hal/hal_uart.h"
#include "../manifold2/hal/hal_network.h"
#include "utils/dji_config_manager.h"
#include <gimbal_emu/test_payload_gimbal_emu.h>
#include <camera_emu/test_payload_cam_emu_media.h>
#include <camera_emu/test_payload_cam_emu_base.h>

View File

@ -1,346 +0,0 @@
/**
********************************************************************
* @file dji_config_manager.c
* @brief
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include <utils/util_misc.h>
#include <dji_logger.h>
#include <utils/util_file.h>
#include <dji_aircraft_info.h>
#include "dji_config_manager.h"
#include "utils/cJSON.h"
/* Private constants ---------------------------------------------------------*/
/* Private types -------------------------------------------------------------*/
/* Private values -------------------------------------------------------------*/
static T_DjiUserInfo s_configManagerUserInfo = {0};
static T_DjiUserLinkConfig s_configManagerLinkInfo = {0};
static bool s_configManagerIsEnable = false;
/* Private functions declaration ---------------------------------------------*/
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo);
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig);
/* Exported functions definition ---------------------------------------------*/
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path)
{
T_DjiReturnCode returnCode;
char curFileDirPath[DJI_FILE_PATH_SIZE_MAX];
char tempFileDirPath[DJI_FILE_PATH_SIZE_MAX];
if (path == NULL) {
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, DJI_FILE_PATH_SIZE_MAX,
curFileDirPath);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
return returnCode;
}
snprintf(tempFileDirPath, DJI_FILE_PATH_SIZE_MAX, "%s/dji_sdk_config.json",
curFileDirPath);
} else {
strcpy(tempFileDirPath, path);
}
printf("Load configuration start.\r\n");
returnCode = DjiUserConfigManager_GetAppInfoInner(tempFileDirPath, &s_configManagerUserInfo);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Get app info failed.\n");
}
returnCode = DjiUserConfigManager_GetLinkConfigInner(tempFileDirPath, &s_configManagerLinkInfo);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Get link info failed.\n");
}
printf("\r\nLoad configuration successfully.\r\n");
s_configManagerIsEnable = true;
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo)
{
memcpy(userInfo, &s_configManagerUserInfo, sizeof(T_DjiUserInfo));
}
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig)
{
memcpy(linkConfig, &s_configManagerLinkInfo, sizeof(T_DjiUserLinkConfig));
}
bool DjiUserConfigManager_IsEnable(void)
{
return s_configManagerIsEnable;
}
/* Private functions definition-----------------------------------------------*/
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo)
{
T_DjiReturnCode returnCode;
uint32_t fileSize = 0;
uint32_t readRealSize = 0;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
uint8_t *jsonData = NULL;
cJSON *jsonRoot = NULL;
cJSON *jsonItem = NULL;
cJSON *jsonValue = NULL;
#ifdef SYSTEM_ARCH_LINUX
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
return returnCode;
}
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
jsonData = osalHandler->Malloc(fileSize + 1);
if (jsonData == NULL) {
USER_LOG_ERROR("Malloc failed.");
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
memset(jsonData, 0, fileSize);
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
jsonData[readRealSize] = '\0';
jsonRoot = cJSON_Parse((char *) jsonData);
if (jsonRoot == NULL) {
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_app_info");
if (jsonItem != NULL) {
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_name");
if (jsonValue != NULL) {
strcpy(userInfo->appName, jsonValue->valuestring);
}
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_id");
if (jsonValue != NULL) {
strcpy(userInfo->appId, jsonValue->valuestring);
}
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_key");
if (jsonValue != NULL) {
strcpy(userInfo->appKey, jsonValue->valuestring);
}
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_license");
if (jsonValue != NULL) {
strcpy(userInfo->appLicense, jsonValue->valuestring);
}
jsonValue = cJSON_GetObjectItem(jsonItem, "user_develop_account");
if (jsonValue != NULL) {
strcpy(userInfo->developerAccount, jsonValue->valuestring);
}
jsonValue = cJSON_GetObjectItem(jsonItem, "user_baud_rate");
if (jsonValue != NULL) {
strcpy(userInfo->baudRate, jsonValue->valuestring);
}
}
if (strlen(userInfo->appName) >= sizeof(userInfo->appName) ||
strlen(userInfo->appId) > sizeof(userInfo->appId) ||
strlen(userInfo->appKey) > sizeof(userInfo->appKey) ||
strlen(userInfo->appLicense) > sizeof(userInfo->appLicense) ||
strlen(userInfo->developerAccount) >= sizeof(userInfo->developerAccount) ||
strlen(userInfo->baudRate) > sizeof(userInfo->baudRate)) {
USER_LOG_ERROR("Length of user information string is beyond limit. Please check.");
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
if (!strcmp(userInfo->appName, "your_app_name") ||
!strcmp(userInfo->appId, "your_app_id") ||
!strcmp(userInfo->appKey, "your_app_key") ||
!strcmp(userInfo->appLicense, "your_app_license") ||
!strcmp(userInfo->developerAccount, "your_developer_account") ||
!strcmp(userInfo->baudRate, "your_baud_rate")) {
USER_LOG_ERROR(
"Please fill in correct user information to 'samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.json' file.");
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
osalHandler->Free(jsonData);
#endif
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig)
{
T_DjiReturnCode returnCode;
uint32_t fileSize = 0;
uint32_t readRealSize = 0;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
uint8_t *jsonData = NULL;
cJSON *jsonRoot = NULL;
cJSON *jsonItem = NULL;
cJSON *jsonValue = NULL;
cJSON *jsonConfig = NULL;
int32_t configValue;
#ifdef SYSTEM_ARCH_LINUX
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
return returnCode;
}
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
jsonData = osalHandler->Malloc(fileSize + 1);
if (jsonData == NULL) {
USER_LOG_ERROR("Malloc failed.");
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
memset(jsonData, 0, fileSize);
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
jsonData[readRealSize] = '\0';
jsonRoot = cJSON_Parse((char *) jsonData);
if (jsonRoot == NULL) {
goto jsonDataFree;
}
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_link_config");
if (jsonItem != NULL) {
jsonValue = cJSON_GetObjectItem(jsonItem, "link_select");
if (jsonValue != NULL) {
printf("\r\nSelect link type: %s\r\n", jsonValue->valuestring);
if (strcmp(jsonValue->valuestring, "use_only_uart") == 0) {
linkConfig->type = DJI_USER_LINK_CONFIG_USE_ONLY_UART;
} else if (strcmp(jsonValue->valuestring, "use_uart_and_network_device") == 0) {
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE;
} else if (strcmp(jsonValue->valuestring, "use_uart_and_usb_bulk_device") == 0) {
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE;
}
}
jsonValue = cJSON_GetObjectItem(jsonItem, "uart_config");
if (jsonValue != NULL) {
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart1_device_name");
printf("\r\nConfig uart1 device name: %s\r\n", jsonConfig->valuestring);
strcpy(linkConfig->uartConfig.uart1DeviceName, jsonConfig->valuestring);
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_name");
printf("Config uart2 device name: %s\r\n", jsonConfig->valuestring);
strcpy(linkConfig->uartConfig.uart2DeviceName, jsonConfig->valuestring);
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_enable");
printf("Config uart2 device enable: %s\r\n", jsonConfig->valuestring);
if (strcmp(jsonConfig->valuestring, "true") == 0) {
linkConfig->uartConfig.uart2DeviceEnable = true;
} else {
linkConfig->uartConfig.uart2DeviceEnable = false;
}
}
jsonValue = cJSON_GetObjectItem(jsonItem, "network_config");
if (jsonValue != NULL) {
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_device_name");
printf("\r\nConfig network device name: %s\r\n", jsonConfig->valuestring);
strcpy(linkConfig->networkConfig.networkDeviceName, jsonConfig->valuestring);
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_vid");
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->networkConfig.networkUsbAdapterVid = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_pid");
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->networkConfig.networkUsbAdapterPid = configValue;
}
jsonValue = cJSON_GetObjectItem(jsonItem, "usb_bulk_config");
if (jsonValue != NULL) {
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_vid");
printf("\r\nConfig usb device vid: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbDeviceVid = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_pid");
printf("Config usb device pid: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbDevicePid = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_device_name");
printf("Config usb bulk1 device name: %s\r\n", jsonConfig->valuestring);
strcpy(linkConfig->usbBulkConfig.usbBulk1DeviceName, jsonConfig->valuestring);
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_interface_num");
printf("Config usb bulk1 interface num: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbBulk1InterfaceNum = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_in");
printf("Config usb bulk1 endpoint in: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbBulk1EndpointIn = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_out");
printf("Config usb bulk1 endpoint out: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbBulk1EndpointOut = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_device_name");
printf("Config usb bulk2 device name: %s\r\n", jsonConfig->valuestring);
strcpy(linkConfig->usbBulkConfig.usbBulk2DeviceName, jsonConfig->valuestring);
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_interface_num");
printf("Config usb bulk2 interface num: %s\r\n", jsonConfig->valuestring);
sscanf(jsonConfig->valuestring, "%X", &configValue);
linkConfig->usbBulkConfig.usbBulk2InterfaceNum = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_in");
printf("Config usb bulk2 endpoint in: %s\r\n", jsonConfig->valuestring);
linkConfig->usbBulkConfig.usbBulk2EndpointIn = configValue;
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_out");
printf("Config usb bulk2 endpoint out: %s\r\n", jsonConfig->valuestring);
linkConfig->usbBulkConfig.usbBulk2EndpointOut = configValue;
}
}
jsonDataFree:
osalHandler->Free(jsonData);
#endif
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/

View File

@ -1,88 +0,0 @@
/**
********************************************************************
* @file dji_config_manager.h
* @brief This is the header file for "dji_config_manager.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef DJI_CONFIG_MANAGER_H
#define DJI_CONFIG_MANAGER_H
/* Includes ------------------------------------------------------------------*/
#include "dji_platform.h"
#include "dji_core.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define USER_DEVICE_NAME_STR_MAX_SIZE (64)
/* Exported types ------------------------------------------------------------*/
typedef enum {
DJI_USER_LINK_CONFIG_USE_ONLY_UART,
DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE,
DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE,
} E_DjiUserLinkConfigType;
typedef struct {
E_DjiUserLinkConfigType type;
struct {
char uart1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
bool uart2DeviceEnable;
char uart2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
} uartConfig;
struct {
char networkDeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
// M300/M350 RTK payload port no need
uint16_t networkUsbAdapterVid;
uint16_t networkUsbAdapterPid;
} networkConfig;
struct {
uint16_t usbDeviceVid;
uint16_t usbDevicePid;
char usbBulk1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
uint8_t usbBulk1InterfaceNum;
uint8_t usbBulk1EndpointIn;
uint8_t usbBulk1EndpointOut;
char usbBulk2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
uint8_t usbBulk2InterfaceNum;
uint8_t usbBulk2EndpointIn;
uint8_t usbBulk2EndpointOut;
} usbBulkConfig;
} T_DjiUserLinkConfig;
/* Exported functions --------------------------------------------------------*/
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path);
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo);
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig);
bool DjiUserConfigManager_IsEnable(void);
#ifdef __cplusplus
}
#endif
#endif // DJI_CONFIG_MANAGER_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -30,7 +30,7 @@
#include "stdio.h"
#include "hal_network.h"
#include "dji_logger.h"
#include "dji_config_manager.h"
#include "utils/dji_config_manager.h"
/* Private constants ---------------------------------------------------------*/
@ -63,7 +63,7 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
strcpy(networkDeviceName, LINUX_NETWORK_DEV);
}
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", LINUX_NETWORK_DEV);
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", networkDeviceName);
ret = system(cmdStr);
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Can't open the network."
@ -72,7 +72,7 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s %s netmask %s", LINUX_NETWORK_DEV, ipAddr, netMask);
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s %s netmask %s", networkDeviceName, ipAddr, netMask);
ret = system(cmdStr);
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Can't config the ip address of network."

View File

@ -25,7 +25,7 @@
/* Includes ------------------------------------------------------------------*/
#include <dji_logger.h>
#include "hal_uart.h"
#include "dji_config_manager.h"
#include "utils/dji_config_manager.h"
/* Private constants ---------------------------------------------------------*/
#define UART_DEV_NAME_STR_SIZE (128)

View File

@ -25,7 +25,7 @@
/* Includes ------------------------------------------------------------------*/
#include "hal_usb_bulk.h"
#include "dji_logger.h"
#include "dji_config_manager.h"
#include "utils/dji_config_manager.h"
/* Private constants ---------------------------------------------------------*/
#define LINUX_USB_BULK_TRANSFER_TIMEOUT_MS (50)

View File

@ -54,13 +54,6 @@ if (OpenCV_FOUND)
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
add_definitions(-DOPEN_CV_INSTALLED)
if ("${OpenCV_VERSION}" STRLESS "4.0.0")
add_definitions(-DOPEN_CV_VERSION_3)
else ()
add_definitions(-DOPEN_CV_VERSION_4)
endif ()
else ()
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
endif ()
@ -72,10 +65,10 @@ if (FFMPEG_FOUND)
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
EXECUTE_PROCESS(COMMAND ffmpeg -version
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
OUTPUT_VARIABLE ffmpeg_version_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_psdk_libput})
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_output})
string(REGEX MATCH " .* " ffmpeg_version ${ffmpeg_version_line})
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version ${ffmpeg_version})