summaryrefslogtreecommitdiff
path: root/command
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2011-03-14 23:08:40 +0100
committerJochen Dolze <vdr@dolze.de>2011-03-14 23:08:40 +0100
commit0662afd6d8816713ebeef519b38456d0f57a837b (patch)
treed16c991b8677d6c068d9b20281951097256310cd /command
parentad13e186a657a6d2488dcc608ef670804107f4a7 (diff)
downloadvdr-plugin-markad-0662afd6d8816713ebeef519b38456d0f57a837b.tar.gz
vdr-plugin-markad-0662afd6d8816713ebeef519b38456d0f57a837b.tar.bz2
Added -O3 and -funroll-loops in Makefile
Reverted cutval to 127, adding commandline argument later Fixed demux error with TS files Added more info messages
Diffstat (limited to 'command')
-rw-r--r--command/Makefile2
-rw-r--r--command/decoder.cpp22
-rw-r--r--command/decoder.h4
-rw-r--r--command/demux.cpp59
-rw-r--r--command/demux.h4
-rw-r--r--command/video.cpp4
6 files changed, 76 insertions, 19 deletions
diff --git a/command/Makefile b/command/Makefile
index 5173b3e..810afa9 100644
--- a/command/Makefile
+++ b/command/Makefile
@@ -12,7 +12,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' ../version.h | awk '{ pr
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -g -rdynamic -O3 -Wall -Wextra -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -rdynamic -O3 -funroll-loops -Wall -Wextra -Woverloaded-virtual -Wno-parentheses
PKG-CONFIG ?= pkg-config
STRIP ?= strip
diff --git a/command/decoder.cpp b/command/decoder.cpp
index 9b3fcca..2a8f9a3 100644
--- a/command/decoder.cpp
+++ b/command/decoder.cpp
@@ -103,6 +103,10 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3, int Threa
last_qscale_table=NULL;
skipframes=true;
+ noticeERRVID=false;
+ noticeERRMP2=false;
+ noticeERRAC3=false;
+
cpu_set_t cpumask;
uint len = sizeof(cpumask);
int cpucount;
@@ -476,7 +480,11 @@ bool cMarkAdDecoder::DecodeMP2(MarkAdContext *maContext, uchar *espkt, int eslen
#endif
if (len<0)
{
- esyslog("error decoding mp2");
+ if (!noticeERRMP2)
+ {
+ esyslog("error decoding mp2");
+ noticeERRMP2=true;
+ }
break;
}
if (audiobufsize>0)
@@ -517,7 +525,11 @@ bool cMarkAdDecoder::DecodeAC3(MarkAdContext *maContext, uchar *espkt, int eslen
#endif
if (len<0)
{
- esyslog("error decoding ac3");
+ if (!noticeERRAC3)
+ {
+ esyslog("error decoding ac3");
+ noticeERRAC3=true;
+ }
break;
}
if (audiobufsize>0)
@@ -603,7 +615,11 @@ bool cMarkAdDecoder::DecodeVideo(MarkAdContext *maContext,uchar *pkt, int plen)
#endif
if (len<0)
{
- esyslog("error decoding video");
+ if (!noticeERRVID)
+ {
+ esyslog("error decoding video");
+ noticeERRVID=true;
+ }
break;
}
else
diff --git a/command/decoder.h b/command/decoder.h
index ff03f6f..0ea6e47 100644
--- a/command/decoder.h
+++ b/command/decoder.h
@@ -58,6 +58,10 @@ private:
bool SetVideoInfos(MarkAdContext *maContext,AVCodecContext *Video_Context,
AVFrame *Video_Frame);
+
+ bool noticeERRVID;
+ bool noticeERRMP2;
+ bool noticeERRAC3;
public:
bool DecodeVideo(MarkAdContext *maContext, uchar *pkt, int plen);
bool DecodeMP2(MarkAdContext *maContext, uchar *espkt, int eslen);
diff --git a/command/demux.cpp b/command/demux.cpp
index addc95f..88f3048 100644
--- a/command/demux.cpp
+++ b/command/demux.cpp
@@ -352,7 +352,19 @@ int cPaketQueue::findaudioheader(int start, int *framesize, int *headersize, boo
}
}
-int cPaketQueue::FindPesHeader(int Start)
+int cPaketQueue::FindTSHeader(int Start)
+{
+ int start=outptr+Start;
+ int i=0;
+ for (i=start; i<inptr; i++)
+ {
+ if (buffer[i]==0x47) break;
+ }
+ if (i==inptr) return -1;
+ return i;
+}
+
+int cPaketQueue::FindPESHeader(int Start)
{
int start=outptr+Start;
int ssize,hsize;
@@ -580,6 +592,7 @@ void cTS2Pkt::Clear()
noticeFILLER=false;
noticeSEQUENCE=false;
noticeSTREAM=false;
+ noticeTSERR=false;
if (queue) queue->Clear();
}
@@ -638,6 +651,12 @@ bool cTS2Pkt::Process(uchar *TSData, int TSSize, AvPacket *Pkt)
return true;
}
+ if ((tshdr->TError) && (!noticeTSERR))
+ {
+ noticeTSERR=true;
+ isyslog("stream error bit set");
+ }
+
int buflen=TS_SIZE+1;
uchar *buf=NULL;
@@ -912,13 +931,14 @@ bool cDemux::isvideopes(uchar *data, int count)
int cDemux::checkts(uchar *data, int count, int &pid)
{
+ pid=-1;
if (count<(int) sizeof(struct TSHDR)) return -1;
if (data[0]!=0x47) return 1;
struct TSHDR *tshdr = (struct TSHDR *) data;
+ pid = (tshdr->PidH << 8) | tshdr->PidL;
if ((tshdr->AFC<=0) || (tshdr->AFC>3)) return 1;
- pid = (tshdr->PidH << 8) | tshdr->PidL;
return 0;
}
@@ -952,19 +972,19 @@ int cDemux::fillqueue(uchar *data, int count, int &stream_or_pid, int &packetsiz
skipped++;
stream_or_pid=0;
packetsize=1;
- return 0;
+ return 0; // no useable data found, try next byte!
}
}
else
{
- int error_skipbytes=checkts(qData,PEEKBUF,stream_or_pid);
- if (error_skipbytes==-1) return -1;
- if (error_skipbytes)
+ int ret=checkts(qData,PEEKBUF,stream_or_pid);
+ if (ret==-1) return -1;
+ if (ret)
{
- skipped+=error_skipbytes;
+ skipped++;
stream_or_pid=0;
packetsize=1;
- return error_skipbytes; // no useable data found, try next!
+ return 0; // no useable data found, try next byte!
}
packetsize=TS_SIZE;
}
@@ -989,8 +1009,8 @@ int cDemux::fillqueue(uchar *data, int count, int &stream_or_pid, int &packetsiz
int start=packetsize;
if ((qData[start]!=0) || (qData[start+1]!=0) || (qData[start+2]!=1) || (qData[start+3]<0xBC))
{
- int start=queue->FindPesHeader(1);
- if (start)
+ int start=queue->FindPESHeader(1);
+ if (start>0)
{
// broken PES in queue, skip it
packetsize=start;
@@ -1000,7 +1020,8 @@ int cDemux::fillqueue(uchar *data, int count, int &stream_or_pid, int &packetsiz
}
else
{
- return -1;
+ // try to use the first packet
+ return 0;
}
}
}
@@ -1019,7 +1040,21 @@ int cDemux::fillqueue(uchar *data, int count, int &stream_or_pid, int &packetsiz
}
if (ret)
{
- return -1;
+ if (pid!=-1) return 0; // next packet is broken!
+ int start=queue->FindTSHeader(1);
+ if (start>0)
+ {
+ // broken TS in queue, skip it
+ packetsize=start;
+ skipped+=start;
+ stream_or_pid=0;
+ return 0;
+ }
+ else
+ {
+ // try to use the first packet
+ return 0;
+ }
}
}
}
diff --git a/command/demux.h b/command/demux.h
index 2299e6b..4d53a95 100644
--- a/command/demux.h
+++ b/command/demux.h
@@ -207,7 +207,8 @@ public:
return ((scannerstart==inptr) || (scannerstart==outptr));
}
}
- int FindPesHeader(int Start);
+ int FindPESHeader(int Start);
+ int FindTSHeader(int Start);
};
// ----------------------------------------------------------------------------
@@ -225,6 +226,7 @@ private:
bool noticeFILLER;
bool noticeSEQUENCE;
bool noticeSTREAM;
+ bool noticeTSERR;
public:
cTS2Pkt(int Pid, const char *QueueName="TS2Pkt", int QueueSize=32768, bool H264=false);
~cTS2Pkt();
diff --git a/command/video.cpp b/command/video.cpp
index 9233d9a..7cbadb3 100644
--- a/command/video.cpp
+++ b/command/video.cpp
@@ -223,8 +223,8 @@ int cMarkAdLogo::SobelPlane(int plane)
}
int boundary=6;
- //int cutval=127;
- int cutval=32;
+ int cutval=127;
+ //int cutval=32;
int width=LOGOWIDTH;
if (plane>0)