diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2023-09-30 19:34:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-10-08 21:34:55 +0200 |
commit | 6490b9aed63c06f20bbc46e0bc801e612d07e81e (patch) | |
tree | 627b19aa9381a6298265ee4f0d28bc7f8cdf1d21 /libavformat/jacosubdec.c | |
parent | 9132a0fbe25d472952872c67abe818aec5d64e4a (diff) | |
download | ffmpeg-6490b9aed63c06f20bbc46e0bc801e612d07e81e.tar.gz |
avformat/jacosubdec: Factorize code in get_shift() a bit
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/jacosubdec.c')
-rw-r--r-- | libavformat/jacosubdec.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 61b1316dc9..42c201f93a 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -143,16 +143,12 @@ static int get_shift(int timeres, const char *buf) ret = 0; switch (n) { - case 4: - ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d); - break; - case 3: - ret = sign * (( (int64_t)a*60 + b) * timeres + c); - break; - case 2: - ret = sign * (( (int64_t)a) * timeres + b); - break; + case 1: a = 0; + case 2: c = b; b = a; a = 0; + case 3: d = c; c = b; b = a; a = 0; } + + ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d); if ((int)ret != ret) ret = 0; |