aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/spdifenc.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-12-30 22:48:18 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2012-01-05 16:27:07 -0800
commit580bb779360e9832e3b5581e349f76bca75ada08 (patch)
tree38e01ed5b5eb24a345baf1aa8c9515729a895d53 /libavformat/spdifenc.c
parentf5be84cfbc9c132a867ae8a8c0e0de26ed1a4e88 (diff)
downloadffmpeg-580bb779360e9832e3b5581e349f76bca75ada08.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: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/spdifenc.c')
-rw-r--r--libavformat/spdifenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index d541aba848..5a1b8e4cb0 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)