[FFmpeg-devel] [PATCH] latmenc: simplify using avpriv_copy_bits.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Apr 10 21:42:31 CEST 2012


Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavformat/latmenc.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 8933a62..c466d8a 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -170,7 +170,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
 
     /* The LATM payload is written unaligned */
 
-    i = 0;
+    /* PayloadMux() */
     if (pkt->size && (pkt->data[0] & 0xe1) == 0x81) {
         // Convert byte-aligned DSE to non-aligned.
         // Due to the input format encoding we know that
@@ -181,11 +181,9 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
         // 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 < pkt->size; i++)
-        put_bits(&bs, 8, pkt->data[i]);
+        avpriv_copy_bits(&bs, pkt->data + 1, 8*pkt->size - 8);
+    } else
+        avpriv_copy_bits(&bs, pkt->data, 8*pkt->size);
 
     avpriv_align_put_bits(&bs);
     flush_put_bits(&bs);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list