From 3f84fe14c06956b5092c257fd27da490565566e5 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Fri, 4 Apr 2014 16:48:32 -0700 Subject: [PATCH] Fix crashing when using opengl services with wrapper producers. Steinar reported crashing in Kdenlive when using the framebuffer producer due to movit.crop changing the format to mlt_image_none. Removing that required making other components handle requests with format = mlt_image_none. --- src/framework/mlt_frame.c | 3 +++ src/modules/core/producer_colour.c | 2 +- src/modules/gtk2/producer_pixbuf.c | 4 ++-- src/modules/opengl/filter_movit_crop.cpp | 3 --- src/modules/qt/qimage_wrapper.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index baf9d8d5..da7bb8e0 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -509,6 +509,9 @@ static int generate_test_image( mlt_properties properties, uint8_t **buffer, ml if ( *buffer ) memset( *buffer, 255, size ); break; + case mlt_image_glsl: + case mlt_image_glsl_texture: + *format = mlt_image_yuv422; case mlt_image_yuv422: size *= 2; size += *width * 2; diff --git a/src/modules/core/producer_colour.c b/src/modules/core/producer_colour.c index bb9427cc..80ca7a61 100644 --- a/src/modules/core/producer_colour.c +++ b/src/modules/core/producer_colour.c @@ -88,7 +88,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form mlt_color color = mlt_properties_get_color( producer_props, "resource" ); // Choose suitable out values if nothing specific requested - if ( *format == mlt_image_none ) + if ( *format == mlt_image_none || *format == mlt_image_glsl ) *format = mlt_image_rgb24a; if ( *width <= 0 ) *width = mlt_service_profile( MLT_PRODUCER_SERVICE(producer) )->width; diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index 1ec705e3..e155f403 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -442,7 +442,7 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, mlt_image_form self->image, self->pixbuf, current_idx, self->image_idx, self->pixbuf_idx, width ); // If we have a pixbuf and we need an image - if ( self->pixbuf && ( !self->image || ( format != mlt_image_none && format != self->format ) ) ) + if ( self->pixbuf && ( !self->image || ( format != mlt_image_none && format != mlt_image_glsl && format != self->format ) ) ) { char *interps = mlt_properties_get( properties, "rescale.interp" ); if ( interps ) interps = strdup( interps ); @@ -495,7 +495,7 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, mlt_image_form pthread_mutex_unlock( &g_mutex ); // Convert image to requested format - if ( format != mlt_image_none && format != self->format ) + if ( format != mlt_image_none && format != mlt_image_glsl && format != self->format ) { uint8_t *buffer = NULL; diff --git a/src/modules/opengl/filter_movit_crop.cpp b/src/modules/opengl/filter_movit_crop.cpp index 24ae8702..0dee4b9c 100644 --- a/src/modules/opengl/filter_movit_crop.cpp +++ b/src/modules/opengl/filter_movit_crop.cpp @@ -53,9 +53,6 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format // Get the image as requested // *format = (mlt_image_format) mlt_properties_get_int( MLT_PRODUCER_PROPERTIES(producer), "_movit image_format" ); - *format = mlt_image_none; - if ( mlt_properties_get_int( properties, "test_image" ) ) - *format = mlt_image_yuv422; error = mlt_frame_get_image( frame, image, format, width, height, writable ); // Skip processing if requested. diff --git a/src/modules/qt/qimage_wrapper.cpp b/src/modules/qt/qimage_wrapper.cpp index ee5db0b1..850a7e4e 100644 --- a/src/modules/qt/qimage_wrapper.cpp +++ b/src/modules/qt/qimage_wrapper.cpp @@ -222,7 +222,7 @@ void refresh_image( producer_qimage self, mlt_frame frame, mlt_image_format form self->current_image = NULL; // If we have a qimage and need a new scaled image - if ( self->qimage && ( !self->current_image || ( format != mlt_image_none && format != self->format ) ) ) + if ( self->qimage && ( !self->current_image || ( format != mlt_image_none && format != mlt_image_glsl && format != self->format ) ) ) { QString interps = mlt_properties_get( properties, "rescale.interp" ); bool interp = ( interps != "nearest" ) && ( interps != "none" ); @@ -269,7 +269,7 @@ void refresh_image( producer_qimage self, mlt_frame frame, mlt_image_format form } // Convert image to requested format - if ( format != mlt_image_none && format != self->format ) + if ( format != mlt_image_none && format != mlt_image_glsl && format != self->format ) { uint8_t *buffer = NULL; -- 2.39.2