Skip to content

Commit

Permalink
spdifenc: use special alignment for DTS-HD length_code
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
anssih committed Oct 30, 2011
1 parent 3c32a94 commit ab9c00b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libavformat/spdifenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ab9c00b

Please sign in to comment.