[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39749] trunk/blender: == Sequencer ==
Peter Schlaile
peter at schlaile.de
Sun Aug 28 16:46:04 CEST 2011
Revision: 39749
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39749
Author: schlaile
Date: 2011-08-28 14:46:03 +0000 (Sun, 28 Aug 2011)
Log Message:
-----------
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
Modified Paths:
--------------
trunk/blender/intern/ffmpeg/ffmpeg_compat.h
trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
trunk/blender/source/blender/blenkernel/BKE_image.h
trunk/blender/source/blender/blenkernel/BKE_sequencer.h
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/blenkernel/intern/sequencer.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/editors/space_image/image_buttons.c
trunk/blender/source/blender/editors/space_sequencer/SConscript
trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_intern.h
trunk/blender/source/blender/editors/space_sequencer/sequencer_ops.c
trunk/blender/source/blender/imbuf/CMakeLists.txt
trunk/blender/source/blender/imbuf/IMB_imbuf.h
trunk/blender/source/blender/imbuf/intern/IMB_anim.h
trunk/blender/source/blender/imbuf/intern/allocimbuf.c
trunk/blender/source/blender/imbuf/intern/anim_movie.c
trunk/blender/source/blender/imbuf/intern/filter.c
trunk/blender/source/blender/imbuf/intern/thumbs.c
trunk/blender/source/blender/imbuf/intern/util.c
trunk/blender/source/blender/makesdna/DNA_sequence_types.h
trunk/blender/source/blender/makesdna/DNA_space_types.h
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
trunk/blender/source/blender/makesrna/intern/rna_space.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_jobs.c
Modified: trunk/blender/intern/ffmpeg/ffmpeg_compat.h
===================================================================
--- trunk/blender/intern/ffmpeg/ffmpeg_compat.h 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/intern/ffmpeg/ffmpeg_compat.h 2011-08-28 14:46:03 UTC (rev 39749)
@@ -71,6 +71,7 @@
#define avio_open url_fopen
#define avio_tell url_ftell
#define avio_close url_fclose
+#define avio_size url_fsize
#endif
/* there are some version inbetween, which have avio_... functions but no
@@ -130,4 +131,19 @@
}
#endif
+static inline
+int64_t av_get_pts_from_frame(AVFormatContext *avctx, AVFrame * picture)
+{
+ int64_t pts = picture->pkt_pts;
+
+ if (pts == AV_NOPTS_VALUE) {
+ pts = picture->pkt_dts;
+ }
+ if (pts == AV_NOPTS_VALUE) {
+ pts = 0;
+ }
+
+ return pts;
+}
+
#endif
Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py 2011-08-28 14:46:03 UTC (rev 39749)
@@ -60,6 +60,7 @@
layout.separator()
layout.operator("sequencer.refresh_all")
+ layout.template_running_jobs()
elif st.view_type == 'SEQUENCER_PREVIEW':
layout.separator()
layout.operator("sequencer.refresh_all")
@@ -241,6 +242,7 @@
layout.operator("sequencer.images_separate")
layout.operator("sequencer.offset_clear")
layout.operator("sequencer.deinterlace_selected_movies")
+ layout.operator("sequencer.rebuild_proxy")
layout.separator()
layout.operator("sequencer.duplicate")
@@ -578,6 +580,7 @@
col = split.column()
col.prop(strip, "filepath", text="")
col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
+ col.prop(strip, "streamindex", text="Stream Index")
# TODO, sound???
# end drawing filename
@@ -746,7 +749,7 @@
class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
- bl_label = "Proxy"
+ bl_label = "Proxy / Timecode"
@classmethod
def poll(cls, context):
@@ -772,13 +775,30 @@
flow = layout.column_flow()
flow.prop(strip, "use_proxy_custom_directory")
flow.prop(strip, "use_proxy_custom_file")
- if strip.proxy: # TODO - need to add this somehow
+ if strip.proxy:
if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
flow.prop(strip.proxy, "directory")
if strip.use_proxy_custom_file:
flow.prop(strip.proxy, "filepath")
+ row = layout.row()
+ row.prop(strip.proxy, "build_25")
+ row.prop(strip.proxy, "build_50")
+ row.prop(strip.proxy, "build_75")
+ row.prop(strip.proxy, "build_100")
+ col = layout.column()
+ col.label(text="Build JPEG quality")
+ col.prop(strip.proxy, "quality")
+
+ if strip.type == "MOVIE":
+ col = layout.column()
+ col.label(text="Use timecode index:")
+
+ col.prop(strip.proxy, "timecode")
+
+
+
class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
bl_label = "Scene Preview/Render"
bl_space_type = 'SEQUENCE_EDITOR'
Modified: trunk/blender/source/blender/blenkernel/BKE_image.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_image.h 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/source/blender/blenkernel/BKE_image.h 2011-08-28 14:46:03 UTC (rev 39749)
@@ -60,7 +60,7 @@
int BKE_imtype_to_ftype(int imtype);
int BKE_imtype_is_movie(int imtype);
-struct anim *openanim(char * name, int flags);
+struct anim *openanim(char * name, int flags, int streamindex);
void image_de_interlace(struct Image *ima, int odd);
Modified: trunk/blender/source/blender/blenkernel/BKE_sequencer.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_sequencer.h 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/source/blender/blenkernel/BKE_sequencer.h 2011-08-28 14:46:03 UTC (rev 39749)
@@ -177,6 +177,7 @@
/* maintainance functions, mostly for RNA */
// extern
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
+void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq);
void seq_free_strip(struct Strip *strip);
void seq_free_editing(struct Scene *scene);
void seq_free_clipboard(void);
@@ -199,6 +200,11 @@
int input_have_to_preprocess(
SeqRenderData context, struct Sequence * seq, float cfra);
+void seq_proxy_rebuild(struct Main * bmain,
+ struct Scene *scene, struct Sequence * seq,
+ short *stop, short *do_update, float *progress);
+
+
/* **********************************************************************
seqcache.c
Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/source/blender/blenkernel/intern/image.c 2011-08-28 14:46:03 UTC (rev 39749)
@@ -1371,15 +1371,15 @@
}
/* used by sequencer too */
-struct anim *openanim(char *name, int flags)
+struct anim *openanim(char *name, int flags, int streamindex)
{
struct anim *anim;
struct ImBuf *ibuf;
- anim = IMB_open_anim(name, flags);
+ anim = IMB_open_anim(name, flags, streamindex);
if (anim == NULL) return NULL;
- ibuf = IMB_anim_absolute(anim, 0);
+ ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
if (ibuf == NULL) {
if(BLI_exists(name))
printf("not an anim: %s\n", name);
@@ -1773,20 +1773,26 @@
else
BLI_path_abs(str, G.main->name);
- ima->anim = openanim(str, IB_rect);
+ /* FIXME: make several stream accessible in image editor, too*/
+ ima->anim = openanim(str, IB_rect, 0);
/* let's initialize this user */
if(ima->anim && iuser && iuser->frames==0)
- iuser->frames= IMB_anim_get_duration(ima->anim);
+ iuser->frames= IMB_anim_get_duration(ima->anim,
+ IMB_TC_RECORD_RUN);
}
if(ima->anim) {
- int dur = IMB_anim_get_duration(ima->anim);
+ int dur = IMB_anim_get_duration(ima->anim,
+ IMB_TC_RECORD_RUN);
int fra= frame-1;
if(fra<0) fra = 0;
if(fra>(dur-1)) fra= dur-1;
- ibuf = IMB_anim_absolute(ima->anim, fra);
+ ibuf = IMB_makeSingleUser(
+ IMB_anim_absolute(ima->anim, fra,
+ IMB_TC_RECORD_RUN,
+ IMB_PROXY_NONE));
if(ibuf) {
image_initialize_after_load(ima, ibuf);
Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c 2011-08-28 14:21:44 UTC (rev 39748)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c 2011-08-28 14:46:03 UTC (rev 39749)
@@ -218,6 +218,18 @@
MEM_freeN(seq);
}
+void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
+{
+ Sequence *iseq;
+
+ for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+ seq_free_sequence_recurse(scene, iseq);
+ }
+
+ seq_free_sequence(scene, seq);
+}
+
+
Editing *seq_give_editing(Scene *scene, int alloc)
{
if (scene->ed == NULL && alloc) {
@@ -683,13 +695,16 @@
}
case SEQ_MOVIE:
if(seq->anim) IMB_free_anim(seq->anim);
- seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0));
+ seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (!seq->anim) {
return;
}
- seq->len = IMB_anim_get_duration(seq->anim);
+ seq->len = IMB_anim_get_duration(seq->anim,
+ seq->strip->proxy ?
+ seq->strip->proxy->tc :
+ IMB_TC_RECORD_RUN);
seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
@@ -1117,56 +1132,113 @@
return cnt;
}
-
+
/* **********************************************************************
proxy management
********************************************************************** */
#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
+static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
+{
+ if (size >= 100) {
+ return IMB_PROXY_NONE;
+ }
+ if (size >= 99) {
+ return IMB_PROXY_100;
+ }
+ if (size >= 75) {
+ return IMB_PROXY_75;
+ }
+ if (size >= 50) {
+ return IMB_PROXY_50;
+ }
+ return IMB_PROXY_25;
+}
+
+static void seq_open_anim_file(Sequence * seq)
+{
+ char name[FILE_MAXDIR+FILE_MAXFILE];
+ StripProxy * proxy;
+
+ if(seq->anim != NULL) {
+ return;
+ }
+
+ BLI_join_dirfile(name, sizeof(name),
+ seq->strip->dir, seq->strip->stripdata->name);
+ BLI_path_abs(name, G.main->name);
+
+ seq->anim = openanim(name, IB_rect |
+ ((seq->flag & SEQ_FILTERY) ?
+ IB_animdeinterlace : 0), seq->streamindex);
+
+ if (seq->anim == NULL) {
+ return;
+ }
+
+ proxy = seq->strip->proxy;
+
+ if (proxy == NULL) {
+ return;
+ }
+
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+ IMB_anim_set_index_dir(seq->anim, seq->strip->proxy->dir);
+ }
+}
+
+
static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name)
{
int frameno;
char dir[FILE_MAXDIR];
+ int render_size = context.preview_render_size;
if (!seq->strip->proxy) {
return FALSE;
}
+ /* MOVIE tracks (only exception: custom files) are now handled
+ internally by ImBuf module for various reasons: proper time code
+ support, quicker index build, using one file instead
+ of a full directory of jpeg files, etc. Trying to support old
+ and new method at once could lead to funny effects, if people
+ have both, a directory full of jpeg files and proxy avis, so
+ sorry folks, please rebuild your proxies... */
+
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
strcpy(dir, seq->strip->proxy->dir);
+ } else if (seq->type == SEQ_IMAGE) {
+ snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
} else {
- if (ELEM(seq->type, SEQ_IMAGE, SEQ_MOVIE)) {
- snprintf(dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir);
- } else {
- return FALSE;
- }
+ return FALSE;
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
- BLI_join_dirfile(name, FILE_MAX, dir, seq->strip->proxy->file); /* XXX, not real length */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list