This will only work for DSEs that are first in a packet, but
that is enough to fix handling of the reference files in
fate-suite/aac (though most of them still have other issues).
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
... | ... |
@@ -166,8 +166,21 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) |
166 | 166 |
|
167 | 167 |
/* The LATM payload is written unaligned */ |
168 | 168 |
|
169 |
+ i = 0; |
|
170 |
+ if (pkt->size && (pkt->data[0] & 0xe1) == 0x81) { |
|
171 |
+ // Convert byte-aligned DSE to non-aligned. |
|
172 |
+ // Due to the input format encoding we know that |
|
173 |
+ // it is naturally byte-aligned in the input stream, |
|
174 |
+ // so there are no padding bits to account for. |
|
175 |
+ // To avoid having to add padding bits and rearrange |
|
176 |
+ // the whole stream we just remove the byte-align flag. |
|
177 |
+ // This allows us to remux our FATE AAC samples into latm |
|
178 |
+ // files that are still playable with minimal effort. |
|
179 |
+ put_bits(&bs, 8, pkt->data[0] & 0xfe); |
|
180 |
+ i++; |
|
181 |
+ } |
|
169 | 182 |
/* PayloadMux() */ |
170 |
- for (i = 0; i < pkt->size; i++) |
|
183 |
+ for (; i < pkt->size; i++) |
|
171 | 184 |
put_bits(&bs, 8, pkt->data[i]); |
172 | 185 |
|
173 | 186 |
avpriv_align_put_bits(&bs); |
... | ... |
@@ -139,6 +139,10 @@ if [ -n "$do_mp3" ] ; then |
139 | 139 |
do_lavf_fate mp3 "mp3-conformance/he_32khz.bit" "-acodec copy" |
140 | 140 |
fi |
141 | 141 |
|
142 |
+if [ -n "$do_latm" ] ; then |
|
143 |
+do_lavf_fate latm "aac/al04_44.mp4" "-acodec copy" |
|
144 |
+fi |
|
145 |
+ |
|
142 | 146 |
if [ -n "$do_ogg_vp3" ] ; then |
143 | 147 |
# -idct simple causes different results on different systems |
144 | 148 |
DEC_OPTS="$DEC_OPTS -idct auto" |