[FFmpeg-devel] correct expression of ternary operation.

Message ID 0eabd803-a3d7-3577-52f6-dfa5822c16b3@gmx.de
State New
Headers
Series [FFmpeg-devel] correct expression of ternary operation. |

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Helge Klein May 12, 2023, 10:56 a.m. UTC
Signed-off-by: Helge Klein <helge_klein@gmx.de>
---
  fftools/ffmpeg_opt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

-abs_start_seek : -new_start_time;
              } else if (copy_ts)
                  ifile->ts_offset = 0;
--
2.31.1
  

Comments

Leo Izen May 12, 2023, 4:30 p.m. UTC | #1
On 5/12/23 06:56, Helge Klein wrote:
> Signed-off-by: Helge Klein <helge_klein@gmx.de>
> ---
>   fftools/ffmpeg_opt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 7f22b22604..11639e7468 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -228,7 +228,7 @@ static void correct_input_start_times(void)
>               if (copy_ts && start_at_zero)
>                   ifile->ts_offset = -new_start_time;
>               else if (!copy_ts) {
> -                abs_start_seek = is->start_time + (ifile->start_time !=
> AV_NOPTS_VALUE) ? ifile->start_time : 0;
> +                abs_start_seek = is->start_time + ((ifile->start_time
> != AV_NOPTS_VALUE) ? ifile->start_time : 0);
>                   ifile->ts_offset = abs_start_seek > new_start_time ?
> -abs_start_seek : -new_start_time;
>               } else if (copy_ts)
>                   ifile->ts_offset = 0;
> -- 
> 2.31.1
> 

LGTM. Although the parentheses around (ifile->start_tile != 
AV_NOPTS_VALUE) can be removed as well.

- Leo Izen (Traneptora / thebombzen)
  

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 7f22b22604..11639e7468 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -228,7 +228,7 @@  static void correct_input_start_times(void)
              if (copy_ts && start_at_zero)
                  ifile->ts_offset = -new_start_time;
              else if (!copy_ts) {
-                abs_start_seek = is->start_time + (ifile->start_time !=
AV_NOPTS_VALUE) ? ifile->start_time : 0;
+                abs_start_seek = is->start_time + ((ifile->start_time
!= AV_NOPTS_VALUE) ? ifile->start_time : 0);
                  ifile->ts_offset = abs_start_seek > new_start_time ?