mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
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 <marcosashiglesias@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user