This should make these APIs simpler to use, and less error prone
in case the caller does not check they are valid, and makes them
more similar to other naming APIs.
---
This should help in the bug in avprobe found by Luca.
Sending as RFC since I believe we are allowed to break this API as we
did the version bump, but I'd like to be sure.
Vittorio
libavutil/pixdesc.c | 10 +++++-----
libavutil/pixdesc.h | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index fb2e1a12f3..a2c4f9ba84 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2003,30 +2003,30 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum
AVPixelFormat pix_fmt)
const char *av_color_range_name(enum AVColorRange range)
{
return (unsigned) range < AVCOL_RANGE_NB ?
- color_range_names[range] : NULL;
+ color_range_names[range] : "unknown";
}
const char *av_color_primaries_name(enum AVColorPrimaries primaries)
{
return (unsigned) primaries < AVCOL_PRI_NB ?
- color_primaries_names[primaries] : NULL;
+ color_primaries_names[primaries] : "unknown";
}
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
{
return (unsigned) transfer < AVCOL_TRC_NB ?
- color_transfer_names[transfer] : NULL;
+ color_transfer_names[transfer] : "unknown";
}
const char *av_color_space_name(enum AVColorSpace space)
{
return (unsigned) space < AVCOL_SPC_NB ?
- color_space_names[space] : NULL;
+ color_space_names[space] : "unknown";
}
const char *av_chroma_location_name(enum AVChromaLocation location)
{
return (unsigned) location < AVCHROMA_LOC_NB ?
- chroma_location_names[location] : NULL;
+ chroma_location_names[location] : "unknown";
}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 3bb10f777a..4e53f59ef5 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -293,27 +293,27 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt);
/**
- * @return the name for provided color range or NULL if unknown.
+ * @return the name for provided color range or "unknown" if unknown.
*/
const char *av_color_range_name(enum AVColorRange range);
/**
- * @return the name for provided color primaries or NULL if unknown.
+ * @return the name for provided color primaries or "unknown" if unknown.
*/
const char *av_color_primaries_name(enum AVColorPrimaries primaries);
/**
- * @return the name for provided color transfer or NULL if unknown.
+ * @return the name for provided color transfer or "unknown" if unknown.
*/
const char *av_color_transfer_name(enum AVColorTransferCharacteristic
transfer);
/**
- * @return the name for provided color space or NULL if unknown.
+ * @return the name for provided color space or "unknown" if unknown.
*/
const char *av_color_space_name(enum AVColorSpace space);
/**
- * @return the name for provided chroma location or NULL if unknown.
+ * @return the name for provided chroma location or "unknown" if unknown.
*/
const char *av_chroma_location_name(enum AVChromaLocation location);
--
2.12.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel