(bind-func xtm_play
(lambda (path)
(if vplay1
(println "Wait to finish the running video first!\n")
(let ((gstErr:GError* (halloc))
(playz (gst_parse_launch (cstring (replace "playbin uri=*" "*" path))
gstErr))
(filter (gst_parse_launch "videoflip method=5" gstErr))
(sinkz (gst_parse_launch "appsink caps=video/x-raw,format=RGB,width=600,height=400" gstErr))
(bus (gst_pipeline_get_bus (cast playz GstPipeline*)))
(appBin:GstElement* (gst_bin_new "app_bin"))
(data:userdata* (halloc))
(callbacks:GstAppSinkCallbacks* (halloc))
(gv:GValue* (halloc)))
(gst_bus_add_watch bus (cast (get_native_fptr playbin_bus_call) GstBusFunc) (cast data gpointer))
(println "filter:" (not (null? filter)))
(println "sinkz:" (not (null? sinkz)))
(println "playz" (not (null? playz)))
(gst_object_unref bus)
(tfill! callbacks
(get_native_fptr eos)
(get_native_fptr new_preroll)
(get_native_fptr new_sample))
(tset! data 0 1)
(tset! data 1 (cast playz GstElement*))
(gst_app_sink_set_callbacks (cast sinkz i8*) callbacks (cast data gpointer) null)