diff --git a/libeplayer3/include/pes.h b/libeplayer3/include/pes.h index a8eb3be..c6421f4 100644 --- a/libeplayer3/include/pes.h +++ b/libeplayer3/include/pes.h @@ -14,7 +14,11 @@ #define PES_VERSION_FAKE_START_CODE 0x31 +#ifdef MARTII +#define MAX_PES_PACKET_SIZE (6+65535) +#else #define MAX_PES_PACKET_SIZE 65400 +#endif /* start codes */ diff --git a/libeplayer3/output/writer/aac.c b/libeplayer3/output/writer/aac.c index 73c5f10..f527131 100644 --- a/libeplayer3/output/writer/aac.c +++ b/libeplayer3/output/writer/aac.c @@ -37,6 +37,9 @@ #include #include #include +#ifdef MARTII +#include +#endif #include "common.h" #include "output.h" @@ -246,17 +249,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)); @@ -269,6 +293,7 @@ static int writeData(void* _call) free(PacketStart); return len; +#endif } /* ***************************** */