Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 0ac8e2bf2b
)
tags/n0.8
@@ -397,6 +397,7 @@ attribute_deprecated unsigned int get_be32(AVIOContext *s); | |||||
attribute_deprecated uint64_t get_be64(AVIOContext *s); | attribute_deprecated uint64_t get_be64(AVIOContext *s); | ||||
attribute_deprecated void put_byte(AVIOContext *s, int b); | attribute_deprecated void put_byte(AVIOContext *s, int b); | ||||
attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count); | |||||
attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); | attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); | ||||
attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); | attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); | ||||
attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); | attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); | ||||
@@ -421,7 +422,6 @@ AVIOContext *avio_alloc_context( | |||||
int64_t (*seek)(void *opaque, int64_t offset, int whence)); | int64_t (*seek)(void *opaque, int64_t offset, int whence)); | ||||
void avio_w8(AVIOContext *s, int b); | void avio_w8(AVIOContext *s, int b); | ||||
void put_nbyte(AVIOContext *s, int b, int count); | |||||
void avio_write(AVIOContext *s, const unsigned char *buf, int size); | void avio_write(AVIOContext *s, const unsigned char *buf, int size); | ||||
void avio_wl64(AVIOContext *s, uint64_t val); | void avio_wl64(AVIOContext *s, uint64_t val); | ||||
void avio_wb64(AVIOContext *s, uint64_t val); | void avio_wb64(AVIOContext *s, uint64_t val); | ||||
@@ -40,4 +40,6 @@ int ffio_init_context(AVIOContext *s, | |||||
*/ | */ | ||||
int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); | int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); | ||||
void ffio_fill(AVIOContext *s, int b, int count); | |||||
#endif // AVFORMAT_AVIO_INTERNAL_H | #endif // AVFORMAT_AVIO_INTERNAL_H |
@@ -141,7 +141,7 @@ void avio_w8(AVIOContext *s, int b) | |||||
flush_buffer(s); | flush_buffer(s); | ||||
} | } | ||||
void put_nbyte(AVIOContext *s, int b, int count) | |||||
void ffio_fill(AVIOContext *s, int b, int count) | |||||
{ | { | ||||
while (count > 0) { | while (count > 0) { | ||||
int len = FFMIN(s->buf_end - s->buf_ptr, count); | int len = FFMIN(s->buf_end - s->buf_ptr, count); | ||||
@@ -352,6 +352,10 @@ void put_buffer(AVIOContext *s, const unsigned char *buf, int size) | |||||
{ | { | ||||
avio_write(s, buf, size); | avio_write(s, buf, size); | ||||
} | } | ||||
void put_nbyte(AVIOContext *s, int b, int count) | |||||
{ | |||||
ffio_fill(s, b, count); | |||||
} | |||||
#endif | #endif | ||||
int avio_put_str(AVIOContext *s, const char *str) | int avio_put_str(AVIOContext *s, const char *str) | ||||
@@ -525,7 +525,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) | |||||
if (ctx->out_bytes & 1) | if (ctx->out_bytes & 1) | ||||
spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8); | spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8); | ||||
put_nbyte(s->pb, 0, padding); | |||||
ffio_fill(s->pb, 0, padding); | |||||
av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", | av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", | ||||
ctx->data_type, ctx->out_bytes, ctx->pkt_offset); | ctx->data_type, ctx->out_bytes, ctx->pkt_offset); | ||||