encoderd: update deprecated ffmpeg functions (#24501)

This commit is contained in:
Willem Melching
2022-05-12 12:43:07 +02:00
committed by GitHub
parent 3f5afa158a
commit 75f2149267
3 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ FfmpegEncoder::~FfmpegEncoder() {
}
void FfmpegEncoder::encoder_open(const char* path) {
AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_FFVHUFF);
const AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_FFVHUFF);
this->codec_ctx = avcodec_alloc_context3(codec);
assert(this->codec_ctx);
+2 -7
View File
@@ -1,5 +1,3 @@
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <cassert>
#include <cstdlib>
@@ -23,11 +21,8 @@ VideoWriter::VideoWriter(const char *path, const char *filename, bool remuxing,
assert(this->ofmt_ctx);
// set codec correctly. needed?
av_register_all();
AVCodec *avcodec = NULL;
assert(codec != cereal::EncodeIndex::Type::FULL_H_E_V_C);
avcodec = avcodec_find_encoder(raw ? AV_CODEC_ID_FFVHUFF : AV_CODEC_ID_H264);
const AVCodec *avcodec = avcodec_find_encoder(raw ? AV_CODEC_ID_FFVHUFF : AV_CODEC_ID_H264);
assert(avcodec);
this->codec_ctx = avcodec_alloc_context3(avcodec);
@@ -95,7 +90,7 @@ void VideoWriter::write(uint8_t *data, int len, long long timestamp, bool codecc
int err = av_interleaved_write_frame(ofmt_ctx, &pkt);
if (err < 0) { LOGW("ts encoder write issue"); }
av_free_packet(&pkt);
av_packet_unref(&pkt);
}
}
}
+1
View File
@@ -4,6 +4,7 @@
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
#include "cereal/messaging/messaging.h"