History

avformat/mov: use a more descriptive name for variables of type HEIFItem

Other HEIF related structs will be introduced, so lets be more specific about what this one defines.

James Almer committed 2 years ago

Commit b94b3ea1 parent cc774cd2 files · +28 −28Browse files

Unified · Split

2 files
  1. libavformat/isom.h +2 −2
  2. libavformat/mov.c +26 −26
libavformat/isom.h+2−2
@@ -334,8 +334,8 @@ typedef struct MOVContext { · 333 unmodified lines
334334 uint32_t max_stts_delta;
335335 int primary_item_id;
336336 int cur_item_id;
337− HEIFItem *heif_info;
338− int heif_info_size;
337+ HEIFItem *heif_item;
338+ int nb_heif_item;
339339 int interleaved_read;
340340 } MOVContext;
341341
libavformat/mov.c+26−26
@@ -4648,8 +4648,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4647 unmodified lines
46484648 if (c->found_iinf) {
46494649 // * For animated heif, if the iinf box showed up before the moov
46504650 // box, we need to clear all the streams read in the former.
4651− for (int i = c->heif_info_size - 1; i >= 0; i--) {
4652− HEIFItem *item = &c->heif_info[i];
4651+ for (int i = c->nb_heif_item - 1; i >= 0; i--) {
4652+ HEIFItem *item = &c->heif_item[i];
46534653
46544654 if (!item->st)
46554655 continue;
@@ -4657,8 +4657,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1 unmodified line
46574657 mov_free_stream_context(c->fc, item->st);
46584658 ff_remove_stream(c->fc, item->st);
46594659 }
4660− av_freep(&c->heif_info);
4661− c->heif_info_size = 0;
4660+ av_freep(&c->heif_item);
4661+ c->nb_heif_item = 0;
46624662 c->found_iinf = c->found_iloc = 0;
46634663 }
46644664
@@ -7812,11 +7812,11 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3147 unmodified lines
78127812 }
78137813 item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
78147814
7815− if (!c->heif_info) {
7816− c->heif_info = av_calloc(item_count, sizeof(*c->heif_info));
7817− if (!c->heif_info)
7815+ if (!c->heif_item) {
7816+ c->heif_item = av_calloc(item_count, sizeof(*c->heif_item));
7817+ if (!c->heif_item)
78187818 return AVERROR(ENOMEM);
7819− c->heif_info_size = item_count;
7819+ c->nb_heif_item = item_count;
78207820 }
78217821
78227822 av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count);
@@ -7830,7 +7830,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines
78307830 avpriv_request_sample(c->fc, "iloc offset type %d", offset_type);
78317831 return AVERROR_PATCHWELCOME;
78327832 }
7833− c->heif_info[i].item_id = item_id;
7833+ c->heif_item[i].item_id = item_id;
78347834
78357835 avio_rb16(pb); // data_reference_index.
78367836 if (rb_size(pb, &base_offset, base_offset_size) < 0)
@@ -7845,11 +7845,11 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines
78457845 if (rb_size(pb, &extent_offset, offset_size) < 0 ||
78467846 rb_size(pb, &extent_length, length_size) < 0)
78477847 return AVERROR_INVALIDDATA;
7848− c->heif_info[i].extent_length = extent_length;
7849− c->heif_info[i].extent_offset = base_offset + extent_offset;
7848+ c->heif_item[i].extent_length = extent_length;
7849+ c->heif_item[i].extent_offset = base_offset + extent_offset;
78507850 av_log(c->fc, AV_LOG_TRACE, "iloc: item_idx %d, offset_type %d, "
78517851 "extent_offset %"PRId64", extent_length %"PRId64"\n",
7852− i, offset_type, c->heif_info[i].extent_offset, c->heif_info[i].extent_length);
7852+ i, offset_type, c->heif_item[i].extent_offset, c->heif_item[i].extent_length);
78537853 }
78547854 }
78557855
@@ -7890,13 +7890,13 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 34 unmodified lines
78907890 if (size > 0)
78917891 avio_skip(pb, size);
78927892
7893− c->heif_info[c->cur_item_id].item_id = item_id;
7894− c->heif_info[c->cur_item_id].type = item_type;
7893+ c->heif_item[c->cur_item_id].item_id = item_id;
7894+ c->heif_item[c->cur_item_id].type = item_type;
78957895
78967896 switch (item_type) {
78977897 case MKTAG('a','v','0','1'):
78987898 case MKTAG('h','v','c','1'):
7899− ret = heif_add_stream(c, &c->heif_info[c->cur_item_id]);
7899+ ret = heif_add_stream(c, &c->heif_item[c->cur_item_id]);
79007900 if (ret < 0)
79017901 return ret;
79027902 break;
@@ -7929,11 +7929,11 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 26 unmodified lines
79297929 avio_rb24(pb); // flags.
79307930 entry_count = version ? avio_rb32(pb) : avio_rb16(pb);
79317931
7932− if (!c->heif_info) {
7933− c->heif_info = av_calloc(entry_count, sizeof(*c->heif_info));
7934− if (!c->heif_info)
7932+ if (!c->heif_item) {
7933+ c->heif_item = av_calloc(entry_count, sizeof(*c->heif_item));
7934+ if (!c->heif_item)
79357935 return AVERROR(ENOMEM);
7936− c->heif_info_size = entry_count;
7936+ c->nb_heif_item = entry_count;
79377937 }
79387938
79397939 c->cur_item_id = 0;
@@ -7977,10 +7977,10 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 37 unmodified lines
79777977 av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %u, height %u\n",
79787978 c->cur_item_id, width, height);
79797979
7980− for (int i = 0; i < c->heif_info_size; i++) {
7981− if (c->heif_info[i].item_id == c->cur_item_id) {
7982− c->heif_info[i].width = width;
7983− c->heif_info[i].height = height;
7980+ for (int i = 0; i < c->nb_heif_item; i++) {
7981+ if (c->heif_item[i].item_id == c->cur_item_id) {
7982+ c->heif_item[i].width = width;
7983+ c->heif_item[i].height = height;
79847984 break;
79857985 }
79867986 }
@@ -8718,7 +8718,7 @@ static int mov_read_close(AVFormatContext *s) · 731 unmodified lines
87188718
87198719 av_freep(&mov->aes_decrypt);
87208720 av_freep(&mov->chapter_tracks);
8721− av_freep(&mov->heif_info);
8721+ av_freep(&mov->heif_item);
87228722
87238723 return 0;
87248724 }
@@ -8896,8 +8896,8 @@ static int mov_read_header(AVFormatContext *s) · 171 unmodified lines
88968896 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
88978897
88988898 if (mov->found_iloc) {
8899− for (i = 0; i < mov->heif_info_size; i++) {
8900− HEIFItem *item = &mov->heif_info[i];
8899+ for (i = 0; i < mov->nb_heif_item; i++) {
8900+ HEIFItem *item = &mov->heif_item[i];
89018901 MOVStreamContext *sc;
89028902 AVStream *st;
89038903

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t