Skip to content

Commit b8190a5

Browse files
committedMay 11, 2022
Add bitstream filter eof API
1 parent e7fe168 commit b8190a5

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
 

‎avcodec/avcodec.ml

+2
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,6 @@ module BitstreamFilter = struct
639639

640640
external receive_packet : 'a t -> 'a Packet.t
641641
= "ocaml_avcodec_bsf_receive_packet"
642+
643+
external send_eof : 'a t -> unit = "ocaml_avcodec_bsf_send_eof"
642644
end

‎avcodec/avcodec.mli

+1
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ module BitstreamFilter : sig
454454
val init : ?opts:opts -> filter -> 'a params -> 'a t * 'a params
455455

456456
val send_packet : 'a t -> 'a Packet.t -> unit
457+
val send_eof : 'a t -> unit
457458
val receive_packet : 'a t -> 'a Packet.t
458459
end
459460

‎avcodec/avcodec_stubs.c

+16
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,22 @@ CAMLprim value ocaml_avcodec_bsf_send_packet(value _filter, value _packet) {
17361736
CAMLreturn(Val_unit);
17371737
}
17381738

1739+
CAMLprim value ocaml_avcodec_bsf_send_eof(value _filter) {
1740+
CAMLparam1(_filter);
1741+
int ret;
1742+
AVBSFContext *bsf = BsfFilter_val(_filter);
1743+
1744+
caml_release_runtime_system();
1745+
ret = av_bsf_send_packet(bsf, NULL);
1746+
caml_acquire_runtime_system();
1747+
1748+
if (ret < 0) {
1749+
ocaml_avutil_raise_error(ret);
1750+
}
1751+
1752+
CAMLreturn(Val_unit);
1753+
}
1754+
17391755
CAMLprim value ocaml_avcodec_bsf_receive_packet(value _filter) {
17401756
CAMLparam1(_filter);
17411757
int ret;

0 commit comments

Comments
 (0)
Please sign in to comment.