History

spherical: add functions to retrieve and request projection names

James Almer committed 9 years ago

Commit ad52eef1 parent 7acb9034 files · +50 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/spherical.c +28 −0
  3. libavutil/spherical.h +18 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2017-03-23 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162017-04-xx - xxxxxxx - lavu 56.1.0 - spherical.h
17 Add av_spherical_projection_name() and av_spherical_from_name().
18
162017-04-26 - xxxxxxx - lavc 58.3.1 - avcodec.h192017-04-26 - xxxxxxx - lavc 58.3.1 - avcodec.h
17 Add AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH.20 Add AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH.
18 21
libavutil/spherical.c+28−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */19 */
20 20
21#include "common.h"
21#include "mem.h"22#include "mem.h"
22#include "spherical.h"23#include "spherical.h"
23 24
@@ -50,3 +51,30 @@ void av_spherical_tile_bounds(AVSphericalMapping *map, · 26 unmodified lines
50 *right = orig_width - width - *left;51 *right = orig_width - width - *left;
51 *bottom = orig_height - height - *top;52 *bottom = orig_height - height - *top;
52}53}
54
55static const char *spherical_projection_names[] = {
56 [AV_SPHERICAL_EQUIRECTANGULAR] = "equirectangular",
57 [AV_SPHERICAL_CUBEMAP] = "cubemap",
58 [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
59};
60
61const 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
69int 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}
libavutil/spherical.h+18−0
@@ -206,6 +206,24 @@ void av_spherical_tile_bounds(AVSphericalMapping *map, · 205 unmodified lines
206 size_t width, size_t height,206 size_t width, size_t height,
207 size_t *left, size_t *top,207 size_t *left, size_t *top,
208 size_t *right, size_t *bottom);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 */
217const 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 */
226int av_spherical_from_name(const char *name);
209/**227/**
210 * @}228 * @}
211 * @}229 * @}
libavutil/version.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
54 */54 */
55 55
56#define LIBAVUTIL_VERSION_MAJOR 5656#define LIBAVUTIL_VERSION_MAJOR 56
57#define LIBAVUTIL_VERSION_MINOR 057#define LIBAVUTIL_VERSION_MINOR 1
58#define LIBAVUTIL_VERSION_MICRO 058#define LIBAVUTIL_VERSION_MICRO 0
59 59
60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t