Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| ... | ... |
@@ -15,6 +15,11 @@ libavutil: 2015-08-28 |
| 15 | 15 |
|
| 16 | 16 |
API changes, most recent first: |
| 17 | 17 |
|
| 18 |
+2017-xx-xx - xxxxxxx - lavu 55.76.100 / 56.6.0 - pixdesc.h |
|
| 19 |
+ Add av_color_range_from_name(), av_color_primaries_from_name(), |
|
| 20 |
+ av_color_transfer_from_name(), av_color_space_from_name(), and |
|
| 21 |
+ av_chroma_location_from_name(). |
|
| 22 |
+ |
|
| 18 | 23 |
2017-09-13 - xxxxxxx - lavc 57.106.100 - avcodec.h |
| 19 | 24 |
Add AV_PKT_FLAG_TRUSTED. |
| 20 | 25 |
|
| ... | ... |
@@ -2749,26 +2749,91 @@ const char *av_color_range_name(enum AVColorRange range) |
| 2749 | 2749 |
color_range_names[range] : NULL; |
| 2750 | 2750 |
} |
| 2751 | 2751 |
|
| 2752 |
+int av_color_range_from_name(const char *name) |
|
| 2753 |
+{
|
|
| 2754 |
+ int i; |
|
| 2755 |
+ |
|
| 2756 |
+ for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
|
|
| 2757 |
+ size_t len = strlen(color_range_names[i]); |
|
| 2758 |
+ if (!strncmp(color_range_names[i], name, len)) |
|
| 2759 |
+ return i; |
|
| 2760 |
+ } |
|
| 2761 |
+ |
|
| 2762 |
+ return AVERROR(EINVAL); |
|
| 2763 |
+} |
|
| 2764 |
+ |
|
| 2752 | 2765 |
const char *av_color_primaries_name(enum AVColorPrimaries primaries) |
| 2753 | 2766 |
{
|
| 2754 | 2767 |
return (unsigned) primaries < AVCOL_PRI_NB ? |
| 2755 | 2768 |
color_primaries_names[primaries] : NULL; |
| 2756 | 2769 |
} |
| 2757 | 2770 |
|
| 2771 |
+int av_color_primaries_from_name(const char *name) |
|
| 2772 |
+{
|
|
| 2773 |
+ int i; |
|
| 2774 |
+ |
|
| 2775 |
+ for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
|
|
| 2776 |
+ size_t len = strlen(color_primaries_names[i]); |
|
| 2777 |
+ if (!strncmp(color_primaries_names[i], name, len)) |
|
| 2778 |
+ return i; |
|
| 2779 |
+ } |
|
| 2780 |
+ |
|
| 2781 |
+ return AVERROR(EINVAL); |
|
| 2782 |
+} |
|
| 2783 |
+ |
|
| 2758 | 2784 |
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer) |
| 2759 | 2785 |
{
|
| 2760 | 2786 |
return (unsigned) transfer < AVCOL_TRC_NB ? |
| 2761 | 2787 |
color_transfer_names[transfer] : NULL; |
| 2762 | 2788 |
} |
| 2763 | 2789 |
|
| 2790 |
+int av_color_transfer_from_name(const char *name) |
|
| 2791 |
+{
|
|
| 2792 |
+ int i; |
|
| 2793 |
+ |
|
| 2794 |
+ for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
|
|
| 2795 |
+ size_t len = strlen(color_transfer_names[i]); |
|
| 2796 |
+ if (!strncmp(color_transfer_names[i], name, len)) |
|
| 2797 |
+ return i; |
|
| 2798 |
+ } |
|
| 2799 |
+ |
|
| 2800 |
+ return AVERROR(EINVAL); |
|
| 2801 |
+} |
|
| 2802 |
+ |
|
| 2764 | 2803 |
const char *av_color_space_name(enum AVColorSpace space) |
| 2765 | 2804 |
{
|
| 2766 | 2805 |
return (unsigned) space < AVCOL_SPC_NB ? |
| 2767 | 2806 |
color_space_names[space] : NULL; |
| 2768 | 2807 |
} |
| 2769 | 2808 |
|
| 2809 |
+int av_color_space_from_name(const char *name) |
|
| 2810 |
+{
|
|
| 2811 |
+ int i; |
|
| 2812 |
+ |
|
| 2813 |
+ for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
|
|
| 2814 |
+ size_t len = strlen(color_space_names[i]); |
|
| 2815 |
+ if (!strncmp(color_space_names[i], name, len)) |
|
| 2816 |
+ return i; |
|
| 2817 |
+ } |
|
| 2818 |
+ |
|
| 2819 |
+ return AVERROR(EINVAL); |
|
| 2820 |
+} |
|
| 2821 |
+ |
|
| 2770 | 2822 |
const char *av_chroma_location_name(enum AVChromaLocation location) |
| 2771 | 2823 |
{
|
| 2772 | 2824 |
return (unsigned) location < AVCHROMA_LOC_NB ? |
| 2773 | 2825 |
chroma_location_names[location] : NULL; |
| 2774 | 2826 |
} |
| 2827 |
+ |
|
| 2828 |
+int av_chroma_location_from_name(const char *name) |
|
| 2829 |
+{
|
|
| 2830 |
+ int i; |
|
| 2831 |
+ |
|
| 2832 |
+ for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
|
|
| 2833 |
+ size_t len = strlen(chroma_location_names[i]); |
|
| 2834 |
+ if (!strncmp(chroma_location_names[i], name, len)) |
|
| 2835 |
+ return i; |
|
| 2836 |
+ } |
|
| 2837 |
+ |
|
| 2838 |
+ return AVERROR(EINVAL); |
|
| 2839 |
+} |
| ... | ... |
@@ -251,26 +251,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); |
| 251 | 251 |
const char *av_color_range_name(enum AVColorRange range); |
| 252 | 252 |
|
| 253 | 253 |
/** |
| 254 |
+ * @return the AVColorRange value for name or an AVError if not found. |
|
| 255 |
+ */ |
|
| 256 |
+int av_color_range_from_name(const char *name); |
|
| 257 |
+ |
|
| 258 |
+/** |
|
| 254 | 259 |
* @return the name for provided color primaries or NULL if unknown. |
| 255 | 260 |
*/ |
| 256 | 261 |
const char *av_color_primaries_name(enum AVColorPrimaries primaries); |
| 257 | 262 |
|
| 258 | 263 |
/** |
| 264 |
+ * @return the AVColorPrimaries value for name or an AVError if not found. |
|
| 265 |
+ */ |
|
| 266 |
+int av_color_primaries_from_name(const char *name); |
|
| 267 |
+ |
|
| 268 |
+/** |
|
| 259 | 269 |
* @return the name for provided color transfer or NULL if unknown. |
| 260 | 270 |
*/ |
| 261 | 271 |
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); |
| 262 | 272 |
|
| 263 | 273 |
/** |
| 274 |
+ * @return the AVColorTransferCharacteristic value for name or an AVError if not found. |
|
| 275 |
+ */ |
|
| 276 |
+int av_color_transfer_from_name(const char *name); |
|
| 277 |
+ |
|
| 278 |
+/** |
|
| 264 | 279 |
* @return the name for provided color space or NULL if unknown. |
| 265 | 280 |
*/ |
| 266 | 281 |
const char *av_color_space_name(enum AVColorSpace space); |
| 267 | 282 |
|
| 268 | 283 |
/** |
| 284 |
+ * @return the AVColorSpace value for name or an AVError if not found. |
|
| 285 |
+ */ |
|
| 286 |
+int av_color_space_from_name(const char *name); |
|
| 287 |
+ |
|
| 288 |
+/** |
|
| 269 | 289 |
* @return the name for provided chroma location or NULL if unknown. |
| 270 | 290 |
*/ |
| 271 | 291 |
const char *av_chroma_location_name(enum AVChromaLocation location); |
| 272 | 292 |
|
| 273 | 293 |
/** |
| 294 |
+ * @return the AVChromaLocation value for name or an AVError if not found. |
|
| 295 |
+ */ |
|
| 296 |
+int av_chroma_location_from_name(const char *name); |
|
| 297 |
+ |
|
| 298 |
+/** |
|
| 274 | 299 |
* Return the pixel format corresponding to name. |
| 275 | 300 |
* |
| 276 | 301 |
* If there is no pixel format with name name, then looks for a |