* [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index
@ 2024-03-26 1:28 James Almer
2024-03-26 2:18 ` Michael Niedermayer
0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2024-03-26 1:28 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/mov.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f954b924a0..9f2ea97a5b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8085,7 +8085,6 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
memset(c->heif_item + c->nb_heif_item, 0,
sizeof(*c->heif_item) * (item_count - c->nb_heif_item));
c->nb_heif_item = FFMAX(c->nb_heif_item, item_count);
- c->cur_item_id = 0;
av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count);
for (int i = 0; i < item_count; i++) {
@@ -8127,7 +8126,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return atom.size;
}
-static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
{
AVBPrint item_name;
int64_t size = atom.size;
@@ -8164,21 +8163,19 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_skip(pb, size);
if (ret)
- av_bprint_finalize(&item_name, &c->heif_item[c->cur_item_id].name);
- c->heif_item[c->cur_item_id].item_id = item_id;
- c->heif_item[c->cur_item_id].type = item_type;
+ av_bprint_finalize(&item_name, &c->heif_item[idx].name);
+ c->heif_item[idx].item_id = item_id;
+ c->heif_item[idx].type = item_type;
switch (item_type) {
case MKTAG('a','v','0','1'):
case MKTAG('h','v','c','1'):
- ret = heif_add_stream(c, &c->heif_item[c->cur_item_id]);
+ ret = heif_add_stream(c, &c->heif_item[idx]);
if (ret < 0)
return ret;
break;
}
- c->cur_item_id++;
-
return 0;
}
@@ -8210,14 +8207,13 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
memset(c->heif_item + c->nb_heif_item, 0,
sizeof(*c->heif_item) * (entry_count - c->nb_heif_item));
c->nb_heif_item = FFMAX(c->nb_heif_item, entry_count);
- c->cur_item_id = 0;
for (int i = 0; i < entry_count; i++) {
MOVAtom infe;
infe.size = avio_rb32(pb) - 8;
infe.type = avio_rl32(pb);
- ret = mov_read_infe(c, pb, infe);
+ ret = mov_read_infe(c, pb, infe, i);
if (ret < 0)
return ret;
}
--
2.44.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index
2024-03-26 1:28 [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index James Almer
@ 2024-03-26 2:18 ` Michael Niedermayer
2024-03-26 2:22 ` James Almer
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2024-03-26 2:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 520 bytes --]
On Mon, Mar 25, 2024 at 10:28:52PM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavformat/mov.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
havnt tested, but it improves the code, so definityl LGTM
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Some people wanted to paint the bikeshed green, some blue and some pink.
People argued and fought, when they finally agreed, only rust was left.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index
2024-03-26 2:18 ` Michael Niedermayer
@ 2024-03-26 2:22 ` James Almer
0 siblings, 0 replies; 3+ messages in thread
From: James Almer @ 2024-03-26 2:22 UTC (permalink / raw)
To: ffmpeg-devel
On 3/25/2024 11:18 PM, Michael Niedermayer wrote:
> On Mon, Mar 25, 2024 at 10:28:52PM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavformat/mov.c | 16 ++++++----------
>> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> havnt tested, but it improves the code, so definityl LGTM
>
> thx
Applied, thanks.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-26 2:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 1:28 [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index James Almer
2024-03-26 2:18 ` Michael Niedermayer
2024-03-26 2:22 ` James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git