module Ogg_demuxer:sig..end
Decoders are also provided in ocaml-vorbis, ocaml-speex, ocaml-schroedinger, ocaml-flac and ocaml-theora.
Functions in this module are not thread safe!
This module provides a functional abstract API to
decode and seek in Ogg streams.
Decoders are also provided in ocaml-vorbis, ocaml-speex, ocaml-schroedinger, ocaml-flac and ocaml-theora.
Functions in this module are not thread safe!
Decoders are also provided in ocaml-vorbis, ocaml-speex, ocaml-schroedinger, ocaml-flac and ocaml-theora.
Functions in this module are not thread safe!
type t
type callbacks = {
|
read : |
|
seek : |
|
tell : |
type track =
| |
Audio_track of |
| |
Video_track of |
Ogg.Stream.stream logical
stream used to pull data packets for that
track.type standard_tracks = {
|
mutable audio_track : |
|
mutable video_track : |
get_standard_tracks below).typemetadata =string * (string * string) list
(label,value).type audio_info = {
|
channels : |
|
sample_rate : |
typeaudio_data =float array array
typevideo_plane =(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
type video_format =
| |
Yuvj_420 |
| |
Yuvj_422 |
| |
Yuvj_444 |
type video_info = {
|
fps_numerator : |
|||
|
fps_denominator : |
|||
|
width : |
(* |
Width of the Y' luminance plane
| *) |
|
height : |
(* |
Height of the luminance plane
| *) |
type video_data = {
|
format : |
|||
|
frame_width : |
|||
|
frame_height : |
|||
|
y_stride : |
(* |
Length, in bytes, per line
| *) |
|
uv_stride : |
(* |
Length, in bytes, per line
| *) |
|
y : |
(* |
luminance data
| *) |
|
u : |
(* |
Cb data
| *) |
|
v : |
(* |
Cr data
| *) |
exception Invalid_stream
exception Not_available
exception End_of_stream
val init : ?log:(string -> unit) -> callbacks -> tlog is an optional functioned used to
return logged messages during the deocding
process.val init_from_file : ?log:(string -> unit) -> string -> t * Unix.file_descrval init_from_fd : ?log:(string -> unit) -> Unix.file_descr -> tUnix.file_descriptorval get_ogg_sync : t -> Ogg.Sync.tval reset : t -> unitval abort : t -> unit
eos dec is true after this call.
val eos : t -> booltrue if the decoder has reached the end of each
logical streams and all data has been decoded.
If you do not plan on decoding some data,
you should use drop_track to indicate it
to the decoder. Otherwise, eos will return
false until you have decoded all data.
val get_tracks : t -> track listval get_standard_tracks : t -> standard_tracksval update_standard_tracks : t -> standard_tracks -> unitreset to update the standard tracks
with the newly created tracks.val drop_track : t -> track -> unitval audio_info : t ->
track -> audio_info * metadataval video_info : t ->
track -> video_info * metadataval sample_rate : t -> track -> int * int(numerator,denominator).val get_track_position : t -> track -> floatval get_position : t -> floatval can_seek : t -> booltrue if the decoder
can be used with the seek function.val seek : ?relative:bool -> t -> float -> float
Raises Not_available if seeking is
not possible.
Raises End_of_stream if the end of
current stream has been reached while
seeking. You may call reset in this
situation to see if there is a new seqentialized
stream available.
Returns the time actually reached, either in
relative time or absolute time.
val decode_audio : t ->
track -> (audio_data -> unit) -> unit
Raises End_of_stream if all stream have ended.
In this case, you can try reset to see if there is a
new sequentialized stream.
val decode_video : t ->
track -> (video_data -> unit) -> unit
Raises End_of_stream if all streams have ended.
In this case, you can try reset to see if there is a
new sequentialized stream.
type ('a, 'b) decoder = {
|
name : |
|||
|
info : |
|||
|
decode : |
|||
|
restart : |
(* |
This function is called after seeking
to notify the decoder of the new
Ogg.Stream.stream
that is should use to pull data packets. | *) |
|
samples_of_granulepos : |
type decoders =
| |
Video of |
| |
Audio of |
| |
Unknown |
typeregister_decoder =(Ogg.Stream.packet -> bool) * (Ogg.Stream.stream -> decoders)
Ogg.Stream.packet
of an Ogg.Stream.stream matches the format decodable by this decoder.
Second element is a function that instanciates the actual decoder
using the initial Ogg.Stream.stream used to pull data packets for the
decoder.val ogg_decoders : (string, register_decoder) Hashtbl.t