== Sequencer ==

This adds custom proxy file storage to the sequencer.
Reasoning: sometimes low resolution versions are already available as a
seperate file built by the capture application.
So there is no real reason to make blender build it's own seperate proxy.

This also somewhat fixes (aehm works around :) )
[#13632] Creating Proxy Takes Over Process, Should be Background

Since now you can just fire up ffmpeg to build your proxies in the background.
(You could have done before and build a directory of jpeg files, but then you
would have to rename all the files since otherwise things are off by one...)
This commit is contained in:
Peter Schlaile 2009-05-24 13:41:37 +00:00
parent e41eeaa045
commit ea94f8ab8a
5 changed files with 94 additions and 11 deletions

@ -3689,6 +3689,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
if (seq->flag & SEQ_USE_PROXY) {
seq->strip->proxy = newdataadr(
fd, seq->strip->proxy);
seq->strip->proxy->anim = 0;
} else {
seq->strip->proxy = 0;
}

@ -318,7 +318,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
/* *********************** */
#define B_RENDERBUTS 1690
#define B_SEQUENCERBUTS 1699
#define B_SEQUENCERBUTS 1700
#define B_FS_PIC 1601
#define B_FS_BACKBUF 1602
@ -377,6 +377,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_SEQ_BUT_RELOAD_FILE 1696
#define B_SEQ_BUT_REBUILD_PROXY 1697
#define B_SEQ_SEL_PROXY_DIR 1698
#define B_SEQ_SEL_PROXY_FILE 1699
/* *********************** */
#define B_ARMATUREBUTS 1800
#define B_POSE 1701

@ -78,6 +78,8 @@ typedef struct StripColorBalance {
typedef struct StripProxy {
char dir[160];
char file[80];
struct anim *anim;
} StripProxy;
typedef struct Strip {
@ -258,6 +260,7 @@ typedef struct SpeedControlVars {
#define SEQ_USE_COLOR_BALANCE 262144
#define SEQ_USE_PROXY_CUSTOM_DIR 524288
#define SEQ_ACTIVE 1048576
#define SEQ_USE_PROXY_CUSTOM_FILE 2097152
#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
#define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2

@ -1174,7 +1174,7 @@ static void seq_panel_proxy()
uiDefButBitI(block, TOG, SEQ_USE_PROXY,
B_SEQ_BUT_RELOAD, "Use Proxy",
10,140,120,19, &last_seq->flag,
10,140,80,19, &last_seq->flag,
0.0, 21.0, 100, 0,
"Use a preview proxy for this strip");
@ -1187,10 +1187,16 @@ static void seq_panel_proxy()
uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_DIR,
B_SEQ_BUT_RELOAD, "Custom Dir",
130,140,120,19, &last_seq->flag,
90,140,80,19, &last_seq->flag,
0.0, 21.0, 100, 0,
"Use a custom directory to store data");
uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_FILE,
B_SEQ_BUT_RELOAD, "Custom File",
170,140,80,19, &last_seq->flag,
0.0, 21.0, 100, 0,
"Use a custom file to load data from");
if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_DIR,
ICON_FILESEL, 10, 120, 20, 20, 0, 0, 0, 0, 0,
@ -1202,30 +1208,41 @@ static void seq_panel_proxy()
30,120,220,20, last_seq->strip->proxy->dir,
0.0, 160.0, 100, 0, "");
}
if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_FILE,
ICON_FILESEL, 10, 100, 20, 20, 0, 0, 0,
0, 0,
"Select the custom proxy file "
"(used for all preview resolutions!)");
uiDefBut(block, TEX,
B_SEQ_BUT_RELOAD, "File: ",
30,100,220,20, last_seq->strip->proxy->file,
0.0, 160.0, 100, 0, "");
}
}
if (last_seq->flag & SEQ_USE_PROXY) {
if (G.scene->r.size == 100) {
uiDefBut(block, LABEL, 0,
"Full render size selected, ",
10,100,240,19, 0, 0, 0, 0, 0, "");
10,60,240,19, 0, 0, 0, 0, 0, "");
uiDefBut(block, LABEL, 0,
"so no proxy enabled!",
10,80,240,19, 0, 0, 0, 0, 0, "");
10,40,240,19, 0, 0, 0, 0, 0, "");
} else if (last_seq->type != SEQ_MOVIE
&& last_seq->type != SEQ_IMAGE
&& !(last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) {
uiDefBut(block, LABEL, 0,
"Cannot proxy this strip without ",
10,100,240,19, 0, 0, 0, 0, 0, "");
10,60,240,19, 0, 0, 0, 0, 0, "");
uiDefBut(block, LABEL, 0,
"custom directory selection!",
10,80,240,19, 0, 0, 0, 0, 0, "");
} else {
10,40,240,19, 0, 0, 0, 0, 0, "");
} else if (!(last_seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)) {
uiDefBut(block, BUT, B_SEQ_BUT_REBUILD_PROXY,
"Rebuild proxy",
10,100,240,19, 0, 0, 0, 0, 0,
10,60,240,19, 0, 0, 0, 0, 0,
"Rebuild proxy for the "
"currently selected strip.");
}
@ -1294,7 +1311,19 @@ static void sel_proxy_dir(char *name)
allqueue(REDRAWBUTSSCENE, 0);
BIF_undo_push("Change proxy directory");
BIF_undo_push("Change custom proxy directory");
}
static void sel_proxy_file(char *name)
{
Sequence *last_seq = get_last_seq();
BLI_split_dirfile_basic(name, last_seq->strip->proxy->dir,
last_seq->strip->proxy->file);
allqueue(REDRAWBUTSSCENE, 0);
BIF_undo_push("Change custom proxy file");
}
void do_sequencer_panels(unsigned short event)
@ -1324,6 +1353,13 @@ void do_sequencer_panels(unsigned short event)
last_seq->strip->proxy->dir,
sel_proxy_dir);
break;
case B_SEQ_SEL_PROXY_FILE:
sa= closest_bigger_area();
areawinset(sa->win);
activate_fileselect(FILE_SPECIAL, "SELECT PROXY FILE",
last_seq->strip->proxy->dir,
sel_proxy_file);
break;
case B_SEQ_BUT_RELOAD:
case B_SEQ_BUT_RELOAD_ALL:
update_seq_ipo_rect(last_seq);

