From 9d22af41c5202aead24e1c9204fc6e0dce2dba00 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 14 Jul 2013 16:07:15 +0200 Subject: [PATCH] libeplayer3/h264: unbreak Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/12b77f59a76195777fdb4668a7f5228f087fd6e8 Author: martii Date: 2013-07-14 (Sun, 14 Jul 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3/output/writer/h264.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libeplayer3/output/writer/h264.c b/libeplayer3/output/writer/h264.c index 749997b..13dcfc5 100644 --- a/libeplayer3/output/writer/h264.c +++ b/libeplayer3/output/writer/h264.c @@ -92,6 +92,7 @@ typedef struct avcC_s /* ***************************** */ const unsigned char Head[] = {0, 0, 0, 1}; static int initialHeader = 1; +//static int NoOtherBeginningFound = 1; static unsigned int NalLengthBytes = 1; /* ***************************** */ @@ -105,6 +106,7 @@ static unsigned int NalLengthBytes = 1; static int reset() { initialHeader = 1; + //NoOtherBeginningFound = 1; return 0; } @@ -117,10 +119,6 @@ static int writeData(void* _call) unsigned int TimeDelta; unsigned int TimeScale; 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; struct iovec iov[128]; h264_printf(10, "\n"); @@ -149,11 +147,10 @@ static int writeData(void* _call) return 0; } -#if 0 // 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) || - (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)) + 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] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff))) { unsigned int PacketLength = 0; 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); return writev(call->fd, iov, ic); } - NoOtherBeginningFound = 0; -#endif + //NoOtherBeginningFound = 0; if (initialHeader) {