AVS_Clip *clip;
AVS_ScriptEnvironment *env;
HMODULE library;
+ int num_frames;
/* declare function pointers for the utilized functions to be loaded without __declspec,
as the avisynth header does not compensate for this type of usage */
struct
p_param->i_height = vi->height;
p_param->i_fps_num = vi->fps_numerator;
p_param->i_fps_den = vi->fps_denominator;
+ h->num_frames = vi->num_frames;
p_param->i_csp = X264_CSP_YV12;
fprintf( stderr, "avs [info]: %dx%d @ %.2f fps (%d frames)\n",
p_param->i_width, p_param->i_height,
(double)p_param->i_fps_num / p_param->i_fps_den,
- vi->num_frames );
+ h->num_frames );
*p_handle = h;
return 0;
static int get_frame_total( hnd_t handle )
{
avs_hnd_t *h = handle;
- const AVS_VideoInfo *vi = h->func.avs_get_video_info( h->clip );
- return vi->num_frames;
+ return h->num_frames;
}
static int picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height )
{
static int plane[3] = { AVS_PLANAR_Y, AVS_PLANAR_V, AVS_PLANAR_U };
avs_hnd_t *h = handle;
+ if( i_frame >= h->num_frames )
+ return -1;
AVS_VideoFrame *frm =
p_pic->opaque = h->func.avs_get_frame( h->clip, i_frame );
int i;