[Bf-blender-cvs] [e692b3d] multiview: Partial Fix for Movie Exporting name clash

Dalai Felinto noreply at git.blender.org
Fri Jan 16 04:43:11 CET 2015


Commit: e692b3d1e34b4ef44ba9bf492237093ea88ef17b
Author: Dalai Felinto
Date:   Thu Jan 15 20:09:05 2015 -0200
Branches: multiview
https://developer.blender.org/rBe692b3d1e34b4ef44ba9bf492237093ea88ef17b

Partial Fix for Movie Exporting name clash

Before if we exported (from anywhere) videos in the Individual Views
format the _L and _R videos would have the same name. Not anymore.

This was required before I finish the support for Movie proxies in the
sequencer. Or maybe not required, but at least related, and I wanted to
get this over with before finish up the proxies anyways.

Big Important Note:
===================
This is still not working for video formats that rely on the
writeffmpeg.c file. (not that I tested the other formats, but I know
it's breaking with MPEG + Quickime + H.264.

The code in that file uses a lot of statics, and they make it impossible
to writei two movies simultaneously.

That may be why we don't have an option to export videos from the 'File
Output' compositor node.

I thought about two ways of going around that:

1) do something similar with how we handle Render structs, so instead of
having one static of each property we store a whole struct in a listbase
and populate it with the needed elements.

2) we quit using static elements and pass a custom struct to the
mh.* functions (start_movie, append_movie, ...). And we store this
struct in the mf struct.

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

M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/BKE_writeavi.h
M	source/blender/blenkernel/BKE_writeffmpeg.h
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenkernel/intern/writeavi.c
M	source/blender/blenkernel/intern/writeffmpeg.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/screen/screendump.c
M	source/blender/makesrna/intern/rna_scene_api.c
M	source/blender/quicktime/apple/qtkit_export.m
M	source/blender/quicktime/quicktime_export.h
M	source/blender/render/intern/source/pipeline.c

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

diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 4104582..8f0f902 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -159,6 +159,7 @@ const char *BKE_scene_render_view_name_get(const struct RenderData *rd, const in
 size_t BKE_scene_view_id_get(const struct RenderData *rd, const char *viewname);
 void BKE_scene_view_filepath_get(const struct RenderData *rd, const char *filepath, const char *view, char *r_filepath);
 const char *BKE_scene_view_suffix_get(const struct RenderData *rd, const char *viewname);
+const char *BKE_scene_view_id_suffix_get(const struct RenderData *rd, const size_t view_id);
 void BKE_scene_view_prefix_get(struct Scene *scene, const char *name, char *rprefix, char **rext);
 void BKE_scene_videos_dimensions_get(const struct RenderData *rd, const size_t width, const size_t height, size_t *r_width, size_t *r_height);
 size_t BKE_scene_num_videos_get(const struct RenderData *rd);
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index 7887595..4a1de0f 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -43,16 +43,16 @@ struct ReportList;
 struct Scene;
 
 typedef struct bMovieHandle {
-	int (*start_movie)(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
+	int (*start_movie)(struct Scene *scene, struct RenderData *rd, int rectx, int recty, const char *suffix, struct ReportList *reports);
 	int (*append_movie)(struct RenderData *rd, int start_frame, int frame, int *pixels,
-	                    int rectx, int recty, struct ReportList *reports);
+	                    int rectx, int recty, const char *suffix, struct ReportList *reports);
 	void (*end_movie)(void);
 	int (*get_next_frame)(struct RenderData *rd, struct ReportList *reports); /* optional */
-	void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
+	void (*get_movie_path)(char *string, struct RenderData *rd, const char *suffix); /* optional */
 } bMovieHandle;
 
 bMovieHandle *BKE_movie_handle_get(const char imtype);
-void BKE_movie_filepath_get(char *string, struct RenderData *rd);
+void BKE_movie_filepath_get(char *string, struct RenderData *rd, const char *suffix);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 703e84b..2052c87 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -69,11 +69,11 @@ struct RenderData;
 struct ReportList;
 struct Scene;
 
-int BKE_ffmpeg_start(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports);
+int BKE_ffmpeg_start(struct Scene *scene, struct RenderData *rd, int rectx, int recty, const char *suffix, struct ReportList *reports);
 void BKE_ffmpeg_end(void);
 int BKE_ffmpeg_append(struct RenderData *rd, int start_frame, int frame, int *pixels,
-                      int rectx, int recty, struct ReportList *reports);
-void BKE_ffmpeg_filepath_get(char *string, struct RenderData *rd);
+                      int rectx, int recty, const char *suffix, struct ReportList *reports);
+void BKE_ffmpeg_filepath_get(char *string, struct RenderData *rd, const char *suffix);
 
 void BKE_ffmpeg_preset_set(struct RenderData *rd, int preset);
 void BKE_ffmpeg_image_type_verify(struct RenderData *rd, struct ImageFormatData *imf);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 9060ea6..aeaa1ec 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2310,6 +2310,16 @@ const char *BKE_scene_view_suffix_get(const RenderData *rd, const char *viewname
 		return viewname;
 }
 
