mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 13:35:13 +00:00
avutil/stereo3d: 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
1044c09eca
commit
c3606cad9c
@ -26,9 +26,20 @@
|
||||
#include "mem.h"
|
||||
#include "stereo3d.h"
|
||||
|
||||
static void get_defaults(AVStereo3D *stereo)
|
||||
{
|
||||
stereo->horizontal_disparity_adjustment = (AVRational) { 0, 1 };
|
||||
}
|
||||
|
||||
AVStereo3D *av_stereo3d_alloc(void)
|
||||
{
|
||||
return av_mallocz(sizeof(AVStereo3D));
|
||||
AVStereo3D *stereo = av_mallocz(sizeof(AVStereo3D));
|
||||
if (!stereo)
|
||||
return NULL;
|
||||
|
||||
get_defaults(stereo);
|
||||
|
||||
return stereo;
|
||||
}
|
||||
|
||||
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
|
||||
@ -40,6 +51,7 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
|
||||
return NULL;
|
||||
|
||||
memset(side_data->data, 0, sizeof(AVStereo3D));
|
||||
get_defaults((AVStereo3D *)side_data->data);
|
||||
|
||||
return (AVStereo3D *)side_data->data;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 59
|
||||
#define LIBAVUTIL_VERSION_MINOR 24
|
||||
#define LIBAVUTIL_VERSION_MICRO 102
|
||||
#define LIBAVUTIL_VERSION_MICRO 103
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, \
|
||||
|
@ -6,7 +6,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
|
@ -30,7 +30,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
@ -59,7 +59,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
|
@ -135,7 +135,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[/STREAM]
|
||||
@ -155,7 +155,7 @@ inverted=1
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[/STREAM]
|
||||
@ -173,7 +173,7 @@ inverted=1
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[/STREAM]
|
||||
@ -192,7 +192,7 @@ inverted=1
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[/STREAM]
|
||||
|
@ -38,7 +38,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[/STREAM]
|
||||
|
@ -6,7 +6,7 @@ inverted=0
|
||||
view=packed
|
||||
primary_eye=none
|
||||
baseline=0
|
||||
horizontal_disparity_adjustment=0/0
|
||||
horizontal_disparity_adjustment=0/1
|
||||
horizontal_field_of_view=0
|
||||
[/SIDE_DATA]
|
||||
[SIDE_DATA]
|
||||
|
Loading…
Reference in New Issue
Block a user