deps,libobs,plugins: Fix discarded-qualifiers warnings with FFmpeg 5
parent
eb06594381
commit
17ba8359e4
|
@ -66,7 +66,7 @@ void ff_init()
|
|||
|
||||
const char *ff_codec_name_from_id(int codec_id)
|
||||
{
|
||||
AVCodec *codec = avcodec_find_encoder(codec_id);
|
||||
const AVCodec *codec = avcodec_find_encoder(codec_id);
|
||||
if (codec != NULL)
|
||||
return codec->name;
|
||||
else
|
||||
|
@ -159,7 +159,7 @@ static void add_codec_to_list(const struct ff_format_desc *format_desc,
|
|||
d->name = codec->name;
|
||||
d->long_name = codec->long_name;
|
||||
d->id = codec->id;
|
||||
AVCodec *base_codec = avcodec_find_encoder(codec->id);
|
||||
const AVCodec *base_codec = avcodec_find_encoder(codec->id);
|
||||
if (strcmp(base_codec->name, codec->name) != 0) {
|
||||
d->alias = true;
|
||||
d->base_name = base_codec->name;
|
||||
|
@ -415,7 +415,7 @@ ff_format_desc_next(const struct ff_format_desc *format_desc)
|
|||
static const char *get_encoder_name(const struct ff_format_desc *format_desc,
|
||||
enum AVCodecID codec_id)
|
||||
{
|
||||
AVCodec *codec = avcodec_find_encoder(codec_id);
|
||||
const AVCodec *codec = avcodec_find_encoder(codec_id);
|
||||
if (codec == NULL && codec_id == AV_CODEC_ID_NONE)
|
||||
return NULL;
|
||||
else if (codec == NULL)
|
||||
|
|
|
@ -31,7 +31,7 @@ enum AVHWDeviceType hw_priority[] = {
|
|||
AV_HWDEVICE_TYPE_NONE,
|
||||
};
|
||||
|
||||
static bool has_hw_type(AVCodec *c, enum AVHWDeviceType type,
|
||||
static bool has_hw_type(const AVCodec *c, enum AVHWDeviceType type,
|
||||
enum AVPixelFormat *hw_format)
|
||||
{
|
||||
for (int i = 0;; i++) {
|
||||
|
|
|
@ -53,7 +53,7 @@ struct mp_decode {
|
|||
|
||||
AVCodecContext *decoder;
|
||||
AVBufferRef *hw_ctx;
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
|
||||
int64_t last_duration;
|
||||
int64_t frame_pts;
|
||||
|
|
|
@ -39,7 +39,8 @@ static bool ffmpeg_image_open_decoder_context(struct ffmpeg_image *info)
|
|||
AVStream *const stream = fmt_ctx->streams[ret];
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
||||
AVCodecParameters *const codecpar = stream->codecpar;
|
||||
AVCodec *const decoder = avcodec_find_decoder(codecpar->codec_id);
|
||||
const AVCodec *const decoder = avcodec_find_decoder(
|
||||
codecpar->codec_id); // fix discarded-qualifiers
|
||||
#else
|
||||
AVCodecContext *const decoder_ctx = stream->codec;
|
||||
AVCodec *const decoder = avcodec_find_decoder(decoder_ctx->codec_id);
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
* Data structure for decoder
|
||||
*/
|
||||
struct v4l2_decoder {
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
AVCodecContext *context;
|
||||
AVPacket *packet;
|
||||
AVFrame *frame;
|
||||
|
|
|
@ -41,7 +41,7 @@ struct enc_encoder {
|
|||
|
||||
const char *type;
|
||||
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
AVCodecContext *context;
|
||||
|
||||
uint8_t *samples[MAX_AV_PLANES];
|
||||
|
|
|
@ -79,7 +79,8 @@ void ffmpeg_log_error(int log_level, struct ffmpeg_data *data,
|
|||
}
|
||||
|
||||
static bool new_stream(struct ffmpeg_data *data, AVStream **stream,
|
||||
AVCodec **codec, enum AVCodecID id, const char *name)
|
||||
const AVCodec **codec, enum AVCodecID id,
|
||||
const char *name)
|
||||
{
|
||||
*codec = (!!name && *name) ? avcodec_find_encoder_by_name(name)
|
||||
: avcodec_find_encoder(id);
|
||||
|
@ -418,7 +419,7 @@ static bool create_audio_stream(struct ffmpeg_data *data, int idx)
|
|||
|
||||
static inline bool init_streams(struct ffmpeg_data *data)
|
||||
{
|
||||
AVOutputFormat *format = data->output->oformat;
|
||||
const AVOutputFormat *format = data->output->oformat;
|
||||
|
||||
if (format->video_codec != AV_CODEC_ID_NONE)
|
||||
if (!create_video_stream(data))
|
||||
|
@ -439,7 +440,7 @@ static inline bool init_streams(struct ffmpeg_data *data)
|
|||
|
||||
static inline bool open_output_file(struct ffmpeg_data *data)
|
||||
{
|
||||
AVOutputFormat *format = data->output->oformat;
|
||||
const AVOutputFormat *format = data->output->oformat;
|
||||
int ret;
|
||||
|
||||
AVDictionary *dict = NULL;
|
||||
|
@ -566,7 +567,7 @@ static inline const char *safe_str(const char *s)
|
|||
|
||||
static enum AVCodecID get_codec_id(const char *name, int id)
|
||||
{
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
|
||||
if (id != 0)
|
||||
return (enum AVCodecID)id;
|
||||
|
|
|
@ -43,8 +43,8 @@ struct ffmpeg_data {
|
|||
AVStream *video;
|
||||
AVCodecContext *video_ctx;
|
||||
struct ffmpeg_audio_info *audio_infos;
|
||||
AVCodec *acodec;
|
||||
AVCodec *vcodec;
|
||||
const AVCodec *acodec;
|
||||
const AVCodec *vcodec;
|
||||
AVFormatContext *output;
|
||||
struct SwsContext *swscale;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ struct vaapi_encoder {
|
|||
AVBufferRef *vadevice_ref;
|
||||
AVBufferRef *vaframes_ref;
|
||||
|
||||
AVCodec *vaapi;
|
||||
const AVCodec *vaapi;
|
||||
AVCodecContext *context;
|
||||
|
||||
AVPacket *packet;
|
||||
|
|
|
@ -21,7 +21,7 @@ struct ffmpeg_video_encoder {
|
|||
obs_encoder_t *encoder;
|
||||
const char *enc_name;
|
||||
|
||||
AVCodec *avcodec;
|
||||
const AVCodec *avcodec;
|
||||
AVCodecContext *context;
|
||||
int64_t start_ts;
|
||||
bool first_packet;
|
||||
|
|
|
@ -230,7 +230,7 @@ extern bool load_nvenc_lib(void);
|
|||
|
||||
static bool nvenc_codec_exists(const char *name, const char *fallback)
|
||||
{
|
||||
AVCodec *nvenc = avcodec_find_encoder_by_name(name);
|
||||
const AVCodec *nvenc = avcodec_find_encoder_by_name(name);
|
||||
if (!nvenc)
|
||||
nvenc = avcodec_find_encoder_by_name(fallback);
|
||||
|
||||
|
@ -286,7 +286,7 @@ static bool nvenc_supported(bool *out_h264, bool *out_hevc)
|
|||
#ifdef LIBAVUTIL_VAAPI_AVAILABLE
|
||||
static bool vaapi_supported(void)
|
||||
{
|
||||
AVCodec *vaenc = avcodec_find_encoder_by_name("h264_vaapi");
|
||||
const AVCodec *vaenc = avcodec_find_encoder_by_name("h264_vaapi");
|
||||
return !!vaenc;
|
||||
}
|
||||
#endif
|
||||
|
@ -306,7 +306,7 @@ extern void obs_ffmpeg_unload_logging(void);
|
|||
static void register_encoder_if_available(struct obs_encoder_info *info,
|
||||
const char *id)
|
||||
{
|
||||
AVCodec *c = avcodec_find_encoder_by_name(id);
|
||||
const AVCodec *c = avcodec_find_encoder_by_name(id);
|
||||
if (c) {
|
||||
obs_register_encoder(info);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ enum AVHWDeviceType hw_priority[] = {
|
|||
AV_HWDEVICE_TYPE_NONE,
|
||||
};
|
||||
|
||||
static bool has_hw_type(AVCodec *c, enum AVHWDeviceType type)
|
||||
static bool has_hw_type(const AVCodec *c, enum AVHWDeviceType type)
|
||||
{
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
|
||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
|||
struct ffmpeg_decode {
|
||||
AVBufferRef *hw_device_ctx;
|
||||
AVCodecContext *decoder;
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
|
||||
AVFrame *hw_frame;
|
||||
AVFrame *frame;
|
||||
|
|
Loading…
Reference in New Issue