fix: likely update all deprecated fucntion calls

Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
2026-02-19 10:04:35 +01:00
parent 73cb05f572
commit 087e488ae9

View File

@@ -149,7 +149,7 @@ FileInfoResponse get_file_info(std::string filename) {
.level = (int)pLocalCodecParameters->level, .level = (int)pLocalCodecParameters->level,
.width = (int)pLocalCodecParameters->width, .width = (int)pLocalCodecParameters->width,
.height = (int)pLocalCodecParameters->height, .height = (int)pLocalCodecParameters->height,
.channels = (int)pLocalCodecParameters->channels, .channels = (int)pLocalCodecParameters->ch_layout.nb_channels,
.sample_rate = (int)pLocalCodecParameters->sample_rate, .sample_rate = (int)pLocalCodecParameters->sample_rate,
.frame_size = (int)pLocalCodecParameters->frame_size, .frame_size = (int)pLocalCodecParameters->frame_size,
}; };
@@ -165,7 +165,6 @@ FileInfoResponse get_file_info(std::string filename) {
} }
r.streams.push_back(stream); r.streams.push_back(stream);
free(fourcc);
} }
// Loop through the chapters (if any). // Loop through the chapters (if any).
@@ -227,7 +226,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
} }
// Get streams data. // Get streams data.
AVCodec *pCodec = NULL; const AVCodec *pCodec = NULL;
AVCodecParameters *pCodecParameters = NULL; AVCodecParameters *pCodecParameters = NULL;
int video_stream_index = -1; int video_stream_index = -1;
int nb_frames = 0; int nb_frames = 0;
@@ -238,7 +237,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
pLocalCodecParameters = pFormatContext->streams[i]->codecpar; pLocalCodecParameters = pFormatContext->streams[i]->codecpar;
// Print out the decoded frame info. // 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 (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
if (video_stream_index == -1) { if (video_stream_index == -1) {
video_stream_index = i; video_stream_index = i;
@@ -296,7 +295,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
} }
// Track keyframes so we paginate by each GOP. // 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. // Break at the next keyframe found.
if (key_frames > 1) break; if (key_frames > 1) break;
@@ -307,7 +306,7 @@ FramesResponse get_frames(std::string filename, int timestamp) {
.pts = (int) pPacket->pts, .pts = (int) pPacket->pts,
.dts = (int) pPacket->dts, .dts = (int) pPacket->dts,
.pos = (int) pPacket->pos, .pos = (int) pPacket->pos,
.pkt_size = pFrame->pkt_size, .pkt_size = pPacket->size,
}; };
r.frames.push_back(f); r.frames.push_back(f);
@@ -399,4 +398,4 @@ EMSCRIPTEN_BINDINGS(structs) {
.field("avg_frame_rate", &FramesResponse::avg_frame_rate) .field("avg_frame_rate", &FramesResponse::avg_frame_rate)
; ;
function("get_frames", &get_frames); function("get_frames", &get_frames);
} }