This document presents the complete C API and a general presentation on how to use it
The general use of this API is:
#include <stdio.h> int main (int argc, char *argv[]) { Avs_Environment *p_env; Avs_Clip *p_clip; AVS_VideoInfo *p_vi; if (argc < 2) { printf ("Usage: %s file.avs\n", argv[0]); return 0; } p_env = avs_environment_new (1000000); if (!p_env) goto quit; p_clip = avs_clip_new_from_file (argv[1]); if (!p_clip) goto free_env; p_vi = avs_clip_videoinfo_get (p_clip); if (!p_vi) goto free_clip; if (avs_videoinfo_has_video (p_vi) { AVS_ColorSpace *p_csp; printf ("size.........: %dx%d\n", avs_videoinfo_width_get (p_vi), avs_videoinfo_height_get (p_vi)); printf ("frame count..: %d\n", avs_videoinfo_framecount_get (p_vi)); printf ("frame ratet..: %d/%d\n", avs_videoinfo_fps_numerator_get (p_vi), avs_videoinfo_fps_denominator_get (p_vi)); p_csp = avs_videoinfo_colorspace_get (p_vi); if (p_csp) { printf ("colorspace...: "); switch (avs_colorspace_id_get (p_csp)) { case I_RGB32: printf ("RGB32\n"); break; case I_YV12: printf ("YV12\n"); break; default: printf ("Other (too lazy to list all of them)\n"); break; } avs_colorspace_delete (p_csp); } } else { printf ("No video stream\n"); } avs_videoinfo_delete (p_vi); free_clip: avs_clip_delete (p_clip); free_env: avs_environment_delete (p_env); quit: return 0; }
#include <stdio.h> int main (int argc, char *argv[]) { Avs_Environment *p_env; Avs_Clip *p_clip; AVS_VideoInfo *p_vi; AVS_VideoFrame *p_vf; if (argc < 2) { printf ("Usage: %s file.avs\n", argv[0]); return 0; } p_env = avs_environment_new (1000000); if (!p_env) goto quit; p_clip = avs_clip_new_from_file (argv[1]); if (!p_clip) goto free_env; p_vi = avs_clip_videoinfo_get (p_clip); if (!p_vi) goto free_clip; p_vf = avs_clip_videoframe_get (p_clip); if (!p_vf) goto free_videoinfo; if (avs_videoinfo_has_video (p_vi) { AVS_ColorSpace *p_csp; unsigned char *data = NULL; p_csp = avs_videoinfo_colorspace_get (p_vi); if (p_csp) { if (avs_colorspace_id_get (p_csp) == I_RGB32) { data = avs_videoframe_plane_get ('~'); avs_colorspace_delete (p_csp); } } } else { printf ("No video stream\n"); } avs_videoframe_delete (p_vf); free_videoinfo: avs_videoinfo_delete (p_vi); free_clip: avs_clip_delete (p_clip); free_env: avs_environment_delete (p_env); quit: return 0; }