(bind-func playbin_bus_call:GstBusFunc
(lambda (bus msg data)
(let ((playz (tref (cast data userdata*) 1))
(msgtype (tref msg 1))
(time (tref msg 2))
(seq (tref msg 4)))
(cond ((<> (& GST_MESSAGE_EOS msgtype) 0)
;; (printf "END OF STREAM!\n")
(gst_element_set_state playz GST_STATE_NULL)
(gst_object_unref (cast playz gpointer)) ;; does playz release sink?
(free data)
1)
((<> (& GST_MESSAGE_ERROR msgtype) 0)
(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))
((<> (& msgtype GST_MESSAGE_WARNING) 0)
(printf "WARNING: %s\n" (gst_message_type_get_name msgtype))
1)
(else
;; (printf "MSG: %d:%s\n" msgtype (gst_message_type_get_name msgtype))
1))
1)))