Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: cenzhanquan2@gmail.com
To: ffmpeg-devel@ffmpeg.org
Cc: zhanquan cen <cenzhanquan2@gmail.com>, your_email@domain.com
Subject: [FFmpeg-devel] [PATCH v2 2/3] avfilter/mapping: implement dynamic routing logic.
Date: Mon, 21 Jul 2025 20:04:43 +0800
Message-ID: <20250721120444.2125750-3-cenzhanquan2@gmail.com> (raw)
In-Reply-To: <20250721120444.2125750-1-cenzhanquan2@gmail.com>

From: zhanquan cen <cenzhanquan2@gmail.com>

---
 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 <stddef.h>
+#include <stdlib.h>
+#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".

  parent reply	other threads:[~2025-07-21 12:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 11:27 [FFmpeg-devel] [PATCH 1/1] avfilter/abufsrc: add audio buffer source filter with dynamic routing cenzhanquan2
2025-07-21 11:48 ` Nicolas George
2025-07-21 12:04 ` [FFmpeg-devel] [PATCH v2 0/3] lavfi: Add volume scaling, dynamic routing, and abufsrc filter cenzhanquan2
2025-07-21 12:04   ` [FFmpeg-devel] [PATCH v2 1/3] avfilter/volume: add volume scaling utilities cenzhanquan2
2025-07-21 13:48     ` Steven Liu
2025-07-21 12:04   ` cenzhanquan2 [this message]
2025-07-21 12:04   ` [FFmpeg-devel] [PATCH v2 3/3] avfilter/abufsrc: integrate volume and mapping modules cenzhanquan2
2025-07-21 15:23   ` [FFmpeg-devel] [PATCH v2 0/3] lavfi: Add volume scaling, dynamic routing, and abufsrc filter Nicolas George

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250721120444.2125750-3-cenzhanquan2@gmail.com \
    --to=cenzhanquan2@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=your_email@domain.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git