Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/proxy.c
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | bool seq_proxy_get_custom_file_fname(Sequence *seq, char *name, const int view_id) | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_strncpy(name, fname, PROXY_MAXFILE); | BLI_strncpy(name, fname, PROXY_MAXFILE); | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| static bool seq_proxy_get_fname(Editing *ed, | static bool seq_proxy_get_fname(Scene *scene, | ||||
| Sequence *seq, | Sequence *seq, | ||||
| int timeline_frame, | int timeline_frame, | ||||
| eSpaceSeq_Proxy_RenderSize render_size, | eSpaceSeq_Proxy_RenderSize render_size, | ||||
| char *name, | char *name, | ||||
| const int view_id) | const int view_id) | ||||
| { | { | ||||
| char dir[PROXY_MAXFILE]; | char dir[PROXY_MAXFILE]; | ||||
| char suffix[24] = {'\0'}; | char suffix[24] = {'\0'}; | ||||
| Editing *ed = SEQ_editing_get(scene, false); | |||||
| StripProxy *proxy = seq->strip->proxy; | StripProxy *proxy = seq->strip->proxy; | ||||
| if (proxy == NULL) { | if (proxy == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Multi-view suffix. */ | /* Multi-view suffix. */ | ||||
| if (view_id > 0) { | if (view_id > 0) { | ||||
| Show All 31 Lines | static bool seq_proxy_get_fname(Scene *scene, | ||||
| /* Proxy size number to be used in path. */ | /* Proxy size number to be used in path. */ | ||||
| int proxy_size_number = SEQ_rendersize_to_scale_factor(render_size) * 100; | int proxy_size_number = SEQ_rendersize_to_scale_factor(render_size) * 100; | ||||
| BLI_snprintf(name, | BLI_snprintf(name, | ||||
| PROXY_MAXFILE, | PROXY_MAXFILE, | ||||
| "%s/images/%d/%s_proxy%s", | "%s/images/%d/%s_proxy%s", | ||||
| dir, | dir, | ||||
| proxy_size_number, | proxy_size_number, | ||||
| SEQ_render_give_stripelem(seq, timeline_frame)->name, | SEQ_render_give_stripelem(scene, seq, timeline_frame)->name, | ||||
| suffix); | suffix); | ||||
| BLI_path_abs(name, BKE_main_blendfile_path_from_global()); | BLI_path_abs(name, BKE_main_blendfile_path_from_global()); | ||||
| strcat(name, ".jpg"); | strcat(name, ".jpg"); | ||||
| return true; | return true; | ||||
| } | } | ||||
| bool SEQ_can_use_proxy(const struct SeqRenderData *context, Sequence *seq, int psize) | bool SEQ_can_use_proxy(const struct SeqRenderData *context, Sequence *seq, int psize) | ||||
| { | { | ||||
| if (seq->strip->proxy == NULL || !context->use_proxies) { | if (seq->strip->proxy == NULL || !context->use_proxies) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| short size_flags = seq->strip->proxy->build_size_flags; | short size_flags = seq->strip->proxy->build_size_flags; | ||||
| return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; | return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; | ||||
| } | } | ||||
| ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int timeline_frame) | ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int timeline_frame) | ||||
| { | { | ||||
| char name[PROXY_MAXFILE]; | char name[PROXY_MAXFILE]; | ||||
| StripProxy *proxy = seq->strip->proxy; | StripProxy *proxy = seq->strip->proxy; | ||||
| const eSpaceSeq_Proxy_RenderSize psize = context->preview_render_size; | const eSpaceSeq_Proxy_RenderSize psize = context->preview_render_size; | ||||
| Editing *ed = context->scene->ed; | |||||
| StripAnim *sanim; | StripAnim *sanim; | ||||
| /* only use proxies, if they are enabled (even if present!) */ | /* only use proxies, if they are enabled (even if present!) */ | ||||
| if (!SEQ_can_use_proxy(context, seq, SEQ_rendersize_to_proxysize(psize))) { | if (!SEQ_can_use_proxy(context, seq, SEQ_rendersize_to_proxysize(psize))) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { | if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { | ||||
| int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs; | int frameno = (int)seq_give_frame_index(context->scene, seq, timeline_frame) + | ||||
| seq->anim_startofs; | |||||
| if (proxy->anim == NULL) { | if (proxy->anim == NULL) { | ||||
| if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { | if (seq_proxy_get_fname( | ||||
| context->scene, seq, timeline_frame, psize, name, context->view_id) == 0) { | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name); | proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name); | ||||
| } | } | ||||
| if (proxy->anim == NULL) { | if (proxy->anim == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| seq_open_anim_file(context->scene, seq, true); | seq_open_anim_file(context->scene, seq, true); | ||||
| sanim = seq->anims.first; | sanim = seq->anims.first; | ||||
| frameno = IMB_anim_index_get_frame_index( | frameno = IMB_anim_index_get_frame_index( | ||||
| sanim ? sanim->anim : NULL, seq->strip->proxy->tc, frameno); | sanim ? sanim->anim : NULL, seq->strip->proxy->tc, frameno); | ||||
| return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); | return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); | ||||
| } | } | ||||
| if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { | if (seq_proxy_get_fname(context->scene, seq, timeline_frame, psize, name, context->view_id) == | ||||
| 0) { | |||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (BLI_exists(name)) { | if (BLI_exists(name)) { | ||||
| ImBuf *ibuf = IMB_loadiffname(name, IB_rect, NULL); | ImBuf *ibuf = IMB_loadiffname(name, IB_rect, NULL); | ||||
| if (ibuf) { | if (ibuf) { | ||||
| seq_imbuf_assign_spaces(context->scene, ibuf); | seq_imbuf_assign_spaces(context->scene, ibuf); | ||||
| Show All 11 Lines | static void seq_proxy_build_frame(const SeqRenderData *context, | ||||
| int timeline_frame, | int timeline_frame, | ||||
| int proxy_render_size, | int proxy_render_size, | ||||
| const bool overwrite) | const bool overwrite) | ||||
| { | { | ||||
| char name[PROXY_MAXFILE]; | char name[PROXY_MAXFILE]; | ||||
| int quality; | int quality; | ||||
| int rectx, recty; | int rectx, recty; | ||||
| ImBuf *ibuf_tmp, *ibuf; | ImBuf *ibuf_tmp, *ibuf; | ||||
| Editing *ed = context->scene->ed; | Scene *scene = context->scene; | ||||
| if (!seq_proxy_get_fname(ed, seq, timeline_frame, proxy_render_size, name, context->view_id)) { | if (!seq_proxy_get_fname( | ||||
| scene, seq, timeline_frame, proxy_render_size, name, context->view_id)) { | |||||
| return; | return; | ||||
| } | } | ||||
| if (!overwrite && BLI_exists(name)) { | if (!overwrite && BLI_exists(name)) { | ||||
| return; | return; | ||||
| } | } | ||||
| ibuf_tmp = seq_render_strip(context, state, seq, timeline_frame); | ibuf_tmp = seq_render_strip(context, state, seq, timeline_frame); | ||||
| ▲ Show 20 Lines • Show All 329 Lines • Show Last 20 Lines | |||||