;; path must be a valid URI to media
(bind-func xtm_play
(lambda (path)
(gst_init null null)
(let ((playz (gst_element_factory_make "playbin" "play"))
(bus (gst_pipeline_get_bus (cast playz GstPipeline*)))
(gval:GValue* (alloc)))
(g_value_init gval G_TYPE_STRING)
(g_value_set_string gval path)
(g_object_set_property (cast playz GObject*) "uri" gval)
(gst_bus_add_watch bus (cast (llvm_get_function_ptr "_playbin_bus_call_native") GstBusFunc) (cast playz gpointer))
(gst_object_unref bus)
(gst_element_set_state playz GST_STATE_PLAYING)
1)))