(bind-func new_sample
(lambda (sink:GstAppSink* data:gpointer)
(let ((sample (gst_app_sink_pull_sample (cast sink i8*)))
(caps (gst_sample_get_caps sample))
(buffer (gst_sample_get_buffer sample))
(dat:i8* null)
(xsize:gsize 0)
(quad (tref (cast data userdata*) 0)))
;; (printf "Playing back on quad:%d\n" quad)
(set! dat (cond ((= quad 1) sampledata1)
((= quad 2) sampledata2)
((= quad 3) sampledata3)
((= quad 4) sampledata4)))
(set! xsize (gst_buffer_extract buffer 0 dat (* 3 600 400)))
(if (= xsize (* 3 600 400))
(cond ((= quad 1) (set! sampledata1dirty #t))
((= quad 2) (set! sampledata2dirty #t))
((= quad 3) (set! sampledata3dirty #t))
((= quad 4) (set! sampledata4dirty #t)))
(cond ((= quad 1) (set! sampledata1dirty #f))
((= quad 2) (set! sampledata2dirty #f))
((= quad 3) (set! sampledata3dirty #f))
((= quad 4) (set! sampledata4dirty #f))))
GST_FLOW_OK)))