History

lavf/movenc.c: Set sgpd and sbgp atoms to represent decoder delay for AAC.

According to https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html and ISO-IEC-14496-12 Section 10.1.1.1 and 10.1.1.3

Sasi Inguva committed 9 years ago

Commit e7e1fbc1 parent df884e04 files · +25 −17Browse files

Showing the changes to libavformat (1 of 4 files). Show all

Unified · Split

libavformat/movenc.c+15−7
@@ -2208,14 +2208,16 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track) · 2207 unmodified lines
22082208 (AVRational){1, 1000},
22092209 (AVRational){1, 48000});
22102210
2211− if (track->entry) {
2212− sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries));
2213− if (!sgpd_entries)
2214− return AVERROR(ENOMEM);
2215− }
2211+ if (!track->entry)
2212+ return 0;
22162213
2217− av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS);
2214+ sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries));
2215+ if (!sgpd_entries)
2216+ return AVERROR(ENOMEM);
22182217
2218+ av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == AV_CODEC_ID_AAC);
2219+
2220+ if (track->par->codec_id == AV_CODEC_ID_OPUS) {
22192221 for (i = 0; i < track->entry; i++) {
22202222 int roll_samples_remaining = roll_samples;
22212223 int distance = 0;
@@ -2242,6 +2244,12 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track) · 20 unmodified lines
22422244 sgpd_entries[entries].group_description_index = distance ? ++group : 0;
22432245 }
22442246 }
2247+ } else {
2248+ entries++;
2249+ sgpd_entries[entries].count = track->sample_count;
2250+ sgpd_entries[entries].roll_distance = 1;
2251+ sgpd_entries[entries].group_description_index = ++group;
2252+ }
22452253 entries++;
22462254
22472255 if (!group) {
@@ -2304,7 +2312,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext · 56 unmodified lines
23042312 if (track->cenc.aes_ctr) {
23052313 ff_mov_cenc_write_stbl_atoms(&track->cenc, pb);
23062314 }
2307− if (track->par->codec_id == AV_CODEC_ID_OPUS) {
2315+ if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == AV_CODEC_ID_AAC) {
23082316 mov_preroll_write_stbl_atoms(pb, track);
23092317 }
23102318 return update_size(pb, pos);

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