libeplayer3/h264: unbreak

This commit is contained in:
martii
2013-07-14 16:07:15 +02:00
parent ea4054f258
commit 876c7e95e1

View File

@@ -92,6 +92,7 @@ typedef struct avcC_s
/* ***************************** */ /* ***************************** */
const unsigned char Head[] = {0, 0, 0, 1}; const unsigned char Head[] = {0, 0, 0, 1};
static int initialHeader = 1; static int initialHeader = 1;
//static int NoOtherBeginningFound = 1;
static unsigned int NalLengthBytes = 1; static unsigned int NalLengthBytes = 1;
/* ***************************** */ /* ***************************** */
@@ -105,6 +106,7 @@ static unsigned int NalLengthBytes = 1;
static int reset() static int reset()
{ {
initialHeader = 1; initialHeader = 1;
//NoOtherBeginningFound = 1;
return 0; return 0;
} }
@@ -117,10 +119,6 @@ static int writeData(void* _call)
unsigned int TimeDelta; unsigned int TimeDelta;
unsigned int TimeScale; unsigned int TimeScale;
int len = 0; int len = 0;
#if 0
// This should at least be set to 1 in reset(), but seems to make playback unreliable. Disabled for now. --martii
static int NoOtherBeginningFound = 1;
#endif
int ic = 0; int ic = 0;
struct iovec iov[128]; struct iovec iov[128];
h264_printf(10, "\n"); h264_printf(10, "\n");
@@ -149,11 +147,10 @@ static int writeData(void* _call)
return 0; return 0;
} }
#if 0
// This seems to make playback unreliable. Disabled for now. --martii // This seems to make playback unreliable. Disabled for now. --martii
if((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) || if((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) ||
(call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x01 && NoOtherBeginningFound) || //(call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x01 && NoOtherBeginningFound) ||
(call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)) (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))
{ {
unsigned int PacketLength = 0; unsigned int PacketLength = 0;
unsigned int FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE; unsigned int FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE;
@@ -175,8 +172,7 @@ static int writeData(void* _call)
iov[0].iov_len = InsertPesHeader(PesHeader, PacketLength, MPEG_VIDEO_PES_START_CODE, call->Pts, FakeStartCode); iov[0].iov_len = InsertPesHeader(PesHeader, PacketLength, MPEG_VIDEO_PES_START_CODE, call->Pts, FakeStartCode);
return writev(call->fd, iov, ic); return writev(call->fd, iov, ic);
} }
NoOtherBeginningFound = 0; //NoOtherBeginningFound = 0;
#endif
if (initialHeader) if (initialHeader)
{ {