Documentation ¶
Overview ¶
Package remote define the operations that how to flush the ASCII image to remote client, it would be different flush handler for different picture or video type. Inspiration comes from https://github.com/HFO4/plus1s.live.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseFlushHandler ¶
type BaseFlushHandler struct { }
BaseFlushHandler is a basic flush handler that define some basic opration
func (*BaseFlushHandler) Flush ¶
func (handler *BaseFlushHandler) Flush(w http.ResponseWriter, s string) error
Flush flush the string to remote client immediately
func (*BaseFlushHandler) HandlerFunc ¶
func (handler *BaseFlushHandler) HandlerFunc() func(w http.ResponseWriter, r *http.Request)
HandlerFunc return a empty hadnler function
func (*BaseFlushHandler) Init ¶
func (handler *BaseFlushHandler) Init() error
Init doing nothing in base flush handler
type FlushHandler ¶
type FlushHandler interface { Init() error HandlerFunc() func(w http.ResponseWriter, r *http.Request) }
FlushHandler define the basic oprations that flush image to remote server
func NewFlushHandler ¶
func NewFlushHandler(filename string, options *convert.Options) (handler FlushHandler, supported bool)
NewFlushHandler is factory method to create flush handler
func NewGifFlushHandler ¶
func NewGifFlushHandler(filename string, convertOptions *convert.Options) FlushHandler
NewGifFlushHandler create a new gif flush handler
func NewImageFlusherHandler ¶
func NewImageFlusherHandler(filename string, convertOptions *convert.Options) FlushHandler
NewImageFlusherHandler create a new image flusher handler
type GifFlushHandler ¶
type GifFlushHandler struct { BaseFlushHandler Filename string FrameCache []string // contains filtered or unexported fields }
GifFlushHandler extends from BaseFlushHandler, and responsible for flushing the gif frames to remote client.
func (*GifFlushHandler) HandlerFunc ¶
func (handler *GifFlushHandler) HandlerFunc() func(w http.ResponseWriter, r *http.Request)
HandlerFunc for gif flush handler flush the cached ASCII string slices slice by slice at a centian frequency
func (*GifFlushHandler) Init ¶
func (handler *GifFlushHandler) Init() error
Init for gif flush handler responsible for decoding the gif to frames then decoding the frames to ASCII string slices, then cache results, reduce resource consumption.
type ImageFlushHandler ¶
type ImageFlushHandler struct { BaseFlushHandler Filename string ImageCache string // contains filtered or unexported fields }
ImageFlushHandler extends the BaseFlushHandler and responsible for flush the ASCII image to remote client.
func (*ImageFlushHandler) HandlerFunc ¶
func (handler *ImageFlushHandler) HandlerFunc() func(w http.ResponseWriter, r *http.Request)
HandlerFunc for image flush handler return a simple handler function that write the cached ASCII image to remote client.
func (*ImageFlushHandler) Init ¶
func (handler *ImageFlushHandler) Init() error
Init for ImageFlushHandler init the image flush handler that is responsible for decoding the image and convert the image to ASCII image, then cache the ASCII image.