Skip to content

Commit

Permalink
Don't set certain frame properties when RFF is used
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed Apr 3, 2024
1 parent 9d7e218 commit e6039ce
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
19 changes: 11 additions & 8 deletions src/avisynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,17 @@ class AvisynthVideoSource : public IClip {
Env->propSetInt(Props, "_ColorRange", 1, 0);
else if (Src->ColorRange == 2)
Env->propSetInt(Props, "_ColorRange", 0, 0);
Env->propSetData(Props, "_PictType", &Src->PictType, 1, 0);

// Set field information
int FieldBased = 0;
if (Src->InterlacedFrame)
FieldBased = (Src->TopFieldFirst ? 2 : 1);
Env->propSetInt(Props, "_FieldBased", FieldBased, 0);
Env->propSetInt(Props, "RepeatField", Src->RepeatPict, 0);

if (!RFF) {
Env->propSetData(Props, "_PictType", &Src->PictType, 1, 0);

// Set field information
int FieldBased = 0;
if (Src->InterlacedFrame)
FieldBased = (Src->TopFieldFirst ? 2 : 1);
Env->propSetInt(Props, "_FieldBased", FieldBased, 0);
Env->propSetInt(Props, "RepeatField", Src->RepeatPict, 0);
}

if (Src->HasMasteringDisplayPrimaries) {
for (int i = 0; i < 3; i++) {
Expand Down
35 changes: 19 additions & 16 deletions src/vapoursynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,25 @@ static const VSFrame *VS_CC BestVideoSourceGetFrame(int n, int ActivationReason,
vsapi->mapSetInt(Props, "_ColorRange", 1, maAppend);
else if (Src->ColorRange == 2)
vsapi->mapSetInt(Props, "_ColorRange", 0, maAppend);
vsapi->mapSetData(Props, "_PictType", &Src->PictType, 1, dtUtf8, maAppend);

// Set field information
int FieldBased = 0;
if (Src->InterlacedFrame)
FieldBased = (Src->TopFieldFirst ? 2 : 1);
vsapi->mapSetInt(Props, "_FieldBased", FieldBased, maAppend);
vsapi->mapSetInt(Props, "RepeatField", Src->RepeatPict, maAppend);

// FIXME, use PTS difference between frames instead?
if (Src->Duration > 0) {
int64_t DurNum = VP.TimeBase.Num;
int64_t DurDen = VP.TimeBase.Den;
vsh::muldivRational(&DurNum, &DurDen, Src->Duration, 1);
vsapi->mapSetInt(Props, "_DurationNum", DurNum, maAppend);
vsapi->mapSetInt(Props, "_DurationDen", DurDen, maAppend);

if (!D->RFF) {
vsapi->mapSetData(Props, "_PictType", &Src->PictType, 1, dtUtf8, maAppend);

// Set field information
int FieldBased = 0;
if (Src->InterlacedFrame)
FieldBased = (Src->TopFieldFirst ? 2 : 1);
vsapi->mapSetInt(Props, "_FieldBased", FieldBased, maAppend);
vsapi->mapSetInt(Props, "RepeatField", Src->RepeatPict, maAppend);

// FIXME, use PTS difference between frames instead?
if (Src->Duration > 0) {
int64_t DurNum = VP.TimeBase.Num;
int64_t DurDen = VP.TimeBase.Den;
vsh::muldivRational(&DurNum, &DurDen, Src->Duration, 1);
vsapi->mapSetInt(Props, "_DurationNum", DurNum, maAppend);
vsapi->mapSetInt(Props, "_DurationDen", DurDen, maAppend);
}
}

if (Src->HasMasteringDisplayPrimaries) {
Expand Down

0 comments on commit e6039ce

Please sign in to comment.