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)
|
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)
|
if (codec != NULL)
|
||||||
return codec->name;
|
return codec->name;
|
||||||
else
|
else
|
||||||
|
@ -159,7 +159,7 @@ static void add_codec_to_list(const struct ff_format_desc *format_desc,
|
||||||
d->name = codec->name;
|
d->name = codec->name;
|
||||||
d->long_name = codec->long_name;
|
d->long_name = codec->long_name;
|
||||||
d->id = codec->id;
|
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) {
|
if (strcmp(base_codec->name, codec->name) != 0) {
|
||||||
d->alias = true;
|
d->alias = true;
|
||||||
d->base_name = base_codec->name;
|
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,
|
static const char *get_encoder_name(const struct ff_format_desc *format_desc,
|
||||||
enum AVCodecID codec_id)
|
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)
|
if (codec == NULL && codec_id == AV_CODEC_ID_NONE)
|
||||||
return NULL;
|
return NULL;
|
||||||
else if (codec == NULL)
|
else if (codec == NULL)
|
||||||
|
|
|
@ -31,7 +31,7 @@ enum AVHWDeviceType hw_priority[] = {
|
||||||
AV_HWDEVICE_TYPE_NONE,
|
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)
|
enum AVPixelFormat *hw_format)
|
||||||
{
|
{
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct mp_decode {
|
||||||
|
|
||||||
AVCodecContext *decoder;
|
AVCodecContext *decoder;
|
||||||
AVBufferRef *hw_ctx;
|
AVBufferRef *hw_ctx;
|
||||||
AVCodec *codec;
|
const AVCodec *codec;
|
||||||
|
|
||||||
int64_t last_duration;
|
int64_t last_duration;
|
||||||
int64_t frame_pts;
|
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];
|
AVStream *const stream = fmt_ctx->streams[ret];
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
||||||
AVCodecParameters *const codecpar = stream->codecpar;
|
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
|
#else
|
||||||
AVCodecContext *const decoder_ctx = stream->codec;
|
AVCodecContext *const decoder_ctx = stream->codec;
|
||||||
AVCodec *const decoder = avcodec_find_decoder(decoder_ctx->codec_id);
|
AVCodec *const decoder = avcodec_find_decoder(decoder_ctx->codec_id);
|
||||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
||||||
* Data structure for decoder
|
* Data structure for decoder
|
||||||
*/
|
*/
|
||||||
struct v4l2_decoder {
|
struct v4l2_decoder {
|
||||||
AVCodec *codec;
|
const AVCodec *codec;
|
||||||
AVCodecContext *context;
|
AVCodecContext *context;
|
||||||
AVPacket *packet;
|
AVPacket *packet;
|
||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct enc_encoder {
|
||||||
|
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
AVCodec *codec;
|
const AVCodec *codec;
|
||||||
AVCodecContext *context;
|
AVCodecContext *context;
|
||||||
|
|
||||||
uint8_t *samples[MAX_AV_PLANES];
|
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,
|
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)
|
*codec = (!!name && *name) ? avcodec_find_encoder_by_name(name)
|
||||||
: avcodec_find_encoder(id);
|
: 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)
|
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 (format->video_codec != AV_CODEC_ID_NONE)
|
||||||
if (!create_video_stream(data))
|
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)
|
static inline bool open_output_file(struct ffmpeg_data *data)
|
||||||
{
|
{
|
||||||
AVOutputFormat *format = data->output->oformat;
|
const AVOutputFormat *format = data->output->oformat;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
AVDictionary *dict = NULL;
|
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)
|
static enum AVCodecID get_codec_id(const char *name, int id)
|
||||||
{
|
{
|
||||||
AVCodec *codec;
|
const AVCodec *codec;
|
||||||
|
|
||||||
if (id != 0)
|
if (id != 0)
|
||||||
return (enum AVCodecID)id;
|
return (enum AVCodecID)id;
|
||||||
|
|
|
@ -43,8 +43,8 @@ struct ffmpeg_data {
|
||||||
AVStream *video;
|
AVStream *video;
|
||||||
AVCodecContext *video_ctx;
|
AVCodecContext *video_ctx;
|
||||||
struct ffmpeg_audio_info *audio_infos;
|
struct ffmpeg_audio_info *audio_infos;
|
||||||
AVCodec *acodec;
|
const AVCodec *acodec;
|
||||||
AVCodec *vcodec;
|
const AVCodec *vcodec;
|
||||||
AVFormatContext *output;
|
AVFormatContext *output;
|
||||||
struct SwsContext *swscale;
|
struct SwsContext *swscale;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct vaapi_encoder {
|
||||||
AVBufferRef *vadevice_ref;
|
AVBufferRef *vadevice_ref;
|
||||||
AVBufferRef *vaframes_ref;
|
AVBufferRef *vaframes_ref;
|
||||||
|
|
||||||
AVCodec *vaapi;
|
const AVCodec *vaapi;
|
||||||
AVCodecContext *context;
|
AVCodecContext *context;
|
||||||
|
|
||||||
AVPacket *packet;
|
AVPacket *packet;
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct ffmpeg_video_encoder {
|
||||||
obs_encoder_t *encoder;
|
obs_encoder_t *encoder;
|
||||||
const char *enc_name;
|
const char *enc_name;
|
||||||
|
|
||||||
AVCodec *avcodec;
|
const AVCodec *avcodec;
|
||||||
AVCodecContext *context;
|
AVCodecContext *context;
|
||||||
int64_t start_ts;
|
int64_t start_ts;
|
||||||
bool first_packet;
|
bool first_packet;
|
||||||
|
|
|
@ -230,7 +230,7 @@ extern bool load_nvenc_lib(void);
|
||||||
|
|
||||||
static bool nvenc_codec_exists(const char *name, const char *fallback)
|
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)
|
if (!nvenc)
|
||||||
nvenc = avcodec_find_encoder_by_name(fallback);
|
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
|
#ifdef LIBAVUTIL_VAAPI_AVAILABLE
|
||||||
static bool vaapi_supported(void)
|
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;
|
return !!vaenc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -306,7 +306,7 @@ extern void obs_ffmpeg_unload_logging(void);
|
||||||
static void register_encoder_if_available(struct obs_encoder_info *info,
|
static void register_encoder_if_available(struct obs_encoder_info *info,
|
||||||
const char *id)
|
const char *id)
|
||||||
{
|
{
|
||||||
AVCodec *c = avcodec_find_encoder_by_name(id);
|
const AVCodec *c = avcodec_find_encoder_by_name(id);
|
||||||
if (c) {
|
if (c) {
|
||||||
obs_register_encoder(info);
|
obs_register_encoder(info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ enum AVHWDeviceType hw_priority[] = {
|
||||||
AV_HWDEVICE_TYPE_NONE,
|
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++) {
|
for (int i = 0;; i++) {
|
||||||
const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
|
const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
struct ffmpeg_decode {
|
struct ffmpeg_decode {
|
||||||
AVBufferRef *hw_device_ctx;
|
AVBufferRef *hw_device_ctx;
|
||||||
AVCodecContext *decoder;
|
AVCodecContext *decoder;
|
||||||
AVCodec *codec;
|
const AVCodec *codec;
|
||||||
|
|
||||||
AVFrame *hw_frame;
|
AVFrame *hw_frame;
|
||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
|
|
Loading…
Reference in New Issue