diff --git a/CHANGES b/CHANGES index 614c284f..081df0e6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 1.2.0 (unreleased) ===== * Removed unused `Av.write_audio_frame`/`Av.write_video_frame`. +* Remove use of deprecated `av_packet_side_data_get` * Added support to get all streams from output container * Removed unreliable `Av.was_keyframe` * Added `on_keyframe` to `Av.write_frame`. diff --git a/av/av_stubs.c b/av/av_stubs.c index 6932e6a3..fd0526df 100644 --- a/av/av_stubs.c +++ b/av/av_stubs.c @@ -2495,19 +2495,24 @@ CAMLprim value ocaml_av_stream_bitrate(value _stream) { if (!stream) CAMLreturn(Val_none); - AVCPBProperties *props = (AVCPBProperties *)av_stream_get_side_data( - stream, AV_PKT_DATA_CPB_PROPERTIES, NULL); + if (stream->codecpar->bit_rate) { + ans = caml_alloc_tuple(1); + Store_field(ans, 0, Val_int(stream->codecpar->bit_rate)); + CAMLreturn(ans); + } - if (!stream->codecpar->bit_rate && !props) + const AVPacketSideData *side_data = av_packet_side_data_get( + stream->codecpar->coded_side_data, stream->codecpar->nb_coded_side_data, + AV_PKT_DATA_CPB_PROPERTIES); + if (!side_data) CAMLreturn(Val_none); - ans = caml_alloc_tuple(1); + AVCPBProperties *props = (AVCPBProperties *)side_data->data; - if (stream->codecpar->bit_rate) { - Store_field(ans, 0, Val_int(stream->codecpar->bit_rate)); - } else if (props) { - Store_field(ans, 0, Val_int(props->max_bitrate)); - } + if (!props) + CAMLreturn(Val_none); + ans = caml_alloc_tuple(1); + Store_field(ans, 0, Val_int(props->max_bitrate)); CAMLreturn(ans); } diff --git a/av/config/discover.ml b/av/config/discover.ml index b2570a06..40698d17 100644 --- a/av/config/discover.ml +++ b/av/config/discover.ml @@ -1,6 +1,7 @@ module C = Configurator.V1 -let packages = [("avutil", "55.78.100"); ("avformat", "57.83.100")] +let packages = + [("avutil", "55.78.100"); ("avformat", "57.83.100"); ("avcodec", "60.29.100")] let () = C.main ~name:"ffmpeg-av-pkg-config" (fun c ->