This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 5d70f0844c libavutil/stereo3d: fix prefix matching in *_from_name()
functions
5d70f0844c is described below
commit 5d70f0844ced0896e8bf2b6921e7765725852045
Author: marcos ashton <[email protected]>
AuthorDate: Sun Mar 22 22:03:28 2026 +0000
Commit: michaelni <[email protected]>
CommitDate: Wed Mar 25 01:32:20 2026 +0000
libavutil/stereo3d: fix prefix matching in *_from_name() functions
The three *_from_name() functions used av_strstart() for prefix matching,
which returns incorrect results when one name is a prefix of another.
av_stereo3d_from_name("side by side (quincunx subsampling)") matched
"side by side" at index 1 and returned AV_STEREO3D_SIDEBYSIDE instead of
AV_STEREO3D_SIDEBYSIDE_QUINCUNX. Similarly,
av_stereo3d_primary_eye_from_name("nonexistent") matched "none" and
returned AV_PRIMARY_EYE_NONE instead of -1.
Switch all three functions from av_strstart() to strcmp() for exact
matching. No in-tree callers rely on prefix matching.
Signed-off-by: marcos ashton <[email protected]>
---
libavutil/stereo3d.c | 7 +++----
tests/ref/fate/stereo3d | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index d6de476532..bf3d1e1fe5 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -20,7 +20,6 @@
#include <string.h>
-#include "avstring.h"
#include "frame.h"
#include "macros.h"
#include "mem.h"
@@ -103,7 +102,7 @@ int av_stereo3d_from_name(const char *name)
int i;
for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_type_names); i++) {
- if (av_strstart(name, stereo3d_type_names[i], NULL))
+ if (!strcmp(name, stereo3d_type_names[i]))
return i;
}
@@ -123,7 +122,7 @@ int av_stereo3d_view_from_name(const char *name)
int i;
for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_view_names); i++) {
- if (av_strstart(name, stereo3d_view_names[i], NULL))
+ if (!strcmp(name, stereo3d_view_names[i]))
return i;
}
@@ -143,7 +142,7 @@ int av_stereo3d_primary_eye_from_name(const char *name)
int i;
for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_primary_eye_names); i++) {
- if (av_strstart(name, stereo3d_primary_eye_names[i], NULL))
+ if (!strcmp(name, stereo3d_primary_eye_names[i]))
return i;
}
diff --git a/tests/ref/fate/stereo3d b/tests/ref/fate/stereo3d
index bfb4cadc1d..6ed769ce24 100644
--- a/tests/ref/fate/stereo3d
+++ b/tests/ref/fate/stereo3d
@@ -23,7 +23,7 @@ side by side: 1
top and bottom: 2
frame alternate: 3
checkerboard: 4
-side by side (quincunx subsampling): 1
+side by side (quincunx subsampling): 5
interleaved lines: 6
interleaved columns: 7
unspecified: 8
@@ -35,7 +35,7 @@ type roundtrip 1 (side by side): OK
type roundtrip 2 (top and bottom): OK
type roundtrip 3 (frame alternate): OK
type roundtrip 4 (checkerboard): OK
-type roundtrip 5 (side by side (quincunx subsampling)): FAIL
+type roundtrip 5 (side by side (quincunx subsampling)): OK
type roundtrip 6 (interleaved lines): OK
type roundtrip 7 (interleaved columns): OK
type roundtrip 8 (unspecified): OK
@@ -70,4 +70,4 @@ Testing av_stereo3d_primary_eye_from_name()
none: 0
left: 1
right: 2
-nonexistent: 0
+nonexistent: -1
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]