NEW: release DJI Payload-SDK version 3.13.0
Signed-off-by: martin <dev@dji.com>
This commit is contained in:
@ -23,10 +23,13 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <iostream>
|
||||
#include <dji_logger.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "test_liveview_entry.hpp"
|
||||
#include "dji_liveview_object_detection.hpp"
|
||||
#include "dji_payload_camera.h"
|
||||
#include "dji_high_speed_data_channel.h"
|
||||
#include "dji_aircraft_info.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "dji_typedef.h"
|
||||
@ -79,6 +82,7 @@ static const char* s_invalidLables[] = {
|
||||
static std::ofstream outFileH264;
|
||||
static std::ofstream outFileYUV;
|
||||
static std::string getCurrentTimestamp();
|
||||
static T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
static void outH264Tofile(const uint8_t *buf, int32_t len);
|
||||
static void outYUVTofile(const uint8_t *buf, int32_t len);
|
||||
static void DjiLiveview_RcvImageCallback(E_DjiLiveViewCameraPosition position, const uint8_t *buf, uint32_t len ,T_DjiLiveviewImageInfo imageInfo);
|
||||
@ -377,7 +381,9 @@ void DjiUser_RunCameraAiDetectionSample()
|
||||
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
if (pos < 1 || pos > 3 || (mediaSource != 0 &&mediaSource != 1 && mediaSource != 7))
|
||||
USER_LOG_INFO("Input cammera sourece(1:1080p, 3:M4 serials 4K, 7:H30 serials 4K): ");
|
||||
std::cin >> mediaSource;
|
||||
if (pos < 1 || pos > 3 || mediaSource > 7)
|
||||
{
|
||||
USER_LOG_ERROR("invalid param");
|
||||
return;
|
||||
@ -385,7 +391,9 @@ void DjiUser_RunCameraAiDetectionSample()
|
||||
|
||||
std::string timestamp = getCurrentTimestamp();
|
||||
|
||||
std::string h264FileName = "output_" + timestamp + ".h264";
|
||||
// avoid miss dir error
|
||||
mkdir ("data", 0755);
|
||||
std::string h264FileName = "data/output_" + timestamp + ".h264";
|
||||
outFileH264.open(h264FileName, std::ios::out | std::ios::binary | std::ios::app);
|
||||
if (!outFileH264) {
|
||||
std::cerr << "cant open " << h264FileName << std::endl;
|
||||
@ -422,6 +430,12 @@ void DjiUser_RunCameraAiDetectionSample()
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
returnCode = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft base info error");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef OPEN_CV_INSTALLED
|
||||
returnCode = DjiLiveview_RegUserAiTargetLableList(YOLO_LABLES_NUM, s_classLables);
|
||||
#else
|
||||
@ -597,10 +611,13 @@ static void DjiLiveview_EncoderUseCallback(const uint8_t *buf, uint32_t len)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
outH264Tofile(buf, len);
|
||||
returnCode = DjiPayloadCamera_SendVideoStream(buf, len);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
if (aircraftInfoBaseInfo.aircraftSeries != DJI_AIRCRAFT_SERIES_M4D)
|
||||
{
|
||||
USER_LOG_ERROR("failed to send video to pilot, ret: 0x%08llX", returnCode);
|
||||
returnCode = DjiPayloadCamera_SendVideoStream(buf, len);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("failed to send video to pilot, ret: 0x%08llX", returnCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
0
samples/sample_c++/module_sample/liveview/test_liveview_entry.cpp
Executable file → Normal file
0
samples/sample_c++/module_sample/liveview/test_liveview_entry.cpp
Executable file → Normal file
@ -46,6 +46,7 @@
|
||||
#include "camera_manager/test_camera_manager_entry.h"
|
||||
#include <hms_manager/hms_manager_entry.h>
|
||||
#include <liveview/dji_liveview_object_detection.hpp>
|
||||
#include "liveview/test_liveview.h"
|
||||
#include <signal.h>
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
@ -63,6 +64,7 @@ int main(int argc, char **argv)
|
||||
char inputChar;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
T_DjiReturnCode returnCode;
|
||||
E_DjiMountPosition mountPosition = DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1;
|
||||
|
||||
start:
|
||||
std::cout
|
||||
@ -80,7 +82,8 @@ start:
|
||||
<< "| [i] Run manifold3 AI sample - request h.264 bitstream data, codec it and display it on pilot |\n"
|
||||
<< "| [j] Run Hms Enhance sample - shake motor and play sound on pilot |\n"
|
||||
<< "| [l] Run widget states manager sample, control widget states on other payload |\n"
|
||||
<< "| [m] Run Open Ar sample - draw ar gragh\n"
|
||||
<< "| [m] Run Open Ar sample - draw ar gragh |\n"
|
||||
<< "| [n] Run H.264 liveview sample - save H.264 files in the current directory |\n"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputChar;
|
||||
@ -129,6 +132,9 @@ start:
|
||||
case 'm':
|
||||
DjiUser_RunOpenArSample();
|
||||
break;
|
||||
case 'n':
|
||||
DjiTest_LiveviewRunSample(mountPosition);
|
||||
break;
|
||||
case 'q':
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user