1、操作遥控器按钮,psdk进程通过socket发送命令给相机进程 来控制高光谱采集系统;
2、通过FFmpeg采集摄像头视频流并编码为h264,利用psdk推流到遥控器;
This commit is contained in:
176
sample/api_sample/camera_media_emu/ffmpeg_tc.c
Normal file
176
sample/api_sample/camera_media_emu/ffmpeg_tc.c
Normal file
@ -0,0 +1,176 @@
|
||||
//
|
||||
// Created by tangchao on 2021/11/16.
|
||||
//
|
||||
|
||||
|
||||
#include "ffmpeg_tc.h"
|
||||
|
||||
char *getsystemtime()
|
||||
{
|
||||
//获取系统时间
|
||||
time_t timer;//time_t就是long int 类型
|
||||
struct tm *tblock;
|
||||
timer = time(NULL);//返回秒数(精度为秒),从1970-1-1,00:00:00 可以当成整型输出或用于其它函数
|
||||
tblock = localtime(&timer);
|
||||
//printf("Local time is: %s\n", asctime(tblock));
|
||||
|
||||
//格式化时间为需要的格式
|
||||
char fileNameTmp[256] = { 0 };
|
||||
char dirNameTmp[256] = { 0 };
|
||||
strftime(fileNameTmp, sizeof(fileNameTmp), "%Y%m%d_%H%M%S", tblock);
|
||||
return fileNameTmp;
|
||||
}
|
||||
|
||||
AVFrame *get_video_frame(IntputDev* input)//tc改动
|
||||
{
|
||||
clock_t start,finish;
|
||||
start = clock(); // 设置开始clock
|
||||
|
||||
int ret;
|
||||
AVFrame * ret_frame=NULL;
|
||||
|
||||
if(av_read_frame(input->v_ifmtCtx, input->in_packet)>=0)
|
||||
{
|
||||
if(input->in_packet->stream_index==input->videoindex)
|
||||
{
|
||||
ret = avcodec_send_packet(input->pCodecCtx, input->in_packet);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error sending a packet for decoding\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = avcodec_receive_frame(input->pCodecCtx, input->pFrame);
|
||||
if(ret<0)
|
||||
{
|
||||
printf("Decode Error.\n");
|
||||
av_packet_unref(input->in_packet);
|
||||
return NULL;
|
||||
}
|
||||
sws_scale(input->img_convert_ctx, (const unsigned char* const*)input->pFrame->data, input->pFrame->linesize, 0, input->pCodecCtx->height, input->pFrameYUV->data, input->pFrameYUV->linesize);
|
||||
input->pFrameYUV->pts=input->next_pts++;
|
||||
ret_frame= input->pFrameYUV;
|
||||
}
|
||||
av_packet_unref(input->in_packet);
|
||||
}
|
||||
|
||||
finish = clock();// 设置结束clock
|
||||
double duration = (double)(finish - start) / CLOCKS_PER_SEC;//转换浮点型
|
||||
// printf( "采集视频帧时间:%lf seconds\n", duration );
|
||||
|
||||
return ret_frame;
|
||||
}
|
||||
//
|
||||
//static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt)
|
||||
//{
|
||||
// int ret;
|
||||
//
|
||||
// /* send the frame to the encoder */
|
||||
// if (frame)
|
||||
// printf("Send frame %3"PRId64"\n", frame->pts);
|
||||
//
|
||||
// ret = avcodec_send_frame(enc_ctx, frame);//返回-21?????????????????????????????????????????????
|
||||
// if (ret < 0) {
|
||||
// fprintf(stderr, "Error sending a frame for encoding\n");
|
||||
// exit(1);
|
||||
// }
|
||||
//
|
||||
// while (ret >= 0) {
|
||||
// ret = avcodec_receive_packet(enc_ctx, pkt);
|
||||
// if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||
// return;
|
||||
// else if (ret < 0) {
|
||||
// fprintf(stderr, "Error during encoding\n");
|
||||
// exit(1);
|
||||
// }
|
||||
//
|
||||
//// printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
|
||||
//// fwrite(pkt->data, 1, pkt->size, outfile);
|
||||
// av_packet_unref(pkt);
|
||||
// }
|
||||
//}
|
||||
|
||||
void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, char **data, int *datasize)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* send the frame to the encoder */
|
||||
// if (frame)
|
||||
// printf("Send frame %3"PRId64"\n", frame->pts);
|
||||
|
||||
ret = avcodec_send_frame(enc_ctx, frame);//返回-21?????????????????????????????????????????????
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error sending a frame for encoding\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_packet(enc_ctx, pkt);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||
{
|
||||
printf("11111111111111111111\n");
|
||||
return;
|
||||
}
|
||||
else if (ret < 0) {
|
||||
fprintf(stderr, "Error during encoding\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
|
||||
// fwrite(pkt->data, 1, pkt->size, outfile);
|
||||
|
||||
//tc
|
||||
char *dataBuffer = calloc(pkt->size, 1);
|
||||
memcpy(dataBuffer,pkt->data,pkt->size);
|
||||
|
||||
*data = dataBuffer;
|
||||
*datasize = pkt->size;
|
||||
|
||||
av_packet_unref(pkt);
|
||||
}
|
||||
printf("22222222222222222\n");
|
||||
}
|
||||
|
||||
char * encode2(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, int *datasize)
|
||||
{
|
||||
clock_t start,finish;
|
||||
start = clock(); // 设置开始clock
|
||||
|
||||
int ret;
|
||||
char *dataBuffer;
|
||||
|
||||
ret = avcodec_send_frame(enc_ctx, frame);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error sending a frame for encoding\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_packet(enc_ctx, pkt);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||
{
|
||||
printf("11111111111111111111\n");
|
||||
return NULL;
|
||||
}
|
||||
else if (ret < 0) {
|
||||
fprintf(stderr, "Error during encoding\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
|
||||
// fwrite(pkt->data, 1, pkt->size, outfile);
|
||||
|
||||
//tc
|
||||
dataBuffer = calloc(pkt->size, 1);
|
||||
memcpy(dataBuffer,pkt->data,pkt->size);
|
||||
|
||||
*datasize = pkt->size;
|
||||
|
||||
av_packet_unref(pkt);
|
||||
|
||||
finish = clock();// 设置结束clock
|
||||
double duration = (double)(finish - start) / CLOCKS_PER_SEC;//转换浮点型
|
||||
// printf( "编码视频帧时间:%lf seconds\n", duration );
|
||||
|
||||
return dataBuffer;
|
||||
}
|
||||
}
|
63
sample/api_sample/camera_media_emu/ffmpeg_tc.h
Normal file
63
sample/api_sample/camera_media_emu/ffmpeg_tc.h
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Created by tangchao on 2021/11/16.
|
||||
//
|
||||
|
||||
#ifndef PSDK_DEMO_FFMPEG_TC_H
|
||||
#define PSDK_DEMO_FFMPEG_TC_H
|
||||
|
||||
|
||||
//tc开始
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <libavutil/avassert.h>
|
||||
#include <libavutil/channel_layout.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
#include <libavutil/timestamp.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include "libavdevice/avdevice.h"
|
||||
|
||||
#include <libavutil/imgutils.h>
|
||||
|
||||
#include <unistd.h>//usleep
|
||||
|
||||
|
||||
#define STREAM_DURATION 50.0 /*录制视频的持续时间 秒*/
|
||||
#define STREAM_FRAME_RATE 15 /* images/s 这里可以根据摄像头的采集速度来设置帧率 */
|
||||
#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
|
||||
#define SCALE_FLAGS SWS_BICUBIC
|
||||
//tc结束
|
||||
|
||||
|
||||
//存放视频的宽度和高度
|
||||
int video_width;
|
||||
int video_height;
|
||||
|
||||
|
||||
typedef struct IntputDev
|
||||
{
|
||||
AVCodecContext *pCodecCtx;
|
||||
AVCodec *pCodec;
|
||||
AVFormatContext *v_ifmtCtx;
|
||||
int videoindex;
|
||||
struct SwsContext *img_convert_ctx;
|
||||
AVPacket *in_packet;
|
||||
AVFrame *pFrame,*pFrameYUV;
|
||||
|
||||
/*下一帧的点数*/
|
||||
int64_t next_pts;
|
||||
}IntputDev;
|
||||
|
||||
char *getsystemtime();
|
||||
AVFrame *get_video_frame(IntputDev* input);
|
||||
//static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt);
|
||||
void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, char **data, int *datasize);
|
||||
char * encode2(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, int *datasize);
|
||||
|
||||
#endif //PSDK_DEMO_FFMPEG_TC_H
|
@ -0,0 +1,265 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_core.c
|
||||
* @version V1.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 <string.h>
|
||||
#include <psdk_logger.h>
|
||||
|
||||
#include "psdk_media_file_core.h"
|
||||
#include "psdk_media_file_jpg.h"
|
||||
#include "psdk_media_file_mp4.h"
|
||||
#include "psdk_platform.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Private values ------------------------------------------------------------*/
|
||||
//@formatter:off
|
||||
static const T_PsdkMediaFileOptItem s_mediaFileOpt[] =
|
||||
{
|
||||
//JPEG File Operation Item
|
||||
{
|
||||
PSDK_CAMERA_FILE_TYPE_JPEG ,
|
||||
PsdkMediaFile_IsSupported_JPG,
|
||||
PsdkMediaFile_GetAttrFunc_JPG,
|
||||
PsdkMediaFile_GetDataOrigin_JPG,
|
||||
PsdkMediaFile_GetFileSizeOrigin_JPG,
|
||||
PsdkMediaFile_CreateThumbNail_JPG,
|
||||
PsdkMediaFile_GetFileSizeThumbNail_JPG,
|
||||
PsdkMediaFile_GetDataThumbNail_JPG,
|
||||
PsdkMediaFile_DestroyThumbNail_JPG,
|
||||
PsdkMediaFile_CreateScreenNail_JPG,
|
||||
PsdkMediaFile_GetFileSizeScreenNail_JPG,
|
||||
PsdkMediaFile_GetDataScreenNail_JPG,
|
||||
PsdkMediaFile_DestroyScreenNail_JPG,
|
||||
},
|
||||
//MP4 File Operation Item
|
||||
{
|
||||
PSDK_CAMERA_FILE_TYPE_MP4 ,
|
||||
PsdkMediaFile_IsSupported_MP4,
|
||||
PsdkMediaFile_GetAttrFunc_MP4,
|
||||
PsdkMediaFile_GetDataOrigin_MP4,
|
||||
PsdkMediaFile_GetFileSizeOrigin_MP4,
|
||||
PsdkMediaFile_CreateThumbNail_MP4,
|
||||
PsdkMediaFile_GetFileSizeThumbNail_MP4,
|
||||
PsdkMediaFile_GetDataThumbNail_MP4,
|
||||
PsdkMediaFile_DestroyThumbNail_MP4,
|
||||
PsdkMediaFile_CreateScreenNail_MP4,
|
||||
PsdkMediaFile_GetFileSizeScreenNail_MP4,
|
||||
PsdkMediaFile_GetDataScreenNail_MP4,
|
||||
PsdkMediaFile_DestroyScreenNail_MP4,
|
||||
},
|
||||
};
|
||||
static const uint32_t s_mediaFileOptCount = sizeof (s_mediaFileOpt) / sizeof(T_PsdkMediaFileOptItem);
|
||||
//@formatter:on
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported(const char *filePath)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s_mediaFileOptCount; i++) {
|
||||
if (s_mediaFileOpt[i].isSupportedFunc(filePath) == true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateHandle(const char *filePath, T_PsdkMediaFileHandle *pMediaFileHandle)
|
||||
{
|
||||
int optIndex;//这个指数 指明了 filePath中的文件格式 处于数组s_mediaFileOpt中的哪一个元素
|
||||
|
||||
for (optIndex = 0; optIndex < s_mediaFileOptCount; optIndex++) {
|
||||
if (s_mediaFileOpt[optIndex].isSupportedFunc(filePath) == true) {//查看filePath的格式是否 存在于 所有支持的格式中
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optIndex == s_mediaFileOptCount) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*pMediaFileHandle = PsdkOsal_Malloc(sizeof(T_PsdkMediaFile));
|
||||
if (*pMediaFileHandle == NULL) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
(*pMediaFileHandle)->filePath = PsdkOsal_Malloc(strlen(filePath) + 1);
|
||||
if ((*pMediaFileHandle)->filePath == NULL) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
(*pMediaFileHandle)->mediaFileOptItem = s_mediaFileOpt[optIndex];//为pMediaFileHandle(媒体文件句柄)添加处理函数
|
||||
(*pMediaFileHandle)->mediaFileThm.privThm = NULL;
|
||||
(*pMediaFileHandle)->mediaFileScr.privScr = NULL;
|
||||
|
||||
strcpy((*pMediaFileHandle)->filePath, filePath);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyHandle(T_PsdkMediaFileHandle mediaFileHandle)
|
||||
{
|
||||
PsdkOsal_Free(mediaFileHandle->filePath);
|
||||
|
||||
PsdkOsal_Free(mediaFileHandle);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetMediaFileType(T_PsdkMediaFileHandle mediaFileHandle,
|
||||
E_PsdkCameraMediaFileType *mediaFileType)
|
||||
{
|
||||
*mediaFileType = mediaFileHandle->mediaFileOptItem.mediaFileType;
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetMediaFileAttr(T_PsdkMediaFileHandle mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getAttrFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getAttrFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getAttrFunc(mediaFileHandle, mediaFileAttr);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrg(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getDataOrgFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getDataOrgFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getDataOrgFunc(mediaFileHandle, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrg(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getFileSizeOrgFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getFileSizeOrgFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getFileSizeOrgFunc(mediaFileHandle, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThm(T_PsdkMediaFileHandle mediaFileHandle)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.createThmFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle createThmFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.createThmFunc(mediaFileHandle);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThm(T_PsdkMediaFileHandle mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getFileSizeThmFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getFileSizeThmFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getFileSizeThmFunc(mediaFileHandle, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataThm(T_PsdkMediaFileHandle mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getDataThmFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getDataThmFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getDataThmFunc(mediaFileHandle, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestoryThm(T_PsdkMediaFileHandle mediaFileHandle)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.destroyThmFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle destroyThmFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.destroyThmFunc(mediaFileHandle);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScr(T_PsdkMediaFileHandle mediaFileHandle)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.creatScrFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle creatScrFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.creatScrFunc(mediaFileHandle);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScr(T_PsdkMediaFileHandle mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getFileSizeScrFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getFileSizeScrFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getFileSizeScrFunc(mediaFileHandle, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataScr(T_PsdkMediaFileHandle mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getDataScrFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle getDataScrFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.getDataScrFunc(mediaFileHandle, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScr(T_PsdkMediaFileHandle mediaFileHandle)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.destroyScrFunc == NULL) {
|
||||
PsdkLogger_UserLogError("Media file handle destroyScrFunc null error");
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return mediaFileHandle->mediaFileOptItem.destroyScrFunc(mediaFileHandle);
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
@ -0,0 +1,117 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_core.h
|
||||
* @version V0.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief This is the header file for "psdk_media_file_core.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 PSDK_MEDIA_FILE_CORE_H
|
||||
#define PSDK_MEDIA_FILE_CORE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <psdk_typedef.h>
|
||||
#include <psdk_payload_camera.h>
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define PSDK_MEDIA_FILE_PATH_LEN_MAX 512 /*max file path len */
|
||||
#define PSDK_MEDIA_DIR_PATH_LEN_MAX 256 /*max dir path len */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
void *privThm;
|
||||
} T_PsdkMediaFileThm;
|
||||
|
||||
typedef struct {
|
||||
void *privScr;
|
||||
} T_PsdkMediaFileScr;
|
||||
|
||||
struct _PsdkMediaFile;
|
||||
|
||||
typedef struct {
|
||||
E_PsdkCameraMediaFileType mediaFileType;
|
||||
bool (*isSupportedFunc)(const char *filePath);
|
||||
|
||||
T_PsdkReturnCode (*getAttrFunc)(struct _PsdkMediaFile *mediaFileHandle, T_PsdkCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_PsdkReturnCode (*getDataOrgFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode (*getFileSizeOrgFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_PsdkReturnCode (*createThmFunc)(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode (*getFileSizeThmFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode (*getDataThmFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode (*destroyThmFunc)(struct _PsdkMediaFile *mediaFileHandle);
|
||||
|
||||
T_PsdkReturnCode (*creatScrFunc)(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode (*getFileSizeScrFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode (*getDataScrFunc)(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode (*destroyScrFunc)(struct _PsdkMediaFile *mediaFileHandle);
|
||||
} T_PsdkMediaFileOptItem;
|
||||
|
||||
typedef struct _PsdkMediaFile {
|
||||
char *filePath;
|
||||
T_PsdkMediaFileOptItem mediaFileOptItem;
|
||||
T_PsdkMediaFileThm mediaFileThm;
|
||||
T_PsdkMediaFileScr mediaFileScr;
|
||||
} T_PsdkMediaFile, *T_PsdkMediaFileHandle;
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported(const char *filePath);
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateHandle(const char *filePath, T_PsdkMediaFileHandle *pMediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyHandle(T_PsdkMediaFileHandle mediaFileHandle);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetMediaFileType(T_PsdkMediaFileHandle mediaFileHandle,
|
||||
E_PsdkCameraMediaFileType *mediaFileType);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetMediaFileAttr(T_PsdkMediaFileHandle mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrg(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrg(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThm(T_PsdkMediaFileHandle mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThm(T_PsdkMediaFileHandle mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataThm(T_PsdkMediaFileHandle mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestoryThm(T_PsdkMediaFileHandle mediaFileHandle);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScr(T_PsdkMediaFileHandle mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScr(T_PsdkMediaFileHandle mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataScr(T_PsdkMediaFileHandle mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScr(T_PsdkMediaFileHandle mediaFileHandle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PSDK_MEDIA_FILE_CORE_H
|
||||
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
@ -0,0 +1,227 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_JPG.c
|
||||
* @version V1.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 "psdk_media_file_jpg.h"
|
||||
#include "psdk_media_file_core.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <psdk_logger.h>
|
||||
#include <utils/util_misc.h>
|
||||
#include "psdk_platform.h"
|
||||
#include "utils/util_time.h"
|
||||
#include "utils/util_file.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define JPG_FILE_SUFFIX ".jpg"
|
||||
#define JPG_TEMP_FILE_TEMPLATE_STR "JPG_TEMP_XXXXXX.jpg"
|
||||
#define JPG_TEMP_FILE_PATH_MAX_LEN 50
|
||||
#define FFMPEG_CMD_BUF_SIZE 1024
|
||||
|
||||
#define JPG_THM_SCALE_CFG_STR "scale=100:-1"
|
||||
#define JPG_SCR_SCALE_CFG_STR "scale=600:-1"
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
FILE *tempFile;
|
||||
char tempfilePath[JPG_TEMP_FILE_PATH_MAX_LEN];
|
||||
} T_PsdkJPGTempFilePriv;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_PsdkReturnCode PsdkMediaFile_CreateTempFilePriv_JPG(const char *srcFilePath, const char *scaleCfgStr,
|
||||
T_PsdkJPGTempFilePriv **pTempFilePrivHandle);
|
||||
static T_PsdkReturnCode PsdkMediaFile_DestroyTempFilePriv_JPG(T_PsdkJPGTempFilePriv *tempFilePrivHandle);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported_JPG(const char *filePath)
|
||||
{
|
||||
if (filePath == NULL) {
|
||||
PsdkLogger_UserLogError("input parameter is null error");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(&filePath[strlen(filePath) - 4], JPG_FILE_SUFFIX) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetAttrFunc_JPG(struct _PsdkMediaFile *mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr)
|
||||
{
|
||||
USER_UTIL_UNUSED(mediaFileHandle);
|
||||
|
||||
mediaFileAttr->attrVideoDuration = 0;
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrigin_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
return UtilFile_GetFileDataByPath(mediaFileHandle->filePath, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrigin_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
return UtilFile_GetFileSizeByPath(mediaFileHandle->filePath, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_CreateTempFilePriv_JPG(mediaFileHandle->filePath, JPG_THM_SCALE_CFG_STR,
|
||||
(T_PsdkJPGTempFilePriv **) &mediaFileHandle->mediaFileThm.privThm);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
T_PsdkJPGTempFilePriv *jpgFileThmPriv = (T_PsdkJPGTempFilePriv *) mediaFileHandle->mediaFileThm.privThm;
|
||||
|
||||
return UtilFile_GetFileSize(jpgFileThmPriv->tempFile, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
T_PsdkJPGTempFilePriv *jpgFileThmPriv = (T_PsdkJPGTempFilePriv *) mediaFileHandle->mediaFileThm.privThm;
|
||||
|
||||
return UtilFile_GetFileData(jpgFileThmPriv->tempFile, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_DestroyTempFilePriv_JPG(mediaFileHandle->mediaFileThm.privThm);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_CreateTempFilePriv_JPG(mediaFileHandle->filePath, JPG_SCR_SCALE_CFG_STR,
|
||||
(T_PsdkJPGTempFilePriv **) &mediaFileHandle->mediaFileScr.privScr);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
T_PsdkJPGTempFilePriv *jpgFileScrPriv = (T_PsdkJPGTempFilePriv *) mediaFileHandle->mediaFileScr.privScr;
|
||||
|
||||
return UtilFile_GetFileSize(jpgFileScrPriv->tempFile, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
T_PsdkJPGTempFilePriv *jpgFileScrPriv = (T_PsdkJPGTempFilePriv *) mediaFileHandle->mediaFileScr.privScr;
|
||||
|
||||
return UtilFile_GetFileData(jpgFileScrPriv->tempFile, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_DestroyTempFilePriv_JPG(mediaFileHandle->mediaFileScr.privScr);
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_PsdkReturnCode PsdkMediaFile_CreateTempFilePriv_JPG(const char *srcFilePath, const char *scaleCfgStr,
|
||||
T_PsdkJPGTempFilePriv **pTempFilePrivHandle)
|
||||
{
|
||||
char ffmpeg_cmd[FFMPEG_CMD_BUF_SIZE];
|
||||
int cmdRet;
|
||||
T_PsdkRunTimeStamps tiStart, tiEnd;
|
||||
T_PsdkJPGTempFilePriv *jpgTempFilePriv;
|
||||
T_PsdkReturnCode psdkStat;
|
||||
int tempFd;
|
||||
|
||||
tiStart = PsdkUtilTime_GetRunTimeStamps();
|
||||
|
||||
*pTempFilePrivHandle = PsdkOsal_Malloc(sizeof(T_PsdkJPGTempFilePriv));
|
||||
if (*pTempFilePrivHandle == NULL) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
jpgTempFilePriv = *pTempFilePrivHandle;
|
||||
|
||||
//get temp file name
|
||||
strcpy(jpgTempFilePriv->tempfilePath, JPG_TEMP_FILE_TEMPLATE_STR);
|
||||
tempFd = mkstemps(jpgTempFilePriv->tempfilePath, strlen(JPG_FILE_SUFFIX));
|
||||
if (tempFd < 0) {
|
||||
PsdkLogger_UserLogError("JPG Create Temp File Error, tempFd = %d\n", tempFd);
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_create_temp;
|
||||
}
|
||||
close(tempFd);
|
||||
unlink(jpgTempFilePriv->tempfilePath);
|
||||
|
||||
//ffmpeg cmd send
|
||||
snprintf(ffmpeg_cmd, FFMPEG_CMD_BUF_SIZE, "ffmpeg -i \"%s\" -vf %s %s 1>/dev/null 2>&1",
|
||||
srcFilePath, scaleCfgStr, jpgTempFilePriv->tempfilePath);
|
||||
|
||||
cmdRet = system(ffmpeg_cmd);
|
||||
|
||||
tiEnd = PsdkUtilTime_GetRunTimeStamps();
|
||||
|
||||
PsdkLogger_UserLogDebug("JPG Create TempFile, RealTime = %ld us\n", tiEnd.realUsec - tiStart.realUsec);
|
||||
|
||||
if (cmdRet != 0) {
|
||||
PsdkLogger_UserLogError("JPG ffmpeg cmd call error, ret = %d\n", cmdRet);
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_system_cmd;
|
||||
}
|
||||
|
||||
//open temp file
|
||||
jpgTempFilePriv->tempFile = fopen(jpgTempFilePriv->tempfilePath, "rb+");
|
||||
if (jpgTempFilePriv->tempFile == NULL) {
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_file_open;
|
||||
}
|
||||
|
||||
//unlink temp file
|
||||
unlink(jpgTempFilePriv->tempfilePath);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
|
||||
err_file_open:
|
||||
unlink(jpgTempFilePriv->tempfilePath);
|
||||
err_system_cmd:
|
||||
err_create_temp:
|
||||
PsdkOsal_Free(*pTempFilePrivHandle);
|
||||
|
||||
return psdkStat;
|
||||
}
|
||||
|
||||
static T_PsdkReturnCode PsdkMediaFile_DestroyTempFilePriv_JPG(T_PsdkJPGTempFilePriv *tempFilePrivHandle)
|
||||
{
|
||||
fclose(tempFilePrivHandle->tempFile);
|
||||
PsdkOsal_Free(tempFilePrivHandle);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
@ -0,0 +1,77 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_JPG.h
|
||||
* @version V0.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief This is the header file for "psdk_media_file_JPG.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 PSDK_MEDIA_FILE_JPG_H
|
||||
#define PSDK_MEDIA_FILE_JPG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <psdk_payload_camera.h>
|
||||
#include <psdk_typedef.h>
|
||||
#include "psdk_media_file_core.h"
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported_JPG(const char *filePath);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetAttrFunc_JPG(struct _PsdkMediaFile *mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrigin_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrigin_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyThumbNail_JPG(struct _PsdkMediaFile *mediaFileHandle);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScreenNail_JPG(struct _PsdkMediaFile *mediaFileHandle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PSDK_MEIDA_FILE_JPG_H
|
||||
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
@ -0,0 +1,261 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_MP4.c
|
||||
* @version V1.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 "psdk_media_file_mp4.h"
|
||||
#include "psdk_media_file_core.h"
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <psdk_logger.h>
|
||||
#include <stdlib.h>
|
||||
#include "psdk_platform.h"
|
||||
#include "utils/util_time.h"
|
||||
#include "utils/util_file.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
#define MP4_FILE_SUFFIX ".mp4"
|
||||
#define MP4_TEMP_FILE_TEMPLATE_STR "MP4_TEMP_XXXXXX.jpg"
|
||||
#define MP4_TEMP_FILE_PATH_MAX_LEN 50
|
||||
#define FFMPEG_CMD_BUF_SIZE (PSDK_MEDIA_FILE_PATH_LEN_MAX + 256)
|
||||
|
||||
#define MP4_THM_SCALE_CFG_STR "scale=100:-1"
|
||||
#define MP4_SCR_SCALE_CFG_STR "scale=600:-1"
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
FILE *tempFile;
|
||||
char tempfilePath[MP4_TEMP_FILE_PATH_MAX_LEN];
|
||||
} T_PsdkMP4TempPicPriv;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_PsdkReturnCode PsdkMediaFile_CreateTempPicPriv_MP4(const char *srcFilePath, const char *scaleCfgStr,
|
||||
T_PsdkMP4TempPicPriv **pTempPicPrivHandle);
|
||||
static T_PsdkReturnCode PsdkMediaFile_DestroyTempPicPriv_MP4(T_PsdkMP4TempPicPriv *tempPicPrivHandle);
|
||||
|
||||
/* Private values ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported_MP4(const char *filePath)
|
||||
{
|
||||
if (filePath == NULL) {
|
||||
PsdkLogger_UserLogError("input parameter is null error");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(&filePath[strlen(filePath) - 4], MP4_FILE_SUFFIX) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetAttrFunc_MP4(struct _PsdkMediaFile *mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr)
|
||||
{
|
||||
FILE *fp;
|
||||
char ffmpegCmdStr[FFMPEG_CMD_BUF_SIZE];
|
||||
float hour, minute, second;
|
||||
char tempTailStr[128];
|
||||
int ret;
|
||||
T_PsdkReturnCode psdkStat;
|
||||
|
||||
snprintf(ffmpegCmdStr, FFMPEG_CMD_BUF_SIZE, "ffmpeg -i \"%s\" 2>&1 | grep \"Duration\"", mediaFileHandle->filePath);
|
||||
fp = popen(ffmpegCmdStr, "r");
|
||||
|
||||
if (fp == NULL) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
ret = fscanf(fp, " Duration: %f:%f:%f,%127s", &hour, &minute, &second, tempTailStr);
|
||||
if (ret <= 0) {
|
||||
PsdkLogger_UserLogError("MP4 File Get Duration Error\n");
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
mediaFileAttr->attrVideoDuration = (uint32_t) (hour * 3600 + minute * 60 + second + 0.5);
|
||||
|
||||
/*! The user needs to obtain the frame rate and resolution of the video file by ffmpeg tools.
|
||||
* Also the frame rate and resolution of video need convert to enum E_PsdkCameraVideoFrameRate or
|
||||
* E_PsdkCameraVideoResolution.
|
||||
*/
|
||||
mediaFileAttr->attrVideoFrameRate = PSDK_CAMERA_VIDEO_FRAME_RATE_30_FPS;
|
||||
mediaFileAttr->attrVideoResolution = PSDK_CAMERA_VIDEO_RESOLUTION_1920x1080;
|
||||
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
|
||||
out:
|
||||
pclose(fp);
|
||||
|
||||
return psdkStat;
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrigin_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
return UtilFile_GetFileDataByPath(mediaFileHandle->filePath, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrigin_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
return UtilFile_GetFileSizeByPath(mediaFileHandle->filePath, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
|
||||
return PsdkMediaFile_CreateTempPicPriv_MP4(mediaFileHandle->filePath, MP4_THM_SCALE_CFG_STR,
|
||||
(T_PsdkMP4TempPicPriv **) &mediaFileHandle->mediaFileThm.privThm);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
T_PsdkMP4TempPicPriv *jpgFileThmPriv = (T_PsdkMP4TempPicPriv *) mediaFileHandle->mediaFileThm.privThm;
|
||||
|
||||
return UtilFile_GetFileSize(jpgFileThmPriv->tempFile, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
T_PsdkMP4TempPicPriv *jpgFileThmPriv = (T_PsdkMP4TempPicPriv *) mediaFileHandle->mediaFileThm.privThm;
|
||||
|
||||
return UtilFile_GetFileData(jpgFileThmPriv->tempFile, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyThumbNail_MP4(struct _PsdkMediaFile *MediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_DestroyTempPicPriv_MP4(MediaFileHandle->mediaFileThm.privThm);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_CreateTempPicPriv_MP4(mediaFileHandle->filePath, MP4_SCR_SCALE_CFG_STR,
|
||||
(T_PsdkMP4TempPicPriv **) &mediaFileHandle->mediaFileScr.privScr);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize)
|
||||
{
|
||||
T_PsdkMP4TempPicPriv *jpgFileScrPriv = (T_PsdkMP4TempPicPriv *) mediaFileHandle->mediaFileScr.privScr;
|
||||
|
||||
return UtilFile_GetFileSize(jpgFileScrPriv->tempFile, fileSize);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
{
|
||||
T_PsdkMP4TempPicPriv *jpgFileScrPriv = (T_PsdkMP4TempPicPriv *) mediaFileHandle->mediaFileScr.privScr;
|
||||
|
||||
return UtilFile_GetFileData(jpgFileScrPriv->tempFile, offset, len, data, realLen);
|
||||
}
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle)
|
||||
{
|
||||
return PsdkMediaFile_DestroyTempPicPriv_MP4(mediaFileHandle->mediaFileScr.privScr);
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_PsdkReturnCode PsdkMediaFile_CreateTempPicPriv_MP4(const char *srcFilePath, const char *scaleCfgStr,
|
||||
T_PsdkMP4TempPicPriv **pTempPicPrivHandle)
|
||||
{
|
||||
char ffmpeg_cmd[FFMPEG_CMD_BUF_SIZE];
|
||||
int cmdRet;
|
||||
T_PsdkRunTimeStamps tiStart, tiEnd;
|
||||
T_PsdkMP4TempPicPriv *mp4TempPicFile;
|
||||
T_PsdkReturnCode psdkStat;
|
||||
int tempFd;
|
||||
|
||||
tiStart = PsdkUtilTime_GetRunTimeStamps();
|
||||
|
||||
*pTempPicPrivHandle = PsdkOsal_Malloc(sizeof(T_PsdkMP4TempPicPriv));
|
||||
if (*pTempPicPrivHandle == NULL) {
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
mp4TempPicFile = *pTempPicPrivHandle;
|
||||
|
||||
//get temp file name
|
||||
strcpy(mp4TempPicFile->tempfilePath, MP4_TEMP_FILE_TEMPLATE_STR);
|
||||
tempFd = mkstemps(mp4TempPicFile->tempfilePath, strlen(MP4_FILE_SUFFIX));
|
||||
if (tempFd < 0) {
|
||||
PsdkLogger_UserLogError("JPG Create Temp File Error, tempFd = %d\n", tempFd);
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_create_temp;
|
||||
}
|
||||
close(tempFd);
|
||||
unlink(mp4TempPicFile->tempfilePath);
|
||||
|
||||
//ffmpeg cmd send
|
||||
snprintf(ffmpeg_cmd, FFMPEG_CMD_BUF_SIZE, "ffmpeg -i \"%s\" -vf %s -ss 00:00:00 -vframes 1 %s 1>/dev/null 2>&1",
|
||||
srcFilePath, scaleCfgStr, mp4TempPicFile->tempfilePath);
|
||||
|
||||
cmdRet = system(ffmpeg_cmd);
|
||||
|
||||
tiEnd = PsdkUtilTime_GetRunTimeStamps();
|
||||
|
||||
PsdkLogger_UserLogDebug("JPG Create TempFile, RealTime = %ld us\n", tiEnd.realUsec - tiStart.realUsec);
|
||||
|
||||
if (cmdRet != 0) {
|
||||
PsdkLogger_UserLogError("JPG ffmpeg cmd call error, ret = %d\n", cmdRet);
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_system_cmd;
|
||||
}
|
||||
|
||||
//open temp file
|
||||
mp4TempPicFile->tempFile = fopen(mp4TempPicFile->tempfilePath, "rb+");
|
||||
if (mp4TempPicFile->tempFile == NULL) {
|
||||
psdkStat = PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto err_file_open;
|
||||
}
|
||||
|
||||
//unlink temp file
|
||||
unlink(mp4TempPicFile->tempfilePath);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
|
||||
err_file_open:
|
||||
unlink(mp4TempPicFile->tempfilePath);
|
||||
err_system_cmd:
|
||||
err_create_temp:
|
||||
PsdkOsal_Free(*pTempPicPrivHandle);
|
||||
|
||||
return psdkStat;
|
||||
}
|
||||
|
||||
static T_PsdkReturnCode PsdkMediaFile_DestroyTempPicPriv_MP4(T_PsdkMP4TempPicPriv *tempPicPrivHandle)
|
||||
{
|
||||
fclose(tempPicPrivHandle->tempFile);
|
||||
PsdkOsal_Free(tempPicPrivHandle);
|
||||
|
||||
return PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
@ -0,0 +1,77 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_media_file_MP4.h
|
||||
* @version V0.0.0
|
||||
* @date 2019/01/01
|
||||
* @brief This is the header file for "psdk_media_file_MP4.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2017-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 DJI’s 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 PSDK_MEDIA_FILE_MP4_H
|
||||
#define PSDK_MEDIA_FILE_MP4_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <psdk_payload_camera.h>
|
||||
#include <psdk_typedef.h>
|
||||
#include "psdk_media_file_core.h"
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
bool PsdkMediaFile_IsSupported_MP4(const char *filePath);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetAttrFunc_MP4(struct _PsdkMediaFile *mediaFileHandle,
|
||||
T_PsdkCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_GetDataOrigin_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeOrigin_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataThumbNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyThumbNail_MP4(struct _PsdkMediaFile *MediaFileHandle);
|
||||
|
||||
T_PsdkReturnCode PsdkMediaFile_CreateScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle);
|
||||
T_PsdkReturnCode PsdkMediaFile_GetFileSizeScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
T_PsdkReturnCode
|
||||
PsdkMediaFile_GetDataScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_PsdkReturnCode PsdkMediaFile_DestroyScreenNail_MP4(struct _PsdkMediaFile *mediaFileHandle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PSDK_MEDIA_FILE_MP4_H
|
||||
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
1874
sample/api_sample/camera_media_emu/test_payload_cam_media.c
Normal file
1874
sample/api_sample/camera_media_emu/test_payload_cam_media.c
Normal file
File diff suppressed because it is too large
Load Diff
61
sample/api_sample/camera_media_emu/test_payload_cam_media.h
Normal file
61
sample/api_sample/camera_media_emu/test_payload_cam_media.h
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_payload_cam_media.h
|
||||
* @version V2.0.0
|
||||
* @date 2019/07/01
|
||||
* @brief This is the header file for "test_payload_cam_media.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018-2019 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 DJI’s 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 TEST_PAYLOAD_CAM_MEDIA_H
|
||||
#define TEST_PAYLOAD_CAM_MEDIA_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#if PSDK_ARCH_SYS_LINUX
|
||||
|
||||
#include "psdk_typedef.h"
|
||||
#include "psdk_payload_camera.h"
|
||||
|
||||
//tc开始
|
||||
#include "ffmpeg_tc.h"
|
||||
//tc结束
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_PsdkReturnCode PsdkTest_CameraMediaInit(void);
|
||||
T_PsdkReturnCode PsdkTest_CameraMediaGetFileInfo(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // TEST_PAYLOAD_CAM_MEDIA_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
Reference in New Issue
Block a user