Skip to content

Commit

Permalink
Condition
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Feb 23, 2024
1 parent ce9b97f commit dff5996
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion av/av_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,7 @@ CAMLprim value ocaml_av_stream_bitrate(value _stream) {

av_t *av = StreamAv_val(_stream);
int index = StreamIndex_val(_stream);
AVCPBProperties *props = NULL;

if (!av->format_context || !av->format_context->streams)
CAMLreturn(Val_none);
Expand All @@ -2501,13 +2502,19 @@ CAMLprim value ocaml_av_stream_bitrate(value _stream) {
CAMLreturn(ans);
}

#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 15, 100)
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);

AVCPBProperties *props = (AVCPBProperties *)side_data->data;
props = (AVCPBProperties *)side_data->data;
#else
props = (AVCPBProperties *)av_stream_get_side_data(
stream, AV_PKT_DATA_CPB_PROPERTIES, NULL);
#endif

if (!props)
CAMLreturn(Val_none);
Expand Down
3 changes: 1 addition & 2 deletions av/config/discover.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module C = Configurator.V1

let packages =
[("avutil", "55.78.100"); ("avformat", "57.83.100"); ("avcodec", "60.29.100")]
let packages = [("avutil", "55.78.100"); ("avformat", "57.83.100")]

let () =
C.main ~name:"ffmpeg-av-pkg-config" (fun c ->
Expand Down

0 comments on commit dff5996

Please sign in to comment.