mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-19 21:06:42 +00:00
lavu/stereo3d: change the horizontal FOV field to a rational
This avoids hardcoding any implementation-specific limitiations as part of the API, and allows for future expandability. This also allows API users to more conveniently convert the values into floats without hardcoding specific conversion constants. The API was committed a few days ago, so changing this field now is within the realms of acceptable.
This commit is contained in:
parent
0d748eec8d
commit
dae12ddb2e
@ -2548,7 +2548,7 @@ static void print_pkt_side_data(WriterContext *w,
|
|||||||
print_str("primary_eye", av_stereo3d_primary_eye_name(stereo->primary_eye));
|
print_str("primary_eye", av_stereo3d_primary_eye_name(stereo->primary_eye));
|
||||||
print_int("baseline", stereo->baseline);
|
print_int("baseline", stereo->baseline);
|
||||||
print_q("horizontal_disparity_adjustment", stereo->horizontal_disparity_adjustment, '/');
|
print_q("horizontal_disparity_adjustment", stereo->horizontal_disparity_adjustment, '/');
|
||||||
print_int("horizontal_field_of_view", stereo->horizontal_field_of_view);
|
print_q("horizontal_field_of_view", stereo->horizontal_field_of_view, '/');
|
||||||
} else if (sd->type == AV_PKT_DATA_SPHERICAL) {
|
} else if (sd->type == AV_PKT_DATA_SPHERICAL) {
|
||||||
const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
|
const AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
|
||||||
print_str("projection", av_spherical_projection_name(spherical->projection));
|
print_str("projection", av_spherical_projection_name(spherical->projection));
|
||||||
|
@ -267,8 +267,9 @@ static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
|
|||||||
if (stereo->horizontal_disparity_adjustment.num && stereo->horizontal_disparity_adjustment.den)
|
if (stereo->horizontal_disparity_adjustment.num && stereo->horizontal_disparity_adjustment.den)
|
||||||
av_log(ctx, log_level, ", horizontal_disparity_adjustment: %d/%d",
|
av_log(ctx, log_level, ", horizontal_disparity_adjustment: %d/%d",
|
||||||
stereo->horizontal_disparity_adjustment.num, stereo->horizontal_disparity_adjustment.den);
|
stereo->horizontal_disparity_adjustment.num, stereo->horizontal_disparity_adjustment.den);
|
||||||
if (stereo->horizontal_field_of_view)
|
if (stereo->horizontal_field_of_view.num && stereo->horizontal_field_of_view.den)
|
||||||
av_log(ctx, log_level, ", horizontal_field_of_view: %"PRIu32"", stereo->horizontal_field_of_view);
|
av_log(ctx, log_level, ", horizontal_field_of_view: %d/%d", stereo->horizontal_field_of_view.num,
|
||||||
|
stereo->horizontal_field_of_view.den);
|
||||||
|
|
||||||
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
||||||
av_log(ctx, log_level, " (inverted)");
|
av_log(ctx, log_level, " (inverted)");
|
||||||
|
@ -6782,7 +6782,8 @@ static int mov_read_hfov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->stereo3d->horizontal_field_of_view = avio_rb32(pb);
|
sc->stereo3d->horizontal_field_of_view.num = avio_rb32(pb);
|
||||||
|
sc->stereo3d->horizontal_field_of_view.den = 1000; // thousands of a degree
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
static void get_defaults(AVStereo3D *stereo)
|
static void get_defaults(AVStereo3D *stereo)
|
||||||
{
|
{
|
||||||
stereo->horizontal_disparity_adjustment = (AVRational) { 0, 1 };
|
stereo->horizontal_disparity_adjustment = (AVRational) { 0, 1 };
|
||||||
|
stereo->horizontal_field_of_view = (AVRational) { 0, 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
AVStereo3D *av_stereo3d_alloc(void)
|
AVStereo3D *av_stereo3d_alloc(void)
|
||||||
|
@ -224,9 +224,9 @@ typedef struct AVStereo3D {
|
|||||||
AVRational horizontal_disparity_adjustment;
|
AVRational horizontal_disparity_adjustment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horizontal field of view in thousanths of a degree. Zero if unset.
|
* Horizontal field of view, in degrees. Zero if unset.
|
||||||
*/
|
*/
|
||||||
uint32_t horizontal_field_of_view;
|
AVRational horizontal_field_of_view;
|
||||||
} AVStereo3D;
|
} AVStereo3D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,7 +7,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[SIDE_DATA]
|
[SIDE_DATA]
|
||||||
side_data_type=Spherical Mapping
|
side_data_type=Spherical Mapping
|
||||||
|
@ -31,7 +31,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[SIDE_DATA]
|
[SIDE_DATA]
|
||||||
side_data_type=Spherical Mapping
|
side_data_type=Spherical Mapping
|
||||||
@ -60,7 +60,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[SIDE_DATA]
|
[SIDE_DATA]
|
||||||
side_data_type=Spherical Mapping
|
side_data_type=Spherical Mapping
|
||||||
|
@ -136,7 +136,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[/STREAM]
|
[/STREAM]
|
||||||
[STREAM]
|
[STREAM]
|
||||||
@ -156,7 +156,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[/STREAM]
|
[/STREAM]
|
||||||
[STREAM]
|
[STREAM]
|
||||||
@ -174,7 +174,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[/STREAM]
|
[/STREAM]
|
||||||
[STREAM]
|
[STREAM]
|
||||||
@ -193,7 +193,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[/STREAM]
|
[/STREAM]
|
||||||
[STREAM]
|
[STREAM]
|
||||||
|
@ -39,6 +39,6 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[/STREAM]
|
[/STREAM]
|
||||||
|
@ -7,7 +7,7 @@ view=packed
|
|||||||
primary_eye=none
|
primary_eye=none
|
||||||
baseline=0
|
baseline=0
|
||||||
horizontal_disparity_adjustment=0/1
|
horizontal_disparity_adjustment=0/1
|
||||||
horizontal_field_of_view=0
|
horizontal_field_of_view=0/1
|
||||||
[/SIDE_DATA]
|
[/SIDE_DATA]
|
||||||
[SIDE_DATA]
|
[SIDE_DATA]
|
||||||
side_data_type=Spherical Mapping
|
side_data_type=Spherical Mapping
|
||||||
|
Loading…
Reference in New Issue
Block a user