Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2017-03-23 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | API changes, most recent first: |
| 15 | 15 | |
| 16 | +2017-04-xx - xxxxxxx - lavu 56.1.0 - spherical.h | |
| 17 | + Add av_spherical_projection_name() and av_spherical_from_name(). | |
| 18 | + | |
| 16 | 19 | 2017-04-26 - xxxxxxx - lavc 58.3.1 - avcodec.h |
| 17 | 20 | Add AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH. |
| 18 | 21 | |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include "common.h" | |
| 21 | 22 | #include "mem.h" |
| 22 | 23 | #include "spherical.h" |
| 23 | 24 | |
| @@ -50,3 +51,30 @@ void av_spherical_tile_bounds(AVSphericalMapping *map, · 26 unmodified lines | ||
| 50 | 51 | *right = orig_width - width - *left; |
| 51 | 52 | *bottom = orig_height - height - *top; |
| 52 | 53 | } |
| 54 | + | |
| 55 | +static const char *spherical_projection_names[] = { | |
| 56 | + [AV_SPHERICAL_EQUIRECTANGULAR] = "equirectangular", | |
| 57 | + [AV_SPHERICAL_CUBEMAP] = "cubemap", | |
| 58 | + [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular", | |
| 59 | +}; | |
| 60 | + | |
| 61 | +const char *av_spherical_projection_name(enum AVSphericalProjection projection) | |
| 62 | +{ | |
| 63 | + if ((unsigned) projection >= FF_ARRAY_ELEMS(spherical_projection_names)) | |
| 64 | + return "unknown"; | |
| 65 | + | |
| 66 | + return spherical_projection_names[projection]; | |
| 67 | +} | |
| 68 | + | |
| 69 | +int av_spherical_from_name(const char *name) | |
| 70 | +{ | |
| 71 | + int i; | |
| 72 | + | |
| 73 | + for (i = 0; i < FF_ARRAY_ELEMS(spherical_projection_names); i++) { | |
| 74 | + size_t len = strlen(spherical_projection_names[i]); | |
| 75 | + if (!strncmp(spherical_projection_names[i], name, len)) | |
| 76 | + return i; | |
| 77 | + } | |
| 78 | + | |
| 79 | + return AVERROR(EINVAL); | |
| 80 | +} | |
| @@ -206,6 +206,24 @@ void av_spherical_tile_bounds(AVSphericalMapping *map, · 205 unmodified lines | ||
| 206 | 206 | size_t width, size_t height, |
| 207 | 207 | size_t *left, size_t *top, |
| 208 | 208 | size_t *right, size_t *bottom); |
| 209 | + | |
| 210 | +/** | |
| 211 | + * Provide a human-readable name of a given AVSphericalProjection. | |
| 212 | + * | |
| 213 | + * @param projection The input AVSphericalProjection. | |
| 214 | + * | |
| 215 | + * @return The name of the AVSphericalProjection, or "unknown". | |
| 216 | + */ | |
| 217 | +const char *av_spherical_projection_name(enum AVSphericalProjection projection); | |
| 218 | + | |
| 219 | +/** | |
| 220 | + * Get the AVSphericalProjection form a human-readable name. | |
| 221 | + * | |
| 222 | + * @param name The input string. | |
| 223 | + * | |
| 224 | + * @return The AVSphericalProjection value, or AVERROR if not found. | |
| 225 | + */ | |
| 226 | +int av_spherical_from_name(const char *name); | |
| 209 | 227 | /** |
| 210 | 228 | * @} |
| 211 | 229 | * @} |
| @@ -54,7 +54,7 @@ · 53 unmodified lines | ||
| 54 | 54 | */ |
| 55 | 55 | |
| 56 | 56 | #define LIBAVUTIL_VERSION_MAJOR 56 |
| 57 | −#define LIBAVUTIL_VERSION_MINOR 0 | |
| 57 | +#define LIBAVUTIL_VERSION_MINOR 1 | |
| 58 | 58 | #define LIBAVUTIL_VERSION_MICRO 0 |
| 59 | 59 | |
| 60 | 60 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |