Align IEC 61937 length_code for DTS-HD so that
(length_code & 0xf) == 0x8. This is reportedly needed with some
receivers.
---

I applied this to FFmpeg two months ago, sorry for the delay in
submitting it here.

 libavformat/spdifenc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index d541aba..5a1b8e4 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -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)
-- 
1.7.7.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to