diff options
-rw-r--r-- | streaminfo.cpp | 31 | ||||
-rw-r--r-- | streaminfo.h | 2 |
2 files changed, 32 insertions, 1 deletions
diff --git a/streaminfo.cpp b/streaminfo.cpp index 353440b..2eb1cc8 100644 --- a/streaminfo.cpp +++ b/streaminfo.cpp @@ -10,6 +10,7 @@ cMarkAdStreamInfo::cMarkAdStreamInfo() { memset(&H264,0,sizeof(H264)); + H264.frame_num=-1; } bool cMarkAdStreamInfo::FindAC3AudioInfos(MarkAdContext *maContext, uchar *espkt, int eslen) @@ -120,6 +121,14 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, int nalu=pkt[4] & 0x1F; + if (nalu==NAL_AUD) + { + if (pkt[5]==0x10) + { + H264.primary_pic_typeI=true; + } + } + if (nalu==NAL_SPS) { uint8_t nal_data[len]; @@ -409,7 +418,8 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, { bs.skipBits(2); // colour_plane_id } - bs.skipBits(H264.log2_max_frame_num); // frame_num + 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) @@ -454,7 +464,26 @@ bool cMarkAdStreamInfo::FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, default: break; } + maContext->Video.Info.Pict_Type=slice_type; + + if (!maContext->Video.Info.Interlaced) + { + if (frame_num!=H264.frame_num) + { + if (H264.primary_pic_typeI) + { + maContext->Video.Info.Pict_Type=MA_I_TYPE; + H264.primary_pic_typeI=false; + } + H264.frame_num=frame_num; + return true; + } + else + { + return false; + } + } return true; } return false; diff --git a/streaminfo.h b/streaminfo.h index dc712be..1ccdcb5 100644 --- a/streaminfo.h +++ b/streaminfo.h @@ -32,9 +32,11 @@ private: struct H264 { + bool primary_pic_typeI; bool separate_colour_plane_flag; bool frame_mbs_only_flag; int log2_max_frame_num; + int frame_num; } H264; int nalUnescape(uint8_t *dst, const uint8_t *src, int len); |