1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
open Avutil
external version : unit -> int = "ocaml_swscale_version"
external configuration : unit -> string = "ocaml_swscale_configuration"
external license : unit -> string = "ocaml_swscale_configuration"
type pixel_format = Avutil.Pixel_format.t
type flag = Fast_bilinear | Bilinear | Bicubic | Print_info
type t
external create :
flag array -> int -> int -> pixel_format -> int -> int -> pixel_format -> t
= "ocaml_swscale_get_context_byte" "ocaml_swscale_get_context"
let create flags in_w in_h in_pf out_w out_h out_pf =
create (Array.of_list flags) in_w in_h in_pf out_w out_h out_pf
type planes = (data * int) array
external scale : t -> planes -> int -> int -> planes -> int -> unit
= "ocaml_swscale_scale_byte" "ocaml_swscale_scale"
type vector_kind = PackedBa | Ba | Frm | Str
module type VideoData = sig
type t
val vk : vector_kind
end
module BigArray = struct
type t = planes
let vk = Ba
end
module PackedBigArray = struct
type plane = { plane_size : int; stride : int }
type t = { data : data; planes : plane array }
let vk = PackedBa
end
module Frame = struct
type t = video frame
let vk = Frm
end
module Bytes = struct
type t = (string * int) array
let vk = Str
end
type ('i, 'o) ctx
module Make (I : VideoData) (O : VideoData) = struct
type t = (I.t, O.t) ctx
external create :
flag array ->
vector_kind ->
int ->
int ->
pixel_format ->
vector_kind ->
int ->
int ->
pixel_format ->
t = "ocaml_swscale_create_byte" "ocaml_swscale_create"
let create flags in_width in_height in_pixel_format out_width out_height
out_pixel_format =
create (Array.of_list flags) I.vk in_width in_height in_pixel_format O.vk
out_width out_height out_pixel_format
(*
let from_codec flags in_codec out_width out_height out_pixel_format =
create flags
(Avcodec.Video.get_width in_codec)
(Avcodec.Video.get_height in_codec)
(Avcodec.Video.get_pixel_format in_codec)
out_width out_height out_pixel_format
let to_codec flags in_width in_height in_pixel_format out_codec =
create flags
in_width in_height in_pixel_format
(Avcodec.Video.get_width out_codec)
(Avcodec.Video.get_height out_codec)
(Avcodec.Video.get_pixel_format out_codec)
let from_codec_to_codec flags in_codec out_codec =
create flags
(Avcodec.Video.get_width in_codec)
(Avcodec.Video.get_height in_codec)
(Avcodec.Video.get_pixel_format in_codec)
(Avcodec.Video.get_width out_codec)
(Avcodec.Video.get_height out_codec)
(Avcodec.Video.get_pixel_format out_codec)
*)
external convert : t -> I.t -> O.t = "ocaml_swscale_convert"
end
|