|
|
|
@ -518,13 +518,13 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) { |
|
|
|
|
avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1); |
|
|
|
|
avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1); |
|
|
|
|
} else { |
|
|
|
|
av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); |
|
|
|
|
if (!ctx->buffer) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); |
|
|
|
|
avio_write(s->pb, ctx->buffer, ctx->out_bytes & ~1); |
|
|
|
|
av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); |
|
|
|
|
if (!ctx->buffer) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); |
|
|
|
|
avio_write(s->pb, ctx->buffer, ctx->out_bytes & ~1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* a final lone byte has to be MSB aligned */ |
|
|
|
|