1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

lavc/videotoolbox: fix warnings

fix mixing declarations and code warnings

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
Jun Zhao 2023-04-03 20:08:23 +08:00 committed by Jun Zhao
parent aa8ff2240c
commit 639ded10e3

View File

@ -799,6 +799,9 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec_type, static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec_type,
AVCodecContext *avctx) AVCodecContext *avctx)
{ {
CFMutableDictionaryRef avc_info;
CFDataRef data = NULL;
CFMutableDictionaryRef config_info = CFDictionaryCreateMutable(kCFAllocatorDefault, CFMutableDictionaryRef config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
0, 0,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryKeyCallBacks,
@ -810,9 +813,6 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec
kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
kCFBooleanTrue); kCFBooleanTrue);
CFMutableDictionaryRef avc_info;
CFDataRef data = NULL;
avc_info = CFDictionaryCreateMutable(kCFAllocatorDefault, avc_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
1, 1,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryKeyCallBacks,
@ -1072,13 +1072,14 @@ static int videotoolbox_hevc_end_frame(AVCodecContext *avctx)
HEVCContext *h = avctx->priv_data; HEVCContext *h = avctx->priv_data;
AVFrame *frame = h->ref->frame; AVFrame *frame = h->ref->frame;
VTContext *vtctx = avctx->internal->hwaccel_priv_data; VTContext *vtctx = avctx->internal->hwaccel_priv_data;
int ret;
h->output_frame->crop_right = 0; h->output_frame->crop_right = 0;
h->output_frame->crop_left = 0; h->output_frame->crop_left = 0;
h->output_frame->crop_top = 0; h->output_frame->crop_top = 0;
h->output_frame->crop_bottom = 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; vtctx->bitstream_size = 0;
return ret; return ret;
} }
@ -1132,15 +1133,17 @@ static int videotoolbox_prores_end_frame(AVCodecContext *avctx)
} }
static enum AVPixelFormat videotoolbox_best_pixel_format(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); const AVPixFmtDescriptor *descriptor = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
if (!descriptor) if (!descriptor)
return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context() 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) if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA)
return AV_PIX_FMT_AYUV64; return AV_PIX_FMT_AYUV64;
depth = descriptor->comp[0].depth;
#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
if (depth > 10) if (depth > 10)
return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : AV_PIX_FMT_P216; 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; VTContext *vtctx = avctx->internal->hwaccel_priv_data;
AVHWFramesContext *hw_frames; AVHWFramesContext *hw_frames;
int err; int err;
bool full_range;
vtctx->logctx = avctx; vtctx->logctx = avctx;
@ -1241,7 +1245,7 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx)
goto fail; 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 = vtctx->vt_ctx->cv_pix_fmt_type =
av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, full_range); av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, full_range);
if (!vtctx->vt_ctx->cv_pix_fmt_type) { if (!vtctx->vt_ctx->cv_pix_fmt_type) {