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!
type
t
type
callbacks = {
|
read : |
|
seek : |
|
tell : |
type
track =
| |
Audio_track of |
| |
Video_track of |
Ogg.Stream.t
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 -> t
log
is an optional functioned used to
return logged messages during the deocding
process.val init_from_file : ?log:(string -> unit) -> string -> t * Unix.file_descr
val init_from_fd : ?log:(string -> unit) -> Unix.file_descr -> t
Unix.file_descriptor
val get_ogg_sync : t -> Ogg.Sync.t
val reset : t -> unit
val abort : t -> unit
eos dec
is true
after this call.
val eos : t -> bool
true
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 list
val get_standard_tracks : t -> standard_tracks
val update_standard_tracks : t -> standard_tracks -> unit
reset
to update the standard tracks
with the newly created tracks.val drop_track : t -> track -> unit
val audio_info : t ->
track -> audio_info * metadata
val video_info : t ->
track -> video_info * metadata
val sample_rate : t -> track -> int * int
(numerator,denominator)
.val get_track_position : t -> track -> float
val get_position : t -> float
val can_seek : t -> bool
true
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.t
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.t -> decoders)
Ogg.Stream.packet
of an Ogg.Stream.t
matches the format decodable by this decoder.
Second element is a function that instanciates the actual decoder
using the initial Ogg.Stream.t
used to pull data packets for the
decoder.val ogg_decoders : (string, register_decoder) Hashtbl.t