diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..6403ad5
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+##### 1.1.0:
+ Set frame properties - _DurationNum, _DurationDen, _FieldBased, _AspectRatio, _GOPNumber, _GOPPosition, _GOPClosed, _EncodedFrameTop, _EncodedFrameBottom, _PictType, _Matrix, _QuantsAverage, _QuantsAverage, _QuantsMax.
+
+##### 1.0.0:
+ Renamed the plugin and function to D2VSource.
\ No newline at end of file
diff --git a/build/D2VSource.vcxproj b/build/D2VSource.vcxproj
index 32e53c0..4c76d67 100644
--- a/build/D2VSource.vcxproj
+++ b/build/D2VSource.vcxproj
@@ -99,7 +99,7 @@
true
Speed
true
- false
+ true
true
Precise
@@ -119,7 +119,7 @@
true
Speed
true
- false
+ true
true
GenerateParallelCode
diff --git a/src/AVISynthAPI.cpp b/src/AVISynthAPI.cpp
index 0df4f4b..fb8a627 100644
--- a/src/AVISynthAPI.cpp
+++ b/src/AVISynthAPI.cpp
@@ -244,6 +244,10 @@ MPEG2Source::MPEG2Source(const char* d2v, int idct, bool showQ,
luminanceTable[i] = static_cast(value);
}
}
+
+ has_at_least_v8 = true;
+ try { env->CheckVersion(8); }
+ catch (const AvisynthError&) { has_at_least_v8 = false; }
}
@@ -277,6 +281,58 @@ PVideoFrame __stdcall MPEG2Source::GetFrame(int n, IScriptEnvironment* env)
if (d.info != 0)
show_info(n, d, frame, vi, env);
+ if (has_at_least_v8)
+ {
+ AVSMap* props = env->getFramePropsRW(frame);
+
+ /* Sample duration */
+ env->propSetInt(props, "_DurationNum", d.VF_FrameRate_Num, 0);
+ env->propSetInt(props, "_DurationDen", d.VF_FrameRate_Den, 0);
+ /* BFF or TFF */
+ uint32_t raw = std::max(d.FrameList[n].bottom, d.FrameList[n].top);
+ if (raw < d.BadStartingFrames)
+ raw = d.BadStartingFrames;
+
+ uint32_t gop = 0;
+ do {
+ if (raw >= d.GOPList[gop].number)
+ if (raw < d.GOPList[static_cast(gop) + 1].number)
+ break;
+ } while (++gop < d.GOPList.size() - 1);
+
+ const auto& rgop = d.GOPList[gop];
+
+ int field_based = 0;
+ if (!rgop.progressive)
+ field_based = d.Field_Order == 1 ? 2 : 1;
+ env->propSetInt(props, "_FieldBased", field_based, 0);
+ /* AR */
+ env->propSetData(props, "_AspectRatio", d.Aspect_Ratio, *(d.Aspect_Ratio), 0);
+ /* GOP */
+ int64_t gop_number[2] = { gop, rgop.number };
+ env->propSetIntArray(props, "_GOPNumber", gop_number, 2);
+ env->propSetInt(props, "_GOPPosition", rgop.position, 0);
+
+ int closed_gop = rgop.closed ? 1 : 0;
+ env->propSetInt(props, "_GOPClosed", closed_gop, 0);
+ /* Encoded frame */
+ const auto& fn = d.FrameList[n];
+
+ env->propSetInt(props, "_EncodedFrameTop", fn.top, 0);
+ env->propSetInt(props, "_EncodedFrameBottom", fn.bottom, 0);
+ /* Picture type */
+ const auto& fraw = d.FrameList[raw];
+ const char* pct = fraw.pct == I_TYPE ? "I" : fraw.pct == B_TYPE ? "B" : "P";
+
+ env->propSetData(props, "_PictType", pct, 1, 0);
+ /* Matrix */
+ env->propSetInt(props, "_Matrix", rgop.matrix, 0);
+ /* Quants */
+ env->propSetInt(props, "_QuantsAverage", d.avgquant, 0);
+ env->propSetInt(props, "_QuantsMin", d.minquant, 0);
+ env->propSetInt(props, "_QuantsMax", d.maxquant, 0);
+ }
+
return frame;
}
diff --git a/src/AVISynthAPI.h b/src/AVISynthAPI.h
index 4c812ce..d1531d3 100644
--- a/src/AVISynthAPI.h
+++ b/src/AVISynthAPI.h
@@ -39,6 +39,7 @@ class MPEG2Source: public IClip {
CMPEG2Decoder* decoder;
bool luminanceFlag;
uint8_t luminanceTable[256];
+ bool has_at_least_v8;
public:
MPEG2Source(const char* d2v, int idct, bool showQ, int _info, int _upConv, bool _i420, int iCC, IScriptEnvironment* env);
diff --git a/src/d2vsource.rc b/src/d2vsource.rc
index 9793c45..628e668 100644
--- a/src/d2vsource.rc
+++ b/src/d2vsource.rc
@@ -2,8 +2,8 @@
#include
VS_VERSION_INFO VERSIONINFO
-FILEVERSION 1,0,0,0
-PRODUCTVERSION 1,0,0,0
+FILEVERSION 1,1,0,0
+PRODUCTVERSION 1,1,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0x0L
FILEOS VOS__WINDOWS32
@@ -16,11 +16,11 @@ BEGIN
BEGIN
VALUE "Comments", "Modified DGDecode."
VALUE "FileDescription", "D2VSource for AviSynth 2.6 / AviSynth+"
- VALUE "FileVersion", "1.0.0"
+ VALUE "FileVersion", "1.1.0"
VALUE "InternalName", "D2VSource"
VALUE "OriginalFilename", "D2VSource.dll"
VALUE "ProductName", "D2VSource"
- VALUE "ProductVersion", "1.0.0"
+ VALUE "ProductVersion", "1.1.0"
END
END
BLOCK "VarFileInfo"