Browse code

flvenc: Write proper cropping for VP6 even if there's no extradata

This keeps cropping when remuxing from F4V to FLV.

Signed-off-by: Martin Storsjö <martin@martin.st>

Martin Storsjö authored on 2013/08/15 17:07:30
Showing 1 changed files
... ...
@@ -527,9 +527,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
527 527
         avio_wb32(pb, data_size + 11);
528 528
     } else {
529 529
         avio_w8(pb,flags);
530
-        if (enc->codec_id == AV_CODEC_ID_VP6F || enc->codec_id == AV_CODEC_ID_VP6A)
531
-            avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
532
-        else if (enc->codec_id == AV_CODEC_ID_AAC)
530
+        if (enc->codec_id == AV_CODEC_ID_VP6F || enc->codec_id == AV_CODEC_ID_VP6A) {
531
+            if (enc->extradata_size)
532
+                avio_w8(pb, enc->extradata[0]);
533
+            else
534
+                avio_w8(pb, ((FFALIGN(enc->width,  16) - enc->width) << 4) |
535
+                             (FFALIGN(enc->height, 16) - enc->height));
536
+        } else if (enc->codec_id == AV_CODEC_ID_AAC)
533 537
             avio_w8(pb, 1); // AAC raw
534 538
         else if (enc->codec_id == AV_CODEC_ID_H264) {
535 539
             avio_w8(pb, 1); // AVC NALU