Ok, I have tried your test program.

This works:
http://hpaste.org/70103 (having fakesink as a sink filter)

but this http://hpaste.org/70104
SEGFAULTS, as you said

Program received signal SIGSEGV, Segmentation fault.
0x0000003cc2279acd in gst_element_link_pads_filtered () from /usr/lib64/libgstreamer-0.10.so.0
(gdb) backtrace
#0 0x0000003cc2279acd in gst_element_link_pads_filtered () from /usr/lib64/libgstreamer-0.10.so.0
#1 0x0000000000400a85 in connect ()
#2 0x0000003cad047914 in ?? () from /usr/lib64/libX11.so.6
#3 0x0000003cad047152 in _X11TransConnect () from /usr/lib64/libX11.so.6
#4 0x0000003cad022968 in _X11TransConnectDisplay () from /usr/lib64/libX11.so.6
#5 0x0000003cad036f96 in XOpenDisplay () from /usr/lib64/libX11.so.6
#6 0x00002aaaaeb9859c in gst_pad_peer_accept_caps () from /usr/lib64/gstreamer-0.10/libgstximagesink.so
#7 0x00002aaaaeb99b38 in gst_pad_peer_accept_caps () from /usr/lib64/gstreamer-0.10/libgstximagesink.so
#8 0x0000003cc223d1d0 in gst_element_change_state () from /usr/lib64/libgstreamer-0.10.so.0
#9 0x0000003cc223d60d in ?? () from /usr/lib64/libgstreamer-0.10.so.0
#10 0x0000003cc222f074 in ?? () from /usr/lib64/libgstreamer-0.10.so.0
#11 0x0000003cc223d1d0 in gst_element_change_state () from /usr/lib64/libgstreamer-0.10.so.0
#12 0x0000003cc223d60d in ?? () from /usr/lib64/libgstreamer-0.10.so.0
#13 0x0000000000400c86 in player ()
#14 0x0000000000400ccb in main ()


It has X-related calls in the backtrace, so I guess the problem is we didn't initialize something needed by that window to be shown.

I have tried to call XInitThreads and XOpenDisplay prior to any gstreamer code, but it doesn't change anything.


I will check with gstreamer community and post my findings here.



On Mon, Jun 18, 2012 at 1:58 AM, <wagnerdm@seas.upenn.edu> wrote:
Quoting Milan Markovi? <zivotinja@gmail.com>:

> 2. When I construct a graph to test my filter in following code
> http://hpaste.org/69925 and load the code in ghci it SEGFAULTs. When I
> compile and run everything seems OK but no ximagesink's window ever
> appears. Did I forget to initialize something in Glib? gst-launch with the
> exact same filters shows the window.

I can't reproduce the ghci segfault. I can only think of two avenues
to pursue here:

1. Have you tried using ghci -fno-ghci-sandbox?
2. By any chance, are you using GHC 7.2? Somebody mentioned on
#haskell the other day that they were having some problems with GHC
7.2 and I haven't had a chance to attempt to reproduce them.

As for the ximagesink window not appearing, I think the right next
step is to ask a gstreamer expert. For example, we could post a
question to StackOverflow or similar. Likely the gstreamer experts
will want to read C code, so I made an attempt at a straightforward
translation of your code to C: <http://hpaste.org/70088>. However, it
segfaults on the gst_element_set_state line. If you can get that code
running, then we can do one of two things:

1. if no ximagesink window appears, then it's not gtk2hs' fault, and
we can ask a gstreamer expert for more help
2. if an ximagesink window does appear, then we can investigate the
difference between the calls gtk2hs is making and the calls the C
version is making

Good luck!
~d

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gtk2hs-users mailing list
Gtk2hs-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-users