]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/spdifenc.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / spdifenc.c
index 53aa27c44690589b52535109554ee592ab1ad25f..13b91e4750ba051acd4d75980056d2c695f93070 100644 (file)
@@ -220,7 +220,10 @@ static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size,
     }
 
     ctx->out_bytes   = sizeof(dtshd_start_code) + 2 + pkt_size;
-    ctx->length_code = ctx->out_bytes;
+
+    /* Align so that (length_code & 0xf) == 0x8. This is reportedly needed
+     * with some receivers, but the exact requirement is unconfirmed. */
+    ctx->length_code = FFALIGN(ctx->out_bytes + 0x8, 0x10) - 0x8;
 
     av_fast_malloc(&ctx->hd_buf, &ctx->hd_buf_size, ctx->out_bytes);
     if (!ctx->hd_buf)
@@ -550,6 +553,6 @@ AVOutputFormat ff_spdif_muxer = {
     .write_header      = spdif_write_header,
     .write_packet      = spdif_write_packet,
     .write_trailer     = spdif_write_trailer,
-    .flags = AVFMT_NOTIMESTAMPS,
-    .priv_class = &class,
+    .flags             = AVFMT_NOTIMESTAMPS,
+    .priv_class        = &class,
 };