mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-31 17:31:22 +02:00
libeplayer3: further malloc-memcpy-write -> writev replacements; not fully regression tested
This commit is contained in:
@@ -37,9 +37,7 @@
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#ifdef MARTII
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
@@ -96,9 +94,6 @@ static int writeData(void* _call)
|
||||
WriterAVCallData_t* call = (WriterAVCallData_t*) _call;
|
||||
|
||||
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
||||
#ifndef MARTII
|
||||
unsigned char DataCopy[PES_MAX_HEADER_SIZE];
|
||||
#endif
|
||||
int len = 0;
|
||||
|
||||
h263_printf(10, "\n");
|
||||
@@ -136,30 +131,12 @@ static int writeData(void* _call)
|
||||
|
||||
HeaderLength += PrivateHeaderLength;
|
||||
|
||||
#ifdef MARTII
|
||||
struct iovec iov[2];
|
||||
iov[0].iov_base = PesHeader;
|
||||
iov[0].iov_len = HeaderLength;
|
||||
iov[1].iov_base = call->data;
|
||||
iov[1].iov_len = call->len;
|
||||
len = writev(call->fd, iov, 2);
|
||||
#else
|
||||
unsigned char *PacketData = malloc(HeaderLength + call->len);
|
||||
|
||||
if(PacketData != NULL)
|
||||
{
|
||||
memcpy(PacketData, PesHeader, HeaderLength);
|
||||
memcpy(PacketData + HeaderLength, call->data, call->len);
|
||||
|
||||
len = write(call->fd, PacketData, call->len + HeaderLength);
|
||||
|
||||
free(PacketData);
|
||||
}
|
||||
else
|
||||
{
|
||||
h263_err("no mem\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
h263_printf(10, "< len %d\n", len);
|
||||
return len;
|
||||
|
Reference in New Issue
Block a user