encoderd: update deprecated ffmpeg functions (#24501)

old-commit-hash: 75f2149267
taco
Willem Melching 3 years ago committed by GitHub
parent e6f1d751b9
commit c7e31ef974
  1. 2
      selfdrive/loggerd/encoder/ffmpeg_encoder.cc
  2. 9
      selfdrive/loggerd/encoder/video_writer.cc
  3. 1
      selfdrive/loggerd/encoder/video_writer.h

@ -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);

@ -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);
}
}
}

@ -4,6 +4,7 @@
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
#include "cereal/messaging/messaging.h"

Loading…
Cancel
Save