From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E4F394B53E for ; Mon, 21 Jul 2025 12:05:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D609168C4E4; Mon, 21 Jul 2025 15:05:11 +0300 (EEST) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 031FA68C49D for ; Mon, 21 Jul 2025 15:05:06 +0300 (EEST) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-748fe69a7baso3760614b3a.3 for ; Mon, 21 Jul 2025 05:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753099504; x=1753704304; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zP4oKHWOSNCFN3PMdYF97iyPry7+RjDT/0y/q/TFXbQ=; b=bSYbHV/PuvPcu3v0/tQrqIcfFSOD8k+T0myg4hJ3FVbBswnsw5rCQbcg7x5w/Qbp1t AUQPdMDWyoOy7PaP2oWPIuAg6LDcRgwh28ONb3PYx31WhqzuW6LlO9U7v78t1YMcwPEW esT4N6io0WElMsVIJQO8XvrnxPSGl+dayAPZ6OQQBm3w9BjZIxBVg1hxU0JyUoKCIRRA mpGsjhUd6/j1WzGPz5Bpkjqkc7CPd4Rl6aeM/89Ua8k9rMpsMD5YiKH0D+N4KcrYYv+9 8PvgZlQJNH0HwkFr3cEEzthKcBJaQauegqHezjd4ms5s1Abw2Vtai9JDPwWx8Ow5vdRU C4Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753099504; x=1753704304; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zP4oKHWOSNCFN3PMdYF97iyPry7+RjDT/0y/q/TFXbQ=; b=gujYdbvaj+IQzUoyGHQQDOSEhQxVGXBHSOKRMkqmt0Qp6rvmkNtaFW/LfIrgyG0XOS VniczUEtNNu+s6NxJUv3EQX50hsQ3VnSgQpkj4YgWXbQ6YXboJZO2BBm/TRwDsPJgUsT 7R6wNASKaVPcGNtv3ld9QsGhJuTnLoD/RukD+3aPg9vS4VLLw7ch3Jx2G/+Po4mCqrT8 Dz2xpeyp5RB4grBuE6/xHTjVcu0RnwuBdMwoU+P6/LeI21HgD2z/sdrq1bwLQYB/h2Ey 5Df/oOK+RlqrKBUJILLRepgLSCMtWDAGPe/ldc4Qe5AEtHk7ZU37vmVCE8aYE67xvcd7 Z2HQ== X-Gm-Message-State: AOJu0Yw5IrIUGfmU3tBBuUIpkUKIiBCkLQt3cgvMuzGBwS7iZArZDH/O /z8a5qdBb77tpG39vplqa5h1aVmSVqMY336aZlfhZ13YEG6NkhCnGjOmZ0jZOw== X-Gm-Gg: ASbGncv9AZ90peZJZa2AwuJlM9uqfybG4aV39hqGe79/xya/KB++aNFmybll6q322WS DL/lBhMrLEdjUWT/f5n3C7dlNkrUTuy6Hg7+Ogzy8+G9ZvpfL3BjFjM8KADYfhHt8idgy4WVcmi 2CTlSa5REe+m9/2B8wn+UZNPqbrEILwA9Ij9BwxQhY/i0NXZUrmMNW9rYTNQjnpo4AyH/mU/Gpm 5wthDoLzTAkYvqsPjYupYVbbKd9wvS4ou/xJfx3YxVKO1U1c+LszNSIIsxkAUF7lbX4LWRODNE+ IJypKdKQFGlNJzt0+dyr5CwabdriqIo2S3sSFLjlDJ90CEO7kCnSGbPH6ZfsL2MqMR0fseVyoDA nmeXLIKamHofnnEhEjmyyqkg6SA/67Vo= X-Google-Smtp-Source: AGHT+IEodNqCiJnXGrOGSOoclWecbw14Xz6hh5smKITD907k0KbSu3PylCvo8qZfI302HNJvNldfVg== X-Received: by 2002:a05:6a00:4fca:b0:736:4644:86ee with SMTP id d2e1a72fcca58-7584aa4cfd6mr22961994b3a.14.1753099503622; Mon, 21 Jul 2025 05:05:03 -0700 (PDT) Received: from cen.mioffice.cn ([43.224.245.228]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-759cb974219sm5520809b3a.116.2025.07.21.05.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jul 2025 05:05:03 -0700 (PDT) From: cenzhanquan2@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Jul 2025 20:04:43 +0800 Message-Id: <20250721120444.2125750-3-cenzhanquan2@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250721120444.2125750-1-cenzhanquan2@gmail.com> References: <20250721112752.2105845-1-cenzhanquan2@gmail.com> <20250721120444.2125750-1-cenzhanquan2@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/3] avfilter/mapping: implement dynamic routing logic. 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 Cc: zhanquan cen , your_email@domain.com 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: From: zhanquan cen --- mapping.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ mapping.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 mapping.c create mode 100644 mapping.h diff --git a/mapping.c b/mapping.c new file mode 100644 index 0000000000..53fa2fb3b5 --- /dev/null +++ b/mapping.c @@ -0,0 +1,51 @@ + +/* + * filter layer + * Copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "mapping.h" +int avfilter_parse_mapping(const char *map_str, int **map, int nb_map) +{ + int *new_map = NULL; + int new_nb_map = 0; + if (!map_str || nb_map <= 0) + return AVERROR(EINVAL); + new_map = av_calloc(nb_map, sizeof(*new_map)); + if (!new_map) + return AVERROR(ENOMEM); + while (1) { + char *p; + int n = strtol(map_str, &p, 0); + if (map_str == p) + break; + map_str = p; + if (new_nb_map >= nb_map) { + av_freep(&new_map); + return AVERROR(EINVAL); + } + new_map[new_nb_map++] = n; + } + if (!new_nb_map) { + av_freep(&new_map); + return AVERROR(EINVAL); + } + av_freep(map); + *map = new_map; + return 0; +} \ No newline at end of file diff --git a/mapping.h b/mapping.h new file mode 100644 index 0000000000..2c1d90ef93 --- /dev/null +++ b/mapping.h @@ -0,0 +1,44 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_MAPPING_H +#define AVFILTER_MAPPING_H + +#include +#include +#include "libavutil/error.h" +#include "libavutil/mem.h" + +/** + * @file + * control routing for src filter + */ + +/** + * Parse the mapping definition. + * + * @param map_str The mapping definition string. + * @param map Pointer to an array that will hold the parsed mapping relationships. + * The array will be allocated by this function and should be freed + * by the caller using av_freep(). + * @param nb_map The number of mappings expected in the map array. + * @return 0 on success, a negative AVERROR code on error. + */ +int avfilter_parse_mapping(const char *map_str, int **map, int nb_map); + +#endif /* AVFILTER_MAPPING_H */ \ No newline at end of file -- 2.34.1 _______________________________________________ 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".