Fix ffmpeg 5 const errors
parent
9fd0a94c9f
commit
d1395dab9a
|
@ -325,7 +325,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
|
|||
//dump_sidedata(NULL, st, " ");
|
||||
}
|
||||
|
||||
int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) {
|
||||
int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) {
|
||||
const enum AVSampleFormat *p = codec->sample_fmts;
|
||||
|
||||
while (*p != AV_SAMPLE_FMT_NONE) {
|
||||
|
|
|
@ -217,7 +217,7 @@ void zm_dump_codecpar(const AVCodecParameters *par);
|
|||
|
||||
#define zm_av_frame_alloc() av_frame_alloc()
|
||||
|
||||
int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt);
|
||||
int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt);
|
||||
enum AVPixelFormat fix_deprecated_pix_fmt(enum AVPixelFormat );
|
||||
|
||||
bool is_video_stream(const AVStream *);
|
||||
|
|
|
@ -353,7 +353,7 @@ int FfmpegCamera::OpenFfmpeg() {
|
|||
Debug(3, "Found video stream at index %d, audio stream at index %d",
|
||||
mVideoStreamId, mAudioStreamId);
|
||||
|
||||
AVCodec *mVideoCodec = nullptr;
|
||||
const AVCodec *mVideoCodec = nullptr;
|
||||
if (mVideoStream->codecpar->codec_id == AV_CODEC_ID_H264) {
|
||||
if ((mVideoCodec = avcodec_find_decoder_by_name("h264_mmal")) == nullptr) {
|
||||
Debug(1, "Failed to find decoder (h264_mmal)");
|
||||
|
@ -494,7 +494,7 @@ int FfmpegCamera::OpenFfmpeg() {
|
|||
} // end if have audio stream
|
||||
|
||||
if ( mAudioStreamId >= 0 ) {
|
||||
AVCodec *mAudioCodec = nullptr;
|
||||
const AVCodec *mAudioCodec = nullptr;
|
||||
if (!(mAudioCodec = avcodec_find_decoder(mAudioStream->codecpar->codec_id))) {
|
||||
Debug(1, "Can't find codec for audio stream from %s", mPath.c_str());
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ class FFmpeg_Input {
|
|||
private:
|
||||
typedef struct {
|
||||
AVCodecContext *context;
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
int frame_count;
|
||||
} stream;
|
||||
|
||||
|
|
|
@ -97,16 +97,11 @@ int VideoStream::SetupCodec(
|
|||
// Not sure what this value should be really...
|
||||
ofc->packet_size = width*height;
|
||||
Debug(1,"Setting packet_size to %d", ofc->packet_size);
|
||||
|
||||
if (of->video_codec == AV_CODEC_ID_NONE) {
|
||||
// RTP does not have a default codec in ffmpeg <= 0.8.
|
||||
of->video_codec = AV_CODEC_ID_MPEG4;
|
||||
}
|
||||
}
|
||||
|
||||
_AVCODECID codec_id = of->video_codec;
|
||||
if (codec_name) {
|
||||
AVCodec *a = avcodec_find_encoder_by_name(codec_name);
|
||||
const AVCodec *a = avcodec_find_encoder_by_name(codec_name);
|
||||
if (a) {
|
||||
codec_id = a->id;
|
||||
Debug(1, "Using codec \"%s\"", codec_name);
|
||||
|
|
|
@ -40,11 +40,11 @@ protected:
|
|||
const char *format;
|
||||
const char *codec_name;
|
||||
enum _AVPIXELFORMAT pf;
|
||||
AVOutputFormat *of;
|
||||
const AVOutputFormat *of;
|
||||
AVFormatContext *ofc;
|
||||
AVStream *ost;
|
||||
AVCodecContext *codec_context;
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
AVFrame *opicture;
|
||||
AVFrame *tmp_opicture;
|
||||
uint8_t *video_outbuf;
|
||||
|
|
|
@ -181,7 +181,7 @@ int RemoteCameraRtsp::PrimeCapture() {
|
|||
avcodec_parameters_to_context(mVideoCodecContext, mFormatContext->streams[mVideoStreamId]->codecpar);
|
||||
|
||||
// Find the decoder for the video stream
|
||||
AVCodec *codec = avcodec_find_decoder(mVideoCodecContext->codec_id);
|
||||
const AVCodec *codec = avcodec_find_decoder(mVideoCodecContext->codec_id);
|
||||
if ( codec == nullptr ) {
|
||||
Error("Unable to locate codec %d decoder", mVideoCodecContext->codec_id);
|
||||
return -1;
|
||||
|
|
|
@ -139,7 +139,7 @@ bool VideoStore::open() {
|
|||
oc->metadata = pmetadata;
|
||||
out_format = oc->oformat;
|
||||
out_format->flags |= AVFMT_TS_NONSTRICT; // allow non increasing dts
|
||||
AVCodec *video_out_codec = nullptr;
|
||||
const AVCodec *video_out_codec = nullptr;
|
||||
|
||||
AVDictionary *opts = nullptr;
|
||||
std::string Options = monitor->GetEncoderOptions();
|
||||
|
|
|
@ -38,7 +38,7 @@ class VideoStore {
|
|||
CodecData *chosen_codec_data;
|
||||
|
||||
Monitor *monitor;
|
||||
AVOutputFormat *out_format;
|
||||
const AVOutputFormat *out_format;
|
||||
AVFormatContext *oc;
|
||||
AVStream *video_out_stream;
|
||||
AVStream *audio_out_stream;
|
||||
|
@ -52,7 +52,7 @@ class VideoStore {
|
|||
const AVCodec *audio_in_codec;
|
||||
AVCodecContext *audio_in_ctx;
|
||||
// The following are used when encoding the audio stream to AAC
|
||||
AVCodec *audio_out_codec;
|
||||
const AVCodec *audio_out_codec;
|
||||
AVCodecContext *audio_out_ctx;
|
||||
// Move this into the object so that we aren't constantly allocating/deallocating it on the stack
|
||||
AVPacket opkt;
|
||||
|
|
Loading…
Reference in New Issue