 
 
 (defn init-video [host]
-  (init-decoder)
-  (setup-viewer)
+  #_(setup-viewer)
   (init-video-stream host))
 
 (defn start-video [host]

(ns sormilla.video
  (:import [com.twilight.h264.decoder AVFrame AVPacket H264Decoder MpegEncContext]
           [com.twilight.h264.player FrameUtils]
           [java.util Arrays]
           [java.awt.image BufferedImage]))

(def INBUF_SIZE 65535)
(def inbuf-int (int-array (+ INBUF_SIZE MpegEncContext/FF_INPUT_BUFFER_PADDING_SIZE)))
(def avpkt (AVPacket.))
(.av_init_packet avpkt)

(def codec (H264Decoder.))
(if (nil? codec) (println "Codec not found"))
(def c (MpegEncContext/avcodec_alloc_context))
(def picture (AVFrame/avcodec_alloc_frame))

(if-not (zero? (bit-and (.capabilities codec) H264Decoder/CODEC_CAP_TRUNCATED))
  (println "need to configure CODEC_FLAG_TRUNCATED"))

(if (< (.avcodec_open c codec) 0)
  (println "Could not open codec"))

(defn to-ba-int [b]
  (doall (for [i (range 0 (count b))]

      (swap! frame-number inc)
      (future (update-image (process-and-return-image buff-img))))
    (catch Exception e (println (str "Error displaying frame - skipping " e)))))


(defn read-frame [host out]
  (try
