Browse code

latmenc: Check for LOAS sync word

Write the packet unaltered if found.

Fixes ticket #1917

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

James Almer authored on 2013/01/17 06:27:14
Showing 1 changed files
... ...
@@ -156,6 +156,15 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
156 156
         av_log(s, AV_LOG_ERROR, "ADTS header detected - ADTS will not be incorrectly muxed into LATM\n");
157 157
         return AVERROR_INVALIDDATA;
158 158
     }
159
+
160
+    if (!s->streams[0]->codec->extradata) {
161
+        if(pkt->size > 2 && pkt->data[0] == 0x56 && (pkt->data[1] >> 4) == 0xe &&
162
+            (AV_RB16(pkt->data + 1) & 0x1FFF) + 3 == pkt->size)
163
+            return ff_raw_write_packet(s, pkt);
164
+        else
165
+            return AVERROR_INVALIDDATA;
166
+    }
167
+
159 168
     if (pkt->size > 0x1fff)
160 169
         goto too_large;
161 170