summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command/demux.cpp12
-rw-r--r--command/demux.h1
-rw-r--r--command/streaminfo.cpp67
3 files changed, 50 insertions, 30 deletions
diff --git a/command/demux.cpp b/command/demux.cpp
index 5e7bf86..17008b9 100644
--- a/command/demux.cpp
+++ b/command/demux.cpp
@@ -112,6 +112,7 @@ int cPaketQueue::findpktheader(int start, int *streamsize,int *headersize, bool
{
if (scanner==1L)
{
+ if (buffer[i]==0xE0) longstartcode=false;
found=true;
break;
}
@@ -149,6 +150,7 @@ int cPaketQueue::findpktheader(int start, int *streamsize,int *headersize, bool
{
if (scanner==1L)
{
+ if (buffer[i]==0xE0) longstartcode=false;
found=true;
}
if ((scanner & 0xFFFFFFF0)==0x1E0L)
@@ -389,9 +391,9 @@ bool cPaketQueue::Put(uchar *Data, int Size)
if (outptr>(inptr-outptr))
{
memcpy(buffer,&buffer[outptr],inptr-outptr);
- if (scannerstart==inptr) scannerstart-=outptr;
+ scannerstart-=outptr;
inptr-=outptr;
- if (pktinfo.pkthdr==outptr) pktinfo.pkthdr=0;
+ if (pktinfo.pkthdr>0) pktinfo.pkthdr-=outptr;
outptr=0;
}
}
@@ -540,6 +542,7 @@ uchar *cPaketQueue::GetPacket(int *Size, int Type)
else
{
scannerstart=pkthdr+pktsyncsize;
+ if (pktsyncsize>4) scanner=0xFFFFFFFF;
}
uchar *ptr=&buffer[pktinfo.pkthdr];
@@ -969,7 +972,7 @@ void cDemux::Clear()
if (ts2pkt_apid) ts2pkt_apid->Clear();
if (queue) queue->Clear();
- offset=0;
+ offset=rawoffset=0;
vdroffset=0;
last_bplen=0;
from_oldfile=0;
@@ -1266,6 +1269,7 @@ int cDemux::Process(uchar *Data, int Count, AvPacket *pkt)
bpkt=queue->Get(&bplen);
if (!bpkt) return -1;
last_bplen=bplen;
+ rawoffset+=bplen;
if ((vdrcount) && (TS)) vdraddpatpmt(bpkt,bplen);
}
@@ -1334,7 +1338,7 @@ int cDemux::Process(uchar *Data, int Count, AvPacket *pkt)
break;
}
}
- if (TS)
+ else
{
if (stream_or_pid==vpid)
{
diff --git a/command/demux.h b/command/demux.h
index ba71e30..8385b3e 100644
--- a/command/demux.h
+++ b/command/demux.h
@@ -326,6 +326,7 @@ private:
bool h264;
bool TS;
uint64_t offset;
+ uint64_t rawoffset;
int from_oldfile;
int last_bplen;
diff --git a/command/streaminfo.cpp b/command/streaminfo.cpp
index 62beb6f..8657bb2 100644
--- a/command/streaminfo.cpp
+++ b/command/streaminfo.cpp
@@ -121,7 +121,7 @@ bool cMarkAdStreamInfo::FindVideoInfos(MarkAdContext *maContext, uchar *pkt, int
}
return false;
}
-
+#include <stdio.h>
bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, int len)
{
if ((!maContext) || (!pkt) || (!len)) return false;
@@ -134,45 +134,60 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
if (pkt[5]==0x10)
{
maContext->Video.Info.Pict_Type=MA_I_TYPE;
+ H264.use_field=false;
return true;
}
else
{
- if (maContext->Video.Info.Interlaced) {
- if (H264.use_field) return true;
+ if (maContext->Video.Info.Interlaced)
+ {
+ if (H264.use_field) {
+ H264.use_field=false;
+ return true;
+ } else {
+ H264.use_field=true;
+ }
} else {
return true;
}
+
+ /*
+ if (maContext->Video.Info.Interlaced) {
+ if (H264.use_field) return true;
+ } else {
+ return true;
+ }
+ */
}
}
-
- if ((nalu==NAL_SLICE) || (nalu==NAL_IDR_SLICE))
- {
- uint8_t *nal_data=(uint8_t*) alloca(len);
- if (!nal_data) return false;
- int nal_len = nalUnescape(nal_data, pkt + 5, len - 5);
- cBitStream bs(nal_data, nal_len);
-
- bs.skipUeGolomb(); // first_mb_in_slice
- bs.skipUeGolomb(); // slice_type
- bs.skipUeGolomb(); // pic_parameter_set_id
- if (H264.separate_colour_plane_flag)
+ /*
+ if ((nalu==NAL_SLICE) || (nalu==NAL_IDR_SLICE))
{
- bs.skipBits(2); // colour_plane_id
- }
- bs.skipBits(H264.log2_max_frame_num); // frame_num
+ uint8_t *nal_data=(uint8_t*) alloca(len);
+ if (!nal_data) return false;
+ int nal_len = nalUnescape(nal_data, pkt + 5, len - 5);
+ cBitStream bs(nal_data, nal_len);
+
+ bs.skipUeGolomb(); // first_mb_in_slice
+ bs.skipUeGolomb(); // slice_type
+ bs.skipUeGolomb(); // pic_parameter_set_id
+ if (H264.separate_colour_plane_flag)
+ {
+ bs.skipBits(2); // colour_plane_id
+ }
+ bs.skipBits(H264.log2_max_frame_num); // frame_num
- if (maContext->Video.Info.Interlaced)
- {
- if (bs.getBit()) // field_pic_flag
+ if (maContext->Video.Info.Interlaced)
{
- H264.use_field=bs.getBit(); // bottom_field_flag
- } else {
- H264.use_field=true;
+ if (bs.getBit()) // field_pic_flag
+ {
+ H264.use_field=bs.getBit(); // bottom_field_flag
+ } else {
+ H264.use_field=true;
+ }
}
}
- }
-
+ */
if (nalu==NAL_SPS)
{
uint8_t *nal_data=(uint8_t*) alloca(len);