(bind-func _playbin_bus_call:GstBusFunc
(lambda (bus msg data)
(let ((playz (cast data GstElement*))
(msgtype (tref msg 1))
(time (tref msg 2))
(seq (tref msg 4)))
(cond ((= msgtype GST_MESSAGE_EOS)
(printf "GSTREAMER: end of stream\n")
(gst_element_set_state playz GST_STATE_NULL)
(gst_object_unref (cast playz gpointer))
1)
((= msgtype GST_MESSAGE_ERROR)
(let ((debug:|1,i8*|* (alloc))
(error:|1,GError*|* (alloc)))
(gst_message_parse_error msg (cast error GError**) (cast debug i8**))
(g_free (pref debug 0))
(printf "GstError: %s\n" (tref (pref error 0) 2))
(g_error_free (pref error 0))
1))
(else
;;(printf "MSG: %d:%s\n" msgtype (gst_message_type_get_name msgtype))
1))
1)))