From 087e488ae99d7434bc2a3c38033290800cc81871 Mon Sep 17 00:00:00 2001 From: Alix von Schirp Date: Thu, 19 Feb 2026 10:04:35 +0100 Subject: [PATCH] fix: likely update all deprecated fucntion calls Signed-off-by: Alix von Schirp --- src/ffprobe-wasm-wrapper.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ffprobe-wasm-wrapper.cpp b/src/ffprobe-wasm-wrapper.cpp index 2733d47..b6950c0 100644 --- a/src/ffprobe-wasm-wrapper.cpp +++ b/src/ffprobe-wasm-wrapper.cpp @@ -149,7 +149,7 @@ FileInfoResponse get_file_info(std::string filename) { .level = (int)pLocalCodecParameters->level, .width = (int)pLocalCodecParameters->width, .height = (int)pLocalCodecParameters->height, - .channels = (int)pLocalCodecParameters->channels, + .channels = (int)pLocalCodecParameters->ch_layout.nb_channels, .sample_rate = (int)pLocalCodecParameters->sample_rate, .frame_size = (int)pLocalCodecParameters->frame_size, }; @@ -165,7 +165,6 @@ FileInfoResponse get_file_info(std::string filename) { } r.streams.push_back(stream); - free(fourcc); } // Loop through the chapters (if any). @@ -227,7 +226,7 @@ FramesResponse get_frames(std::string filename, int timestamp) { } // Get streams data. - AVCodec *pCodec = NULL; + const AVCodec *pCodec = NULL; AVCodecParameters *pCodecParameters = NULL; int video_stream_index = -1; int nb_frames = 0; @@ -238,7 +237,7 @@ FramesResponse get_frames(std::string filename, int timestamp) { pLocalCodecParameters = pFormatContext->streams[i]->codecpar; // Print out the decoded frame info. - AVCodec *pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id); + const AVCodec *pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id); if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) { if (video_stream_index == -1) { video_stream_index = i; @@ -296,7 +295,7 @@ FramesResponse get_frames(std::string filename, int timestamp) { } // Track keyframes so we paginate by each GOP. - if (pFrame->key_frame == 1) key_frames++; + if (pFrame->flags & AV_FRAME_FLAG_KEY) key_frames++; // Break at the next keyframe found. if (key_frames > 1) break; @@ -307,7 +306,7 @@ FramesResponse get_frames(std::string filename, int timestamp) { .pts = (int) pPacket->pts, .dts = (int) pPacket->dts, .pos = (int) pPacket->pos, - .pkt_size = pFrame->pkt_size, + .pkt_size = pPacket->size, }; r.frames.push_back(f); @@ -399,4 +398,4 @@ EMSCRIPTEN_BINDINGS(structs) { .field("avg_frame_rate", &FramesResponse::avg_frame_rate) ; function("get_frames", &get_frames); -} \ No newline at end of file +}