diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-04-09 00:10:07 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-04-12 20:27:47 +0200 |
commit | 912a838efe090b0f70429265badfcb8144becded (patch) | |
tree | b47cf76b683ae532a7a441f2f7657cfc374b6f16 /libavformat/latmenc.c | |
parent | 8274b21c0935596c75fd2d6754bf90cc32e3e803 (diff) | |
download | ffmpeg-912a838efe090b0f70429265badfcb8144becded.tar.gz |
latmenc: fix muxing of byte-aligned DSE.
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>
Diffstat (limited to 'libavformat/latmenc.c')
-rw-r--r-- | libavformat/latmenc.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 3ee277d701..c296a1b116 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -166,8 +166,21 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) /* The LATM payload is written unaligned */ + i = 0; + if (pkt->size && (pkt->data[0] & 0xe1) == 0x81) { + // Convert byte-aligned DSE to non-aligned. + // Due to the input format encoding we know that + // it is naturally byte-aligned in the input stream, + // so there are no padding bits to account for. + // To avoid having to add padding bits and rearrange + // the whole stream we just remove the byte-align flag. + // This allows us to remux our FATE AAC samples into latm + // files that are still playable with minimal effort. + put_bits(&bs, 8, pkt->data[0] & 0xfe); + i++; + } /* PayloadMux() */ - for (i = 0; i < pkt->size; i++) + for (; i < pkt->size; i++) put_bits(&bs, 8, pkt->data[i]); avpriv_align_put_bits(&bs); |