[FFmpeg-devel] [PATCH 53/60] avformat/nsvdec: fix variable shadowing
Marvin Scholz
epirat07 at gmail.com
Mon Sep 9 03:08:55 EEST 2024
---
libavformat/nsvdec.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index dd01765d7d..a55da05226 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -380,7 +380,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
uint32_t vtag, atag;
uint16_t vwidth, vheight;
AVRational framerate;
- int i;
+ int nsv_rate;
AVStream *st;
NSVStream *nst;
@@ -388,25 +388,25 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
atag = avio_rl32(pb);
vwidth = avio_rl16(pb);
vheight = avio_rl16(pb);
- i = avio_r8(pb);
+ nsv_rate = avio_r8(pb);
- av_log(s, AV_LOG_TRACE, "NSV NSVs framerate code %2x\n", i);
- if(i&0x80) { /* odd way of giving native framerates from docs */
- int t=(i & 0x7F)>>2;
- if(t<16) framerate = (AVRational){1, t+1};
- else framerate = (AVRational){t-15, 1};
+ av_log(s, AV_LOG_TRACE, "NSV NSVs framerate code %2x\n", nsv_rate);
+ if (nsv_rate & 0x80) { /* odd way of giving native framerates from docs */
+ int t = (nsv_rate & 0x7F)>>2;
+ if (t<16) framerate = (AVRational){1, t+1};
+ else framerate = (AVRational){t-15, 1};
- if(i&1){
+ if (nsv_rate & 1) {
framerate.num *= 1000;
framerate.den *= 1001;
}
- if((i&3)==3) framerate.num *= 24;
- else if((i&3)==2) framerate.num *= 25;
- else framerate.num *= 30;
+ if ((nsv_rate & 3) == 3) framerate.num *= 24;
+ else if ((nsv_rate & 3) == 2) framerate.num *= 25;
+ else framerate.num *= 30;
}
else
- framerate= (AVRational){i, 1};
+ framerate= (AVRational){nsv_rate, 1};
nsv->avsync = avio_rl16(pb);
nsv->framerate = framerate;
@@ -420,7 +420,6 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
nsv->vwidth = vwidth;
nsv->vheight = vwidth;
if (vtag != T_NONE) {
- int i;
st = avformat_new_stream(s, NULL);
if (!st)
goto fail;
@@ -441,7 +440,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s)
st->start_time = 0;
st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den);
- for(i=0;i<nsv->index_entries;i++) {
+ for(int i = 0; i < nsv->index_entries; i++) {
if(nsv->nsvs_timestamps) {
av_add_index_entry(st, nsv->nsvs_file_offset[i], nsv->nsvs_timestamps[i],
0, 0, AVINDEX_KEYFRAME);
--
2.39.3 (Apple Git-146)
More information about the ffmpeg-devel
mailing list