Show error when unsupported movie format used
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2015 16:40:08 +0000 (02:40 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2015 17:02:07 +0000 (03:02 +1000)
Was silently failing.

source/blender/blenkernel/intern/writeavi.c
source/blender/editors/render/render_opengl.c
source/blender/editors/screen/screendump.c
source/blender/render/intern/source/pipeline.c

index cec455e01b9f101fde67b09dd9152e79824d68c1..82e4405225a0f8e182fade5536c9620708a7b646 100644 (file)
@@ -147,7 +147,9 @@ bMovieHandle *BKE_movie_handle_get(const char imtype)
 #endif
 
        /* in case all above are disabled */
-       (void)imtype;return &mh;
+       (void)imtype;
+
+       return (mh.append_movie != append_stub) ? &mh : NULL;
 }
 
 /* ****************************************************************** */
@@ -298,8 +300,10 @@ static void context_free_avi(void *context_v)
 void BKE_movie_filepath_get(char *string, RenderData *rd, bool preview, const char *suffix)
 {
        bMovieHandle *mh = BKE_movie_handle_get(rd->im_format.imtype);
-       if (mh->get_movie_path)
+       if (mh && mh->get_movie_path) {
                mh->get_movie_path(string, rd, preview, suffix);
-       else
+       }
+       else {
                string[0] = '\0';
+       }
 }
index c718dfa922933468cf9bce14eb326ac44880e792..fe4022709de625de3171c8f7d9db822fe4801758 100644 (file)
@@ -706,7 +706,7 @@ static void screen_opengl_render_cancel(bContext *C, wmOperator *op)
 }
 
 /* share between invoke and exec */
-static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
+static bool screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
 {
        /* initialize animation */
        OGLRender *oglrender;
@@ -722,9 +722,16 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
                size_t i, width, height;
 
                BKE_scene_multiview_videos_dimensions_get(&scene->r, oglrender->sizex, oglrender->sizey, &width, &height);
-               oglrender->movie_ctx_arr = MEM_mallocN(sizeof(void *) * oglrender->totvideos, "Movies");
                oglrender->mh = BKE_movie_handle_get(scene->r.im_format.imtype);
 
+               if (oglrender->mh == NULL) {
+                       BKE_report(oglrender->reports, RPT_ERROR, "Movie format unsupported");
+                       screen_opengl_render_end(C, oglrender);
+                       return false;
+               }
+
+               oglrender->movie_ctx_arr = MEM_mallocN(sizeof(void *) * oglrender->totvideos, "Movies");
+
                for (i = 0; i < oglrender->totvideos; i++) {
                        const char *suffix = BKE_scene_multiview_view_id_suffix_get(&scene->r, i);
 
@@ -733,7 +740,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
                                                        oglrender->sizey, oglrender->reports, PRVRANGEON != 0, suffix))
                        {
                                screen_opengl_render_end(C, oglrender);
-                               return 0;
+                               return false;
                        }
                }
        }
@@ -742,7 +749,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
        oglrender->nfra = PSFRA;
        scene->r.cfra = PSFRA;
 
-       return 1;
+       return true;
 }
 
 static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
index e23ac1710e3a3db4eb5e42506afbad1572566eed..a701fc9ccb79b2a8816d915b433e199485c76445 100644 (file)
@@ -354,6 +354,10 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
        
        if (BKE_imtype_is_movie(rd.im_format.imtype)) {
                mh = BKE_movie_handle_get(sj->scene->r.im_format.imtype);
+               if (mh == NULL) {
+                       printf("Movie format unsupported\n");
+                       return;
+               }
                sj->movie_ctx = mh->context_create();
                sj->movie_handle = mh;
 
index 98279da13bd19719caee830ca1bc5e317958b456..ad0856497c326c8adb91332389526deec785b401 100644 (file)
@@ -3517,6 +3517,11 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
                get_videos_dimensions(re, &rd, &width, &height);
 
                mh = BKE_movie_handle_get(scene->r.im_format.imtype);
+               if (mh == NULL) {
+                       BKE_report(re->reports, RPT_ERROR, "Movie format unsupported");
+                       return;
+               }
+
                re->movie_ctx_arr = MEM_mallocN(sizeof(void *) * totvideos, "Movies' Context");
 
                for (i = 0; i < totvideos; i++) {