Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
decoder_ffmpeg: constify codec variables
Browse files Browse the repository at this point in the history
Fixes the following compile warnings:

decoder_ffmpeg.c: In function ‘init_vaapi’:
decoder_ffmpeg.c:135:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  135 |     AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
      |                      ^~~~~~~~~~~~~~~~~~~~
decoder_ffmpeg.c: In function ‘ffdec_init_sw’:
decoder_ffmpeg.c:149:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  149 |     AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
      |                      ^~~~~~~~~~~~~~~~~~~~
  • Loading branch information
mbouron authored and mbouron-gpsw committed Mar 30, 2022
1 parent 819cb57 commit 66e63a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/decoder_ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int init_mediacodec(struct decoder_ctx *ctx)
av_assert0(0);
}

AVCodec *codec = avcodec_find_decoder_by_name(codec_name);
const AVCodec *codec = avcodec_find_decoder_by_name(codec_name);
if (!codec)
return AVERROR_DECODER_NOT_FOUND;

Expand Down Expand Up @@ -132,7 +132,7 @@ static int init_vaapi(struct decoder_ctx *ctx)
avctx->hw_device_ctx = hw_device_ctx_ref;
avctx->thread_count = 0;

AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
const AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
ret = avcodec_open2(avctx, codec, NULL);
if (ret < 0) {
av_buffer_unref(&avctx->hw_device_ctx);
Expand All @@ -146,7 +146,7 @@ static int ffdec_init_sw(struct decoder_ctx *ctx, const struct sxplayer_opts *op
AVCodecContext *avctx = ctx->avctx;
avctx->thread_count = 0;

AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
const AVCodec *codec = avcodec_find_decoder(avctx->codec_id);
return avcodec_open2(avctx, codec, NULL);
}

Expand Down

0 comments on commit 66e63a3

Please sign in to comment.