aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-10-28 13:43:13 +0300
committerAnssi Hannula <anssi.hannula@iki.fi>2011-10-30 15:43:19 +0200
commitab9c00b992c4d077815ccaf981b58f2ee3c9a00c (patch)
tree9be7efe1170cc725398d9a2007c4747e76a4351d
parent3c32a941b76a88f385c794823ee2c45e82ea1737 (diff)
downloadffmpeg-ab9c00b992c4d077815ccaf981b58f2ee3c9a00c.tar.gz
spdifenc: use special alignment for DTS-HD length_code
Align IEC 61937 length_code for DTS-HD so that (length_code & 0xf) == 0x8. This is reportedly needed with some receivers. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
-rw-r--r--libavformat/spdifenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 53aa27c446..05b3879d45 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)