summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-11-22 01:17:28 +0100
committerJochen Dolze <vdr@dolze.de>2010-11-22 01:17:28 +0100
commit2e9d23ab5e3cc12ce58042afdc2d77d098fd498e (patch)
tree2f5887a3b32d4627d6658f1a44998d9145332900
parent1da680d035c377fa6ec94cc97f786f43b07eea2b (diff)
downloadvdr-plugin-markad-2e9d23ab5e3cc12ce58042afdc2d77d098fd498e.tar.gz
vdr-plugin-markad-2e9d23ab5e3cc12ce58042afdc2d77d098fd498e.tar.bz2
Fixed bug found by neptunvasja
-rw-r--r--command/markad-standalone.cpp2
-rw-r--r--command/queue.cpp58
-rw-r--r--command/ts2pkt.cpp20
3 files changed, 73 insertions, 7 deletions
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
index 3c3b6be..35527f0 100644
--- a/command/markad-standalone.cpp
+++ b/command/markad-standalone.cpp
@@ -1301,7 +1301,7 @@ bool cMarkAdStandalone::ProcessFile(int Number)
if (macontext.Video.Info.FramesPerSecond<0)
{
macontext.Video.Info.FramesPerSecond*=-1;
- if (!setFrameRate) isyslog("framerate in info wrong, setting to %.f",macontext.Video.Info.FramesPerSecond);
+ if (!setFrameRate) isyslog("framerate wrong or unset, using %.f",macontext.Video.Info.FramesPerSecond);
setFrameRate=true;
}
diff --git a/command/queue.cpp b/command/queue.cpp
index 9a312e2..65188e4 100644
--- a/command/queue.cpp
+++ b/command/queue.cpp
@@ -163,24 +163,72 @@ int cMarkAdPaketQueue::FindPktHeader(int Start, int *StreamSize,int *HeaderSize,
scanner|=buffer[Start++];
}
+ bool found=false;
for (i=Start; i<inptr; i++)
{
if (LongStartCode)
{
- if (scanner==1L) break;
- if ((scanner & 0xFFFFFFF0)==0x1E0L) break;
+ if (scanner==1L)
+ {
+ found=true;
+ break;
+ }
+ if ((scanner & 0xFFFFFFF0)==0x1E0L)
+ {
+ found=true;
+ break;
+ }
}
else
{
- if ((scanner & 0x00FFFFFF)==1L) break;
+ if ((scanner & 0x00FFFFFF)==1L)
+ {
+ found=true;
+ break;
+ }
}
scanner<<=8;
scanner|=buffer[i];
}
+ if (!found)
+ {
+ if (LongStartCode)
+ {
+ if (scanner==1L)
+ {
+ found=true;
+ }
+ if ((scanner & 0xFFFFFFF0)==0x1E0L)
+ {
+ found=true;
+ }
+ }
+ else
+ {
+ if ((scanner & 0x00FFFFFF)==1L)
+ {
+ found=true;
+ }
+ }
+ }
- if (i==inptr) return -1;
+ if (i==inptr)
+ {
+ if (found)
+ {
+ if (!Start)
+ {
+ scanner=0xFFFFFFFF;
+ return -1;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ }
if (LongStartCode) i--;
- if (buffer[i]>=0xBC)// do we have a PES packet?
+ if ((buffer[i]>=0xBC) && (!Start)) // do we have a PES packet?
{
#define PESHDRSIZE 6
if ((i+PESHDRSIZE)>inptr)
diff --git a/command/ts2pkt.cpp b/command/ts2pkt.cpp
index 8667fd6..3fbfa75 100644
--- a/command/ts2pkt.cpp
+++ b/command/ts2pkt.cpp
@@ -136,7 +136,10 @@ bool cMarkAdTS2Pkt::Process(MarkAdPid Pid, uchar *TSData, int TSSize, MarkAdPack
}
counter=tshdr->Counter;
- if (tshdr->PayloadStart) sync=true;
+ if (tshdr->PayloadStart)
+ {
+ sync=true;
+ }
if (!sync)
{
return false; // not synced
@@ -188,6 +191,21 @@ bool cMarkAdTS2Pkt::Process(MarkAdPid Pid, uchar *TSData, int TSSize, MarkAdPack
return false;
}
+ if (tshdr->PayloadStart)
+ {
+ if ((buf[0]!=0) && (buf[1]!=0))
+ {
+ sync=false;
+ if (buflen<7) return false;
+ // add a pseudo padding stream
+ buf[0]=0;
+ buf[1]=0;
+ buf[2]=1;
+ buf[3]=0xbe;
+ buf[4]=buflen-6;
+ buf[5]=0;
+ }
+ }
queue->Put(buf,buflen);
}
if (!ret) return ret;