mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avutil/pixdesc: Use av_strstart where appropriate
It makes the intent clearer and allows to avoid calculating the strlen separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
3d79ce0c29
commit
114603d0b9
@ -2702,11 +2702,13 @@ static int get_color_type(const AVPixFmtDescriptor *desc) {
|
||||
if(desc->nb_components == 1 || desc->nb_components == 2)
|
||||
return FF_COLOR_GRAY;
|
||||
|
||||
if(desc->name && !strncmp(desc->name, "yuvj", 4))
|
||||
return FF_COLOR_YUV_JPEG;
|
||||
if (desc->name) {
|
||||
if (av_strstart(desc->name, "yuvj", NULL))
|
||||
return FF_COLOR_YUV_JPEG;
|
||||
|
||||
if(desc->name && !strncmp(desc->name, "xyz", 3))
|
||||
return FF_COLOR_XYZ;
|
||||
if (av_strstart(desc->name, "xyz", NULL))
|
||||
return FF_COLOR_XYZ;
|
||||
}
|
||||
|
||||
if(desc->flags & AV_PIX_FMT_FLAG_RGB)
|
||||
return FF_COLOR_RGB;
|
||||
@ -2907,8 +2909,7 @@ int av_color_range_from_name(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
|
||||
size_t len = strlen(color_range_names[i]);
|
||||
if (!strncmp(color_range_names[i], name, len))
|
||||
if (av_strstart(name, color_range_names[i], NULL))
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -2926,13 +2927,10 @@ int av_color_primaries_from_name(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
|
||||
size_t len;
|
||||
|
||||
if (!color_primaries_names[i])
|
||||
continue;
|
||||
|
||||
len = strlen(color_primaries_names[i]);
|
||||
if (!strncmp(color_primaries_names[i], name, len))
|
||||
if (av_strstart(name, color_primaries_names[i], NULL))
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -2950,13 +2948,10 @@ int av_color_transfer_from_name(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
|
||||
size_t len;
|
||||
|
||||
if (!color_transfer_names[i])
|
||||
continue;
|
||||
|
||||
len = strlen(color_transfer_names[i]);
|
||||
if (!strncmp(color_transfer_names[i], name, len))
|
||||
if (av_strstart(name, color_transfer_names[i], NULL))
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -2974,13 +2969,10 @@ int av_color_space_from_name(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
|
||||
size_t len;
|
||||
|
||||
if (!color_space_names[i])
|
||||
continue;
|
||||
|
||||
len = strlen(color_space_names[i]);
|
||||
if (!strncmp(color_space_names[i], name, len))
|
||||
if (av_strstart(name, color_space_names[i], NULL))
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -2998,13 +2990,10 @@ int av_chroma_location_from_name(const char *name)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
|
||||
size_t len;
|
||||
|
||||
if (!chroma_location_names[i])
|
||||
continue;
|
||||
|
||||
len = strlen(chroma_location_names[i]);
|
||||
if (!strncmp(chroma_location_names[i], name, len))
|
||||
if (av_strstart(name, chroma_location_names[i], NULL))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user