@ -106,6 +106,14 @@ void free_tstripdata(int len, TStripElem *se)
}
static void free_proxy_seq(Sequence *seq)
{
if (seq->strip && seq->strip->proxy && seq->strip->proxy->anim) {
IMB_free_anim(seq->strip->proxy->anim);
seq->strip->proxy->anim = 0;
}
}
void free_strip(Strip *strip)
{
strip->us--;
@ -120,6 +128,10 @@ void free_strip(Strip *strip)
}
if (strip->proxy) {
if (strip->proxy->anim) {
IMB_free_anim(strip->proxy->anim);
}
MEM_freeN(strip->proxy);
}
if (strip->crop) {
@ -517,6 +529,8 @@ void reload_sequence_new_file(Sequence * seq)
seq->strip->len = seq->len;
}
free_proxy_seq(seq);
calc_sequence(seq);
}
@ -1053,6 +1067,12 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, char * name)
}
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
snprintf(name, PROXY_MAXFILE, "%s/%s",
dir, seq->strip->proxy->file);
return TRUE;
}
/* generate a seperate proxy directory for each preview size */
if (seq->type == SEQ_IMAGE) {
@ -1099,6 +1119,20 @@ static struct ImBuf * seq_proxy_fetch(Sequence * seq, int cfra)
return 0;
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
if (!seq->strip->proxy->anim) {
if (!seq_proxy_get_fname(seq, cfra, name)) {
return 0;
}
seq->strip->proxy->anim = openanim(name, IB_rect);
}
if (!seq->strip->proxy->anim) {
return 0;
}
return IMB_anim_absolute(seq->strip->proxy->anim, cfra);
}
if (!seq_proxy_get_fname(seq, cfra, name)) {
return 0;
}
@ -1131,6 +1165,11 @@ static void seq_proxy_build_frame(Sequence * seq, int cfra)
return;
}
/* that's why it is called custom... */
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
return;
}
if (!seq_proxy_get_fname(seq, cfra, name)) {
return;
}
@ -2866,6 +2905,7 @@ void free_imbuf_seq_except(int cfra)
if(seq->type==SEQ_MOVIE)
if(seq->startdisp > cfra || seq->enddisp < cfra)
free_anim_seq(seq);
free_proxy_seq(seq);
}
}
END_SEQ
@ -2909,6 +2949,7 @@ void free_imbuf_seq()
if(seq->type==SEQ_SPEED) {
sequence_effect_speed_rebuild_map(seq, 1);
}
free_proxy_seq(seq);
}
}
END_SEQ
@ -2974,6 +3015,7 @@ static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int l
if(seq->type == SEQ_SPEED) {
sequence_effect_speed_rebuild_map(seq, 1);
}
free_proxy_seq(seq);
}
if(len_change)