[Bf-blender-cvs] [4846b44] master: Sequencer: Use movieclip framerate when importing new movie strips

Joshua Leung noreply at git.blender.org
Fri Jan 8 06:34:47 CET 2016


Commit: 4846b4402433738c3483749a7e72fbb82be41e61
Author: Joshua Leung
Date:   Fri Jan 8 18:30:26 2016 +1300
Branches: master
https://developer.blender.org/rB4846b4402433738c3483749a7e72fbb82be41e61

Sequencer: Use movieclip framerate when importing new movie strips

When importing new movie strips into the sequencer, the scene's frame rate
will now be adjusted to match that of the movie being loaded by default.
To get the old behaviour (e.g. if importing a clip into an existing project),
disable the "Use Movie Framerate" option in the file browser when selecting
the strip.

This change is designed to solve the common problem that users trying to import
video clips will forget to adjust the frame rate before importing the clip, thus
causing the sound and video strips to be out of sync (as the sound strip ends
up longer/shorter than the video stream).

===================================================================

M	source/blender/blenkernel/BKE_sequencer.h
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/editors/space_sequencer/sequencer_add.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 4582d11..c86ad39 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -386,6 +386,7 @@ typedef struct SeqLoadInfo {
 #define SEQ_LOAD_FRAME_ADVANCE  (1 << 1)
 #define SEQ_LOAD_MOVIE_SOUND    (1 << 2)
 #define SEQ_LOAD_SOUND_CACHE    (1 << 3)
+#define SEQ_LOAD_SYNC_FPS       (1 << 4)
 
 
 /* seq_dupli' flags */
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 588f591..831f330 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -5249,6 +5249,11 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
 	seq->anim_preseek = IMB_anim_get_preseek(anim_arr[0]);
 	BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2);
 	BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
+	
+	/* adjust scene's frame rate settings to match */
+	if (seq_load->flag & SEQ_LOAD_SYNC_FPS) {
+		IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true);
+	}
 
 	/* basic defaults */
 	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 64b2875..d09a686 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -209,6 +209,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
 
 	if ((prop = RNA_struct_find_property(op->ptr, "sound")) && RNA_property_boolean_get(op->ptr, prop))
 		seq_load->flag |= SEQ_LOAD_MOVIE_SOUND;
+	
+	if ((prop = RNA_struct_find_property(op->ptr, "use_framerate")) && RNA_property_boolean_get(op->ptr, prop))
+		seq_load->flag |= SEQ_LOAD_SYNC_FPS;
 
 	/* always use this for ops */
 	seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
@@ -700,6 +703,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
 	                               WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
 	RNA_def_boolean(ot->srna, "sound", true, "Sound", "Load sound with the movie");
+	RNA_def_boolean(ot->srna, "use_framerate", true, "Use Movie Framerate", "Use framerate from the movie to keep sound and video in sync");
 }
 
 /* add sound operator */




More information about the Bf-blender-cvs mailing list