libeplayer3: experimental fixes

This commit is contained in:
martii
2013-01-17 18:37:45 +01:00
committed by Stefan Seyfried
parent fd72343f69
commit 0bee4efa6e
2 changed files with 29 additions and 0 deletions

View File

@@ -37,6 +37,9 @@
#include <asm/types.h>
#include <pthread.h>
#include <errno.h>
#ifdef MARTII
#include <sys/uio.h>
#endif
#include "common.h"
#include "output.h"
@@ -247,17 +250,38 @@ static int writeData(void* _call)
{
aac_printf(10, "private_data = NULL\n");
#ifdef MARTII
memcpy (ExtraData, DefaultAACHeader, AAC_HEADER_LENGTH);
#else
call->private_data = DefaultAACHeader;
call->private_size = AAC_HEADER_LENGTH;
#endif
}
#ifdef MARTII
else
#endif
memcpy (ExtraData, call->private_data, AAC_HEADER_LENGTH);
#ifdef MARTII
ExtraData[3] |= (PacketLength >> 11) & 0x3;
#else
ExtraData[3] |= (PacketLength >> 12) & 0x3;
#endif
ExtraData[4] = (PacketLength >> 3) & 0xff;
ExtraData[5] |= (PacketLength << 5) & 0xe0;
unsigned int HeaderLength = InsertPesHeader (PesHeader, PacketLength, AAC_AUDIO_PES_START_CODE, call->Pts, 0);
#ifdef MARTII
struct iovec iov[3];
iov[0].iov_base = PesHeader;
iov[0].iov_len = HeaderLength;
iov[1].iov_base = ExtraData;
iov[1].iov_len = AAC_HEADER_LENGTH;
iov[2].iov_base = call->data;
iov[2].iov_len = call->len;
return writev(call->fd, iov, 3);
#else
unsigned char* PacketStart = malloc(HeaderLength + sizeof(ExtraData) + call->len);
memcpy (PacketStart, PesHeader, HeaderLength);
memcpy (PacketStart + HeaderLength, ExtraData, sizeof(ExtraData));
@@ -270,6 +294,7 @@ static int writeData(void* _call)
free(PacketStart);
return len;
#endif
}
/* ***************************** */