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
334 uint32_t max_stts_delta;334 uint32_t max_stts_delta;
335 int primary_item_id;335 int primary_item_id;
336 int cur_item_id;336 int cur_item_id;
337 HEIFItem *heif_info;337 HEIFItem *heif_item;
338 int heif_info_size;338 int nb_heif_item;
339 int interleaved_read;339 int interleaved_read;
340} MOVContext;340} MOVContext;
341 341
libavformat/mov.c+26−26
@@ -4648,8 +4648,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4647 unmodified lines
4648 if (c->found_iinf) {4648 if (c->found_iinf) {
4649 // * For animated heif, if the iinf box showed up before the moov4649 // * For animated heif, if the iinf box showed up before the moov
4650 // box, we need to clear all the streams read in the former.4650 // box, we need to clear all the streams read in the former.
4651 for (int i = c->heif_info_size - 1; i >= 0; i--) {4651 for (int i = c->nb_heif_item - 1; i >= 0; i--) {
4652 HEIFItem *item = &c->heif_info[i];4652 HEIFItem *item = &c->heif_item[i];
4653 4653
4654 if (!item->st)4654 if (!item->st)
4655 continue;4655 continue;
@@ -4657,8 +4657,8 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1 unmodified line
4657 mov_free_stream_context(c->fc, item->st);4657 mov_free_stream_context(c->fc, item->st);
4658 ff_remove_stream(c->fc, item->st);4658 ff_remove_stream(c->fc, item->st);
4659 }4659 }
4660 av_freep(&c->heif_info);4660 av_freep(&c->heif_item);
4661 c->heif_info_size = 0;4661 c->nb_heif_item = 0;
4662 c->found_iinf = c->found_iloc = 0;4662 c->found_iinf = c->found_iloc = 0;
4663 }4663 }
4664 4664
@@ -7812,11 +7812,11 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3147 unmodified lines
7812 }7812 }
7813 item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);7813 item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
7814 7814
7815 if (!c->heif_info) {7815 if (!c->heif_item) {
7816 c->heif_info = av_calloc(item_count, sizeof(*c->heif_info));7816 c->heif_item = av_calloc(item_count, sizeof(*c->heif_item));
7817 if (!c->heif_info)7817 if (!c->heif_item)
7818 return AVERROR(ENOMEM);7818 return AVERROR(ENOMEM);
7819 c->heif_info_size = item_count;7819 c->nb_heif_item = item_count;
7820 }7820 }
7821 7821
7822 av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count);7822 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
7830 avpriv_request_sample(c->fc, "iloc offset type %d", offset_type);7830 avpriv_request_sample(c->fc, "iloc offset type %d", offset_type);
7831 return AVERROR_PATCHWELCOME;7831 return AVERROR_PATCHWELCOME;
7832 }7832 }
7833 c->heif_info[i].item_id = item_id;7833 c->heif_item[i].item_id = item_id;
7834 7834
7835 avio_rb16(pb); // data_reference_index.7835 avio_rb16(pb); // data_reference_index.
7836 if (rb_size(pb, &base_offset, base_offset_size) < 0)7836 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
7845 if (rb_size(pb, &extent_offset, offset_size) < 0 ||7845 if (rb_size(pb, &extent_offset, offset_size) < 0 ||
7846 rb_size(pb, &extent_length, length_size) < 0)7846 rb_size(pb, &extent_length, length_size) < 0)
7847 return AVERROR_INVALIDDATA;7847 return AVERROR_INVALIDDATA;
7848 c->heif_info[i].extent_length = extent_length;7848 c->heif_item[i].extent_length = extent_length;
7849 c->heif_info[i].extent_offset = base_offset + extent_offset;7849 c->heif_item[i].extent_offset = base_offset + extent_offset;
7850 av_log(c->fc, AV_LOG_TRACE, "iloc: item_idx %d, offset_type %d, "7850 av_log(c->fc, AV_LOG_TRACE, "iloc: item_idx %d, offset_type %d, "
7851 "extent_offset %"PRId64", extent_length %"PRId64"\n",7851 "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);
7853 }7853 }
7854 }7854 }
7855 7855
@@ -7890,13 +7890,13 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 34 unmodified lines
7890 if (size > 0)7890 if (size > 0)
7891 avio_skip(pb, size);7891 avio_skip(pb, size);
7892 7892
7893 c->heif_info[c->cur_item_id].item_id = item_id;7893 c->heif_item[c->cur_item_id].item_id = item_id;
7894 c->heif_info[c->cur_item_id].type = item_type;7894 c->heif_item[c->cur_item_id].type = item_type;
7895 7895
7896 switch (item_type) {7896 switch (item_type) {
7897 case MKTAG('a','v','0','1'):7897 case MKTAG('a','v','0','1'):
7898 case MKTAG('h','v','c','1'):7898 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]);
7900 if (ret < 0)7900 if (ret < 0)
7901 return ret;7901 return ret;
7902 break;7902 break;
@@ -7929,11 +7929,11 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 26 unmodified lines
7929 avio_rb24(pb); // flags.7929 avio_rb24(pb); // flags.
7930 entry_count = version ? avio_rb32(pb) : avio_rb16(pb);7930 entry_count = version ? avio_rb32(pb) : avio_rb16(pb);
7931 7931
7932 if (!c->heif_info) {7932 if (!c->heif_item) {
7933 c->heif_info = av_calloc(entry_count, sizeof(*c->heif_info));7933 c->heif_item = av_calloc(entry_count, sizeof(*c->heif_item));
7934 if (!c->heif_info)7934 if (!c->heif_item)
7935 return AVERROR(ENOMEM);7935 return AVERROR(ENOMEM);
7936 c->heif_info_size = entry_count;7936 c->nb_heif_item = entry_count;
7937 }7937 }
7938 7938
7939 c->cur_item_id = 0;7939 c->cur_item_id = 0;
@@ -7977,10 +7977,10 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 37 unmodified lines
7977 av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %u, height %u\n",7977 av_log(c->fc, AV_LOG_TRACE, "ispe: item_id %d, width %u, height %u\n",
7978 c->cur_item_id, width, height);7978 c->cur_item_id, width, height);
7979 7979
7980 for (int i = 0; i < c->heif_info_size; i++) {7980 for (int i = 0; i < c->nb_heif_item; i++) {
7981 if (c->heif_info[i].item_id == c->cur_item_id) {7981 if (c->heif_item[i].item_id == c->cur_item_id) {
7982 c->heif_info[i].width = width;7982 c->heif_item[i].width = width;
7983 c->heif_info[i].height = height;7983 c->heif_item[i].height = height;
7984 break;7984 break;
7985 }7985 }
7986 }7986 }
@@ -8718,7 +8718,7 @@ static int mov_read_close(AVFormatContext *s) · 731 unmodified lines
8718 8718
8719 av_freep(&mov->aes_decrypt);8719 av_freep(&mov->aes_decrypt);
8720 av_freep(&mov->chapter_tracks);8720 av_freep(&mov->chapter_tracks);
8721 av_freep(&mov->heif_info);8721 av_freep(&mov->heif_item);
8722 8722
8723 return 0;8723 return 0;
8724}8724}
@@ -8896,8 +8896,8 @@ static int mov_read_header(AVFormatContext *s) · 171 unmodified lines
8896 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));8896 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
8897 8897
8898 if (mov->found_iloc) {8898 if (mov->found_iloc) {
8899 for (i = 0; i < mov->heif_info_size; i++) {8899 for (i = 0; i < mov->nb_heif_item; i++) {
8900 HEIFItem *item = &mov->heif_info[i];8900 HEIFItem *item = &mov->heif_item[i];
8901 MOVStreamContext *sc;8901 MOVStreamContext *sc;
8902 AVStream *st;8902 AVStream *st;
8903 8903

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