recording: fix ffmpeg5 compat

Include avcodec.h and change AVCodec* and AVOutputFormat* to const.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Zach Bacon 2022-03-18 14:56:57 -04:00 committed by Rafael Kitover
parent 9a325f086e
commit 1e0eea3c08
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 4 additions and 3 deletions

View File

@ -20,6 +20,7 @@ extern "C" {
#define UINT64_C(c) (c ## ULL) #define UINT64_C(c) (c ## ULL)
#endif #endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/avassert.h> #include <libavutil/avassert.h>
#include <libavutil/channel_layout.h> #include <libavutil/channel_layout.h>
@ -90,7 +91,7 @@ class MediaRecorder
bool isRecording; bool isRecording;
int sampleRate; int sampleRate;
AVFormatContext *oc; AVFormatContext *oc;
AVOutputFormat *fmt; const AVOutputFormat *fmt;
// pic info // pic info
AVPixelFormat pixfmt; AVPixelFormat pixfmt;
int pixsize, linesize; int pixsize, linesize;
@ -98,7 +99,7 @@ class MediaRecorder
struct SwsContext *sws; struct SwsContext *sws;
// stream info // stream info
AVStream *st; AVStream *st;
AVCodec *vcodec; const AVCodec *vcodec;
AVCodecContext *enc; AVCodecContext *enc;
int64_t npts; // for video frame pts int64_t npts; // for video frame pts
AVFrame *frameIn; AVFrame *frameIn;
@ -106,7 +107,7 @@ class MediaRecorder
// audio // audio
bool audioOnlyRecording; bool audioOnlyRecording;
struct SwrContext *swr; struct SwrContext *swr;
AVCodec *acodec; const AVCodec *acodec;
AVStream *ast; AVStream *ast;
AVCodecContext *aenc; AVCodecContext *aenc;
int samplesCount; // for audio frame pts generation int samplesCount; // for audio frame pts generation