package metadata

  1. Overview
  2. Docs

Read metadata from various file formats.

module CharEncoding : sig ... end

Functions for handling charset conversion.

module MIME : sig ... end

Guess the MIME type of a file.

module Make (_ : CharEncoding.T) : sig ... end

Generate metadata parsers given functions for converting charsets.

include sig ... end
exception Invalid

Raised when the metadata is not valid.

type metadata = (string * string) list

Metadata are represented as association lists (name, value).

type bigarray = (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

Bigarray representation of (large) tags.

type parser_handler = {
  1. label : string;
  2. length : int;
  3. read : unit -> string;
  4. read_ba : (unit -> bigarray) option;
  5. skip : unit -> unit;
}

When used, a custom parser can override the default parsing mechanism. It is passed the metadata label (without normalization), the expected length of the data, a regular read function an an optional bigarray read function. The custom parser can call any of the read function to get the corresponding tag's value. After doing so, the tag is ignored by the regular parsing process.

Currently only supported for: ID3v2, MP4 and metadata_block_picture in FLAC metadata.

type custom_parser = parser_handler -> unit

A custom parser, see parser_handler.

module Reader : sig ... end

Abstractions for reading from various sources.

module ID3v1 : sig ... end

ID3v1 metadata.

module ID3v2 : sig ... end

ID3v2 metadata.

module OGG : sig ... end

OGG metadata.

module FLAC : sig ... end

Flac metadata.

module JPEG : sig ... end

Jpeg metadata.

module PNG : sig ... end

PNG metadata.

module AVI : sig ... end

AVI metadata.

module MP4 : sig ... end

MP4 metadata.

module WAV : sig ... end

WAV metadata.

module RIFF : sig ... end

RIFF metdata.

val recode : ?source:[ `ISO_8859_1 | `UTF_16 | `UTF_16BE | `UTF_16LE | `UTF_8 ] -> ?target:[ `UTF_16 | `UTF_16BE | `UTF_16LE | `UTF_8 ] -> string -> string

Convert the charset encoding of a string.

module ID3 : sig ... end

ID3v1 and ID3v2 metadata.

val first_valid : (Reader.t -> metadata) list -> Reader.t -> metadata

Return the first application which does not raise invalid.

module Audio : sig ... end

Audio file formats.

module Image : sig ... end

Image file formats.

module Video : sig ... end

Video file formats.

module Any : sig ... end

All support file formats.

val parse : Reader.t -> (string * string) list

Generic metadata parsing.

val parse_file : ?custom_parser:custom_parser -> string -> (string * string) list

Parse the metadata from a file.

val parse_string : ?custom_parser:custom_parser -> string -> (string * string) list

Parse the metadata from a string containing the contents of a file.

OCaml

Innovation. Community. Security.