1 Commits

Author SHA1 Message Date
thead_admin
1871068c7e Linux_SDK_V1.0.2 2022-11-22 15:44:26 +08:00
4 changed files with 29 additions and 10 deletions

View File

@@ -19,12 +19,16 @@
#ifndef _PROCESS_LINKER_H_
#define _PROCESS_LINKER_H_
#ifdef __cplusplus
extern "C" {
#endif
#define PLINK_VERSION_MAJOR 0
#define PLINK_VERSION_MINOR 1
#define PLINK_VERSION_REVISION 1
/* Maximum data descriptors in one packet */
#define PLINK_MAX_DATA_DESCS 4
#define PLINK_MAX_DATA_DESCS 10
/* Close all the connections from client. */
/* Can be used as the second parameter of PLINK_close when the instance is created as SERVER */
@@ -214,4 +218,8 @@ PlinkStatus PLINK_recv_ex(PlinkHandle plink, PlinkChannelID channel, PlinkPacket
*/
PlinkStatus PLINK_close(PlinkHandle plink, PlinkChannelID channel);
#ifdef __cplusplus
}
#endif
#endif /* !_PROCESS_LINKER_H_ */

View File

@@ -21,6 +21,10 @@
#include "process_linker.h"
#ifdef __cplusplus
extern "C" {
#endif
/* When set PlinkMsg.msg to this exit code, it means to close the connection */
#define PLINK_EXIT_CODE -1
@@ -185,4 +189,8 @@ typedef struct _PlinkTimeInfo
long long useconds;
} PlinkTimeInfo;
#ifdef __cplusplus
}
#endif
#endif /* !_PROCESS_LINKER_TYPES_H_ */

View File

@@ -68,7 +68,8 @@ typedef struct _PlinkContext
{
PlinkMode mode;
struct sockaddr_un addr;
struct iovec io[PLINK_MAX_DATA_DESCS];
struct iovec ioIn[PLINK_MAX_DATA_DESCS];
struct iovec ioOut[PLINK_MAX_DATA_DESCS];
int sockfd;
int cfd[MAX_CONNECTIONS];
int connect[MAX_CONNECTIONS];
@@ -228,13 +229,13 @@ PLINK_send(PlinkHandle plink, PlinkChannelID channel, PlinkPacket *pkt)
for (int i = 0; i < pkt->num; i++)
{
PlinkDescHdr *hdr = (PlinkDescHdr *)(pkt->list[i]);
ctx->io[i].iov_base = pkt->list[i];
ctx->io[i].iov_len = hdr->size + DATA_HEADER_SIZE;
PLINK_PRINT(INFO, "Sending %ld bytes\n", ctx->io[i].iov_len);
ctx->ioOut[i].iov_base = pkt->list[i];
ctx->ioOut[i].iov_len = hdr->size + DATA_HEADER_SIZE;
PLINK_PRINT(INFO, "Sending Out %ld bytes\n", ctx->ioOut[i].iov_len);
}
struct msghdr msg = {0};
msg.msg_iov = ctx->io;
msg.msg_iov = ctx->ioOut;
msg.msg_iovlen = pkt->num;
if (pkt->fd > PLINK_INVALID_FD)
@@ -273,11 +274,11 @@ PLINK_recv(PlinkHandle plink, PlinkChannelID channel, PlinkPacket *pkt)
char buf[CMSG_SPACE(sizeof(int))];
memset(buf, 0, sizeof(buf));
ctx->io[0].iov_base = ctx->buffer + ctx->offset;
ctx->io[0].iov_len = MAX_BUFFER_SIZE - ctx->offset;
ctx->ioIn[0].iov_base = ctx->buffer + ctx->offset;
ctx->ioIn[0].iov_len = MAX_BUFFER_SIZE - ctx->offset;
struct msghdr msg = {0};
msg.msg_iov = ctx->io;
msg.msg_iov = ctx->ioIn;
msg.msg_iovlen = 1;
msg.msg_control = buf;
msg.msg_controllen = sizeof(buf);
@@ -477,6 +478,8 @@ parseData(PlinkContext *ctx, PlinkPacket *pkt, int remaining)
{
// not enough buffer to store received data, need another recv call
sts = PLINK_STATUS_MORE_DATA;
PLINK_PRINT(ERROR, "sts:%d Received %d bytes,index exceed max:%d!\n",
sts, remaining, PLINK_MAX_DATA_DESCS);
break;
}

View File

@@ -349,7 +349,7 @@ static int stitchOneFrame(StitcherContext *ctx)
in->format == PLINK_COLOR_FormatRawBayer10bit ||
in->format == PLINK_COLOR_FormatRawBayer12bit)
{
int shift = in->format == PLINK_COLOR_FormatYUV420SemiPlanarP010 ? 2 : 8;
int shift = in->format == PLINK_COLOR_FormatYUV420SemiPlanarP010 ? 2 : 4;
unsigned int temp[4];
for (int h = 0; h < height; h++)
{