Module Avcodec.Packet

Packet.

type 'media t

Packet type

type 'media parser

Parser type

type flag = [
  1. | `Keyframe
  2. | `Corrupt
  3. | `Discard
  4. | `Trusted
  5. | `Disposable
]

Packet flags

type replaygain = {
  1. track_gain : int;
  2. track_peak : int;
  3. album_gain : int;
  4. album_peak : int;
}
type side_data = [
  1. | `Replaygain of replaygain
  2. | `Strings_metadata of (string * string) list
  3. | `Metadata_update of (string * string) list
]

Packet side_data (incomplete)

val add_side_data : 'media t -> side_data -> unit

Add a side data to a packet.

val side_data : 'media t -> side_data list

Return a packet side_data.

val dup : 'media t -> 'media t

Return a fresh packet refereing the same data.

val get_flags : 'media t -> flag list

Retun the packet flags.

val get_size : 'media t -> int

Return the size of the packet.

val get_stream_index : 'media t -> int

Return the stream index of the packet.

val set_stream_index : 'media t -> int -> unit

Set the stream index of the packet.

val get_pts : 'media t -> Stdlib.Int64.t option

Return the packet PTS (Presentation Time) in its stream's base_time unit.

val set_pts : 'media t -> Stdlib.Int64.t option -> unit

Set the packet PTS (Presentation Time) in its stream's base_time unit.

val get_dts : 'media t -> Stdlib.Int64.t option

Return the packet DTS (Decoding Time) in its stream's base_time unit.

val set_dts : 'media t -> Stdlib.Int64.t option -> unit

Set the packet DTS (Decoding Time) in its stream's base_time unit.

val get_duration : 'media t -> Stdlib.Int64.t option

Return the packet duration in its stream's base_time unit.

val set_duration : 'media t -> Stdlib.Int64.t option -> unit

Set the packet duration in its stream's base_time unit.

val get_position : 'media t -> Stdlib.Int64.t option

Return the packet byte position in stream.

val set_position : 'media t -> Stdlib.Int64.t option -> unit

Set the packet byte position in stream.

val to_bytes : 'media t -> bytes

Return a fresh bytes array containing a copy of packet datas.

val parse_data : 'media parser -> ('media t -> unit) -> Avutil.data -> unit

Avcodec.Packet.parse_data parser f data applies function f to the parsed packets frome the data array according to the parser configuration.

Raise Error if the parsing failed.

val parse_bytes : 'media parser -> ('media t -> unit) -> bytes -> int -> unit

Same as Avcodec.Packet.parse_data with bytes array.

val create : string -> 'media t

Advanced users: create a packet with the given data.

val content : 'media t -> string

Advanced users: return the packet's content.