forked from forks/ffprobe-wasm
fix: likely update all deprecated fucntion calls
Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user