Filter SDK/C API/AVS VideoInfo
The AVS_VideoInfo structure holds global information about a clip (i.e. information that does not depend on the frame number). It's a member of the AVS_FilterInfo structure. Below is a description of it (for AVISYNTH_INTERFACE_VERSION=6).
Properties and constants
- Colorspace constants, Colorformat constants and Image_type constants:
- These constants are the same as the ones in the C++ API with a AVS_ prefix. For example, the C++ API constant CS_BGR becomes AVS_CS_BGR.
- For some reason these constants are not part of the AVS_VideoInfo structure. Why not???
- Colorspace properties, Image_type properties and General properties:
- These are the same as in the C++ API.
- Chroma placement constants (bits 20 -> 23):
- They are missing in the C API. Todo: add them in the API.
- Remaining constants (they are not present in the C++ API):
enum {
AVS_FILTER_TYPE=1,
AVS_FILTER_INPUT_COLORSPACE=2,
AVS_FILTER_OUTPUT_TYPE=9,
AVS_FILTER_NAME=4,
AVS_FILTER_AUTHOR=5,
AVS_FILTER_VERSION=6,
AVS_FILTER_ARGS=7,
AVS_FILTER_ARGS_INFO=8,
AVS_FILTER_ARGS_DESCRIPTION=10,
AVS_FILTER_DESCRIPTION=11
};
enum { //SUBTYPES
AVS_FILTER_TYPE_AUDIO=1,
AVS_FILTER_TYPE_VIDEO=2,
AVS_FILTER_OUTPUT_TYPE_SAME=3,
AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4
};
Todo: add description.
Functions [need to add examples]
These functions are not members of the AVS_VideoInfo structure, but they take an AVS_VideoInfo structure as input. Unless stated otherwise the functions have the same funcionality as the corresponding ones in the C++ API.
Note the name of the functions are basically the same as the ones in the C++ API, with a 'avs_' prefix, a AVS_VideoInfo as input, lower case letters and with a underscore between separate words in the name.
For example, instead of vi.IsYUV(), you would use avs_is_yuv(&fi->vi) where fi is a pointer to AVS_FilterInfo.
| C++ API | C API |
|---|---|
| bool IsRGB() const | int avs_is_rgb(const AVS_VideoInfo * p); |
| bool IsRGB24() const | int avs_is_rgb24(const AVS_VideoInfo * p); |
| bool IsRGB32() const | int avs_is_rgb32(const AVS_VideoInfo * p); |
| bool IsYUV() const; | int avs_is_yuv(const AVS_VideoInfo * p); |
| bool IsYUY2() const; | int avs_is_yuy2(const AVS_VideoInfo * p); |
| bool IsYV24() const; | int avs_is_yv24(const AVS_VideoInfo * p); |
| bool IsYV16() const; | int avs_is_yv16(const AVS_VideoInfo * p); |
| bool IsYV12() const; | int avs_is_yv12(const AVS_VideoInfo * p); |
| bool IsYV411() const; | int avs_is_yv411(const AVS_VideoInfo * p); |
| bool IsY8() const; | int avs_is_y8(const AVS_VideoInfo * p); |
| bool IsColorSpace(int c_space) const; | int avs_is_color_space(const AVS_VideoInfo * p, int c_space); |
| bool IsSameColorspace(const VideoInfo& vi) const; | int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y) |
| bool IsPlanar() const; | int avs_is_planar(const AVS_VideoInfo * p) |
| bool Is(int property) const; | int avs_is_property(const AVS_VideoInfo * p, int property) |
| bool IsFieldBased() const; | int avs_is_field_based(const AVS_VideoInfo * p) |
| bool IsParityKnown() const; | int avs_is_parity_known(const AVS_VideoInfo * p) |
| bool IsBFF() const; | int avs_is_bff(const AVS_VideoInfo * p) |
| bool IsTFF() const; | int avs_is_tff(const AVS_VideoInfo * p); |
| void SetFieldBased(bool isfieldbased); | void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased); |
| void Set(int property); | void avs_set_property(AVS_VideoInfo * p, int property); |
| void Clear(int property); | void avs_clear_property(AVS_VideoInfo * p, int property); |
| int BitsPerPixel() const; | int avs_bits_per_pixel(const AVS_VideoInfo * p); |
| void SetFPS(unsigned numerator, unsigned denominator); | void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator) |
| void MulDivFPS(unsigned multiplier, unsigned divisor); | doesn't exist |
| int BytesFromPixels(int pixels) const; | int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels); |
| int RowSize(int plane=0) const; | int avs_row_size_p(const AVS_VideoInfo * p, int plane); |
| int BMPSize() const; | int avs_bmp_size(const AVS_VideoInfo * vi); |
| int GetPlaneWidthSubsampling(int plane) const; | int avs_get_plane_width_subsampling(const AVS_VideoInfo * p, int plane); |
| int GetPlaneHeightSubsampling(int plane) const; | int avs_get_plane_height_subsampling(const AVS_VideoInfo * p, int plane); |
| bool HasAudio() const; | int avs_has_audio(const AVS_VideoInfo * p); |
| int AudioChannels() const; | int avs_audio_channels(const AVS_VideoInfo * p); |
| int SampleType() const; | int avs_sample_type(const AVS_VideoInfo * p); |
| bool IsSampleType(int testtype) const; | doesn't exist |
| int SamplesPerSecond() const; | int avs_samples_per_second(const AVS_VideoInfo * p); |
| int BytesPerAudioSample() const; | int avs_bytes_per_audio_sample(const AVS_VideoInfo * p); |
| int BytesPerChannelSample() const; | int avs_bytes_per_channel_sample(const AVS_VideoInfo * p); |
| __int64 AudioSamplesFromFrames(int frames) const; | INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames); |
| int FramesFromAudioSamples(__int64 samples) const; | int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples); |
| __int64 AudioSamplesFromBytes(__int64 bytes) const; | INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes); |
| __int64 BytesFromAudioSamples(__int64 samples) const; | INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples); |