Module Decoder


module Decoder: sig .. end
Test file extension and mime if available

val log : Dtools.Log.t
type file = string 
A local file is simply identified by its filename.
type stream = string 
A stream is identified by a MIME type.

type input = {
   read : int -> string * int;
   lseek : (int -> int) option;
   tell : (unit -> int) option;
   length : (unit -> int) option;
}
type 'a decoder = {
   decode : 'a -> unit;
   seek : int -> int;
}
type stream_decoder = input -> Generator.From_audio_video_plus.t decoder 
A stream decoder does not "own" any file descriptor, and is generally assumed to not allocate resources (in the sense of things that should be explicitly managed, not just garbage collected). Hence it does not need a close function.

type file_decoder = {
   fill : Frame.t -> int;
   fseek : int -> int;
   close : unit -> unit;
}
A decoder is a filling function and a closing function, called at least when filling fails, i.e. the frame is partial. The closing function can be called earlier e.g. if the user skips. In most cases, file decoders are wrapped stream decoders.
val file_decoders : (metadata:Frame.metadata ->
file -> Frame.content_kind -> (unit -> file_decoder) option)
Plug.plug
For a given file, once a decoder is chosen it can be used several times. This is at least useful to separate the actual opening of the file from checking that it is a valid media file.
val image_file_decoders : (file -> Image.RGBA32.t option) Plug.plug
val stream_decoders : (stream -> Frame.content_kind -> stream_decoder option)
Plug.plug
val conf_decoder : Dtools.Conf.ut
val conf_mime_types : Dtools.Conf.ut
val conf_file_extensions : Dtools.Conf.ut
val test_file : ?log:Dtools.Log.t ->
mimes:string list -> extensions:string list -> string -> bool
Test file extension and mime if available
val get_file_decoder : metadata:Frame.metadata ->
file ->
Frame.content_kind -> (string * (unit -> file_decoder)) option
Get a valid decoder creator for filename.
val get_image_file_decoder : file -> Image.RGBA32.t option
Get a valid image decoder creator for filename.
val get_stream_decoder : file -> Frame.content_kind -> stream_decoder option
module Buffered: 
functor (Generator : Generator.S) -> sig .. end