mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
ffmpeg: take into account image flipping in the display matrix
This covers only standard rotations. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
535a835e51
commit
42fce6fffe
@ -765,18 +765,36 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
theta = get_rotation(displaymatrix);
|
||||
|
||||
if (fabs(theta - 90) < 1.0) {
|
||||
if (displaymatrix[3] > 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose", "clock");
|
||||
} else if (fabs(theta - 180) < 1.0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
if (displaymatrix[0] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (displaymatrix[4] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
}
|
||||
} else if (fabs(theta - 270) < 1.0) {
|
||||
if (displaymatrix[3] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "hflip", NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
ret = insert_filter(&last_filter, &pad_idx, "transpose", "cclock");
|
||||
} else if (fabs(theta) > 1.0) {
|
||||
char rotate_buf[64];
|
||||
snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta);
|
||||
ret = insert_filter(&last_filter, &pad_idx, "rotate", rotate_buf);
|
||||
} else if (fabs(theta) < 1.0) {
|
||||
if (displaymatrix && displaymatrix[4] < 0) {
|
||||
ret = insert_filter(&last_filter, &pad_idx, "vflip", NULL);
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user