AW: AW: AW: Dynamic change of glshader element

Tim Müller tim at centricular.com
Sun Nov 23 13:48:49 PST 2014


On Sun, 2014-11-23 at 21:10 +0100, Christian Winkler wrote:

Hi,

I wonder if it might be a locale issue with the floating point
variables.

Are you using a German locale? If yes, the system (strtod) expects
floating point numbers to be like 1/2 = 0,5 for Germany and not 0.5. You
can try the attached patch to see if it makes a difference.

But then, I would expect strtod to just return 0 in this case and stop
parsing at the comma, and the code doesn't check for parsing errors, so
perhaps it's something else after all.

 Cheers
  -Tim

> I dont see that it is a line ending issue, i tried all possible combinations.
> 
> Part oft he log (Position 21 is the opening bracket...):
> ....
> 
> 0:00:09.974702317  7576 00000000029D7540 INFO                 default gstglshadervariables.c:233:gst_gl_shadervariables_parse: vartype : 'float'
> 
> 0:00:09.977922208  7576 00000000029D7540 INFO                 default gstglshadervariables.c:246:gst_gl_shadervariables_parse: varname : 'shiftX'
> 
> 0:00:09.980697623  7576 00000000029D7540 INFO                 default gstglshadervariables.c:247:gst_gl_shadervariables_parse: arraysize : 0
> 
> 0:00:09.983411459  7576 00000000029D7540 ERROR                default gstglshadervariables.c:322:gst_gl_shadervariables_parse:
> float shiftX = float(0.1);
> 0:00:09.986446612  7576 00000000029D7540 ERROR                default gstglshadervariables.c:326:gst_gl_shadervariables_parse: parse error on line 1, position 21 (0.1))
> 0:00:09.989962164  7576 00000000029D7540 TRACE               glwindow gstglwindow_win32.c:309:gst_gl_window_win32_run: handle message
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von Matthew Waters
> Gesendet: Sonntag, 23. November 2014 16:59
> An: gstreamer-devel at lists.freedesktop.org
> Betreff: Re: AW: AW: Dynamic change of glshader element
> 
> On 23/11/14 23:04, Christian Winkler wrote:
> > Ok...after hours of trying to get uniforms working even in command line i have to come to a simple conclusion:
> > The setting of a preset file for a glshader element is broken in the windows version of gstreamer.
> > It works under android and ubuntu....
> >
> > What a waste of time :-/
> 
> This could possibly be a line endings issue.  What happens if you take the preset file from ubuntu/android and use it in a windows environment?  If it is, the following should fix your issue.
> 
> http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=59085936b820e02734097c17d6dfeb2387f22d9f
> 
> Otherwise please open a bug against gst-plugins-bad here https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
> It would be most helpful if you could also attach a
> GST_DEBUG=default:7,gl*:7 log to the bug.
> 
> > Thanks to all of you for your help.
> >
> > Now lets go fort he c code...
> >
> > -----Ursprüngliche Nachricht-----
> > Von: gstreamer-devel 
> > [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von 
> > Matthew Waters
> > Gesendet: Mittwoch, 19. November 2014 10:45
> > An: gstreamer-devel at lists.freedesktop.org
> > Betreff: Re: AW: Dynamic change of glshader element
> >
> > On 19/11/14 08:18, Christian Winkler wrote:
> >> Dear Luc,
> >>
> >> thanks.
> >> I definitley have trouble setting the presets.
> >> Either by command line or code, they are not accepted.
> >>
> >> For instance:
> >> gst-launch-1.0.exe -e -v videotestsrc ! "video/x-raw, width80, 
> >> heightr0" ! videoconvert ! glshader location=st.frag preset=st.preset 
> >> ! glimagesink
> >>
> >>
> >> dist frag:
> >> precision mediump float;
> >> varying vec2 v_texcoord;
> >> uniform sampler2D tex;
> >>
> >> const vec4 kappa  4(2.75,1.7,0.5,0.5); const float screen_width  0.0; 
> >> const float screen_height 0.0; const vec2 leftCenter  2(0.25, 0.4); 
> >> const vec2 rightCenter  2(0.75, 0.4); const float separation =025; 
> >> const bool stereo_input =alse; uniform float scaleFactor; .........
> >>
> >> dist.preset:
> >> float scaleFactor =loat(0.2);
> >>
> >> or, also tried:
> >> float scaleFactor =;
> > The following works for me.  Note that you need the float on both sides of the assignment in the preset and they must be the same type.  Also, you could try running with the gst debug log and seeing what it outputs.
> >
> > preset/vars:
> > float scale =loat(0.2);
> >
> > shader:
> > #ifdef GL_ES
> > precision mediump float;
> > #endif
> > varying vec2 v_texcoord;
> > uniform sampler2D tex;
> > uniform float scale;
> >
> > void main () {
> >   gl_FragColor =exture2D( tex, v_texcoord ) * vec4(vec3(scale), 1.0); 
> > }
> >
> >> The value 0.2 is simply ignored.
> >> I dont know why that happens
> >>
> >> scaleFactor iss et to 0.
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: gstreamer-devel
> >> [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von 
> >> luc.deschenaux
> >> Gesendet: Montag, 17. November 2014 04:45
> >> An: gstreamer-devel at lists.freedesktop.org
> >> Betreff: Re: Dynamic change of glshader element
> >>
> >> You could also initialize the uniform variables using text values 
> >> (using GLSL
> >> syntax) with something like
> >>         g_object_set (G_OBJECT (glshader), "preset", str, NULL)
> >>
> >> or change their value using text values with
> >>         g_object_set (G_OBJECT (glshader), "vars", str, NULL)
> >>
> >> See
> >> https://bug600195.bugzilla-attachments.gnome.org/attachment.cgi?id66
> >> 1
> >> 9
> >>
> >> But since this rely on the gst_gl_shader_set_uniform methods (with the overhead implied for parsing the text string), calling the gst_gl_shader_set_uniforms methods directly is more efficient for modifying values dynamically.
> >>
> >>
> >>
> >> --
> >> View this message in context: 
> >> http://gstreamer-devel.966125.n4.nabble.com/Dynamic-change-of-glshade
> >> r -element-tp4669514p4669526.html Sent from the GStreamer-devel 
> >> mailing list archive at Nabble.com.
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >> gstreamer-devel at lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >>
> >>
> >
> >
> >
> 
> 
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gl-shadervariables-make-parsing-of-floats-locale-ind.patch
Type: text/x-patch
Size: 3048 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141123/605509ee/attachment.bin>


More information about the gstreamer-devel mailing list