mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-30 17:01:16 +02:00
libeplayer3: run through indent, no binary change
This commit is contained in:
@@ -85,20 +85,20 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x);
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
||||
static const unsigned char SequenceLayerStartCode[] = {0x00, 0x00, 0x01, VC1_SEQUENCE_LAYER_METADATA_START_CODE};
|
||||
static const unsigned char SequenceLayerStartCode[] =
|
||||
{ 0x00, 0x00, 0x01, VC1_SEQUENCE_LAYER_METADATA_START_CODE };
|
||||
|
||||
|
||||
static const unsigned char Metadata[] =
|
||||
{
|
||||
0x00, 0x00, 0x00, 0xc5,
|
||||
0x04, 0x00, 0x00, 0x00,
|
||||
0xc0, 0x00, 0x00, 0x00, /* Struct C set for for advanced profile*/
|
||||
0x00, 0x00, 0x00, 0x00, /* Struct A */
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, /* Struct B */
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
static const unsigned char Metadata[] = {
|
||||
0x00, 0x00, 0x00, 0xc5,
|
||||
0x04, 0x00, 0x00, 0x00,
|
||||
0xc0, 0x00, 0x00, 0x00, /* Struct C set for for advanced profile */
|
||||
0x00, 0x00, 0x00, 0x00, /* Struct A */
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x0c, 0x00, 0x00, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, /* Struct B */
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/* ***************************** */
|
||||
@@ -121,9 +121,9 @@ static int reset()
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int writeData(void* _call)
|
||||
static int writeData(void *_call)
|
||||
{
|
||||
WriterAVCallData_t* call = (WriterAVCallData_t*) _call;
|
||||
WriterAVCallData_t *call = (WriterAVCallData_t *) _call;
|
||||
|
||||
int len = 0;
|
||||
|
||||
@@ -151,81 +151,94 @@ static int writeData(void* _call)
|
||||
|
||||
if (initialHeader) {
|
||||
|
||||
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
||||
unsigned char PesPayload[128];
|
||||
unsigned char* PesPtr;
|
||||
unsigned int crazyFramerate = 0;
|
||||
struct iovec iov[2];
|
||||
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
||||
unsigned char PesPayload[128];
|
||||
unsigned char *PesPtr;
|
||||
unsigned int crazyFramerate = 0;
|
||||
struct iovec iov[2];
|
||||
|
||||
vc1_printf(10, "Framerate: %u\n", call->FrameRate);
|
||||
vc1_printf(10, "biWidth: %d\n", call->Width);
|
||||
vc1_printf(10, "biHeight: %d\n", call->Height);
|
||||
vc1_printf(10, "biWidth: %d\n", call->Width);
|
||||
vc1_printf(10, "biHeight: %d\n", call->Height);
|
||||
|
||||
crazyFramerate = ((10000000.0 / call->FrameRate) * 1000.0);
|
||||
vc1_printf(10, "crazyFramerate: %u\n", crazyFramerate);
|
||||
|
||||
memset(PesPayload, 0, sizeof(PesPayload));
|
||||
|
||||
PesPtr = PesPayload;
|
||||
PesPtr = PesPayload;
|
||||
|
||||
memcpy (PesPtr, SequenceLayerStartCode, sizeof(SequenceLayerStartCode));
|
||||
PesPtr += sizeof(SequenceLayerStartCode);
|
||||
memcpy(PesPtr, SequenceLayerStartCode,
|
||||
sizeof(SequenceLayerStartCode));
|
||||
PesPtr += sizeof(SequenceLayerStartCode);
|
||||
|
||||
memcpy (PesPtr, Metadata, sizeof(Metadata));
|
||||
memcpy(PesPtr, Metadata, sizeof(Metadata));
|
||||
PesPtr += METADATA_STRUCT_C_START;
|
||||
PesPtr += WMV3_PRIVATE_DATA_LENGTH;
|
||||
|
||||
/* Metadata Header Struct A */
|
||||
*PesPtr++ = (call->Height >> 0) & 0xff;
|
||||
*PesPtr++ = (call->Height >> 8) & 0xff;
|
||||
*PesPtr++ = (call->Height >> 0) & 0xff;
|
||||
*PesPtr++ = (call->Height >> 8) & 0xff;
|
||||
*PesPtr++ = (call->Height >> 16) & 0xff;
|
||||
*PesPtr++ = call->Height >> 24;
|
||||
*PesPtr++ = (call->Width >> 0) & 0xff;
|
||||
*PesPtr++ = (call->Width >> 8) & 0xff;
|
||||
*PesPtr++ = (call->Width >> 16) & 0xff;
|
||||
*PesPtr++ = call->Width >> 24;
|
||||
*PesPtr++ = call->Height >> 24;
|
||||
*PesPtr++ = (call->Width >> 0) & 0xff;
|
||||
*PesPtr++ = (call->Width >> 8) & 0xff;
|
||||
*PesPtr++ = (call->Width >> 16) & 0xff;
|
||||
*PesPtr++ = call->Width >> 24;
|
||||
|
||||
PesPtr += 12; /* Skip flag word and Struct B first 8 bytes */
|
||||
PesPtr += 12; /* Skip flag word and Struct B first 8 bytes */
|
||||
|
||||
*PesPtr++ = (crazyFramerate >> 0) & 0xff;
|
||||
*PesPtr++ = (crazyFramerate >> 8) & 0xff;
|
||||
*PesPtr++ = (crazyFramerate >> 0) & 0xff;
|
||||
*PesPtr++ = (crazyFramerate >> 8) & 0xff;
|
||||
*PesPtr++ = (crazyFramerate >> 16) & 0xff;
|
||||
*PesPtr++ = crazyFramerate >> 24;
|
||||
*PesPtr++ = crazyFramerate >> 24;
|
||||
|
||||
iov[0].iov_base = PesHeader;
|
||||
iov[1].iov_base = PesPayload;
|
||||
iov[1].iov_len = PesPtr - PesPayload;
|
||||
iov[0].iov_len = InsertPesHeader (PesHeader, iov[1].iov_len, VC1_VIDEO_PES_START_CODE, INVALID_PTS_VALUE, 0);
|
||||
iov[0].iov_len =
|
||||
InsertPesHeader(PesHeader, iov[1].iov_len,
|
||||
VC1_VIDEO_PES_START_CODE, INVALID_PTS_VALUE,
|
||||
0);
|
||||
len = writev(call->fd, iov, 2);
|
||||
|
||||
/* For VC1 the codec private data is a standard vc1 sequence header so we just copy it to the output */
|
||||
iov[0].iov_base = PesHeader;
|
||||
iov[1].iov_base = call->private_data;
|
||||
iov[1].iov_len = call->private_size;
|
||||
iov[0].iov_len = InsertPesHeader (PesHeader, iov[1].iov_len, VC1_VIDEO_PES_START_CODE, INVALID_PTS_VALUE, 0);
|
||||
iov[0].iov_len =
|
||||
InsertPesHeader(PesHeader, iov[1].iov_len,
|
||||
VC1_VIDEO_PES_START_CODE, INVALID_PTS_VALUE,
|
||||
0);
|
||||
len = writev(call->fd, iov, 2);
|
||||
|
||||
initialHeader = 0;
|
||||
}
|
||||
|
||||
if(call->len > 0 && call->data) {
|
||||
if (call->len > 0 && call->data) {
|
||||
unsigned int Position = 0;
|
||||
unsigned char insertSampleHeader = 1;
|
||||
|
||||
while(Position < call->len) {
|
||||
while (Position < call->len) {
|
||||
|
||||
int PacketLength = (call->len - Position) <= MAX_PES_PACKET_SIZE ?
|
||||
(call->len - Position) : MAX_PES_PACKET_SIZE;
|
||||
int PacketLength =
|
||||
(call->len - Position) <=
|
||||
MAX_PES_PACKET_SIZE ? (call->len -
|
||||
Position) : MAX_PES_PACKET_SIZE;
|
||||
|
||||
int Remaining = call->len - Position - PacketLength;
|
||||
|
||||
vc1_printf(20, "PacketLength=%d, Remaining=%d, Position=%d\n", PacketLength, Remaining, Position);
|
||||
vc1_printf(20, "PacketLength=%d, Remaining=%d, Position=%d\n",
|
||||
PacketLength, Remaining, Position);
|
||||
|
||||
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
||||
int HeaderLength = InsertPesHeader (PesHeader, PacketLength, VC1_VIDEO_PES_START_CODE, call->Pts, 0);
|
||||
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
||||
int HeaderLength =
|
||||
InsertPesHeader(PesHeader, PacketLength,
|
||||
VC1_VIDEO_PES_START_CODE, call->Pts, 0);
|
||||
|
||||
if(insertSampleHeader) {
|
||||
const unsigned char Vc1FrameStartCode[] = {0, 0, 1, VC1_FRAME_START_CODE};
|
||||
if (insertSampleHeader) {
|
||||
const unsigned char Vc1FrameStartCode[] =
|
||||
{ 0, 0, 1, VC1_FRAME_START_CODE };
|
||||
|
||||
/*
|
||||
vc1_printf(10, "Data Start: {00 00 01 0d} - ");
|
||||
@@ -234,13 +247,14 @@ static int writeData(void* _call)
|
||||
vc1_printf(10, "\n");
|
||||
*/
|
||||
|
||||
if (!FrameHeaderSeen && (call->len > 3) && (memcmp (call->data, Vc1FrameStartCode, 4) == 0))
|
||||
FrameHeaderSeen = 1;
|
||||
if (!FrameHeaderSeen)
|
||||
{
|
||||
memcpy (&PesHeader[HeaderLength], Vc1FrameStartCode, sizeof(Vc1FrameStartCode));
|
||||
HeaderLength += sizeof(Vc1FrameStartCode);
|
||||
}
|
||||
if (!FrameHeaderSeen && (call->len > 3)
|
||||
&& (memcmp(call->data, Vc1FrameStartCode, 4) == 0))
|
||||
FrameHeaderSeen = 1;
|
||||
if (!FrameHeaderSeen) {
|
||||
memcpy(&PesHeader[HeaderLength], Vc1FrameStartCode,
|
||||
sizeof(Vc1FrameStartCode));
|
||||
HeaderLength += sizeof(Vc1FrameStartCode);
|
||||
}
|
||||
insertSampleHeader = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user