|
|
|
@ -18,6 +18,7 @@ |
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "common.h" |
|
|
|
|
#include "mem.h" |
|
|
|
|
#include "spherical.h" |
|
|
|
|
|
|
|
|
@ -50,3 +51,30 @@ void av_spherical_tile_bounds(AVSphericalMapping *map, |
|
|
|
|
*right = orig_width - width - *left; |
|
|
|
|
*bottom = orig_height - height - *top; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const char *spherical_projection_names[] = { |
|
|
|
|
[AV_SPHERICAL_EQUIRECTANGULAR] = "equirectangular", |
|
|
|
|
[AV_SPHERICAL_CUBEMAP] = "cubemap", |
|
|
|
|
[AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular", |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const char *av_spherical_projection_name(enum AVSphericalProjection projection) |
|
|
|
|
{ |
|
|
|
|
if ((unsigned) projection >= FF_ARRAY_ELEMS(spherical_projection_names)) |
|
|
|
|
return "unknown"; |
|
|
|
|
|
|
|
|
|
return spherical_projection_names[projection]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int av_spherical_from_name(const char *name) |
|
|
|
|
{ |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < FF_ARRAY_ELEMS(spherical_projection_names); i++) { |
|
|
|
|
size_t len = strlen(spherical_projection_names[i]); |
|
|
|
|
if (!strncmp(spherical_projection_names[i], name, len)) |
|
|
|
|
return i; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return AVERROR(EINVAL); |
|
|
|
|
} |
|
|
|
|