+const char *BKE_scene_view_id_suffix_get(const RenderData *rd, const size_t view_id)
+{
+	if ((rd->scemode & R_MULTIVIEW) == 0)
+		return "";
+	else {
+		const char *viewname = BKE_scene_render_view_name_get(rd, view_id);
+		return BKE_scene_view_suffix_get(rd, viewname);
+	}
+}
+
 void BKE_scene_view_prefix_get(Scene *scene, const char *name, char *rprefix, char **rext)
 {
 	SceneRenderView *srv;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 8a6a043..bf65b79 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -65,11 +65,11 @@ static int append_stub(RenderData *UNUSED(rd), int UNUSED(start_frame), int UNUS
 #  include "AVI_avi.h"
 
 /* callbacks */
-static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports);
+static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports);
 static void end_avi(void);
 static int append_avi(RenderData *rd, int start_frame, int frame, int *pixels,
-                      int rectx, int recty, ReportList *reports);
-static void filepath_avi(char *string, RenderData *rd);
+                      int rectx, int recty, const char *suffix, ReportList *reports);
+static void filepath_avi(char *string, RenderData *rd, const char *suffix);
 #endif  /* WITH_AVI */
 
 #ifdef WITH_QUICKTIME
@@ -141,7 +141,7 @@ bMovieHandle *BKE_movie_handle_get(const char imtype)
 
 static AviMovie *avi = NULL;
 
-static void filepath_avi(char *string, RenderData *rd)
+static void filepath_avi(char *string, RenderData *rd, const char *suffix)
 {
 	if (string == NULL) return;
 
@@ -161,9 +161,11 @@ static void filepath_avi(char *string, RenderData *rd)
 			BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
 		}
 	}
+
+	BLI_path_view(string, suffix);
 }
 
-static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
+static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports)
 {
 	int x, y;
 	char name[256];
@@ -173,7 +175,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
 	
 	(void)scene; /* unused */
 	
-	filepath_avi(name, rd);
+	filepath_avi(name, rd, suffix);
 
 	x = rectx;
 	y = recty;
@@ -208,7 +210,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
 }
 
 static int append_avi(RenderData *UNUSED(rd), int start_frame, int frame, int *pixels,
-                      int rectx, int recty, ReportList *UNUSED(reports))
+                      int rectx, int recty, const char *UNUSED(suffix), ReportList *UNUSED(reports))
 {
 	unsigned int *rt1, *rt2, *rectot;
 	int x, y;
@@ -254,11 +256,11 @@ static void end_avi(void)
 #endif  /* WITH_AVI */
 
 /* similar to BKE_makepicstring() */
-void BKE_movie_filepath_get(char *string, RenderData *rd)
+void BKE_movie_filepath_get(char *string, RenderData *rd, const char *suffix)
 {
 	bMovieHandle *mh = BKE_movie_handle_get(rd->im_format.imtype);
 	if (mh->get_movie_path)
-		mh->get_movie_path(string, rd);
+		mh->get_movie_path(string, rd, suffix);
 	else
 		string[0] = '\0';
 }
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 9737ef4..b8abf9c 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -798,7 +798,7 @@ static void ffmpeg_dict_set_float(AVDictionary **dict, const char *key, float va
 	av_dict_set(dict, key, buffer, 0);
 }
 
-static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, ReportList *reports)
+static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports)
 {
 	/* Handle to the output file */
 	AVFormatContext *of;
@@ -816,7 +816,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 	ffmpeg_autosplit = rd->ffcodecdata.flags & FFMPEG_AUTOSPLIT_OUTPUT;
 	
 	/* Determine the correct filename */
-	BKE_ffmpeg_filepath_get(name, rd);
+	BKE_ffmpeg_filepath_get(name, rd, suffix);
 	PRINT("Starting output to %s(ffmpeg)...\n"
 	        "  Using type=%d, codec=%d, audio_codec=%d,\n"
 	        "  video_bitrate=%d, audio_bitrate=%d,\n"
@@ -1028,7 +1028,7 @@ static void flush_ffmpeg(void)
  * ********************************************************************** */
 
 /* Get the output filename-- similar to the other output formats */
-void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
+void BKE_ffmpeg_filepath_get(char *string, RenderData *rd, const char *suffix)
 {
 	char autosplit[20];
 
@@ -1075,15 +1075,17 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
 
 		strcat(string, autosplit);
 	}
+
+	BLI_path_view(string, suffix);
 }
 
-int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
+int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, const char *suffix, ReportList *reports)
 {
 	int success;
 
 	ffmpeg_autosplit_count = 0;
 
-	success = start_ffmpeg_impl(rd, rectx, recty, reports);
+	success = start_ffmpeg_impl(rd, rectx, recty, suffix, reports);
 #ifdef WITH_AUDASPACE
 	if (audio_stream) {
 		AVCodecContext *c = audio_stream->codec;
@@ -1138,7 +1140,8 @@ static void write_audio_frames(double to_pts)
 }
 #endif
 
-int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, ReportList *reports)
+int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty,
+                      const char *suffix, ReportList *reports)
 {
 	AVFrame *avframe;
 	int success = 1;
@@ -1156,7 +1159,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
 			if (avio_tell(outfile->pb) > FFMPEG_AUTOSPLIT_SIZE) {
 				end_ffmpeg_impl(true);
 				ffmpeg_autosplit_count++;
-				success &= start_ffmpeg_impl(rd, rectx, recty, reports);
+				success &= start_ffmpeg_impl(rd, rectx, recty, suffix, reports);
 			}
 		}
 	}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 632c268..f4a880e 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/rende

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list