aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/spdifenc.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2011-01-02 10:46:50 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2011-01-02 10:46:50 +0000
commitfebd72be6550cd5f4bda2269a382c9ff64d46e8a (patch)
treee2f6cdeda074cef2648992beb9e728935f9a3c48 /libavformat/spdifenc.c
parent17ee8f669f2285aea8aa73bb4d3aa1f2262cb07b (diff)
downloadffmpeg-febd72be6550cd5f4bda2269a382c9ff64d46e8a.tar.gz
Use new function put_nbyte() to speed up padding.
Patch by Anssi Hannula, anssi d hannula a iki d fi Originally committed as revision 26194 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/spdifenc.c')
-rw-r--r--libavformat/spdifenc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index d76b3f74ca..d7a71e161b 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -347,7 +347,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
if (!ctx->pkt_offset)
return 0;
- padding = (ctx->pkt_offset - ctx->use_preamble * BURST_HEADER_SIZE - ctx->out_bytes) >> 1;
+ padding = (ctx->pkt_offset - ctx->use_preamble * BURST_HEADER_SIZE - ctx->out_bytes) & ~1;
if (padding < 0) {
av_log(s, AV_LOG_ERROR, "bitrate is too high\n");
return AVERROR(EINVAL);
@@ -373,8 +373,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
if (ctx->out_bytes & 1)
put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]);
- for (; padding > 0; padding--)
- put_be16(s->pb, 0);
+ put_nbyte(s->pb, 0, padding);
av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
ctx->data_type, ctx->out_bytes, ctx->pkt_offset);