summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--markad-standalone.cpp24
-rw-r--r--streaminfo.cpp74
-rw-r--r--streaminfo.h1
3 files changed, 70 insertions, 29 deletions
diff --git a/markad-standalone.cpp b/markad-standalone.cpp
index 823e0ce..26ca9d7 100644
--- a/markad-standalone.cpp
+++ b/markad-standalone.cpp
@@ -167,6 +167,9 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number)
if (!Directory) return false;
if (!Number) return false;
+ CheckIndex(true);
+ if (abort) return false;
+
int datalen=385024;
uchar data[datalen];
@@ -184,9 +187,6 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number)
free(fbuf);
if (f==-1) return false;
- CheckIndex(true);
- if (abort) return false;
-
int dataread;
dsyslog("processing file %05i",Number);
@@ -218,11 +218,9 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number)
{
if (!framecnt)
{
- if (macontext.General.VPid.Type==MARKAD_PIDTYPE_VIDEO_H264)
- {
- isyslog("HDTV %i%c",
- macontext.Video.Info.Height,macontext.Video.Info.Interlaced ? 'i' : 'p');
- }
+ isyslog("%s %i%c",(macontext.Video.Info.Height>576) ? "HDTV" : "SDTV",
+ macontext.Video.Info.Height,
+ macontext.Video.Info.Interlaced ? 'i' : 'p');
if (!marks.Load(Directory,macontext.Video.Info.FramesPerSecond,isTS))
{
AddStartMark();
@@ -757,12 +755,18 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
esyslog("no PAT/PMT found -> nothing to process");
abort=true;
}
- macontext.General.APid.Num=0;
+ if (!macontext.Audio.Options.AudioSilenceDetection)
+ {
+ macontext.General.APid.Num=0;
+ }
if (asprintf(&indexFile,"%s/index",Directory)==-1) indexFile=NULL;
}
else
{
- macontext.General.APid.Num=-1;
+ if (macontext.Audio.Options.AudioSilenceDetection)
+ {
+ macontext.General.APid.Num=-1;
+ }
macontext.General.DPid.Num=-1;
macontext.General.VPid.Num=-1;
diff --git a/streaminfo.cpp b/streaminfo.cpp
index 2eb1cc8..df789a4 100644
--- a/streaminfo.cpp
+++ b/streaminfo.cpp
@@ -189,10 +189,10 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
bs.skipBit(); // gaps_in_frame_num_value_allowed_flag
width = bs.getUeGolomb() + 1; // pic_width_in_mbs_minus1
height = bs.getUeGolomb() + 1; // pic_height_in_mbs_minus1
- H264.frame_mbs_only_flag = bs.getBit(); // frame_mbs_only_flag
+ bool frame_mbs_only_flag = bs.getBit(); // frame_mbs_only_flag
width *= 16;
- height *= 16 * (H264.frame_mbs_only_flag ? 1 : 2);
- if (!H264.frame_mbs_only_flag)
+ height *= 16 * (frame_mbs_only_flag ? 1 : 2);
+ if (!frame_mbs_only_flag)
bs.skipBit(); // mb_adaptive_frame_field_flag
bs.skipBit(); // direct_8x8_inference_flag
if (bs.getBit()) // frame_cropping_flag
@@ -203,7 +203,7 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
crop_top = bs.getUeGolomb(); // frame_crop_top_offset
crop_bottom = bs.getUeGolomb(); // frame_crop_bottom_offset
width -= 2 * (crop_left + crop_right);
- if (H264.frame_mbs_only_flag)
+ if (frame_mbs_only_flag)
height -= 2 * (crop_top + crop_bottom);
else
height -= 4 * (crop_top + crop_bottom);
@@ -246,7 +246,7 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
if (num_units_in_tick > 0)
{
frame_rate = time_scale / (2*num_units_in_tick);
- if (H264.frame_mbs_only_flag) frame_rate/=2;
+ if (frame_mbs_only_flag) frame_rate/=2;
}
//bs.skipBit(); // fixed_frame_rate_flag
}
@@ -307,6 +307,7 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
if ((bs.getIndex() / 8)>0)
{
// set values
+ maContext->Video.Info.Interlaced=!frame_mbs_only_flag;
maContext->Video.Info.FramesPerSecond=frame_rate;
maContext->Video.Info.Width=width;
maContext->Video.Info.Height=height;
@@ -421,19 +422,16 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt,
int frame_num=bs.getBits(H264.log2_max_frame_num); // frame_num
if (H264.frame_num==-1) H264.frame_num=frame_num;
- maContext->Video.Info.Interlaced=false;
- if (!H264.frame_mbs_only_flag)
- {
- maContext->Video.Info.Interlaced=true;
- /*
- bool field_pic_flag=bs.getBit();
- if (field_pic_flag)
- {
- bool bottom_field_flag=bs.getBit();
- }
- */
- }
-
+ /*
+ if (maContext->Video.Info.Interlaced)
+ {
+ bool field_pic_flag=bs.getBit();
+ if (field_pic_flag)
+ {
+ bool bottom_field_flag=bs.getBit();
+ }
+ }
+ */
switch (slice_type)
{
case 0:
@@ -547,6 +545,41 @@ unsigned TemporalReferenceL:
8;
};
+ struct H262_SequenceExt
+ {
+unsigned Sync1:
+ 8;
+unsigned Sync2:
+ 8;
+unsigned Sync3:
+ 8;
+unsigned Sync4:
+ 8;
+unsigned Profile:
+ 4;
+unsigned StartCode:
+ 4;
+unsigned WidthExtH:
+ 1;
+unsigned Chroma:
+ 2;
+unsigned Progressive:
+ 1;
+unsigned Level:
+ 4;
+unsigned BitRateExtH:
+ 5;
+unsigned HightExt:
+ 2;
+unsigned WidthExtL:
+ 1;
+unsigned Marker:
+ 1;
+unsigned BitRateExtL:
+ 7;
+ };
+
+ struct H262_SequenceExt *seqext = (struct H262_SequenceExt *) pkt;
struct H262_SequenceHdr *seqhdr = (struct H262_SequenceHdr *) pkt;
struct H262_PictureHdr *pichdr = (struct H262_PictureHdr *) pkt;
@@ -575,6 +608,11 @@ unsigned TemporalReferenceL:
return true;
}
+ if (seqext->Sync1==0 && seqext->Sync2==0 && seqext->Sync3==1 && seqext->Sync4==0xb5)
+ {
+ maContext->Video.Info.Interlaced=!seqext->Progressive;
+ }
+
if (seqhdr->Sync1==0 && seqhdr->Sync2==0 && seqhdr->Sync3==1 && seqhdr->Sync4==0xb3)
{
diff --git a/streaminfo.h b/streaminfo.h
index 4ae3a2e..c2f5a70 100644
--- a/streaminfo.h
+++ b/streaminfo.h
@@ -34,7 +34,6 @@ private:
{
bool primary_pic_typeI;
bool separate_colour_plane_flag;
- bool frame_mbs_only_flag;
int log2_max_frame_num;
int frame_num;
} H264;