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
Unified · Split
| @@ -2208,14 +2208,16 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track) · 2207 unmodified lines | |||
| 2208 | (AVRational){1, 1000}, | 2208 | (AVRational){1, 1000}, |
| 2209 | (AVRational){1, 48000}); | 2209 | (AVRational){1, 48000}); |
| 2210 | 2210 | ||
| 2211 | if (track->entry) { | 2211 | if (!track->entry) |
| 2212 | sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries)); | 2212 | return 0; |
| 2213 | if (!sgpd_entries) | ||
| 2214 | return AVERROR(ENOMEM); | ||
| 2215 | } | ||
| 2216 | 2213 | ||
| 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); | ||
| 2218 | 2217 | ||
| 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) { | ||
| 2219 | for (i = 0; i < track->entry; i++) { | 2221 | for (i = 0; i < track->entry; i++) { |
| 2220 | int roll_samples_remaining = roll_samples; | 2222 | int roll_samples_remaining = roll_samples; |
| 2221 | int distance = 0; | 2223 | int distance = 0; |
| @@ -2242,6 +2244,12 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track) · 20 unmodified lines | |||
| 2242 | sgpd_entries[entries].group_description_index = distance ? ++group : 0; | 2244 | sgpd_entries[entries].group_description_index = distance ? ++group : 0; |
| 2243 | } | 2245 | } |
| 2244 | } | 2246 | } |
| 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 | } | ||
| 2245 | entries++; | 2253 | entries++; |
| 2246 | 2254 | ||
| 2247 | if (!group) { | 2255 | if (!group) { |
| @@ -2304,7 +2312,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext · 56 unmodified lines | |||
| 2304 | if (track->cenc.aes_ctr) { | 2312 | if (track->cenc.aes_ctr) { |
| 2305 | ff_mov_cenc_write_stbl_atoms(&track->cenc, pb); | 2313 | ff_mov_cenc_write_stbl_atoms(&track->cenc, pb); |
| 2306 | } | 2314 | } |
| 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) { |
| 2308 | mov_preroll_write_stbl_atoms(pb, track); | 2316 | mov_preroll_write_stbl_atoms(pb, track); |
| 2309 | } | 2317 | } |
| 2310 | return update_size(pb, pos); | 2318 | return update_size(pb, pos); |
| @@ -1,5 +1,5 @@ | |||
| 1 | ef8ce3cbd1d86113e7c991a816086068 *tests/data/fate/adtstoasc_ticket3715.mov | 1 | 0221e04333e6ac432fa42960502f0d5a *tests/data/fate/adtstoasc_ticket3715.mov |
| 2 | 33270 tests/data/fate/adtstoasc_ticket3715.mov | 2 | 33324 tests/data/fate/adtstoasc_ticket3715.mov |
| 3 | #extradata 0: 2, 0x00340022 | 3 | #extradata 0: 2, 0x00340022 |
| 4 | #tb 0: 1/44100 | 4 | #tb 0: 1/44100 |
| 5 | #media_type 0: audio | 5 | #media_type 0: audio |
| @@ -1,5 +1,5 @@ | |||
| 1 | 6889223644fc560069c8591984175a62 *tests/data/fate/copy-psp.psp | 1 | cada61453a2483ef8ba1fb82c8bbff25 *tests/data/fate/copy-psp.psp |
| 2 | 2041379 tests/data/fate/copy-psp.psp | 2 | 2041433 tests/data/fate/copy-psp.psp |
| 3 | #extradata 0: 51, 0xaf6d1012 | 3 | #extradata 0: 51, 0xaf6d1012 |
| 4 | #extradata 1: 2, 0x00b200a1 | 4 | #extradata 1: 2, 0x00b200a1 |
| 5 | #tb 0: 1/90000 | 5 | #tb 0: 1/90000 |
| @@ -1,18 +1,18 @@ | |||
| 1 | write_data len 36, time nopts, type header atom ftyp | 1 | write_data len 36, time nopts, type header atom ftyp |
| 2 | write_data len 2335, time nopts, type header atom - | 2 | write_data len 2389, time nopts, type header atom - |
| 3 | write_data len 788, time 1000000, type sync atom moof | 3 | write_data len 788, time 1000000, type sync atom moof |
| 4 | write_data len 110, time nopts, type trailer atom - | 4 | write_data len 110, time nopts, type trailer atom - |
| 5 | 214242e9c7c93171d2f47f5b47776559 3269 non-empty-moov | 5 | 17a37691eba8b858cf15e60aa9a7dbf7 3323 non-empty-moov |
| 6 | write_data len 36, time nopts, type header atom ftyp | 6 | write_data len 36, time nopts, type header atom ftyp |
| 7 | write_data len 2667, time nopts, type header atom - | 7 | write_data len 2721, time nopts, type header atom - |
| 8 | write_data len 908, time 966667, type sync atom moof | 8 | write_data len 908, time 966667, type sync atom moof |
| 9 | write_data len 110, time nopts, type trailer atom - | 9 | write_data len 110, time nopts, type trailer atom - |
| 10 | 44467d568a3cc38d414fd8ed4b2a968f 3721 non-empty-moov-elst | 10 | 0026ffe059c06c592021f972bf2c5e79 3775 non-empty-moov-elst |
| 11 | write_data len 36, time nopts, type header atom ftyp | 11 | write_data len 36, time nopts, type header atom ftyp |
| 12 | write_data len 2575, time nopts, type header atom - | 12 | write_data len 2629, time nopts, type header atom - |
| 13 | write_data len 908, time 1000000, type sync atom moof | 13 | write_data len 908, time 1000000, type sync atom moof |
| 14 | write_data len 110, time nopts, type trailer atom - | 14 | write_data len 110, time nopts, type trailer atom - |
| 15 | de22b98a3885f9b4b83cdd48ff46aeb9 3629 non-empty-moov-no-elst | 15 | c184e168ac1e5bb3d9c70e580ab6179c 3683 non-empty-moov-no-elst |
| 16 | write_data len 20, time nopts, type header atom ftyp | 16 | write_data len 20, time nopts, type header atom ftyp |
| 17 | write_data len 1171, time nopts, type header atom - | 17 | write_data len 1171, time nopts, type header atom - |
| 18 | write_data len 728, time 0, type sync atom moof | 18 | write_data len 728, time 0, type sync atom moof |