static void movieclip_calc_length(MovieClip *clip) { if (clip->source == MCLIP_SRC_MOVIE) { movieclip_open_anim_file(clip); if (clip->anim) { clip->len = IMB_anim_get_duration(clip->anim, clip->proxy.tc); } } else if (clip->source == MCLIP_SRC_SEQUENCE) { unsigned short numlen; char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX]; BLI_stringdec(clip->name, head, tail, &numlen); if (numlen == 0) { /* there's no number group in file name, assume it's single framed sequence */ clip->len = 1; } else { clip->len = 0; for (;;) { get_sequence_fname(clip, clip->len + clip->start_frame, name); if (BLI_exists(name)) clip->len++; else break; } } } }
static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, int framenr, int flag) { struct ImBuf *ibuf; char name[FILE_MAX]; int loadflag; bool use_proxy = false; char *colorspace; use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL; if (use_proxy) { int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT; get_proxy_fname(clip, user->render_size, undistort, framenr, name); /* Well, this is a bit weird, but proxies for movie sources * are built in the same exact color space as the input, * * But image sequences are built in the display space. */ if (clip->source == MCLIP_SRC_MOVIE) { colorspace = clip->colorspace_settings.name; } else { colorspace = NULL; } } else { get_sequence_fname(clip, framenr, name); colorspace = clip->colorspace_settings.name; } loadflag = IB_rect | IB_multilayer | IB_alphamode_detect; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag, colorspace); #ifdef WITH_OPENEXR if (ibuf) { if (ibuf->ftype == OPENEXR && ibuf->userdata) { IMB_exr_close(ibuf->userdata); ibuf->userdata = NULL; } } #endif return ibuf; }
static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, int framenr, int flag) { struct ImBuf *ibuf; char name[FILE_MAX]; int loadflag, use_proxy = 0; use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL; if (use_proxy) { int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT; get_proxy_fname(clip, user->render_size, undistort, framenr, name); } else get_sequence_fname(clip, framenr, name); loadflag = IB_rect | IB_multilayer; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag); return ibuf; }
static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, int framenr, int flag) { struct ImBuf *ibuf; char name[FILE_MAX]; int loadflag, use_proxy = FALSE; char *colorspace; use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL; if (use_proxy) { int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT; get_proxy_fname(clip, user->render_size, undistort, framenr, name); /* proxies were built using default color space settings */ colorspace = NULL; } else { get_sequence_fname(clip, framenr, name); colorspace = clip->colorspace_settings.name; } loadflag = IB_rect | IB_multilayer | IB_alphamode_detect; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag, colorspace); #ifdef WITH_OPENEXR if (ibuf) { if (ibuf->ftype == OPENEXR && ibuf->userdata) { IMB_exr_close(ibuf->userdata); ibuf->userdata = NULL; } } #endif return ibuf; }