From 8e8a9b8fd5d6cf76323475f0d453f40a47138274 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 13 Aug 2008 16:01:21 +0200 Subject: [PATCH] [155/906] fix some errors and check all the pipelines listed in tests/pipelines --- gst/gl/BUGS | 19 +++++++++- gst/gl/gstglcolorscale.c | 90 ++++++++++++++++++++++++------------------------ gst/gl/gstgldownload.c | 34 +++++++++--------- gst/gl/gstgleffects.c | 18 +++++----- 4 files changed, 89 insertions(+), 72 deletions(-) diff --git a/gst/gl/BUGS b/gst/gl/BUGS index be8e471..6ded89e 100644 --- a/gst/gl/BUGS +++ b/gst/gl/BUGS @@ -1,5 +1,22 @@ known issues: - - + - gst-launch-0.10 videotestsrc ! glupload ! gldownload ! glimagesink + (or glcolorspace instead of glupload ! gldownload) + -> crash on linux when stopping (num_buffers=N or after clicking on the window cross) + (was working on win32) + (gst-launch-0.10 videotestsrc ! glupload ! gldownload ! glupload ! gldownload ! glupload ! gldownload ! ximagesink + crash when stopping) + (but not gst-launch-0.10 videotestsrc ! glupload ! gldownload ! glupload ! gldownload ! ximagesink) + log: ( Définition du pipeline à READY (prêt)... + Context 1 destroyed + Définition du pipeline à NULL... + Caught SIGSEGV accessing address 0x40 ) + - gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glimagesink t. ! queue ! glimagesink + -> crash on linux when stopping (was working on win32 too) + It look likes it's related to the first issue. + + - gst-launch-0.10 videotestsrc ! "video/x-raw-yuv, format=(fourcc)YV12" ! glimagesink + -> wrong color on linux (it look likes it uses text_shader_upload_I420 instead of YV12) + (I remember it was working on win32, so maybe we have made a regression) diff --git a/gst/gl/gstglcolorscale.c b/gst/gl/gstglcolorscale.c index 7f7437a..9f435a7 100644 --- a/gst/gl/gstglcolorscale.c +++ b/gst/gl/gstglcolorscale.c @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2008 Julien Isorce * @@ -28,7 +28,7 @@ #define GST_CAT_DEFAULT gst_gl_colorscale_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -static const GstElementDetails element_details = +static const GstElementDetails element_details = GST_ELEMENT_DETAILS ("OpenGL color scale", "Filter/Effect", "Colorspace converter and video scaler", @@ -134,7 +134,7 @@ gst_gl_colorscale_set_property (GObject* object, guint prop_id, { //GstGLColorscale* colorscale = GST_GL_COLORSCALE (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -148,7 +148,7 @@ gst_gl_colorscale_get_property (GObject* object, guint prop_id, { //GstGLColorscale *colorscale = GST_GL_COLORSCALE (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -158,8 +158,8 @@ gst_gl_colorscale_get_property (GObject* object, guint prop_id, static void gst_gl_colorscale_reset (GstGLColorscale* colorscale) -{ - if (colorscale->display) +{ + if (colorscale->display) { g_object_unref (colorscale->display); colorscale->display = NULL; @@ -195,7 +195,7 @@ gst_gl_colorscale_transform_caps (GstBaseTransform* bt, const GValue* framerate_value = NULL; const GValue* par_value = NULL; - GST_ERROR ("transform caps %" GST_PTR_FORMAT, caps); + GST_DEBUG ("transform caps %" GST_PTR_FORMAT, caps); framerate_value = gst_structure_get_value (structure, "framerate"); par_value = gst_structure_get_value (structure, "pixel-aspect-ratio"); @@ -208,7 +208,7 @@ gst_gl_colorscale_transform_caps (GstBaseTransform* bt, gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); - + gst_structure_set_value (structure, "framerate", framerate_value); if (par_value) gst_structure_set_value (structure, "pixel-aspect-ratio", par_value); @@ -218,7 +218,7 @@ gst_gl_colorscale_transform_caps (GstBaseTransform* bt, gst_caps_merge_structure (newcaps, gst_structure_copy (structure)); - GST_ERROR ("new caps %" GST_PTR_FORMAT, newcaps); + GST_DEBUG ("new caps %" GST_PTR_FORMAT, newcaps); return newcaps; } @@ -244,7 +244,7 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction to_par = gst_structure_get_value (outs, "pixel-aspect-ratio"); //we have both PAR but they might not be fixated - if (from_par && to_par) + if (from_par && to_par) { gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d; @@ -259,7 +259,7 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction from_par_d = gst_value_get_fraction_denominator (from_par); //fixate the out PAR - if (!gst_value_is_fixed (to_par)) + if (!gst_value_is_fixed (to_par)) { GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n, from_par_d); @@ -271,12 +271,12 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction to_par_d = gst_value_get_fraction_denominator (to_par); //f both width and height are already fixed, we can't do anything - //about it anymore + //about it anymore if (gst_structure_get_int (outs, "width", &w)) ++count; if (gst_structure_get_int (outs, "height", &h)) ++count; - if (count == 2) + if (count == 2) { GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating", w, h); @@ -287,7 +287,7 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction gst_structure_get_int (ins, "height", &from_h); if (!gst_video_calculate_display_ratio (&num, &den, from_w, from_h, - from_par_n, from_par_d, to_par_n, to_par_d)) + from_par_n, from_par_d, to_par_n, to_par_d)) { GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL), ("Error calculating the output scaled size - integer overflow")); @@ -304,35 +304,35 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction //prefer those that have one of w/h the same as the incoming video //using wd / hd = num / den - //if one of the output width or height is fixed, we work from there - if (h) + //if one of the output width or height is fixed, we work from there + if (h) { GST_DEBUG_OBJECT (base, "height is fixed,scaling width"); w = (guint) gst_util_uint64_scale_int (h, num, den); - } - else if (w) + } + else if (w) { GST_DEBUG_OBJECT (base, "width is fixed, scaling height"); h = (guint) gst_util_uint64_scale_int (w, den, num); - } - else + } + else { //none of width or height is fixed, figure out both of them based only on //the input width and height - //check hd / den is an integer scale factor, and scale wd with the PAR - if (from_h % den == 0) + //check hd / den is an integer scale factor, and scale wd with the PAR + if (from_h % den == 0) { GST_DEBUG_OBJECT (base, "keeping video height"); h = from_h; w = (guint) gst_util_uint64_scale_int (h, num, den); - } - else if (from_w % num == 0) + } + else if (from_w % num == 0) { GST_DEBUG_OBJECT (base, "keeping video width"); w = from_w; h = (guint) gst_util_uint64_scale_int (w, den, num); - } - else + } + else { GST_DEBUG_OBJECT (base, "approximating but keeping video height"); h = from_h; @@ -344,14 +344,14 @@ gst_gl_colorscale_fixate_caps (GstBaseTransform* base, GstPadDirection direction //now fixate gst_structure_fixate_field_nearest_int (outs, "width", w); gst_structure_fixate_field_nearest_int (outs, "height", h); - } - else + } + else { gint width, height; - if (gst_structure_get_int (ins, "width", &width)) + if (gst_structure_get_int (ins, "width", &width)) { - if (gst_structure_has_field (outs, "width")) + if (gst_structure_has_field (outs, "width")) gst_structure_fixate_field_nearest_int (outs, "width", width); } if (gst_structure_get_int (ins, "height", &height)) { @@ -380,22 +380,22 @@ gst_gl_colorscale_set_caps (GstBaseTransform* bt, GstCaps* incaps, ret |= gst_video_format_parse_caps (incaps, &colorscale->input_video_format, &colorscale->input_video_width, &colorscale->input_video_height); - if (!ret) + if (!ret) { GST_DEBUG ("bad caps"); return FALSE; } colorscale->display = gst_gl_display_new (); - + //init unvisible opengl context - gst_gl_display_create_context (colorscale->display, + gst_gl_display_create_context (colorscale->display, 50, y_pos++ * (colorscale->output_video_height+50) + 50, - colorscale->output_video_width, colorscale->output_video_height, + colorscale->output_video_width, colorscale->output_video_height, 0, FALSE); //blocking call, init colorspace conversion if needed - gst_gl_display_init_upload (colorscale->display, colorscale->input_video_format, + gst_gl_display_init_upload (colorscale->display, colorscale->input_video_format, colorscale->output_video_width, colorscale->output_video_height); //blocking call, init colorspace conversion if needed @@ -415,18 +415,18 @@ gst_gl_colorscale_get_unit_size (GstBaseTransform* trans, GstCaps* caps, gint height; structure = gst_caps_get_structure (caps, 0); - if (gst_structure_has_name (structure, "video/x-raw-gl")) + if (gst_structure_has_name (structure, "video/x-raw-gl")) { ret = gst_gl_buffer_parse_caps (caps, &width, &height); - if (ret) + if (ret) *size = gst_gl_buffer_get_size (width, height); - } - else + } + else { GstVideoFormat video_format; ret = gst_video_format_parse_caps (caps, &video_format, &width, &height); - if (ret) + if (ret) *size = gst_video_format_get_size (video_format, width, height); } @@ -448,22 +448,22 @@ gst_gl_colorscale_transform (GstBaseTransform* trans, GstBuffer* inbuf, GST_BUFFER_DATA (inbuf), GST_BUFFER_SIZE (inbuf)); //blocking call - isAlive = gst_gl_display_do_upload (colorscale->display, gl_temp_buffer->texture, - colorscale->input_video_width, colorscale->input_video_height, + isAlive = gst_gl_display_do_upload (colorscale->display, gl_temp_buffer->texture, + colorscale->input_video_width, colorscale->input_video_height, GST_BUFFER_DATA (inbuf)); GST_DEBUG ("output size %p size %d", GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); //blocking call - isAlive &= gst_gl_display_do_download(colorscale->display, gl_temp_buffer->texture, - gl_temp_buffer->width, gl_temp_buffer->height, + isAlive &= gst_gl_display_do_download(colorscale->display, gl_temp_buffer->texture, + gl_temp_buffer->width, gl_temp_buffer->height, GST_BUFFER_DATA (outbuf)); gst_buffer_unref (gl_temp_buffer); if (isAlive) return GST_FLOW_OK; - else + else return GST_FLOW_UNEXPECTED; } diff --git a/gst/gl/gstgldownload.c b/gst/gl/gstgldownload.c index d67807b..e4d0b58 100644 --- a/gst/gl/gstgldownload.c +++ b/gst/gl/gstgldownload.c @@ -1,4 +1,4 @@ -/* +/* * GStreamer * Copyright (C) 2008 Julien Isorce * @@ -27,7 +27,7 @@ #define GST_CAT_DEFAULT gst_gl_download_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -static const GstElementDetails element_details = +static const GstElementDetails element_details = GST_ELEMENT_DETAILS ("OpenGL video maker", "Filter/Effect", "A from GL to video flow filter", @@ -127,7 +127,7 @@ gst_gl_download_set_property (GObject* object, guint prop_id, { //GstGLDownload *download = GST_GL_DOWNLOAD (object); - switch (prop_id) + switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -153,7 +153,7 @@ gst_gl_download_get_property (GObject* object, guint prop_id, static void gst_gl_download_reset (GstGLDownload* download) { - if (download->display) + if (download->display) { g_object_unref (download->display); download->display = NULL; @@ -194,7 +194,7 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, download = GST_GL_DOWNLOAD (bt); - GST_ERROR ("transform caps %" GST_PTR_FORMAT, caps); + GST_DEBUG ("transform caps %" GST_PTR_FORMAT, caps); structure = gst_caps_get_structure (caps, 0); @@ -203,7 +203,7 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, framerate_value = gst_structure_get_value (structure, "framerate"); par_value = gst_structure_get_value (structure, "pixel-aspect-ratio"); - if (direction == GST_PAD_SINK) + if (direction == GST_PAD_SINK) { newothercaps = gst_caps_new_simple ("video/x-raw-rgb", NULL); newstruct = gst_caps_get_structure (newothercaps, 0); @@ -217,7 +217,7 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, 1, 1, NULL); newcaps = gst_caps_new_simple ("video/x-raw-yuv", NULL); gst_caps_append(newcaps, newothercaps); - } + } else newcaps = gst_caps_new_simple ("video/x-raw-gl", NULL); newstruct = gst_caps_get_structure (newcaps, 0); @@ -230,7 +230,7 @@ gst_gl_download_transform_caps (GstBaseTransform * bt, gst_structure_set (newstruct, "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL); - GST_ERROR ("new caps %" GST_PTR_FORMAT, newcaps); + GST_DEBUG ("new caps %" GST_PTR_FORMAT, newcaps); return newcaps; } @@ -249,7 +249,7 @@ gst_gl_download_set_caps (GstBaseTransform* bt, GstCaps* incaps, ret = gst_video_format_parse_caps (outcaps, &download->video_format, &download->width, &download->height); - if (!ret) + if (!ret) { GST_ERROR ("bad caps"); return FALSE; @@ -268,17 +268,17 @@ gst_gl_download_get_unit_size (GstBaseTransform* trans, GstCaps* caps, gint height; structure = gst_caps_get_structure (caps, 0); - if (gst_structure_has_name (structure, "video/x-raw-gl")) + if (gst_structure_has_name (structure, "video/x-raw-gl")) { ret = gst_gl_buffer_parse_caps (caps, &width, &height); - if (ret) + if (ret) *size = gst_gl_buffer_get_size (width, height); - } - else + } + else { GstVideoFormat video_format; ret = gst_video_format_parse_caps (caps, &video_format, &width, &height); - if (ret) + if (ret) *size = gst_video_format_get_size (video_format, width, height); } @@ -292,7 +292,7 @@ gst_gl_download_transform (GstBaseTransform* trans, GstBuffer* inbuf, GstGLDownload* download = GST_GL_DOWNLOAD (trans); GstGLBuffer* gl_inbuf = GST_GL_BUFFER (inbuf); - if (download->display == NULL) + if (download->display == NULL) { download->display = g_object_ref (gl_inbuf->display); @@ -300,14 +300,14 @@ gst_gl_download_transform (GstBaseTransform* trans, GstBuffer* inbuf, gst_gl_display_init_download (download->display, download->video_format, download->width, download->height); } - else + else g_assert (download->display == gl_inbuf->display); GST_DEBUG ("making video %p size %d", GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); //blocking call - if (gst_gl_display_do_download(download->display, gl_inbuf->texture, + if (gst_gl_display_do_download(download->display, gl_inbuf->texture, gl_inbuf->width, gl_inbuf->height, GST_BUFFER_DATA (outbuf))) return GST_FLOW_OK; else diff --git a/gst/gl/gstgleffects.c b/gst/gl/gstgleffects.c index 64bd0c2..0ec55c7 100644 --- a/gst/gl/gstgleffects.c +++ b/gst/gl/gstgleffects.c @@ -63,7 +63,7 @@ typedef void (* GstGLEffectProcessFunc) (GstGLEffects *effects); struct _GstGLEffects { GstGLFilter filter; - + GstGLEffectProcessFunc effect; GLuint intexture; @@ -125,9 +125,9 @@ gst_gl_effects_effect_get_type (void) { GST_GL_EFFECT_TEST, "Test Effect", "test" }, { 0, NULL, NULL } }; - + if (!gl_effects_effect_type) { - gl_effects_effect_type = + gl_effects_effect_type = g_enum_register_static ("GstGLEffectsEffect", effect_types); } return gl_effects_effect_type; @@ -150,7 +150,7 @@ gst_gl_effects_init_gl_resources (GstGLFilter *filter) { GstGLEffects *effects = GST_GL_EFFECTS (filter); gint i; - + for (i=0; imidtexture[i]); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, effects->midtexture[i]); @@ -271,7 +271,7 @@ gst_gl_effects_identity (GstGLEffects *effects) { static void gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass) { - effects->shaderstable = g_hash_table_new_full (g_str_hash, + effects->shaderstable = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); @@ -304,11 +304,11 @@ static void gst_gl_effects_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstGLEffects *effects = GST_GL_EFFECTS (object); + //GstGLEffects *effects = GST_GL_EFFECTS (object); switch (prop_id) { case PROP_EFFECT: - gst_gl_effects_set_effect (effects, g_value_get_enum (value)); + //gst_gl_effects_set_effect (effects, g_value_get_enum (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -330,8 +330,8 @@ gst_gl_effects_filter (GstGLFilter* filter, GstGLBuffer* inbuf, effects->intexture = inbuf->texture; effects->outtexture = outbuf->texture; - + effects->effect (effects); - + return TRUE; } -- 2.7.4