Module Encoder


module Encoder: sig .. end
Common infrastructure for encoding streams

val conf : Dtools.Conf.ut
val conf_meta : Dtools.Conf.ut
val conf_export_metadata : string list Dtools.Conf.t
The list of metadata fields that should be exported when encoding.
module Meta: sig .. end
val string_of_stereo : bool -> string
module WAV: sig .. end
module Vorbis: sig .. end
module Opus: sig .. end
module MP3: sig .. end
module Flac: sig .. end
module Shine: sig .. end
module AACPlus: sig .. end
module VoAacEnc: sig .. end
module External: sig .. end
module Speex: sig .. end
module GStreamer: sig .. end
module Theora: sig .. end
module Dirac: sig .. end
module Ogg: sig .. end

type format =
| WAV of WAV.t
| Ogg of Ogg.t
| MP3 of MP3.t
| Shine of Shine.t
| Flac of Flac.t
| AACPlus of AACPlus.t
| VoAacEnc of VoAacEnc.t
| External of External.t
| GStreamer of GStreamer.t
val kind_of_format : format ->
(Frame.multiplicity, Frame.multiplicity, Frame.multiplicity) Frame.fields
val kind_of_format : format ->
(Frame.multiplicity, Frame.multiplicity, Frame.multiplicity) Frame.fields
val string_of_format : format -> string

type encoder = {
   insert_metadata : Meta.export_metadata -> unit;
   mutable header : string option;
   encode : Frame.t -> int -> int -> string;
   stop : unit -> string;
}
An encoder, once initialized, is something that consumes frames, insert metadata and that you eventually close (triggers flushing). Insert metadata is really meant for inline metadata, i.e. in most cases, stream sources. Otherwise, metadata are passed when creating the encoder. For instance, the mp3 encoder may accept metadata initally and write them as id3 tags but does not support inline metadata. Also, the ogg encoder supports inline metadata but restarts its stream. This is ok, though, because the ogg container/streams is meant to be sequentialized but not the mp3 format. header contains data that should be sent first to streaming client.
type factory = string -> Meta.export_metadata -> encoder 
type plugin = format -> factory option 
A plugin might or might not accept a given format. If it accepts it, it gives a function creating suitable encoders.
val plug : plugin Plug.plug
exception Found of factory
val get_factory : format -> factory
Return the first available encoder factory for that format.