mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-30 00:41:19 +02:00
- libeplayer3: sync with max_10
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <libavutil/intreadwrite.h>
|
||||
#include "ffmpeg/latmenc.h"
|
||||
#include "ffmpeg/mpeg4audio.h"
|
||||
#include "stm_ioctls.h"
|
||||
|
||||
#include "common.h"
|
||||
@@ -63,6 +64,8 @@
|
||||
/* Variables */
|
||||
/* ***************************** */
|
||||
|
||||
static bool needInitHeader = true;
|
||||
|
||||
/// ** AAC ADTS format **
|
||||
///
|
||||
/// AAAAAAAA AAAABCCD EEFFFFGH HHIJKLMM
|
||||
@@ -127,6 +130,7 @@ static int reset()
|
||||
free(pLATMCtx);
|
||||
pLATMCtx = NULL;
|
||||
}
|
||||
needInitHeader = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -168,7 +172,7 @@ static int _writeData(void *_call, int type)
|
||||
else // check LOAS header
|
||||
{
|
||||
if (!(call->len > 2 && call->data[0] == 0x56 && (call->data[1] >> 4) == 0xe &&
|
||||
(AV_RB16(call->data + 1) & 0x1FFF) + 3 == call->len))
|
||||
(AV_RB16(call->data + 1) & 0x1FFF) + 3 == call->len))
|
||||
{
|
||||
aac_err("parsing Data with wrong latm header. ignoring...\n");
|
||||
return 0;
|
||||
@@ -214,15 +218,17 @@ static int writeDataADTS(void *_call)
|
||||
}
|
||||
|
||||
if ((call->private_data && 0 == strncmp("ADTS", call->private_data, call->private_size)) ||
|
||||
HasADTSHeader(call->data, call->len))
|
||||
HasADTSHeader(call->data, call->len))
|
||||
{
|
||||
return _writeData(_call, 0);
|
||||
}
|
||||
|
||||
uint32_t PacketLength = call->len + AAC_HEADER_LENGTH;
|
||||
uint8_t PesHeader[PES_MAX_HEADER_SIZE + AAC_HEADER_LENGTH];
|
||||
uint32_t adtsHeaderSize = (call->private_data == NULL || needInitHeader == false) ? AAC_HEADER_LENGTH : call->private_size;
|
||||
uint32_t PacketLength = call->len + adtsHeaderSize;
|
||||
uint8_t PesHeader[PES_MAX_HEADER_SIZE + AAC_HEADER_LENGTH + MAX_PCE_SIZE];
|
||||
uint32_t headerSize = InsertPesHeader(PesHeader, PacketLength, MPEG_AUDIO_PES_START_CODE, call->Pts, 0);
|
||||
uint8_t *pExtraData = &PesHeader[headerSize];
|
||||
needInitHeader = false;
|
||||
|
||||
aac_printf(10, "AudioPts %lld\n", call->Pts);
|
||||
if (call->private_data == NULL)
|
||||
@@ -232,7 +238,7 @@ static int writeDataADTS(void *_call)
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(pExtraData, call->private_data, AAC_HEADER_LENGTH);
|
||||
memcpy(pExtraData, call->private_data, adtsHeaderSize);
|
||||
}
|
||||
|
||||
pExtraData[3] &= 0xC0;
|
||||
@@ -250,7 +256,7 @@ static int writeDataADTS(void *_call)
|
||||
|
||||
struct iovec iov[2];
|
||||
iov[0].iov_base = PesHeader;
|
||||
iov[0].iov_len = headerSize + AAC_HEADER_LENGTH;
|
||||
iov[0].iov_len = headerSize + adtsHeaderSize;
|
||||
iov[1].iov_base = call->data;
|
||||
iov[1].iov_len = call->len;
|
||||
|
||||
|
Reference in New Issue
Block a user