Skip to content

Commit 9d156c6

Browse files
PinterfPinterf
authored andcommitted
New script function: ColorSpaceNameToPixelType. Returns a VideoInfo::pixel_type integer
1 parent 42331b4 commit 9d156c6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

avs_core/core/parser/script.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ extern const AVSFunction Script_functions[] = {
248248
{ "IsYUVA", BUILTIN_FUNC_PREFIX, "c", IsYUVA },
249249
{ "IsPlanarRGB", BUILTIN_FUNC_PREFIX, "c", IsPlanarRGB },
250250
{ "IsPlanarRGBA", BUILTIN_FUNC_PREFIX, "c", IsPlanarRGBA },
251+
{ "ColorSpaceNameToPixelType", BUILTIN_FUNC_PREFIX, "s", ColorSpaceNameToPixelType },
251252

252253
{ 0 }
253254
};
@@ -943,6 +944,11 @@ AVSValue PixelType (AVSValue args, void*, IScriptEnvironment* env) {
943944
return GetPixelTypeName(VI(args[0]).pixel_type);
944945
}
945946

947+
// AVS+
948+
AVSValue ColorSpaceNameToPixelType (AVSValue args, void*, IScriptEnvironment* env) {
949+
return GetPixelTypeFromName(args[0].AsString());
950+
}
951+
946952
AVSValue Width(AVSValue args, void*, IScriptEnvironment* env) { return VI(args[0]).width; }
947953
AVSValue Height(AVSValue args, void*, IScriptEnvironment* env) { return VI(args[0]).height; }
948954
AVSValue FrameCount(AVSValue args, void*, IScriptEnvironment* env) { return VI(args[0]).num_frames; }

avs_core/core/parser/script.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,6 @@ AVSValue BitsPerComponent(AVSValue args, void*, IScriptEnvironment* env);
252252
AVSValue IsYUVA(AVSValue args, void*, IScriptEnvironment* env);
253253
AVSValue IsPlanarRGB(AVSValue args, void*, IScriptEnvironment* env);
254254
AVSValue IsPlanarRGBA(AVSValue args, void*, IScriptEnvironment* env);
255+
AVSValue ColorSpaceNameToPixelType(AVSValue args, void*, IScriptEnvironment* env);
255256

256257
#endif // __Script_H__

0 commit comments

Comments
 (0)