Skip to content

Commit

Permalink
Do not output synthetic gray/silence frames at begin/end
Browse files Browse the repository at this point in the history
Some decks sends synthetic gray/silence frames, we try to detect and discard them by default
  • Loading branch information
JeromeMartinez committed Oct 19, 2023
1 parent 4feb0d0 commit 7be05e2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/CLI/CommandLine_Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ return_value Parse(Core &C, int argc, const char* argv_ansi[], const MediaInfoNa
{
OutputFrames_Concealed = false;
}
else if (!strcmp(argv_ansi[i], "--merge-output-nodata"))
{
OutputFrames_NoData = true;
}
else if (!strcmp(argv_ansi[i], "--merge-ignore-nodata"))
{
OutputFrames_NoData = false;
}
else if (!strcmp(argv_ansi[i], "--merge-log-missing"))
{
ShowFrames_Missing = true;
Expand Down
4 changes: 4 additions & 0 deletions Source/Common/Merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ uint64_t Timeout = 0;
uint8_t UseAbst = 0;
bool OutputFrames_Speed = false;
bool OutputFrames_Concealed = false;
bool OutputFrames_NoData = false;
int ShowFrames_Missing = -1;
int ShowFrames_Intermediate = -1;
extern void timecode_to_string(string& Data, int Seconds, bool DropFrame, int Frames);
Expand Down Expand Up @@ -113,6 +114,7 @@ namespace
uint8_t RepeatCount = 0;
int Speed = INT_MIN;
int FullConcealed = false;
bool NoData = false;

per_frame() = default;
per_frame(status const& Status_, ::TimeCode const& TC_, uint8_t* const& BlockStatus_, size_t BlockStatus_Count_) :
Expand Down Expand Up @@ -488,6 +490,7 @@ bool dv_merge_private::AppendFrameToList(size_t InputPos, const MediaInfo_Event_
CurrentFrame.AbstBf = abst_bf(FrameData->AbstBf);
CurrentFrame.Speed = GetDvSpeed(*FrameData);
CurrentFrame.FullConcealed = coherency_flags(FrameData).full_conceal();
CurrentFrame.NoData = coherency_flags(FrameData).no_data();

// Time code jumps - after first frame
timecode TC_Temp(FrameData);
Expand Down Expand Up @@ -1489,6 +1492,7 @@ bool dv_merge_private::Process(float Speed)
if (true
&& (OutputFrames_Speed || (Speed && Speed != 1.0) || GetDvSpeedIsNormalPlayback(DvSpeed))
&& (OutputFrames_Concealed || (Prefered_Frame != -1 && !Inputs[Prefered_Frame]->Segments[Segment_Pos].Frames[Frame_Pos].FullConcealed))
&& (OutputFrames_NoData || (Prefered_Frame != -1 && !Inputs[Prefered_Frame]->Segments[Segment_Pos].Frames[Frame_Pos].NoData))
&& (ShowFrames_Intermediate || (Prefered_Frame != -1 && FirstBadFrame == -1))
)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Common/Merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern uint64_t Timeout;
extern uint8_t UseAbst;
extern bool OutputFrames_Speed;
extern bool OutputFrames_Concealed;
extern bool OutputFrames_NoData;
extern int ShowFrames_Missing;
extern int ShowFrames_Intermediate;
extern bool InControl;
Expand Down
1 change: 1 addition & 0 deletions Source/Common/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct coherency_flags
inline bool no_sourceorcontrol_aud() { return ((_Value >> 6) & 0x1); } // 6
inline bool no_pack() { return no_pack_sub() && no_pack_vid() && no_pack_aud() ; }
inline bool full_conceal() { return full_conceal_vid() && full_conceal_aud(); }
inline bool no_data() { return (_Value2 >> 3) & 0x1; } //

private:
decltype(MediaInfo_Event_DvDif_Analysis_Frame_1::Coherency_Flags) _Value;
Expand Down

0 comments on commit 7be05e2

Please sign in to comment.