@@ -296,6 +296,8 @@ void File_DvDif::Read_Buffer_Continue()
296296 Speed_RecDate_Current.Years =Years;
297297 Speed_RecDate_Current.IsValid =true ;
298298 }
299+ if (!FrameIsNotFake)
300+ FrameIsNotFake=true ;
299301 }
300302 }
301303
@@ -330,6 +332,8 @@ void File_DvDif::Read_Buffer_Continue()
330332 Speed_RecTime_Current.Time .Hours =Hours;
331333 Speed_RecTime_Current.IsValid =true ;
332334 }
335+ if (!FrameIsNotFake)
336+ FrameIsNotFake=true ;
333337 }
334338 }
335339 }
@@ -395,9 +399,9 @@ void File_DvDif::Read_Buffer_Continue()
395399 + ((Buffer[Buffer_Offset+3 +Pos+3 ]&0x0F ) ) ;
396400 int8u Years =((Buffer[Buffer_Offset+3 +Pos+4 ]&0xF0 )>>4 )*10
397401 + ((Buffer[Buffer_Offset+3 +Pos+4 ]&0x0F ) ) ;
398- if (Years<100
399- && Months<=12
400- && Days <=31 )
402+ if (Years<= 99
403+ && Months && Months <=12
404+ && Days && Days <=31 )
401405 {
402406 if (Speed_RecDate_Current.IsValid
403407 && Speed_RecDate_Current.Days !=Days
@@ -413,6 +417,8 @@ void File_DvDif::Read_Buffer_Continue()
413417 Speed_RecDate_Current.Years =Years;
414418 Speed_RecDate_Current.IsValid =true ;
415419 }
420+ if (!FrameIsNotFake)
421+ FrameIsNotFake=true ;
416422 }
417423 }
418424
@@ -447,6 +453,8 @@ void File_DvDif::Read_Buffer_Continue()
447453 Speed_RecTime_Current.Time .Hours =Hours;
448454 Speed_RecTime_Current.IsValid =true ;
449455 }
456+ if (!FrameIsNotFake)
457+ FrameIsNotFake=true ;
450458 }
451459 }
452460
@@ -481,6 +489,8 @@ void File_DvDif::Read_Buffer_Continue()
481489 Captions_Flags.set (Caption_ParityIssueAny);
482490 }
483491 }
492+ if (!FrameIsNotFake)
493+ FrameIsNotFake=true ;
484494 }
485495 }
486496 }
@@ -532,8 +542,9 @@ void File_DvDif::Read_Buffer_Continue()
532542 + ((Buffer[Buffer_Offset+3 +3 ]&0x0F ) ) ;
533543 int8u Years =((Buffer[Buffer_Offset+3 +4 ]&0xF0 )>>4 )*10
534544 + ((Buffer[Buffer_Offset+3 +4 ]&0x0F ) ) ;
535- if (Months<=12
536- && Days <=31 )
545+ if (Years<=99
546+ && Months && Months<=12
547+ && Days && Days<=31 )
537548 {
538549 if (Speed_RecDate_Current.IsValid
539550 && Speed_RecDate_Current.Days !=Days
@@ -549,6 +560,8 @@ void File_DvDif::Read_Buffer_Continue()
549560 Speed_RecDate_Current.Years =Years;
550561 Speed_RecDate_Current.IsValid =true ;
551562 }
563+ if (!FrameIsNotFake)
564+ FrameIsNotFake=true ;
552565 }
553566 }
554567
@@ -583,6 +596,8 @@ void File_DvDif::Read_Buffer_Continue()
583596 Speed_RecTime_Current.Time .Hours =Hours;
584597 Speed_RecTime_Current.IsValid =true ;
585598 }
599+ if (!FrameIsNotFake)
600+ FrameIsNotFake=true ;
586601 }
587602 }
588603
@@ -637,7 +652,39 @@ void File_DvDif::Read_Buffer_Continue()
637652 BlockStatus[(File_Offset+Buffer_Offset-Speed_FrameCount_StartOffset)/80 ]=BlockStatus_OK;
638653 }
639654 else
655+ {
640656 BlockStatus[(File_Offset+Buffer_Offset-Speed_FrameCount_StartOffset)/80 ]=BlockStatus_OK;
657+ if (!FrameIsNotFake)
658+ {
659+ if (QU==(int8u)-1 )
660+ {
661+ // Let's wait
662+ }
663+ else
664+ {
665+ switch (QU)
666+ {
667+ case 0 : // 16-bit
668+ {
669+ for (size_t i=8 ; i<80 ; i+=2 )
670+ {
671+ int16s Value=(int16s)BigEndian2int16u (Buffer+Buffer_Offset+i);
672+ if (Value<=-8 || Value>=8 )
673+ {
674+ FrameIsNotFake=true ;
675+ break ;
676+ }
677+ }
678+ }
679+ break ;
680+ // TODO: check 0 and -1 for 12-bit
681+ defaut:
682+ FrameIsNotFake=true ;
683+ break ;
684+ }
685+ }
686+ }
687+ }
641688 }
642689 }
643690 break ;
@@ -683,6 +730,15 @@ void File_DvDif::Read_Buffer_Continue()
683730 uint8_t Dseq=Buffer[Buffer_Offset+1 ]>>4 ;
684731 Video_STA_Errors_ByDseq[(Dseq<<4 )|STA_Error]++;
685732 }
733+ if (!FrameIsNotFake)
734+ FrameIsNotFake=true ;
735+ }
736+ else
737+ {
738+ // Looking for empty video
739+ static const unsigned char EmptyVideoTemplate[]={0xD1 , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xD1 , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xD1 , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xD1 , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x16 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x26 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 };
740+ if (!FrameIsNotFake && memcmp (Buffer+Buffer_Offset+4 , EmptyVideoTemplate, sizeof (EmptyVideoTemplate)))
741+ FrameIsNotFake=true ;
686742 }
687743 BlockStatus[(File_Offset+Buffer_Offset-Speed_FrameCount_StartOffset)/80 ]=STA_Error?BlockStatus_NOK:BlockStatus_OK;
688744 }
@@ -1882,6 +1938,8 @@ void File_DvDif::Errors_Stats_Update()
18821938 Event1.BlockStatus =BlockStatus;
18831939 Event1.AbstBf =AbstBf_Current;
18841940 Event1.MoreFlags =MoreFlags;
1941+ if (!FrameIsNotFake)
1942+ Event1.MoreFlags |=1 <<3 ;
18851943 if (MoreData)
18861944 {
18871945 Event1.MoreData =MoreData-sizeof (size_t );
@@ -1983,6 +2041,7 @@ void File_DvDif::Errors_Stats_Update()
19832041 Speed_Arb_Current.Clear ();
19842042 Speed_FrameCount++;
19852043 Speed_FrameCount_system[system]++;
2044+ FrameIsNotFake=false ;
19862045 REC_IsValid=false ;
19872046 DirectionSpeed.clear ();
19882047 audio_source_mode.clear ();
0 commit comments