From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 496AC48933 for ; Fri, 22 Mar 2024 16:02:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 09F3368D53A; Fri, 22 Mar 2024 18:02:18 +0200 (EET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C6E7E68D2D9 for ; Fri, 22 Mar 2024 18:02:11 +0200 (EET) Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-29c14800a7fso1644208a91.2 for ; Fri, 22 Mar 2024 09:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711123329; x=1711728129; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=qlQgoAYQMFAZihW9Rcdc2KTqeWgFwtHGwKN6vCGmyR4=; b=k7x70xdL5hnayUWu0IwrGyY6hajsieqK1ewUDr3z7f4l4l16yuYjfUydFjVCzSBmeF 4UO9ZUt7ndNNofVtdfckRVd/PawW3cEGhJRj3JkCHPbPmkVMvyoSUcZF0cVRgErNntV+ xCaNu02yqj6CS5gam8WSlgWiZDGH/2xtav7iBIOKCmHLsHw21DXNI1XflBjZ1Is9s91K 0/mI5hYy3ab4n8iShU6WWCnFr/XG04k1MTT5XskKSfXqCGTLycVioK5IPxAUJXw8KYCQ vWxE31+o+CbhlK2xGOGEyEIVJtu82KbMro3Ion2GJjOEKLmsMmqmxoUe3i/S8wY/+4jh qMEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711123329; x=1711728129; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qlQgoAYQMFAZihW9Rcdc2KTqeWgFwtHGwKN6vCGmyR4=; b=F/HMibnGuc+KvovEugC1Phc3HK+QbNxxGXGpxoiZW6w2uPQaVt8NUi21D/3NrPWgcA /8JQu2V8rwmt7EQyrHZrbqCcahSSQ2l55rKnpdwc0oTXcL4n1o0tf5c87okrGDgq7swi 1BKYZm51r6F1L9pJaLcpMf0NImZyTgq/7Nc0KXvh7ZDNC79opgNDItUnYzcJ2Xj+sUDJ DXqGNaDZBGuI5M6dOheisl4g1fGS4c9sllUAsR3Fuu4JFMGgleyls44lU8Nk4imK506O PtniLv6S7kgUF24Tg+QIGQG3xJ8cBl18Cg+6oUdnTxrRubz+6kZg58yCJyGbnXkAN1x6 Y/JQ== X-Gm-Message-State: AOJu0YzW5DVhwZt+ru93J7on3DPOIgQWMC/dEVLJeDUY3EH1xMc7PT7w 7clovY2ADErIWIwWcI1geaurGc0TVrTv+NxaaT4p9gERow3rKnHMJfqamrQ0 X-Google-Smtp-Source: AGHT+IHmTbXBAAF9ZzjO7L0+4KGpW3PzWdy5WGEjOoTnz+8fatXPH0ofdgDKL7Qx09Vh6E621i2a5Q== X-Received: by 2002:a17:90a:dd92:b0:29c:4395:b931 with SMTP id l18-20020a17090add9200b0029c4395b931mr62817pjv.10.1711123329075; Fri, 22 Mar 2024 09:02:09 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id sc1-20020a17090b510100b002a03a597526sm1670604pjb.25.2024.03.22.09.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:02:08 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Mar 2024 13:01:27 -0300 Message-ID: <20240322160127.1635-1-jamrial@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avutil/channel_layout: don't clear the opaque pointer on type conversion 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Otherwise it would not be lossless. Signed-off-by: James Almer --- libavutil/channel_layout.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index a83618bcc7..3054ee08a5 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -902,9 +902,11 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde lossy = 1; } if (!lossy || allow_lossy) { + void *opaque = channel_layout->opaque; av_channel_layout_uninit(channel_layout); channel_layout->order = AV_CHANNEL_ORDER_UNSPEC; channel_layout->nb_channels = nb_channels; + channel_layout->opaque = opaque; return lossy; } return AVERROR(ENOSYS); @@ -916,8 +918,10 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde return AVERROR(ENOSYS); lossy = has_channel_names(channel_layout); if (!lossy || allow_lossy) { + void *opaque = channel_layout->opaque; av_channel_layout_uninit(channel_layout); av_channel_layout_from_mask(channel_layout, mask); + channel_layout->opaque = opaque; return lossy; } } @@ -925,6 +929,7 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde case AV_CHANNEL_ORDER_CUSTOM: { AVChannelLayout custom = { 0 }; int ret = av_channel_layout_custom_init(&custom, channel_layout->nb_channels); + void *opaque = channel_layout->opaque; if (ret < 0) return ret; if (channel_layout->order != AV_CHANNEL_ORDER_UNSPEC) @@ -932,6 +937,7 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde custom.u.map[i].id = av_channel_layout_channel_from_index(channel_layout, i); av_channel_layout_uninit(channel_layout); *channel_layout = custom; + channel_layout->opaque = opaque; return 0; } case AV_CHANNEL_ORDER_AMBISONIC: @@ -946,10 +952,12 @@ int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrde return AVERROR(ENOSYS); lossy = has_channel_names(channel_layout); if (!lossy || allow_lossy) { + void *opaque = channel_layout->opaque; av_channel_layout_uninit(channel_layout); channel_layout->order = AV_CHANNEL_ORDER_AMBISONIC; channel_layout->nb_channels = nb_channels; channel_layout->u.mask = mask; + channel_layout->opaque = opaque; return lossy; } } -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".