History

avformat/mov: rename avif fields to heif

They are no longer avif specific.

James Almer committed 2 years ago

Commit 0405f711 parent 82ad55f2 files · +16 −16Browse files

Unified · Split

2 files
  1. libavformat/isom.h +2 −2
  2. libavformat/mov.c +14 −14
libavformat/isom.h+2−2
@@ -325,8 +325,8 @@ typedef struct MOVContext { · 324 unmodified lines
325 int item_id;325 int item_id;
326 int extent_length;326 int extent_length;
327 int64_t extent_offset;327 int64_t extent_offset;
328 } *avif_info;328 } *heif_info;
329 int avif_info_size;329 int heif_info_size;
330 int64_t hvcC_offset;330 int64_t hvcC_offset;
331 int hvcC_size;331 int hvcC_size;
332 int interleaved_read;332 int interleaved_read;
libavformat/mov.c+14−14
@@ -4916,15 +4916,15 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4915 unmodified lines
4916 return ret;4916 return ret;
4917}4917}
4918 4918
4919static int avif_add_stream(MOVContext *c, int item_id)4919static int heif_add_stream(MOVContext *c, int item_id)
4920{4920{
4921 MOVStreamContext *sc;4921 MOVStreamContext *sc;
4922 AVStream *st;4922 AVStream *st;
4923 int item_index = -1;4923 int item_index = -1;
4924 if (c->fc->nb_streams)4924 if (c->fc->nb_streams)
4925 return AVERROR_INVALIDDATA;4925 return AVERROR_INVALIDDATA;
4926 for (int i = 0; i < c->avif_info_size; i++)4926 for (int i = 0; i < c->heif_info_size; i++)
4927 if (c->avif_info[i].item_id == item_id) {4927 if (c->heif_info[i].item_id == item_id) {
4928 item_index = i;4928 item_index = i;
4929 break;4929 break;
4930 }4930 }
@@ -4987,8 +4987,8 @@ static int avif_add_stream(MOVContext *c, int item_id) · 56 unmodified lines
4987 sc->stts_data[0].count = 1;4987 sc->stts_data[0].count = 1;
4988 // Not used for still images. But needed by mov_build_index.4988 // Not used for still images. But needed by mov_build_index.
4989 sc->stts_data[0].duration = 0;4989 sc->stts_data[0].duration = 0;
4990 sc->sample_sizes[0] = c->avif_info[item_index].extent_length;4990 sc->sample_sizes[0] = c->heif_info[item_index].extent_length;
4991 sc->chunk_offsets[0] = c->avif_info[item_index].extent_offset;4991 sc->chunk_offsets[0] = c->heif_info[item_index].extent_offset;
4992 4992
4993 mov_build_index(c, st);4993 mov_build_index(c, st);
4994 return 0;4994 return 0;
@@ -5013,7 +5013,7 @@ static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 18 unmodified lines
5013 if (c->is_still_picture_avif) {5013 if (c->is_still_picture_avif) {
5014 int ret;5014 int ret;
5015 // Add a stream for the YUV planes (primary item).5015 // Add a stream for the YUV planes (primary item).
5016 if ((ret = avif_add_stream(c, c->primary_item_id)) < 0)5016 if ((ret = heif_add_stream(c, c->primary_item_id)) < 0)
5017 return ret;5017 return ret;
5018 // For still AVIF images, the meta box contains all the5018 // For still AVIF images, the meta box contains all the
5019 // necessary information that would generally be provided by the5019 // necessary information that would generally be provided by the
@@ -7820,7 +7820,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2800 unmodified lines
7820 return 0;7820 return 0;
7821 }7821 }
7822 7822
7823 if (c->avif_info) {7823 if (c->heif_info) {
7824 av_log(c->fc, AV_LOG_INFO, "Duplicate iloc box found\n");7824 av_log(c->fc, AV_LOG_INFO, "Duplicate iloc box found\n");
7825 return 0;7825 return 0;
7826 }7826 }
@@ -7841,16 +7841,16 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 14 unmodified lines
7841 }7841 }
7842 item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);7842 item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
7843 7843
7844 c->avif_info = av_malloc_array(item_count, sizeof(*c->avif_info));7844 c->heif_info = av_malloc_array(item_count, sizeof(*c->heif_info));
7845 if (!c->avif_info)7845 if (!c->heif_info)
7846 return AVERROR(ENOMEM);7846 return AVERROR(ENOMEM);
7847 c->avif_info_size = item_count;7847 c->heif_info_size = item_count;
7848 7848
7849 for (int i = 0; i < item_count; i++) {7849 for (int i = 0; i < item_count; i++) {
7850 int item_id = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);7850 int item_id = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
7851 if (avio_feof(pb))7851 if (avio_feof(pb))
7852 return AVERROR_INVALIDDATA;7852 return AVERROR_INVALIDDATA;
7853 c->avif_info[i].item_id = item_id;7853 c->heif_info[i].item_id = item_id;
7854 7854
7855 if (version > 0)7855 if (version > 0)
7856 avio_rb16(pb); // construction_method.7856 avio_rb16(pb); // construction_method.
@@ -7867,8 +7867,8 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 10 unmodified lines
7867 if (rb_size(pb, &extent_offset, offset_size) < 0 ||7867 if (rb_size(pb, &extent_offset, offset_size) < 0 ||
7868 rb_size(pb, &extent_length, length_size) < 0)7868 rb_size(pb, &extent_length, length_size) < 0)
7869 return AVERROR_INVALIDDATA;7869 return AVERROR_INVALIDDATA;
7870 c->avif_info[i].extent_length = extent_length;7870 c->heif_info[i].extent_length = extent_length;
7871 c->avif_info[i].extent_offset = base_offset + extent_offset;7871 c->heif_info[i].extent_offset = base_offset + extent_offset;
7872 }7872 }
7873 }7873 }
7874 7874
@@ -8502,7 +8502,7 @@ static int mov_read_close(AVFormatContext *s) · 627 unmodified lines
8502 8502
8503 av_freep(&mov->aes_decrypt);8503 av_freep(&mov->aes_decrypt);
8504 av_freep(&mov->chapter_tracks);8504 av_freep(&mov->chapter_tracks);
8505 av_freep(&mov->avif_info);8505 av_freep(&mov->heif_info);
8506 8506
8507 return 0;8507 return 0;
8508}8508}

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