avutil/ambient_viewing_environment: set a sane default value for AVRational fields
Prevent potential divisions by 0 when using them immediately after allocation. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
5140d8334e
commit
7f1b590480
@ -21,6 +21,13 @@
|
||||
#include "ambient_viewing_environment.h"
|
||||
#include "mem.h"
|
||||
|
||||
static void get_defaults(AVAmbientViewingEnvironment *env)
|
||||
{
|
||||
env->ambient_illuminance =
|
||||
env->ambient_light_x =
|
||||
env->ambient_light_y = (AVRational) { 0, 1 };
|
||||
}
|
||||
|
||||
AVAmbientViewingEnvironment *av_ambient_viewing_environment_alloc(size_t *size)
|
||||
{
|
||||
AVAmbientViewingEnvironment *env =
|
||||
@ -28,6 +35,8 @@ AVAmbientViewingEnvironment *av_ambient_viewing_environment_alloc(size_t *size)
|
||||
if (!env)
|
||||
return NULL;
|
||||
|
||||
get_defaults(env);
|
||||
|
||||
if (size)
|
||||
*size = sizeof(*env);
|
||||
|
||||
@ -44,6 +53,7 @@ AVAmbientViewingEnvironment *av_ambient_viewing_environment_create_side_data(AVF
|
||||
return NULL;
|
||||
|
||||
memset(side_data->data, 0, side_data->size);
|
||||
get_defaults((AVAmbientViewingEnvironment *)side_data->data);
|
||||
|
||||
return (AVAmbientViewingEnvironment *)side_data->data;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 59
|
||||
#define LIBAVUTIL_VERSION_MINOR 24
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
#define LIBAVUTIL_VERSION_MICRO 101
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user