[FFmpeg-cvslog] lavc/videotoolbox: fix warnings
Jun Zhao
git at videolan.org
Sun Apr 9 13:13:50 EEST 2023
ffmpeg | branch: master | Jun Zhao <mypopydev at gmail.com> | Mon Apr 3 20:08:23 2023 +0800| [639ded10e3599b7dd52a4bd7c06589689d177d08] | committer: Jun Zhao
lavc/videotoolbox: fix warnings
fix mixing declarations and code warnings
Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=639ded10e3599b7dd52a4bd7c06589689d177d08
---
libavcodec/videotoolbox.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index e42fea6f32..6444325591 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -799,6 +799,9 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec_type,
AVCodecContext *avctx)
{
+ CFMutableDictionaryRef avc_info;
+ CFDataRef data = NULL;
+
CFMutableDictionaryRef config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
@@ -810,9 +813,6 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec
kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
kCFBooleanTrue);
- CFMutableDictionaryRef avc_info;
- CFDataRef data = NULL;
-
avc_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
1,
&kCFTypeDictionaryKeyCallBacks,
@@ -1072,13 +1072,14 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx)
HEVCContext *h = avctx->priv_data;
AVFrame *frame = h->ref->frame;
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+ int ret;
h->output_frame->crop_right = 0;
h->output_frame->crop_left = 0;
h->output_frame->crop_top = 0;
h->output_frame->crop_bottom = 0;
- int ret = ff_videotoolbox_common_end_frame(avctx, frame);
+ ret = ff_videotoolbox_common_end_frame(avctx, frame);
vtctx->bitstream_size = 0;
return ret;
}
@@ -1132,15 +1133,17 @@ static int videotoolbox_prores_end_frame(AVCodecContext *avctx)
}
static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx) {
+ int depth;
const AVPixFmtDescriptor *descriptor = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
if (!descriptor)
return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context()
- int depth = descriptor->comp[0].depth;
if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA)
return AV_PIX_FMT_AYUV64;
+ depth = descriptor->comp[0].depth;
+
#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
if (depth > 10)
return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : AV_PIX_FMT_P216;
@@ -1194,6 +1197,7 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx)
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
AVHWFramesContext *hw_frames;
int err;
+ bool full_range;
vtctx->logctx = avctx;
@@ -1241,7 +1245,7 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx)
goto fail;
}
- bool full_range = avctx->color_range == AVCOL_RANGE_JPEG;
+ full_range = avctx->color_range == AVCOL_RANGE_JPEG;
vtctx->vt_ctx->cv_pix_fmt_type =
av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, full_range);
if (!vtctx->vt_ctx->cv_pix_fmt_type) {
More information about the ffmpeg-cvslog
mailing list