]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: fix remuxing eia-608 into mov from other containers
authorPaul B Mahol <onemda@gmail.com>
Sun, 14 Jun 2020 16:20:14 +0000 (18:20 +0200)
committerPaul B Mahol <onemda@gmail.com>
Mon, 15 Jun 2020 17:27:20 +0000 (19:27 +0200)
libavformat/movenc.c

index 5d8dc4fd5d7c26816d0be19eb4124aa8f8e69b63..520aaafb7412979f42d70eb694f33831c997dea6 100644 (file)
@@ -5582,6 +5582,22 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
             goto end;
         avio_write(pb, pkt->data, size);
 #endif
+    } else if (par->codec_id == AV_CODEC_ID_EIA_608) {
+        size = 8;
+
+        for (int i = 0; i < pkt->size; i += 3) {
+            if (pkt->data[i] == 0xFC) {
+                size += 2;
+            }
+        }
+        avio_wb32(pb, size);
+        ffio_wfourcc(pb, "cdat");
+        for (int i = 0; i < pkt->size; i += 3) {
+            if (pkt->data[i] == 0xFC) {
+                avio_w8(pb, pkt->data[i + 1]);
+                avio_w8(pb, pkt->data[i + 2]);
+            }
+        }
     } else {
         if (trk->cenc.aes_ctr) {
             if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 4) {