From patchwork Thu Jan 13 01:50:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33426 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp32854iog; Wed, 12 Jan 2022 18:24:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKrRw4mk3TeQBypXR3qBKZ6Kp/pwmL4qvibJsS1+sjWqrqzd8Bk+iwNa41MF2zt2AR0giF X-Received: by 2002:a17:907:2d0c:: with SMTP id gs12mr1937484ejc.4.1642040699017; Wed, 12 Jan 2022 18:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642040699; cv=none; d=google.com; s=arc-20160816; b=PgyiZ0IjH9Gn/wcFpmO+OeRPvfbgP+N4s0pgXf76ZOybPoewLKM69ZkEa/BoP8YE+E Hmz8H0oe77glLKDl+BdXeQJyizOYbII/ijP58ZmR/tQa3ON+cbQwm0ZxKhOMTwZdWBvg KyzWs2JDHe2h2kGRKccDZmdJGQVo6NlIFtRygWIPPMMTeTTUH4iIPd8MhhvDesZVBk9/ DlJXJfWiuA4BY5p4RmVLBj+M34bggdIl0k8XCDLAREWbWhiDTZlJ4QykXgrGiGeWDIZO 4bQ9d3v9ZMcT3npzQUtuzZYWjvHcfq6g+bb6IVV+JLVXDDpkoIMB3fJQT97V92P9ShL/ FY5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=uItcdDtzylAUU04/8E8r4BcNFCvYeJNaNbbquhye9l0=; b=gAp64q13Zh9ISreV7/zNJ0xtqpnMjCaHu6qiQfcnpYAaqUVGAww3gq8CAuqdjjkOAa 0sUgVs0MiEshoUAiU4MQnkSNeIAG/CZS1SUr+lKM5Ts1J8JcF2GBkQjtMbiZfRkEDaqO R1SVgXin9nnPhhdEUoIo91M0gokSBub9Re/L8wcnCJGGwS1r9SE/H/03ccV6WA8QD2C1 C8XP/kDoudjq9Ma2L5Sb4jcSBO+l74VaVrn8ZW0hYuiYL3F4RZKAR8RbTTBY/wkabT9H vF1q14XBo4WM5LNwhQ/hipVSJsAS/QcqW99cNTW0hh791XJniDVp3dLXcFOIzaSROCMk xlBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=H05cgpAE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j17si825214edr.419.2022.01.12.18.24.58; Wed, 12 Jan 2022 18:24:59 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=H05cgpAE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 82E7168B0E2; Thu, 13 Jan 2022 04:00:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E34668AFDD for ; Thu, 13 Jan 2022 04:00:36 +0200 (EET) Received: by mail-qk1-f171.google.com with SMTP id g2so5616786qkp.1 for ; Wed, 12 Jan 2022 18:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RO7ivYUBA37qzPKiv7Stf8v06cq9BFU6ztrvZcYiPW4=; b=H05cgpAEsqp0yYaOMIUVX7UtFWLN201qdWhSZBR+xCv5JpHr/ihaOIbw3V8Nid4qCg HPR0997vNOm4IC6WRCQmnfOcR6Hf3J7OuzxiKtV51r1sQ8c1LqM5c25F542Tustd3nSK 7YLctpcMLTmsBh8PMIUVuko2BheDWAV2uI+mtbLyCqcoFH94AlCGqDIttqXIYUC4zS5Z 8sUiO5qGewU7r7ubI0QPo2y9/HmvGGzEvb51lt6E1UwxNy7PRyjbfyZ5a19P1VoiAkho 3uzeZm4NYeKAZyF1MX8HJV8OQNRZSfjmGG2c7a0J+DjfWfmQmJeQpx0NmQ8mGRWIdvZO Tk/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RO7ivYUBA37qzPKiv7Stf8v06cq9BFU6ztrvZcYiPW4=; b=TMjAnrtY/SGLq+HpV3BFhJyS4zqQ6jcH1suOlhlJKaXZXiI72R4d/0PMoVhWPqaJQC wXl2GLxtM8I32aXmLCjEqlVR48jb8bJaSXEvPNRJvmKqa1vJjFdXSqmn5kux6iS9DQmX gU2xzSl5LO3MIoFYgzQRMtn2IpnSz/u/wwZGY2pr0eY/C9+ViQO/709m/PRJvO6QFCrL 7XFac6teJGHWmGP8SZdsy4UsXSu8RTiyBtgylMtdVbkZTMh4d7vAQbvF3pBm5+l5Enp1 O82SVBtSLkHfzv3F8Fa24Upu0iUQgVVSPrD32SqXto+N89aoQ5gfaPv6fK7Zr1v+29OW Frag== X-Gm-Message-State: AOAM532AuF8a0KW7mO3eYwRd4S/8zR3VbbWmkeSqiSj+90Z0NOUuyTyz wCxn7LdJavR5mQif8uT0/jCLiblvv9c= X-Received: by 2002:ac8:7607:: with SMTP id t7mr2015740qtq.286.1642038789850; Wed, 12 Jan 2022 17:53:09 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id i21sm1204710qti.31.2022.01.12.17.53.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 17:53:09 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 22:50:20 -0300 Message-Id: <20220113015101.4-59-jamrial@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113015101.4-1-jamrial@gmail.com> References: <20220113015101.4-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 058/281] flac: convert to new channel layout API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4D+txmK6ZfAM From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/flacdec.c | 3 +-- libavformat/flacenc.c | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 3401aebe8d..bfae5a2af1 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -191,8 +191,7 @@ static int flac_read_header(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n"); } else { - st->codecpar->channel_layout = mask; - st->codecpar->channels = av_get_channel_layout_nb_channels(mask); + av_channel_layout_from_mask(&st->codecpar->ch_layout, mask); av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0); } } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index b267197ccc..eaaf774f9e 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -238,9 +238,8 @@ static int flac_init(struct AVFormatContext *s) } /* add the channel layout tag */ - if (par->channel_layout && - !(par->channel_layout & ~0x3ffffULL) && - !ff_flac_is_native_layout(par->channel_layout)) { + if (!av_channel_layout_subset(&par->ch_layout, ~0x3ffffULL) && + !ff_flac_is_native_layout(par->ch_layout.u.mask)) { AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0); @@ -249,7 +248,7 @@ static int flac_init(struct AVFormatContext *s) "already present, this muxer will not overwrite it.\n"); } else { uint8_t buf[32]; - snprintf(buf, sizeof(buf), "0x%"PRIx64, par->channel_layout); + snprintf(buf, sizeof(buf), "0x%"PRIx64, par->ch_layout.u.mask); av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0); } }