Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_mux_init: remove whitespaces from input arguments when parsing stream groups
Date: Sat, 20 Jan 2024 09:22:26 -0300
Message-ID: <20240120122227.2382-1-jamrial@gmail.com> (raw)

If the arguments are read from a file, things like line breaks could be present

Signed-off-by: James Almer <jamrial@gmail.com>
---
 fftools/ffmpeg_mux_init.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index b527e1f118..15200c5a7d 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -2025,6 +2025,8 @@ static int of_parse_iamf_audio_element_layers(Muxer *mux, AVStreamGroup *stg, ch
         int demixing = 0, recon_gain = 0;
         int layer = 0;
 
+        if (ptr)
+            ptr += strspn(ptr, " \n\t\r");
         if (av_strstart(token, "layer=", &token))
             layer = 1;
         else if (av_strstart(token, "demixing=", &token))
@@ -2092,6 +2094,8 @@ static int of_parse_iamf_submixes(Muxer *mux, AVStreamGroup *stg, char *ptr)
         const char *subtoken;
         char *subptr = NULL;
 
+        if (ptr)
+            ptr += strspn(ptr, " \n\t\r");
         if (!av_strstart(token, "submix=", &token)) {
             av_log(mux, AV_LOG_ERROR, "No submix in mix presentation specification \"%s\"\n", token);
             goto fail;
@@ -2120,6 +2124,8 @@ static int of_parse_iamf_submixes(Muxer *mux, AVStreamGroup *stg, char *ptr)
             const AVDictionaryEntry *e;
             int element = 0, layout = 0;
 
+            if (subptr)
+                subptr += strspn(subptr, " \n\t\r");
             if (av_strstart(subtoken, "element=", &subtoken))
                 element = 1;
             else if (av_strstart(subtoken, "layout=", &subtoken))
@@ -2331,8 +2337,11 @@ static int of_add_groups(Muxer *mux, const OptionsContext *o)
             return ret;
 
         token = av_strtok(str, ",", &ptr);
-        if (token)
+        if (token) {
+            if (ptr)
+                ptr += strspn(ptr, " \n\t\r");
             ret = of_parse_group_token(mux, token, ptr);
+        }
 
         av_free(str);
         if (ret < 0)
-- 
2.43.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".

             reply	other threads:[~2024-01-20 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-20 12:22 James Almer [this message]
2024-01-20 12:22 ` [FFmpeg-devel] [PATCH 2/2] fate: add raw IAMF tests James Almer
2024-01-22 16:02   ` [FFmpeg-devel] 回复: " Wu Jianhua
2024-01-22 16:10     ` James Almer
2024-01-22 16:23       ` [FFmpeg-devel] 回复: " Wu Jianhua
2024-01-22 16:49         ` James Almer
2024-01-22 17:33           ` [FFmpeg-devel] 回复: " Wu Jianhua

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=20240120122227.2382-1-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /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