diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-26 16:49:59 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-26 16:50:18 +0300 |
commit | c0ef4e9b788b8db433bf3e92bd19ee00f86f9866 (patch) | |
tree | 3ef303f1d1cfcbfbb5c6026a20a9c288df202a75 /source/blender/blenkernel/intern/writeavi.c | |
parent | f80064f2d24408aa85c84f3c328ef470baf39e7c (diff) |
Fix T44122, rendering OpenGL preview movie with audio has wrong audio
range and extra frames.
Issue here is that the movie backend would unconditionally use the start
frame of the scene instead of the preview frame. Solved by passing an
explicit "preview" argument.
Strictly speaking, the preview argument is part of the renderdata
struct, that is also passed to the code, but when rendering the final
result we want to unconditionally render the full range regardless of
the preview setting of the render structure.
However, OpenGL rendering does use the preview range so we need to
account for that when making those exports.
This is also a nice chance to correct the filenames, which still used
the full range.
Diffstat (limited to 'source/blender/blenkernel/intern/writeavi.c')
-rw-r--r-- | source/blender/blenkernel/intern/writeavi.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 85eac1f21ed..b0e23b6b603 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -51,7 +51,7 @@ /* ********************** general blender movie support ***************************** */ static int start_stub(Scene *UNUSED(scene), RenderData *UNUSED(rd), int UNUSED(rectx), int UNUSED(recty), - ReportList *UNUSED(reports)) + ReportList *UNUSED(reports), bool UNUSED(preview)) { return 0; } static void end_stub(void) @@ -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, ReportList *reports, bool preview); 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); +static void filepath_avi(char *string, RenderData *rd, bool preview); #endif /* WITH_AVI */ #ifdef WITH_QUICKTIME @@ -129,9 +129,7 @@ bMovieHandle *BKE_movie_handle_get(const char imtype) #endif /* in case all above are disabled */ - (void)imtype; - - return &mh; + (void)imtype;return &mh; } /* ****************************************************************** */ @@ -141,10 +139,21 @@ 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, bool preview) { + int sfra, efra; + if (string == NULL) return; + if (preview) { + sfra = rd->psfra; + efra = rd->pefra; + } + else { + sfra = rd->sfra; + efra = rd->efra; + } + strcpy(string, rd->pic); BLI_path_abs(string, G.main->name); @@ -152,18 +161,18 @@ static void filepath_avi(char *string, RenderData *rd) if (rd->scemode & R_EXTENSION) { if (!BLI_testextensie(string, ".avi")) { - BLI_path_frame_range(string, rd->sfra, rd->efra, 4); + BLI_path_frame_range(string, sfra, efra, 4); strcat(string, ".avi"); } } else { if (BLI_path_frame_check_chars(string)) { - BLI_path_frame_range(string, rd->sfra, rd->efra, 4); + BLI_path_frame_range(string, sfra, efra, 4); } } } -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, ReportList *reports, bool preview) { int x, y; char name[256]; @@ -173,7 +182,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, preview); x = rectx; y = recty; @@ -258,7 +267,7 @@ void BKE_movie_filepath_get(char *string, RenderData *rd) { 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, false); else string[0] = '\0'; } |