Commit e9eb8d0b authored by Anton Khirnov's avatar Anton Khirnov Committed by Michael Niedermayer

avio: avio: avio_ prefixes for put_* functions

In the name of consistency:
put_byte           -> avio_w8
put_<type>         -> avio_w<type>
put_buffer         -> avio_write

put_nbyte will be made private
put_tag will be merged with avio_put_str
Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 77eb5504)
parent e48fe14a
......@@ -2514,10 +2514,10 @@ static int http_send_data(HTTPContext *c)
header[1] = interleaved_index;
header[2] = len >> 8;
header[3] = len;
put_buffer(pb, header, 4);
avio_write(pb, header, 4);
/* write RTP packet data */
c->buffer_ptr += 4;
put_buffer(pb, c->buffer_ptr, len);
avio_write(pb, c->buffer_ptr, len);
size = url_close_dyn_buf(pb, &c->packet_buffer);
/* prepare asynchronous TCP sending */
rtsp_c->packet_buffer_ptr = c->packet_buffer;
......@@ -3018,7 +3018,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
url_fprintf(c->pb, "Content-Type: application/sdp\r\n");
url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);
url_fprintf(c->pb, "\r\n");
put_buffer(c->pb, content, content_length);
avio_write(c->pb, content, content_length);
av_free(content);
}
......
......@@ -57,7 +57,7 @@ static int a64_write_header(struct AVFormatContext *s)
return AVERROR(EINVAL);
break;
}
put_buffer(s->pb, header, 2);
avio_write(s->pb, header, 2);
c->prev_pkt.size = 0;
c->prev_frame_count = 0;
return 0;
......@@ -110,18 +110,18 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
for(i = 0; i < num_frames; i++) {
if(pkt->data) {
/* if available, put newest charset chunk into buffer */
put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
avio_write(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
} else {
/* a bit ugly, but is there an alternative to put many zeros? */
for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0);
for(j = 0; j < ch_chunksize; j++) avio_w8(s->pb, 0);
}
if(c->prev_pkt.data) {
/* put frame (screen + colram) from last packet into buffer */
put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
avio_write(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
} else {
/* a bit ugly, but is there an alternative to put many zeros? */
for(j = 0; j < frame_size; j++) put_byte(s->pb, 0);
for(j = 0; j < frame_size; j++) avio_w8(s->pb, 0);
}
}
......@@ -145,7 +145,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
default:
/* Write things as is. Nice for self-contained frames from non-multicolor modes or if played
* directly from ram and not from a streaming device (rrnet/mmc) */
if(pkt) put_buffer(s->pb, pkt->data, pkt->size);
if(pkt) avio_write(s->pb, pkt->data, pkt->size);
break;
}
......
......@@ -125,13 +125,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
if (adts->write_adts) {
ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);
put_buffer(pb, buf, ADTS_HEADER_SIZE);
avio_write(pb, buf, ADTS_HEADER_SIZE);
if (adts->pce_size) {
put_buffer(pb, adts->pce_data, adts->pce_size);
avio_write(pb, adts->pce_data, adts->pce_size);
adts->pce_size = 0;
}
}
put_buffer(pb, pkt->data, pkt->size);
avio_write(pb, pkt->data, pkt->size);
put_flush_packet(pb);
return 0;
......
......@@ -45,7 +45,7 @@ static int aiff_write_header(AVFormatContext *s)
/* FORM AIFF header */
put_tag(pb, "FORM");
aiff->form = url_ftell(pb);
put_be32(pb, 0); /* file length */
avio_wb32(pb, 0); /* file length */
put_tag(pb, aifc ? "AIFC" : "AIFF");
if (aifc) { // compressed audio
......@@ -56,17 +56,17 @@ static int aiff_write_header(AVFormatContext *s)
}
/* Version chunk */
put_tag(pb, "FVER");
put_be32(pb, 4);
put_be32(pb, 0xA2805140);
avio_wb32(pb, 4);
avio_wb32(pb, 0xA2805140);
}
/* Common chunk */
put_tag(pb, "COMM");
put_be32(pb, aifc ? 24 : 18); /* size */
put_be16(pb, enc->channels); /* Number of channels */
avio_wb32(pb, aifc ? 24 : 18); /* size */
avio_wb16(pb, enc->channels); /* Number of channels */
aiff->frames = url_ftell(pb);
put_be32(pb, 0); /* Number of frames */
avio_wb32(pb, 0); /* Number of frames */
if (!enc->bits_per_coded_sample)
enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id);
......@@ -77,22 +77,22 @@ static int aiff_write_header(AVFormatContext *s)
if (!enc->block_align)
enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3;
put_be16(pb, enc->bits_per_coded_sample); /* Sample size */
avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */
sample_rate = av_dbl2ext((double)enc->sample_rate);
put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
if (aifc) {
put_le32(pb, enc->codec_tag);
put_be16(pb, 0);
avio_wl32(pb, enc->codec_tag);
avio_wb16(pb, 0);
}
/* Sound data chunk */
put_tag(pb, "SSND");
aiff->ssnd = url_ftell(pb); /* Sound chunk size */
put_be32(pb, 0); /* Sound samples data size */
put_be32(pb, 0); /* Data offset */
put_be32(pb, 0); /* Block-size (block align) */
avio_wb32(pb, 0); /* Sound samples data size */
avio_wb32(pb, 0); /* Data offset */
avio_wb32(pb, 0); /* Block-size (block align) */
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
......@@ -105,7 +105,7 @@ static int aiff_write_header(AVFormatContext *s)
static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
avio_write(pb, pkt->data, pkt->size);
return 0;
}
......@@ -119,22 +119,22 @@ static int aiff_write_trailer(AVFormatContext *s)
int64_t file_size, end_size;
end_size = file_size = url_ftell(pb);
if (file_size & 1) {
put_byte(pb, 0);
avio_w8(pb, 0);
end_size++;
}
if (!url_is_streamed(s->pb)) {
/* File length */
url_fseek(pb, aiff->form, SEEK_SET);
put_be32(pb, file_size - aiff->form - 4);
avio_wb32(pb, file_size - aiff->form - 4);
/* Number of sample frames */
url_fseek(pb, aiff->frames, SEEK_SET);
put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
/* Sound Data chunk size */
url_fseek(pb, aiff->ssnd, SEEK_SET);
put_be32(pb, file_size - aiff->ssnd - 4);
avio_wb32(pb, file_size - aiff->ssnd - 4);
/* return to the end */
url_fseek(pb, end_size, SEEK_SET);
......
......@@ -56,7 +56,7 @@ static int amr_write_header(AVFormatContext *s)
static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
{
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
return 0;
}
......
This diff is collapsed.
......@@ -42,7 +42,7 @@ static int write_header(AVFormatContext *s)
if(!end) end= avctx->extradata + avctx->extradata_size;
else end++;
put_buffer(s->pb, p, end-p);
avio_write(s->pb, p, end-p);
ass->extra_index += end-p;
if(last && !memcmp(last, "[Events]", 8))
......@@ -57,7 +57,7 @@ static int write_header(AVFormatContext *s)
static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
......@@ -69,7 +69,7 @@ static int write_trailer(AVFormatContext *s)
ASSContext *ass = s->priv_data;
AVCodecContext *avctx= s->streams[0]->codec;
put_buffer(s->pb, avctx->extradata + ass->extra_index,
avio_write(s->pb, avctx->extradata + ass->extra_index,
avctx->extradata_size - ass->extra_index);
put_flush_packet(s->pb);
......
......@@ -54,11 +54,11 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
if(!enc->codec_tag)
return -1;
put_tag(pb, ".snd"); /* magic number */
put_be32(pb, 24); /* header size */
put_be32(pb, AU_UNKNOWN_SIZE); /* data size */
put_be32(pb, (uint32_t)enc->codec_tag); /* codec ID */
put_be32(pb, enc->sample_rate);
put_be32(pb, (uint32_t)enc->channels);
avio_wb32(pb, 24); /* header size */
avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */
avio_wb32(pb, enc->sample_rate);
avio_wb32(pb, (uint32_t)enc->channels);
return 0;
}
......@@ -81,7 +81,7 @@ static int au_write_header(AVFormatContext *s)
static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
avio_write(pb, pkt->data, pkt->size);
return 0;
}
......@@ -95,7 +95,7 @@ static int au_write_trailer(AVFormatContext *s)
/* update file size */
file_size = url_ftell(pb);
url_fseek(pb, 8, SEEK_SET);
put_be32(pb, (uint32_t)(file_size - 24));
avio_wb32(pb, (uint32_t)(file_size - 24));
url_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
......
......@@ -78,8 +78,8 @@ int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
while (nal_start < end) {
while(!*(nal_start++));
nal_end = ff_avc_find_startcode(nal_start, end);
put_be32(pb, nal_end - nal_start);
put_buffer(pb, nal_start, nal_end - nal_start);
avio_wb32(pb, nal_end - nal_start);
avio_write(pb, nal_start, nal_end - nal_start);
size += 4 + nal_end - nal_start;
nal_start = nal_end;
}
......@@ -134,21 +134,21 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
assert(sps);
assert(pps);
put_byte(pb, 1); /* version */
put_byte(pb, sps[1]); /* profile */
put_byte(pb, sps[2]); /* profile compat */
put_byte(pb, sps[3]); /* level */
put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
put_be16(pb, sps_size);
put_buffer(pb, sps, sps_size);
put_byte(pb, 1); /* number of pps */
put_be16(pb, pps_size);
put_buffer(pb, pps, pps_size);
avio_w8(pb, 1); /* version */
avio_w8(pb, sps[1]); /* profile */
avio_w8(pb, sps[2]); /* profile compat */
avio_w8(pb, sps[3]); /* level */
avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
avio_wb16(pb, sps_size);
avio_write(pb, sps, sps_size);
avio_w8(pb, 1); /* number of pps */
avio_wb16(pb, pps_size);
avio_write(pb, pps, pps_size);
av_free(start);
} else {
put_buffer(pb, data, len);
avio_write(pb, data, len);
}
}
return 0;
......
This diff is collapsed.
......@@ -395,6 +395,17 @@ attribute_deprecated unsigned int get_be16(AVIOContext *s);
attribute_deprecated unsigned int get_be24(AVIOContext *s);
attribute_deprecated unsigned int get_be32(AVIOContext *s);
attribute_deprecated uint64_t get_be64(AVIOContext *s);
attribute_deprecated void put_byte(AVIOContext *s, int b);
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_be64(AVIOContext *s, uint64_t val);
attribute_deprecated void put_le32(AVIOContext *s, unsigned int val);
attribute_deprecated void put_be32(AVIOContext *s, unsigned int val);
attribute_deprecated void put_le24(AVIOContext *s, unsigned int val);
attribute_deprecated void put_be24(AVIOContext *s, unsigned int val);
attribute_deprecated void put_le16(AVIOContext *s, unsigned int val);
attribute_deprecated void put_be16(AVIOContext *s, unsigned int val);
/**
* @}
*/
......@@ -409,17 +420,17 @@ AVIOContext *avio_alloc_context(
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence));
void put_byte(AVIOContext *s, int b);
void avio_w8(AVIOContext *s, int b);
void put_nbyte(AVIOContext *s, int b, int count);
void put_buffer(AVIOContext *s, const unsigned char *buf, int size);
void put_le64(AVIOContext *s, uint64_t val);
void put_be64(AVIOContext *s, uint64_t val);
void put_le32(AVIOContext *s, unsigned int val);
void put_be32(AVIOContext *s, unsigned int val);
void put_le24(AVIOContext *s, unsigned int val);
void put_be24(AVIOContext *s, unsigned int val);
void put_le16(AVIOContext *s, unsigned int val);
void put_be16(AVIOContext *s, unsigned int val);
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
void avio_wl64(AVIOContext *s, uint64_t val);
void avio_wb64(AVIOContext *s, uint64_t val);
void avio_wl32(AVIOContext *s, unsigned int val);
void avio_wb32(AVIOContext *s, unsigned int val);
void avio_wl24(AVIOContext *s, unsigned int val);
void avio_wb24(AVIOContext *s, unsigned int val);
void avio_wl16(AVIOContext *s, unsigned int val);
void avio_wb16(AVIOContext *s, unsigned int val);
void put_tag(AVIOContext *s, const char *tag);
#if FF_API_OLD_AVIO
......
......@@ -134,7 +134,7 @@ static void flush_buffer(AVIOContext *s)
s->buf_ptr = s->buffer;
}
void put_byte(AVIOContext *s, int b)
void avio_w8(AVIOContext *s, int b)
{
*(s->buf_ptr)++ = b;
if (s->buf_ptr >= s->buf_end)
......@@ -155,7 +155,7 @@ void put_nbyte(AVIOContext *s, int b, int count)
}
}
void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
{
while (size > 0) {
int len = FFMIN(s->buf_end - s->buf_ptr, size);
......@@ -277,20 +277,20 @@ int url_ferror(AVIOContext *s)
return s->error;
}
void put_le32(AVIOContext *s, unsigned int val)
void avio_wl32(AVIOContext *s, unsigned int val)
{
put_byte(s, val);
put_byte(s, val >> 8);
put_byte(s, val >> 16);
put_byte(s, val >> 24);
avio_w8(s, val);
avio_w8(s, val >> 8);
avio_w8(s, val >> 16);
avio_w8(s, val >> 24);
}
void put_be32(AVIOContext *s, unsigned int val)
void avio_wb32(AVIOContext *s, unsigned int val)
{
put_byte(s, val >> 24);
put_byte(s, val >> 16);
put_byte(s, val >> 8);
put_byte(s, val);
avio_w8(s, val >> 24);
avio_w8(s, val >> 16);
avio_w8(s, val >> 8);
avio_w8(s, val);
}
#if FF_API_OLD_AVIO
......@@ -316,6 +316,22 @@ GET(64, uint64_t)
#undef GET
#define PUT(name, type ) \
void put_le ##name(AVIOContext *s, type val)\
{\
avio_wl ##name(s, val);\
}\
void put_be ##name(AVIOContext *s, type val)\
{\
avio_wb ##name(s, val);\
}
PUT(16, unsigned int)
PUT(24, unsigned int)
PUT(32, unsigned int)
PUT(64, uint64_t)
#undef PUT
int get_byte(AVIOContext *s)
{
return avio_r8(s);
......@@ -328,6 +344,14 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
{
return ffio_read_partial(s, buf, size);
}
void put_byte(AVIOContext *s, int val)
{
avio_w8(s, val);
}
void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
{
avio_write(s, buf, size);
}
#endif
int avio_put_str(AVIOContext *s, const char *str)
......@@ -335,9 +359,9 @@ int avio_put_str(AVIOContext *s, const char *str)
int len = 1;
if (str) {
len += strlen(str);
put_buffer(s, (const unsigned char *) str, len);
avio_write(s, (const unsigned char *) str, len);
} else
put_byte(s, 0);
avio_w8(s, 0);
return len;
}
......@@ -351,9 +375,9 @@ int avio_put_str16le(AVIOContext *s, const char *str)
uint16_t tmp;
GET_UTF8(ch, *q++, break;)
PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;)
PUT_UTF16(ch, tmp, avio_wl16(s, tmp);ret += 2;)
}
put_le16(s, 0);
avio_wl16(s, 0);
ret += 2;
return ret;
}
......@@ -371,51 +395,51 @@ void ff_put_v(AVIOContext *bc, uint64_t val){
int i= ff_get_v_length(val);
while(--i>0)
put_byte(bc, 128 | (val>>(7*i)));
avio_w8(bc, 128 | (val>>(7*i)));
put_byte(bc, val&127);
avio_w8(bc, val&127);
}
void put_le64(AVIOContext *s, uint64_t val)
void avio_wl64(AVIOContext *s, uint64_t val)
{
put_le32(s, (uint32_t)(val & 0xffffffff));
put_le32(s, (uint32_t)(val >> 32));
avio_wl32(s, (uint32_t)(val & 0xffffffff));
avio_wl32(s, (uint32_t)(val >> 32));
}
void put_be64(AVIOContext *s, uint64_t val)
void avio_wb64(AVIOContext *s, uint64_t val)
{
put_be32(s, (uint32_t)(val >> 32));
put_be32(s, (uint32_t)(val & 0xffffffff));
avio_wb32(s, (uint32_t)(val >> 32));
avio_wb32(s, (uint32_t)(val & 0xffffffff));
}
void put_le16(AVIOContext *s, unsigned int val)
void avio_wl16(AVIOContext *s, unsigned int val)
{
put_byte(s, val);
put_byte(s, val >> 8);
avio_w8(s, val);
avio_w8(s, val >> 8);
}
void put_be16(AVIOContext *s, unsigned int val)
void avio_wb16(AVIOContext *s, unsigned int val)
{
put_byte(s, val >> 8);
put_byte(s, val);
avio_w8(s, val >> 8);
avio_w8(s, val);
}
void put_le24(AVIOContext *s, unsigned int val)
void avio_wl24(AVIOContext *s, unsigned int val)
{
put_le16(s, val & 0xffff);
put_byte(s, val >> 16);
avio_wl16(s, val & 0xffff);
avio_w8(s, val >> 16);
}
void put_be24(AVIOContext *s, unsigned int val)
void avio_wb24(AVIOContext *s, unsigned int val)
{
put_be16(s, val >> 8);
put_byte(s, val);
avio_wb16(s, val >> 8);
avio_w8(s, val);
}
void put_tag(AVIOContext *s, const char *tag)
{
while (*tag) {
put_byte(s, *tag++);
avio_w8(s, *tag++);
}
}
......@@ -855,7 +879,7 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...)
va_start(ap, fmt);
ret = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
put_buffer(s, buf, strlen(buf));
avio_write(s, buf, strlen(buf));
return ret;
}
#endif //CONFIG_MUXERS
......@@ -1056,7 +1080,7 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
/* don't attempt to pad fixed-size packet buffers */
if (!s->max_packet_size) {
put_buffer(s, padbuf, sizeof(padbuf));
avio_write(s, padbuf, sizeof(padbuf));
padding = FF_INPUT_BUFFER_PADDING_SIZE;
}
......
......@@ -49,7 +49,7 @@ static int crc_write_trailer(struct AVFormatContext *s)
char buf[64];
snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
put_buffer(s->pb, buf, strlen(buf));
avio_write(s->pb, buf, strlen(buf));
put_flush_packet(s->pb);
return 0;
}
......
......@@ -57,9 +57,9 @@ static int daud_write_header(struct AVFormatContext *s)
static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
put_be16(s->pb, pkt->size);
put_be16(s->pb, 0x8010); // unknown
put_buffer(s->pb, pkt->data, pkt->size);
avio_wb16(s->pb, pkt->size);
avio_wb16(s->pb, 0x8010); // unknown
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
return 0;
}
......
......@@ -381,7 +381,7 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index],
pkt->data, pkt->size, &frame);
if (fsize > 0) {
put_buffer(s->pb, frame, fsize);
avio_write(s->pb, frame, fsize);
put_flush_packet(s->pb);
}
return 0;
......
......@@ -36,14 +36,14 @@ static void flush_packet(AVFormatContext *s)
av_abort();
/* put header */
put_be16(pb, PACKET_ID);
put_be16(pb, fill_size);
put_be64(pb, ffm->dts);
avio_wb16(pb, PACKET_ID);
avio_wb16(pb, fill_size);
avio_wb64(pb, ffm->dts);
h = ffm->frame_offset;
if (ffm->first_packet)
h |= 0x8000;
put_be16(pb, h);
put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet);
avio_wb16(pb, h);
avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet);
put_flush_packet(pb);
/* prepare next packet */
......@@ -91,17 +91,17 @@ static int ffm_write_header(AVFormatContext *s)
ffm->packet_size = FFM_PACKET_SIZE;
/* header */
put_le32(pb, MKTAG('F', 'F', 'M', '1'));
put_be32(pb, ffm->packet_size);
put_be64(pb, 0); /* current write position */
avio_wl32(pb, MKTAG('F', 'F', 'M', '1'));
avio_wb32(pb, ffm->packet_size);
avio_wb64(pb, 0); /* current write position */
put_be32(pb, s->nb_streams);
avio_wb32(pb, s->nb_streams);
bit_rate = 0;
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
bit_rate += st->codec->bit_rate;
}
put_be32(pb, bit_rate);
avio_wb32(pb, bit_rate);
/* list of streams */
for(i=0;i<s->nb_streams;i++) {
......@@ -110,82 +110,82 @@ static int ffm_write_header(AVFormatContext *s)
codec = st->codec;
/* generic info */
put_be32(pb, codec->codec_id);
put_byte(pb, codec->codec_type);
put_be32(pb, codec->bit_rate);
put_be32(pb, st->quality);
put_be32(pb, codec->flags);
put_be32(pb, codec->flags2);
put_be32(pb, codec->debug);
avio_wb32(pb, codec->codec_id);
avio_w8(pb, codec->codec_type);
avio_wb32(pb, codec->bit_rate);
avio_wb32(pb, st->quality);
avio_wb32(pb, codec->flags);
avio_wb32(pb, codec->flags2);
avio_wb32(pb, codec->debug);
/* specific info */
switch(codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
put_be32(pb, codec->time_base.num);
put_be32(pb, codec->time_base.den);
put_be16(pb, codec->width);
put_be16(pb, codec->height);
put_be16(pb, codec->gop_size);
put_be32(pb, codec->pix_fmt);
put_byte(pb, codec->qmin);
put_byte(pb, codec->qmax);
put_byte(pb, codec->max_qdiff);
put_be16(pb, (int) (codec->qcompress * 10000.0));
put_be16(pb, (int) (codec->qblur * 10000.0));
put_be32(pb, codec->bit_rate_tolerance);
avio_wb32(pb, codec->time_base.num);
avio_wb32(pb, codec->time_base.den);
avio_wb16(pb, codec->width);
avio_wb16(pb, codec->height);
avio_wb16(pb, codec->gop_size);
avio_wb32(pb, codec->pix_fmt);
avio_w8(pb, codec->qmin);
avio_w8(pb, codec->qmax);
avio_w8(pb, codec->max_qdiff);
avio_wb16(pb, (int) (codec->qcompress * 10000.0));
avio_wb16(pb, (int) (codec->qblur * 10000.0));
avio_wb32(pb, codec->bit_rate_tolerance);
avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp");
put_be32(pb, codec->rc_max_rate);
put_be32(pb, codec->rc_min_rate);
put_be32(pb, codec->rc_buffer_size);
put_be64(pb, av_dbl2int(codec->i_quant_factor));
put_be64(pb, av_dbl2int(codec->b_quant_factor));
put_be64(pb, av_dbl2int(codec->i_quant_offset));
put_be64(pb, av_dbl2int(codec->b_quant_offset));
put_be32(pb, codec->dct_algo);
put_be32(pb, codec->strict_std_compliance);
put_be32(pb, codec->max_b_frames);
put_be32(pb, codec->luma_elim_threshold);
put_be32(pb, codec->chroma_elim_threshold);
put_be32(pb, codec->mpeg_quant);
put_be32(pb, codec->intra_dc_precision);
put_be32(pb, codec->me_method);
put_be32(pb, codec->mb_decision);
put_be32(pb, codec->nsse_weight);
put_be32(pb, codec->frame_skip_cmp);
put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
put_be32(pb, codec->codec_tag);
put_byte(pb, codec->thread_count);
put_be32(pb, codec->coder_type);
put_be32(pb, codec->me_cmp);
put_be32(pb, codec->partitions);
put_be32(pb, codec->me_subpel_quality);
put_be32(pb, codec->me_range);
put_be32(pb, codec->keyint_min);
put_be32(pb, codec->scenechange_threshold);
put_be32(pb, codec->b_frame_strategy);
put_be64(pb, av_dbl2int(codec->qcompress));
put_be64(pb, av_dbl2int(codec->qblur));
put_be32(pb, codec->max_qdiff);
put_be32(pb, codec->refs);
put_be32(pb, codec->directpred);
avio_wb32(pb, codec->rc_max_rate);
avio_wb32(pb, codec->rc_min_rate);
avio_wb32(pb, codec->rc_buffer_size);
avio_wb64(pb, av_dbl2int(codec->i_quant_factor));
avio_wb64(pb, av_dbl2int(codec->b_quant_factor));
avio_wb64(pb, av_dbl2int(codec->i_quant_offset));
avio_wb64(pb, av_dbl2int(codec->b_quant_offset));
avio_wb32(pb, codec->dct_algo);
avio_wb32(pb, codec->strict_std_compliance);
avio_wb32(pb, codec->max_b_frames);
avio_wb32(pb, codec->luma_elim_threshold);
avio_wb32(pb, codec->chroma_elim_threshold);
avio_wb32(pb, codec->mpeg_quant);
avio_wb32(pb, codec->intra_dc_precision);
avio_wb32(pb, codec->me_method);
avio_wb32(pb, codec->mb_decision);
avio_wb32(pb, codec->nsse_weight);
avio_wb32(pb, codec->frame_skip_cmp);
avio_wb64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
avio_wb32(pb, codec->codec_tag);
avio_w8(pb, codec->thread_count);
avio_wb32(pb, codec->coder_type);
avio_wb32(pb, codec->me_cmp);
avio_wb32(pb, codec->partitions);
avio_wb32(pb, codec->me_subpel_quality);
avio_wb32(pb, codec->me_range);
avio_wb32(pb, codec->keyint_min);
avio_wb32(pb, codec->scenechange_threshold);
avio_wb32(pb, codec->b_frame_strategy);
avio_wb64(pb, av_dbl2int(codec->qcompress));
avio_wb64(pb, av_dbl2int(codec->qblur));
avio_wb32(pb, codec->max_qdiff);
avio_wb32(pb, codec->refs);
avio_wb32(pb, codec->directpred);
break;
case AVMEDIA_TYPE_AUDIO:
put_be32(pb, codec->sample_rate);
put_le16(pb, codec->channels);
put_le16(pb, codec->frame_size);
put_le16(pb, codec->sample_fmt);
avio_wb32(pb, codec->sample_rate);
avio_wl16(pb, codec->channels);
avio_wl16(pb, codec->frame_size);
avio_wl16(pb, codec->sample_fmt);
break;
default:
return -1;
}
if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
put_be32(pb, codec->extradata_size);
put_buffer(pb, codec->extradata, codec->extradata_size);
avio_wb32(pb, codec->extradata_size);
avio_write(pb, codec->extradata, codec->extradata_size);
}
}
/* flush until end of block reached */
while ((url_ftell(pb) % ffm->packet_size) != 0)
put_byte(pb, 0);
avio_w8(pb, 0);
put_flush_packet(pb);
......
......@@ -31,8 +31,8 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str)
while (*p) {
if (*p == '#' || *p == ';' || *p == '=' || *p == '\\' || *p == '\n')
put_byte(s, '\\');
put_byte(s, *p);
avio_w8(s, '\\');
avio_w8(s, *p);
p++;
}
}
......@@ -42,17 +42,17 @@ static void write_tags(AVIOContext *s, AVMetadata *m)
AVMetadataTag *t = NULL;
while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) {
write_escape_str(s, t->key);
put_byte(s, '=');
avio_w8(s, '=');
write_escape_str(s, t->value);
put_byte(s, '\n');
avio_w8(s, '\n');
}
}
static int write_header(AVFormatContext *s)
{
put_tag(s->pb, ID_STRING);
put_byte(s->pb, '1'); // version
put_byte(s->pb, '\n');
avio_w8(s->pb, '1'); // version
avio_w8(s->pb, '\n');
put_flush_packet(s->pb);
return 0;
}
......@@ -65,14 +65,14 @@ static int write_trailer(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
put_tag(s->pb, ID_STREAM);
put_byte(s->pb, '\n');
avio_w8(s->pb, '\n');
write_tags(s->pb, s->streams[i]->metadata);
}
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *ch = s->chapters[i];
put_tag(s->pb, ID_CHAPTER);
put_byte(s->pb, '\n');
avio_w8(s->pb, '\n');
url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den);
url_fprintf(s->pb, "START=%"PRId64"\n", ch->start);
url_fprintf(s->pb, "END=%"PRId64"\n", ch->end);
......
......@@ -45,7 +45,7 @@ static int write_header(AVFormatContext *s)
static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
FilmstripMuxContext *film = s->priv_data;
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
film->nb_frames++;
return 0;
}
......@@ -57,16 +57,16 @@ static int write_trailer(AVFormatContext *s)
AVStream *st = s->streams[0];
int i;
put_be32(pb, RAND_TAG);
put_be32(pb, film->nb_frames);
put_be16(pb, 0); // packing method
put_be16(pb, 0); // reserved
put_be16(pb, st->codec->width);
put_be16(pb, st->codec->height);
put_be16(pb, 0); // leading
put_be16(pb, 1/av_q2d(st->codec->time_base));
avio_wb32(pb, RAND_TAG);
avio_wb32(pb, film->nb_frames);
avio_wb16(pb, 0); // packing method
avio_wb16(pb, 0); // reserved
avio_wb16(pb, st->codec->width);
avio_wb16(pb, st->codec->height);
avio_wb16(pb, 0); // leading
avio_wb16(pb, 1/av_q2d(st->codec->time_base));
for (i = 0; i < 16; i++)
put_byte(pb, 0x00); // reserved
avio_w8(pb, 0x00); // reserved
put_flush_packet(pb);
return 0;
}
......
......@@ -30,10 +30,10 @@
static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes,
int last_block)
{
put_byte(pb, last_block ? 0x81 : 0x01);
put_be24(pb, n_padding_bytes);
avio_w8(pb, last_block ? 0x81 : 0x01);
avio_wb24(pb, n_padding_bytes);
while (n_padding_bytes > 0) {
put_byte(pb, 0);
avio_w8(pb, 0);
n_padding_bytes--;
}
return 0;
......@@ -58,7 +58,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m,
bytestream_put_be24(&p, len);
ff_vorbiscomment_write(&p, m, vendor, count);
put_buffer(pb, p0, len+4);
avio_write(pb, p0, len+4);
av_freep(&p0);
p = NULL;
......@@ -102,7 +102,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
/* rewrite the STREAMINFO header block data */
file_size = url_ftell(pb);
url_fseek(pb, 8, SEEK_SET);
put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE);
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
url_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
} else {
......@@ -113,7 +113,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
return 0;
}
......
......@@ -39,11 +39,11 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
/* write "fLaC" stream marker and first metadata block header if needed */
if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
put_buffer(pb, header, 8);
avio_write(pb, header, 8);
}
/* write STREAMINFO or full header */
put_buffer(pb, codec->extradata, codec->extradata_size);
avio_write(pb, codec->extradata, codec->extradata_size);
return 0;
}
......@@ -142,31 +142,31 @@ static int get_audio_flags(AVCodecContext *enc){
static void put_amf_string(AVIOContext *pb, const char *str)
{
size_t len = strlen(str);
put_be16(pb, len);
put_buffer(pb, str, len);
avio_wb16(pb, len);
avio_write(pb, str, len);
}
static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) {
put_byte(pb, FLV_TAG_TYPE_VIDEO);
put_be24(pb, 5); /* Tag Data Size */
put_be24(pb, ts); /* lower 24 bits of timestamp in ms*/
put_byte(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/
put_be24(pb, 0); /* StreamId = 0 */
put_byte(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
put_byte(pb, 2); /* AVC end of sequence */
put_be24(pb, 0); /* Always 0 for AVC EOS. */
put_be32(pb, 16); /* Size of FLV tag */
avio_w8(pb, FLV_TAG_TYPE_VIDEO);
avio_wb24(pb, 5); /* Tag Data Size */
avio_wb24(pb, ts); /* lower 24 bits of timestamp in ms*/
avio_w8(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/
avio_wb24(pb, 0); /* StreamId = 0 */
avio_w8(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
avio_w8(pb, 2); /* AVC end of sequence */
avio_wb24(pb, 0); /* Always 0 for AVC EOS. */
avio_wb32(pb, 16); /* Size of FLV tag */
}
static void put_amf_double(AVIOContext *pb, double d)
{
put_byte(pb, AMF_DATA_TYPE_NUMBER);
put_be64(pb, av_dbl2int(d));
avio_w8(pb, AMF_DATA_TYPE_NUMBER);
avio_wb64(pb, av_dbl2int(d));
}
static void put_amf_bool(AVIOContext *pb, int b) {
put_byte(pb, AMF_DATA_TYPE_BOOL);
put_byte(pb, !!b);
avio_w8(pb, AMF_DATA_TYPE_BOOL);
avio_w8(pb, !!b);
}
static int flv_write_header(AVFormatContext *s)
......@@ -200,19 +200,19 @@ static int flv_write_header(AVFormatContext *s)
av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
}
put_tag(pb,"FLV");
put_byte(pb,1);
put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
avio_w8(pb,1);
avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
+ FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
put_be32(pb,9);
put_be32(pb,0);
avio_wb32(pb,9);
avio_wb32(pb,0);
for(i=0; i<s->nb_streams; i++){
if(s->streams[i]->codec->codec_tag == 5){
put_byte(pb,8); // message type
put_be24(pb,0); // include flags
put_be24(pb,0); // time stamp
put_be32(pb,0); // reserved
put_be32(pb,11); // size
avio_w8(pb,8); // message type
avio_wb24(pb,0); // include flags
avio_wb24(pb,0); // time stamp
avio_wb32(pb,0); // reserved
avio_wb32(pb,11); // size
flv->reserved=5;
}
}
......@@ -220,21 +220,21 @@ static int flv_write_header(AVFormatContext *s)
flv->last_video_ts = -1;
/* write meta_tag */
put_byte(pb, 18); // tag type META
avio_w8(pb, 18); // tag type META
metadata_size_pos= url_ftell(pb);
put_be24(pb, 0); // size of data part (sum of all parts below)
put_be24(pb, 0); // time stamp
put_be32(pb, 0); // reserved
avio_wb24(pb, 0); // size of data part (sum of all parts below)
avio_wb24(pb, 0); // time stamp
avio_wb32(pb, 0); // reserved
/* now data of data_size size */
/* first event name as a string */
put_byte(pb, AMF_DATA_TYPE_STRING);
avio_w8(pb, AMF_DATA_TYPE_STRING);
put_amf_string(pb, "onMetaData"); // 12 bytes
/* mixed array (hash) with size and string/type/data tuples */
put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY);
put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
put_amf_string(pb, "duration");
flv->duration_offset= url_ftell(pb);
......@@ -276,7 +276,7 @@ static int flv_write_header(AVFormatContext *s)
while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
put_amf_string(pb, tag->key);
put_byte(pb, AMF_DATA_TYPE_STRING);
avio_w8(pb, AMF_DATA_TYPE_STRING);
put_amf_string(pb, tag->value);
}
......@@ -285,41 +285,41 @@ static int flv_write_header(AVFormatContext *s)
put_amf_double(pb, 0); // delayed write
put_amf_string(pb, "");
put_byte(pb, AMF_END_OF_OBJECT);
avio_w8(pb, AMF_END_OF_OBJECT);
/* write total size of tag */
data_size= url_ftell(pb) - metadata_size_pos - 10;
url_fseek(pb, metadata_size_pos, SEEK_SET);
put_be24(pb, data_size);
avio_wb24(pb, data_size);
url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
put_be32(pb, data_size + 11);
avio_wb32(pb, data_size + 11);
for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec;
if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
int64_t pos;
put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
avio_w8(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
put_be24(pb, 0); // size patched later
put_be24(pb, 0); // ts
put_byte(pb, 0); // ts ext
put_be24(pb, 0); // streamid
avio_wb24(pb, 0); // size patched later
avio_wb24(pb, 0); // ts
avio_w8(pb, 0); // ts ext
avio_wb24(pb, 0); // streamid
pos = url_ftell(pb);
if (enc->codec_id == CODEC_ID_AAC) {
put_byte(pb, get_audio_flags(enc));
put_byte(pb, 0); // AAC sequence header
put_buffer(pb, enc->extradata, enc->extradata_size);
avio_w8(pb, get_audio_flags(enc));
avio_w8(pb, 0); // AAC sequence header
avio_write(pb, enc->extradata, enc->extradata_size);
} else {
put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
put_byte(pb, 0); // AVC sequence header
put_be24(pb, 0); // composition time
avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
avio_w8(pb, 0); // AVC sequence header
avio_wb24(pb, 0); // composition time
ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
}
data_size = url_ftell(pb) - pos;
url_fseek(pb, -data_size - 10, SEEK_CUR);
put_be24(pb, data_size);
avio_wb24(pb, data_size);
url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
put_be32(pb, data_size + 11); // previous tag size
avio_wb32(pb, data_size + 11); // previous tag size
}
}
......@@ -376,7 +376,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
flags_size= 1;
if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
put_byte(pb, FLV_TAG_TYPE_VIDEO);
avio_w8(pb, FLV_TAG_TYPE_VIDEO);
flags = enc->codec_tag;
if(flags == 0) {
......@@ -391,7 +391,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
assert(size);
put_byte(pb, FLV_TAG_TYPE_AUDIO);
avio_w8(pb, FLV_TAG_TYPE_AUDIO);
}
if (enc->codec_id == CODEC_ID_H264) {
......@@ -409,25 +409,25 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
if (flv->last_video_ts < ts)
flv->last_video_ts = ts;
}
put_be24(pb,size + flags_size);
put_be24(pb,ts);
put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
put_be24(pb,flv->reserved);
put_byte(pb,flags);
avio_wb24(pb,size + flags_size);
avio_wb24(pb,ts);
avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
avio_wb24(pb,flv->reserved);
avio_w8(pb,flags);
if (enc->codec_id == CODEC_ID_VP6)
put_byte(pb,0);
avio_w8(pb,0);
if (enc->codec_id == CODEC_ID_VP6F)
put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
else if (enc->codec_id == CODEC_ID_AAC)
put_byte(pb,1); // AAC raw
avio_w8(pb,1); // AAC raw
else if (enc->codec_id == CODEC_ID_H264) {
put_byte(pb,1); // AVC NALU
put_be24(pb,pkt->pts - pkt->dts);
avio_w8(pb,1); // AVC NALU
avio_wb24(pb,pkt->pts - pkt->dts);
}
put_buffer(pb, data ? data : pkt->data, size);
avio_write(pb, data ? data : pkt->data, size);
put_be32(pb,size+flags_size+11); // previous tag size
avio_wb32(pb,size+flags_size+11); // previous tag size
flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
put_flush_packet(pb);
......
......@@ -28,7 +28,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
char buf[256];
snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
put_buffer(s->pb, buf, strlen(buf));
avio_write(s->pb, buf, strlen(buf));
put_flush_packet(s->pb);
return 0;
}
......
......@@ -116,24 +116,24 @@ static int gif_image_write_header(AVIOContext *pb,
put_tag(pb, "GIF");
put_tag(pb, "89a");
put_le16(pb, width);
put_le16(pb, height);
avio_wl16(pb, width);
avio_wl16(pb, height);
put_byte(pb, 0xf7); /* flags: global clut, 256 entries */
put_byte(pb, 0x1f); /* background color index */
put_byte(pb, 0); /* aspect ratio */
avio_w8(pb, 0xf7); /* flags: global clut, 256 entries */
avio_w8(pb, 0x1f); /* background color index */
avio_w8(pb, 0); /* aspect ratio */
/* the global palette */
if (!palette) {
put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
avio_write(pb, (const unsigned char *)gif_clut, 216*3);
for(i=0;i<((256-216)*3);i++)
put_byte(pb, 0);
avio_w8(pb, 0);
} else {
for(i=0;i<256;i++) {
v = palette[i];
put_byte(pb, (v >> 16) & 0xff);
put_byte(pb, (v >> 8) & 0xff);
put_byte(pb, (v) & 0xff);
avio_w8(pb, (v >> 16) & 0xff);
avio_w8(pb, (v >> 8) & 0xff);
avio_w8(pb, (v) & 0xff);
}
}
......@@ -159,14 +159,14 @@ static int gif_image_write_header(AVIOContext *pb,
/* application extension header */
#ifdef GIF_ADD_APP_HEADER
if (loop_count >= 0 && loop_count <= 65535) {
put_byte(pb, 0x21);
put_byte(pb, 0xff);
put_byte(pb, 0x0b);
avio_w8(pb, 0x21);
avio_w8(pb, 0xff);
avio_w8(pb, 0x0b);
put_tag(pb, "NETSCAPE2.0"); // bytes 4 to 14
put_byte(pb, 0x03); // byte 15
put_byte(pb, 0x01); // byte 16
put_le16(pb, (uint16_t)loop_count);
put_byte(pb, 0x00); // byte 19
avio_w8(pb, 0x03); // byte 15
avio_w8(pb, 0x01); // byte 16
avio_wl16(pb, (uint16_t)loop_count);
avio_w8(pb, 0x00); // byte 19
}
#endif
return 0;
......@@ -189,15 +189,15 @@ static int gif_image_write_image(AVIOContext *pb,
const uint8_t *ptr;
/* image block */
put_byte(pb, 0x2c);
put_le16(pb, x1);
put_le16(pb, y1);
put_le16(pb, width);
put_le16(pb, height);
put_byte(pb, 0x00); /* flags */
avio_w8(pb, 0x2c);
avio_wl16(pb, x1);
avio_wl16(pb, y1);
avio_wl16(pb, width);
avio_wl16(pb, height);
avio_w8(pb, 0x00); /* flags */
/* no local clut */
put_byte(pb, 0x08);
avio_w8(pb, 0x08);
left= width * height;
......@@ -233,13 +233,13 @@ static int gif_image_write_image(AVIOContext *pb,
flush_put_bits(&p);
}
if(put_bits_ptr(&p) - p.buf > 0) {
put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
avio_w8(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
avio_write(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
}
left-=GIF_CHUNKS;
}
put_byte(pb, 0x00); /* end of image block */
avio_w8(pb, 0x00); /* end of image block */
return 0;
}
......@@ -300,10 +300,10 @@ static int gif_write_video(AVFormatContext *s,
int64_t delay;
/* graphic control extension block */
put_byte(pb, 0x21);
put_byte(pb, 0xf9);
put_byte(pb, 0x04); /* block size */
put_byte(pb, 0x04); /* flags */
avio_w8(pb, 0x21);
avio_w8(pb, 0xf9);
avio_w8(pb, 0x04); /* block size */
avio_w8(pb, 0x04); /* flags */
/* 1 jiffy is 1/70 s */
/* the delay_time field indicates the number of jiffies - 1 */
......@@ -314,10 +314,10 @@ static int gif_write_video(AVFormatContext *s,
/* XXX: don't even remember if I really use it for now */
jiffies = (70*enc->time_base.num/enc->time_base.den) - 1;
put_le16(pb, jiffies);
avio_wl16(pb, jiffies);
put_byte(pb, 0x1f); /* transparent color index */
put_byte(pb, 0x00);
avio_w8(pb, 0x1f); /* transparent color index */
avio_w8(pb, 0x00);
gif_image_write_image(pb, 0, 0, enc->width, enc->height,
buf, enc->width * 3, PIX_FMT_RGB24);
......@@ -339,7 +339,7 @@ static int gif_write_trailer(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
put_byte(pb, 0x3b);
avio_w8(pb, 0x3b);
put_flush_packet(s->pb);
return 0;
}
......
This diff is collapsed.
......@@ -29,7 +29,7 @@ static int roq_write_header(struct AVFormatContext *s)
0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
};
put_buffer(s->pb, header, 8);
avio_write(s->pb, header, 8);
put_flush_packet(s->pb);
return 0;
......
......@@ -368,9 +368,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if(codec->codec_id == CODEC_ID_RAWVIDEO){
int ysize = codec->width * codec->height;
put_buffer(pb[0], pkt->data , ysize);
put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
avio_write(pb[0], pkt->data , ysize);
avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
put_flush_packet(pb[1]);
put_flush_packet(pb[2]);
url_fclose(pb[1]);
......@@ -382,15 +382,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){
if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c'))
goto error;
put_be32(pb[0], 12);
avio_wb32(pb[0], 12);
put_tag (pb[0], "jP ");
put_be32(pb[0], 0x0D0A870A); // signature
put_be32(pb[0], 20);
avio_wb32(pb[0], 0x0D0A870A); // signature
avio_wb32(pb[0], 20);
put_tag (pb[0], "ftyp");
put_tag (pb[0], "jp2 ");
put_be32(pb[0], 0);
avio_wb32(pb[0], 0);
put_tag (pb[0], "jp2 ");
put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size);
avio_write(pb[0], st->codec->extradata, st->codec->extradata_size);
}else if(pkt->size < 8 ||
(!st->codec->extradata_size &&
AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature
......@@ -399,7 +399,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
}
}
put_buffer(pb[0], pkt->data, pkt->size);
avio_write(pb[0], pkt->data, pkt->size);
}
put_flush_packet(pb[0]);
if (!img->is_pipe) {
......
......@@ -34,15 +34,15 @@ static int ivf_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n");
return AVERROR(EINVAL);
}
put_buffer(pb, "DKIF", 4);
put_le16(pb, 0); // version
put_le16(pb, 32); // header length
put_le32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80"));
put_le16(pb, ctx->width);
put_le16(pb, ctx->height);
put_le32(pb, s->streams[0]->time_base.den);
put_le32(pb, s->streams[0]->time_base.num);
put_le64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!?
avio_write(pb, "DKIF", 4);
avio_wl16(pb, 0); // version
avio_wl16(pb, 32); // header length
avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80"));
avio_wl16(pb, ctx->width);
avio_wl16(pb, ctx->height);
avio_wl32(pb, s->streams[0]->time_base.den);
avio_wl32(pb, s->streams[0]->time_base.num);
avio_wl64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!?
return 0;
}
......@@ -50,9 +50,9 @@ static int ivf_write_header(AVFormatContext *s)
static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
put_le32(pb, pkt->size);
put_le64(pb, pkt->pts);
put_buffer(pb, pkt->data, pkt->size);
avio_wl32(pb, pkt->size);
avio_wl64(pb, pkt->pts);
avio_write(pb, pkt->data, pkt->size);
put_flush_packet(pb);
return 0;
......
......@@ -47,7 +47,7 @@ static const AVCodecTag nut_tags[] = {
#if CONFIG_LIBNUT_MUXER
static int av_write(void * h, size_t len, const uint8_t * buf) {
AVIOContext * bc = h;
put_buffer(bc, buf, len);
avio_write(bc, buf, len);
//put_flush_packet(bc);
return len;
}
......
......@@ -1376,12 +1376,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
ffio_init_context(&b, extradata, extradata_size, 1,
NULL, NULL, NULL, NULL);
put_buffer(&b, "TTA1", 4);
put_le16(&b, 1);
put_le16(&b, track->audio.channels);
put_le16(&b, track->audio.bitdepth);
put_le32(&b, track->audio.out_samplerate);
put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate);
avio_write(&b, "TTA1", 4);
avio_wl16(&b, 1);
avio_wl16(&b, track->audio.channels);
avio_wl16(&b, track->audio.bitdepth);
avio_wl32(&b, track->audio.out_samplerate);
avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate);
} else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
extradata_offset = 26;
......
......@@ -112,7 +112,7 @@ static void put_ebml_id(AVIOContext *pb, unsigned int id)
{
int i = ebml_id_size(id);
while (i--)
put_byte(pb, id >> (i*8));
avio_w8(pb, id >> (i*8));
}
/**
......@@ -123,9 +123,9 @@ static void put_ebml_id(AVIOContext *pb, unsigned int id)
static void put_ebml_size_unknown(AVIOContext *pb, int bytes)
{
assert(bytes <= 8);
put_byte(pb, 0x1ff >> bytes);
avio_w8(pb, 0x1ff >> bytes);
while (--bytes)
put_byte(pb, 0xff);
avio_w8(pb, 0xff);
}
/**
......@@ -160,7 +160,7 @@ static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes)
num |= 1ULL << bytes*7;
for (i = bytes - 1; i >= 0; i--)
put_byte(pb, num >> i*8);
avio_w8(pb, num >> i*8);
}
static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
......@@ -172,14 +172,14 @@ static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
put_ebml_id(pb, elementid);
put_ebml_num(pb, bytes, 0);
for (i = bytes - 1; i >= 0; i--)
put_byte(pb, val >> i*8);
avio_w8(pb, val >> i*8);
}
static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
{
put_ebml_id(pb, elementid);
put_ebml_num(pb, 8, 0);
put_be64(pb, av_dbl2int(val));
avio_wb64(pb, av_dbl2int(val));
}
static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
......@@ -187,7 +187,7 @@ static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
{
put_ebml_id(pb, elementid);
put_ebml_num(pb, size, 0);
put_buffer(pb, buf, size);
avio_write(pb, buf, size);
}
static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str)
......@@ -216,7 +216,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size)
else
put_ebml_num(pb, size-9, 8);
while(url_ftell(pb) < currentpos + size)
put_byte(pb, 0);
avio_w8(pb, 0);
}
static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize)
......@@ -241,8 +241,8 @@ static void put_xiph_size(AVIOContext *pb, int size)
{
int i;
for (i = 0; i < size / 255; i++)
put_byte(pb, 255);
put_byte(pb, size % 255);
avio_w8(pb, 255);
avio_w8(pb, size % 255);
}
/**
......@@ -426,12 +426,12 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex
return -1;
}
put_byte(pb, 2); // number packets - 1
avio_w8(pb, 2); // number packets - 1
for (j = 0; j < 2; j++) {
put_xiph_size(pb, header_len[j]);
}
for (j = 0; j < 3; j++)
put_buffer(pb, header_start[j], header_len[j]);
avio_write(pb, header_start[j], header_len[j]);
return 0;
}
......@@ -481,13 +481,13 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
else if (codec->codec_id == CODEC_ID_H264)
ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size);
else if (codec->extradata_size)
put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
avio_write(dyn_cp, codec->extradata, codec->extradata_size);
} else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (qt_id) {
if (!codec->codec_tag)
codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id);
if (codec->extradata_size)
put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
avio_write(dyn_cp, codec->extradata, codec->extradata_size);
} else {
if (!codec->codec_tag)
codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);
......@@ -932,10 +932,10 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size));
put_ebml_id(pb, MATROSKA_ID_BLOCK);
put_ebml_num(pb, size+4, 0);
put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
put_be16(pb, pkt->pts - mkv->cluster_pts);
put_byte(pb, 0);
put_buffer(pb, buffer, size);
avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
avio_wb16(pb, pkt->pts - mkv->cluster_pts);
avio_w8(pb, 0);
avio_write(pb, buffer, size);
put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
end_ebml_master(pb, blockgroup);
......@@ -965,10 +965,10 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
data = pkt->data;
put_ebml_id(pb, blockid);
put_ebml_num(pb, size+4, 0);
put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
put_be16(pb, ts - mkv->cluster_pts);
put_byte(pb, flags);
put_buffer(pb, data, size);
avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
avio_wb16(pb, ts - mkv->cluster_pts);
avio_w8(pb, flags);
avio_write(pb, data, size);
if (data != pkt->data)
av_free(data);
}
......@@ -1018,7 +1018,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s)
return;
bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
put_buffer(s->pb, dyn_buf, bufsize);
avio_write(s->pb, dyn_buf, bufsize);
av_free(dyn_buf);
mkv->dyn_bc = NULL;
}
......
......@@ -36,7 +36,7 @@ static void md5_finish(struct AVFormatContext *s, char *buf)
buf[offset] = '\n';
buf[offset+1] = 0;
put_buffer(s->pb, buf, strlen(buf));
avio_write(s->pb, buf, strlen(buf));
put_flush_packet(s->pb);
}
......
......@@ -53,7 +53,7 @@ static void end_tag_be(AVIOContext *pb, int64_t start)
pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET);
put_be32(pb, (uint32_t)(pos - start));
avio_wb32(pb, (uint32_t)(pos - start));
url_fseek(pb, pos, SEEK_SET);
}
......@@ -71,31 +71,31 @@ static int mmf_write_header(AVFormatContext *s)
}
put_tag(pb, "MMMD");
put_be32(pb, 0);
avio_wb32(pb, 0);
pos = ff_start_tag(pb, "CNTI");
put_byte(pb, 0); /* class */
put_byte(pb, 0); /* type */
put_byte(pb, 0); /* code type */
put_byte(pb, 0); /* status */
put_byte(pb, 0); /* counts */
avio_w8(pb, 0); /* class */
avio_w8(pb, 0); /* type */
avio_w8(pb, 0); /* code type */
avio_w8(pb, 0); /* status */
avio_w8(pb, 0); /* counts */
put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */
end_tag_be(pb, pos);
put_buffer(pb, "ATR\x00", 4);
put_be32(pb, 0);
avio_write(pb, "ATR\x00", 4);
avio_wb32(pb, 0);
mmf->atrpos = url_ftell(pb);
put_byte(pb, 0); /* format type */
put_byte(pb, 0); /* sequence type */
put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
put_byte(pb, 0); /* wave base bit */
put_byte(pb, 2); /* time base d */
put_byte(pb, 2); /* time base g */
avio_w8(pb, 0); /* format type */
avio_w8(pb, 0); /* sequence type */
avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
avio_w8(pb, 0); /* wave base bit */
avio_w8(pb, 2); /* time base d */
avio_w8(pb, 2); /* time base g */
put_tag(pb, "Atsq");
put_be32(pb, 16);
avio_wb32(pb, 16);
mmf->atsqpos = url_ftell(pb);
/* Will be filled on close */
put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
mmf->awapos = ff_start_tag(pb, "Awa\x01");
......@@ -109,7 +109,7 @@ static int mmf_write_header(AVFormatContext *s)
static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
avio_write(pb, pkt->data, pkt->size);
return 0;
}
......@@ -117,11 +117,11 @@ static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
static void put_varlength(AVIOContext *pb, int val)
{
if(val < 128)
put_byte(pb, val);
avio_w8(pb, val);
else {
val -= 128;
put_byte(pb, 0x80 | val >> 7);
put_byte(pb, 0x7f & val);
avio_w8(pb, 0x80 | val >> 7);
avio_w8(pb, 0x7f & val);
}
}
......@@ -145,17 +145,17 @@ static int mmf_write_trailer(AVFormatContext *s)
url_fseek(pb, mmf->atsqpos, SEEK_SET);
/* "play wav" */
put_byte(pb, 0); /* start time */
put_byte(pb, 1); /* (channel << 6) | wavenum */
avio_w8(pb, 0); /* start time */
avio_w8(pb, 1); /* (channel << 6) | wavenum */
gatetime = size * 500 / s->streams[0]->codec->sample_rate;
put_varlength(pb, gatetime); /* duration */
/* "nop" */
put_varlength(pb, gatetime); /* start time */
put_buffer(pb, "\xff\x00", 2); /* nop */
avio_write(pb, "\xff\x00", 2); /* nop */
/* "end of sequence" */
put_buffer(pb, "\x00\x00\x00\x00", 4);
avio_write(pb, "\x00\x00\x00\x00", 4);
url_fseek(pb, pos, SEEK_SET);
......
This diff is collapsed.
......@@ -251,14 +251,14 @@ static void output_immediate(const uint8_t *data, int size,
int len = size;
if (len > 14)
len = 14;
put_byte(out, 1); /* immediate constructor */
put_byte(out, len); /* amount of valid data */
put_buffer(out, data, len);
avio_w8(out, 1); /* immediate constructor */
avio_w8(out, len); /* amount of valid data */
avio_write(out, data, len);
data += len;
size -= len;
for (; len < 14; len++)
put_byte(out, 0);
avio_w8(out, 0);
(*entries)++;
}
......@@ -267,13 +267,13 @@ static void output_immediate(const uint8_t *data, int size,
static void output_match(AVIOContext *out, int match_sample,
int match_offset, int match_len, int *entries)
{
put_byte(out, 2); /* sample constructor */
put_byte(out, 0); /* track reference */
put_be16(out, match_len);
put_be32(out, match_sample);
put_be32(out, match_offset);
put_be16(out, 1); /* bytes per block */
put_be16(out, 1); /* samples per block */
avio_w8(out, 2); /* sample constructor */
avio_w8(out, 0); /* track reference */
avio_wb16(out, match_len);
avio_wb32(out, match_sample);
avio_wb32(out, match_offset);
avio_wb16(out, 1); /* bytes per block */
avio_wb16(out, 1); /* samples per block */
(*entries)++;
}
......@@ -318,8 +318,8 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
count_pos = url_ftell(out);
/* RTPsample header */
put_be16(out, 0); /* packet count */
put_be16(out, 0); /* reserved */
avio_wb16(out, 0); /* packet count */
avio_wb16(out, 0); /* reserved */
while (size > 4) {
uint32_t packet_len = AV_RB32(data);
......@@ -354,12 +354,12 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
count++;
/* RTPpacket header */
put_be32(out, 0); /* relative_time */
put_buffer(out, data, 2); /* RTP header */
put_be16(out, seq); /* RTPsequenceseed */
put_be16(out, 0); /* reserved + flags */
avio_wb32(out, 0); /* relative_time */
avio_write(out, data, 2); /* RTP header */
avio_wb16(out, seq); /* RTPsequenceseed */
avio_wb16(out, 0); /* reserved + flags */
entries_pos = url_ftell(out);
put_be16(out, 0); /* entry count */
avio_wb16(out, 0); /* entry count */
data += 12;
size -= 12;
......@@ -373,13 +373,13 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
curpos = url_ftell(out);
url_fseek(out, entries_pos, SEEK_SET);
put_be16(out, entries);
avio_wb16(out, entries);
url_fseek(out, curpos, SEEK_SET);
}
curpos = url_ftell(out);
url_fseek(out, count_pos, SEEK_SET);
put_be16(out, count);
avio_wb16(out, count);
url_fseek(out, curpos, SEEK_SET);
return count;
}
......
......@@ -71,10 +71,10 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
static void id3v2_put_size(AVFormatContext *s, int size)
{
put_byte(s->pb, size >> 21 & 0x7f);
put_byte(s->pb, size >> 14 & 0x7f);
put_byte(s->pb, size >> 7 & 0x7f);
put_byte(s->pb, size & 0x7f);
avio_w8(s->pb, size >> 21 & 0x7f);
avio_w8(s->pb, size >> 14 & 0x7f);
avio_w8(s->pb, size >> 7 & 0x7f);
avio_w8(s->pb, size & 0x7f);
}
static int string_is_ascii(const uint8_t *str)
......@@ -104,9 +104,9 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
(!str2 || string_is_ascii(str2)))
enc = ID3v2_ENCODING_ISO8859;
put_byte(dyn_buf, enc);
avio_w8(dyn_buf, enc);
if (enc == ID3v2_ENCODING_UTF16BOM) {
put_le16(dyn_buf, 0xFEFF); /* BOM */
avio_wl16(dyn_buf, 0xFEFF); /* BOM */
put = avio_put_str16le;
} else
put = avio_put_str;
......@@ -116,10 +116,10 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
put(dyn_buf, str2);
len = url_close_dyn_buf(dyn_buf, &pb);
put_be32(s->pb, tag);
avio_wb32(s->pb, tag);
id3v2_put_size(s, len);
put_be16(s->pb, 0);
put_buffer(s->pb, pb, len);
avio_wb16(s->pb, 0);
avio_write(s->pb, pb, len);
av_freep(&pb);
return len + ID3v2_HEADER_SIZE;
......@@ -128,7 +128,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
return 0;
}
......@@ -139,7 +139,7 @@ static int mp3_write_trailer(struct AVFormatContext *s)
/* write the id3v1 tag */
if (id3v1_create_tag(s, buf) > 0) {
put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
avio_write(s->pb, buf, ID3v1_TAG_SIZE);
put_flush_packet(s->pb);
}
return 0;
......@@ -206,13 +206,13 @@ static int mp3_write_header(struct AVFormatContext *s)
ID3v2_ENCODING_UTF8;
int64_t size_pos, cur_pos;
put_be32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version));
put_byte(s->pb, 0);
put_byte(s->pb, 0); /* flags */
avio_wb32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version));
avio_w8(s->pb, 0);
avio_w8(s->pb, 0); /* flags */
/* reserve space for size */
size_pos = url_ftell(s->pb);
put_be32(s->pb, 0);
avio_wb32(s->pb, 0);
ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
if (mp3->id3v2_version == 4)
......
......@@ -493,12 +493,12 @@ static int mpeg_mux_init(AVFormatContext *ctx)
static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp)
{
put_byte(pb,
avio_w8(pb,
(id << 4) |
(((timestamp >> 30) & 0x07) << 1) |
1);
put_be16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
put_be16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1));
avio_wb16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
avio_wb16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1));
}
......@@ -618,16 +618,16 @@ static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_
MpegMuxContext *s = ctx->priv_data;
int i;
put_be32(pb, PADDING_STREAM);
put_be16(pb, packet_bytes - 6);
avio_wb32(pb, PADDING_STREAM);
avio_wb16(pb, packet_bytes - 6);
if (!s->is_mpeg2) {
put_byte(pb, 0x0f);
avio_w8(pb, 0x0f);
packet_bytes -= 7;
} else
packet_bytes -= 6;
for(i=0;i<packet_bytes;i++)
put_byte(pb, 0xff);
avio_w8(pb, 0xff);
}
static int get_nb_frames(AVFormatContext *ctx, StreamInfo *stream, int len){
......@@ -699,19 +699,19 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
size = put_system_header(ctx, buf_ptr, 0);
buf_ptr += size;
size = buf_ptr - buffer;
put_buffer(ctx->pb, buffer, size);
avio_write(ctx->pb, buffer, size);
put_be32(ctx->pb, PRIVATE_STREAM_2);
put_be16(ctx->pb, 0x03d4); // length
put_byte(ctx->pb, 0x00); // substream ID, 00=PCI
avio_wb32(ctx->pb, PRIVATE_STREAM_2);
avio_wb16(ctx->pb, 0x03d4); // length
avio_w8(ctx->pb, 0x00); // substream ID, 00=PCI
for (i = 0; i < 979; i++)
put_byte(ctx->pb, 0x00);
avio_w8(ctx->pb, 0x00);
put_be32(ctx->pb, PRIVATE_STREAM_2);
put_be16(ctx->pb, 0x03fa); // length
put_byte(ctx->pb, 0x01); // substream ID, 01=DSI
avio_wb32(ctx->pb, PRIVATE_STREAM_2);
avio_wb16(ctx->pb, 0x03fa); // length
avio_w8(ctx->pb, 0x01); // substream ID, 01=DSI
for (i = 0; i < 1017; i++)
put_byte(ctx->pb, 0x00);
avio_w8(ctx->pb, 0x00);
memset(buffer, 0, 128);
buf_ptr = buffer;
......@@ -734,7 +734,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
}
}
size = buf_ptr - buffer;
put_buffer(ctx->pb, buffer, size);
avio_write(ctx->pb, buffer, size);
packet_size = s->packet_size - size;
......@@ -839,16 +839,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
put_be32(ctx->pb, startcode);
avio_wb32(ctx->pb, startcode);
put_be16(ctx->pb, packet_size);
avio_wb16(ctx->pb, packet_size);
if (!s->is_mpeg2)
for(i=0;i<stuffing_size;i++)
put_byte(ctx->pb, 0xff);
avio_w8(ctx->pb, 0xff);
if (s->is_mpeg2) {
put_byte(ctx->pb, 0x80); /* mpeg2 id */
avio_w8(ctx->pb, 0x80); /* mpeg2 id */
pes_flags=0;
......@@ -865,8 +865,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
if (stream->packet_number == 0)
pes_flags |= 0x01;
put_byte(ctx->pb, pes_flags); /* flags */
put_byte(ctx->pb, header_len - 3 + stuffing_size);
avio_w8(ctx->pb, pes_flags); /* flags */
avio_w8(ctx->pb, header_len - 3 + stuffing_size);
if (pes_flags & 0x80) /*write pts*/
put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
......@@ -874,13 +874,13 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
put_timestamp(ctx->pb, 0x01, dts);
if (pes_flags & 0x01) { /*write pes extension*/
put_byte(ctx->pb, 0x10); /* flags */
avio_w8(ctx->pb, 0x10); /* flags */
/* P-STD buffer info */
if ((id & 0xe0) == AUDIO_ID)
put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
avio_wb16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
else
put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
avio_wb16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
}
} else {
......@@ -892,38 +892,38 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
put_timestamp(ctx->pb, 0x02, pts);
}
} else {
put_byte(ctx->pb, 0x0f);
avio_w8(ctx->pb, 0x0f);
}
}
if (s->is_mpeg2) {
/* special stuffing byte that is always written
to prevent accidental generation of start codes. */
put_byte(ctx->pb, 0xff);
avio_w8(ctx->pb, 0xff);
for(i=0;i<stuffing_size;i++)
put_byte(ctx->pb, 0xff);
avio_w8(ctx->pb, 0xff);
}
if (startcode == PRIVATE_STREAM_1) {
put_byte(ctx->pb, id);
avio_w8(ctx->pb, id);
if (id >= 0xa0) {
/* LPCM (XXX: check nb_frames) */
put_byte(ctx->pb, 7);
put_be16(ctx->pb, 4); /* skip 3 header bytes */
put_byte(ctx->pb, stream->lpcm_header[0]);
put_byte(ctx->pb, stream->lpcm_header[1]);
put_byte(ctx->pb, stream->lpcm_header[2]);
avio_w8(ctx->pb, 7);
avio_wb16(ctx->pb, 4); /* skip 3 header bytes */
avio_w8(ctx->pb, stream->lpcm_header[0]);
avio_w8(ctx->pb, stream->lpcm_header[1]);
avio_w8(ctx->pb, stream->lpcm_header[2]);
} else if (id >= 0x40) {
/* AC-3 */
put_byte(ctx->pb, nb_frames);
put_be16(ctx->pb, trailer_size+1);
avio_w8(ctx->pb, nb_frames);
avio_wb16(ctx->pb, trailer_size+1);
}
}
/* output data */
assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo));
av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer);
av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &avio_write);
stream->bytes_to_iframe -= payload_size - stuffing_size;
}else{
payload_size=
......@@ -934,7 +934,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
put_padding_packet(ctx,ctx->pb, pad_packet_bytes);
for(i=0;i<zero_trail_bytes;i++)
put_byte(ctx->pb, 0x00);
avio_w8(ctx->pb, 0x00);
put_flush_packet(ctx->pb);
......@@ -961,7 +961,7 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
int i;
for(i=0;i<s->packet_size;i++)
put_byte(ctx->pb, 0);
avio_w8(ctx->pb, 0);
s->vcd_padding_bytes_written += s->packet_size;
......@@ -1220,7 +1220,7 @@ static int mpeg_mux_end(AVFormatContext *ctx)
/* End header according to MPEG1 systems standard. We do not write
it as it is usually not needed by decoders and because it
complicates MPEG stream concatenation. */
//put_be32(ctx->pb, ISO_11172_END_CODE);
//avio_wb32(ctx->pb, ISO_11172_END_CODE);
//put_flush_packet(ctx->pb);
for(i=0;i<ctx->nb_streams;i++) {
......
......@@ -415,7 +415,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
static void section_write_packet(MpegTSSection *s, const uint8_t *packet)
{
AVFormatContext *ctx = s->opaque;
put_buffer(ctx->pb, packet, TS_PACKET_SIZE);
avio_write(ctx->pb, packet, TS_PACKET_SIZE);
}
static int mpegts_write_header(AVFormatContext *s)
......@@ -625,7 +625,7 @@ static void mpegts_insert_null_packet(AVFormatContext *s)
*q++ = 0xff;
*q++ = 0x10;
memset(q, 0x0FF, TS_PACKET_SIZE - (q - buf));
put_buffer(s->pb, buf, TS_PACKET_SIZE);
avio_write(s->pb, buf, TS_PACKET_SIZE);
}
/* Write a single transport stream packet with a PCR and no payload */
......@@ -650,7 +650,7 @@ static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st)
/* stuffing bytes */
memset(q, 0xFF, TS_PACKET_SIZE - (q - buf));
put_buffer(s->pb, buf, TS_PACKET_SIZE);
avio_write(s->pb, buf, TS_PACKET_SIZE);
}
static void write_pts(uint8_t *q, int fourbits, int64_t pts)
......@@ -844,7 +844,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
memcpy(buf + TS_PACKET_SIZE - len, payload, len);
payload += len;
payload_size -= len;
put_buffer(s->pb, buf, TS_PACKET_SIZE);
avio_write(s->pb, buf, TS_PACKET_SIZE);
}
put_flush_packet(s->pb);
}
......
......@@ -29,7 +29,7 @@ static int mpjpeg_write_header(AVFormatContext *s)
uint8_t buf1[256];
snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
put_buffer(s->pb, buf1, strlen(buf1));
avio_write(s->pb, buf1, strlen(buf1));
put_flush_packet(s->pb);
return 0;
}
......@@ -39,11 +39,11 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t buf1[256];
snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
put_buffer(s->pb, buf1, strlen(buf1));
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, buf1, strlen(buf1));
avio_write(s->pb, pkt->data, pkt->size);
snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
put_buffer(s->pb, buf1, strlen(buf1));
avio_write(s->pb, buf1, strlen(buf1));
put_flush_packet(s->pb);
return 0;
}
......
This diff is collapsed.
......@@ -254,7 +254,7 @@ static void put_str(AVIOContext *bc, const char *string){
int len= strlen(string);
ff_put_v(bc, len);
put_buffer(bc, string, len);
avio_write(bc, string, len);
}
static void put_s(AVIOContext *bc, int64_t val){
......@@ -285,16 +285,16 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in
if(forw_ptr > 4096)
init_checksum(bc, ff_crc04C11DB7_update, 0);
put_be64(bc, startcode);
avio_wb64(bc, startcode);
ff_put_v(bc, forw_ptr);
if(forw_ptr > 4096)
put_le32(bc, get_checksum(bc));
avio_wl32(bc, get_checksum(bc));
if(calculate_checksum)
init_checksum(bc, ff_crc04C11DB7_update, 0);
put_buffer(bc, dyn_buf, dyn_size);
avio_write(bc, dyn_buf, dyn_size);
if(calculate_checksum)
put_le32(bc, get_checksum(bc));
avio_wl32(bc, get_checksum(bc));
av_free(dyn_buf);
}
......@@ -366,7 +366,7 @@ static void write_mainheader(NUTContext *nut, AVIOContext *bc){
ff_put_v(bc, nut->header_count-1);
for(i=1; i<nut->header_count; i++){
ff_put_v(bc, nut->header_len[i]);
put_buffer(bc, nut->header[i], nut->header_len[i]);
avio_write(bc, nut->header[i], nut->header_len[i]);
}
}
......@@ -382,7 +382,7 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream
}
ff_put_v(bc, 4);
if (codec->codec_tag){
put_le32(bc, codec->codec_tag);
avio_wl32(bc, codec->codec_tag);
} else {
av_log(avctx, AV_LOG_ERROR, "No codec tag defined for stream %d\n", i);
return AVERROR(EINVAL);
......@@ -392,10 +392,10 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream
ff_put_v(bc, nut->stream[i].msb_pts_shift);
ff_put_v(bc, nut->stream[i].max_pts_distance);
ff_put_v(bc, codec->has_b_frames);
put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
avio_w8(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
ff_put_v(bc, codec->extradata_size);
put_buffer(bc, codec->extradata, codec->extradata_size);
avio_write(bc, codec->extradata, codec->extradata_size);
switch(codec->codec_type){
case AVMEDIA_TYPE_AUDIO:
......@@ -450,7 +450,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
ff_put_v(bc, count);
dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
put_buffer(bc, dyn_buf, dyn_size);
avio_write(bc, dyn_buf, dyn_size);
av_free(dyn_buf);
return 0;
}
......@@ -479,7 +479,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
ff_put_v(bc, count);
put_buffer(bc, dyn_buf, dyn_size);
avio_write(bc, dyn_buf, dyn_size);
}
av_free(dyn_buf);
......@@ -575,8 +575,8 @@ static int write_header(AVFormatContext *s){
build_frame_code(s);
assert(nut->frame_code['N'].flags == FLAG_INVALID);
put_buffer(bc, ID_STRING, strlen(ID_STRING));
put_byte(bc, 0);
avio_write(bc, ID_STRING, strlen(ID_STRING));
avio_w8(bc, 0);
if ((ret = write_headers(s, bc)) < 0)
return ret;
......@@ -749,7 +749,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
header_idx= fc->header_idx;
init_checksum(bc, ff_crc04C11DB7_update, 0);
put_byte(bc, frame_code);
avio_w8(bc, frame_code);
if(flags & FLAG_CODED){
ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
flags = needed_flags;
......@@ -759,10 +759,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul);
if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
if(flags & FLAG_CHECKSUM) put_le32(bc, get_checksum(bc));
if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc));
else get_checksum(bc);
put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
nus->last_flags= flags;
nus->last_pts= pkt->pts;
......
......@@ -69,7 +69,7 @@ static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc
int64_t pos = url_ftell(pb);
uint32_t checksum = get_checksum(pb);
url_fseek(pb, crc_offset, SEEK_SET);
put_be32(pb, checksum);
avio_wb32(pb, checksum);
url_fseek(pb, pos, SEEK_SET);
}
......@@ -86,16 +86,16 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
return ret;
init_checksum(pb, ff_crc04C11DB7_update, 0);
put_tag(pb, "OggS");
put_byte(pb, 0);
put_byte(pb, page->flags | extra_flags);
put_le64(pb, page->granule);
put_le32(pb, oggstream->serial_num);
put_le32(pb, oggstream->page_counter++);
avio_w8(pb, 0);
avio_w8(pb, page->flags | extra_flags);
avio_wl64(pb, page->granule);
avio_wl32(pb, oggstream->serial_num);
avio_wl32(pb, oggstream->page_counter++);
crc_offset = url_ftell(pb);
put_le32(pb, 0); // crc
put_byte(pb, page->segments_count);
put_buffer(pb, page->segments, page->segments_count);
put_buffer(pb, page->data, page->size);
avio_wl32(pb, 0); // crc
avio_w8(pb, page->segments_count);
avio_write(pb, page->segments, page->segments_count);
avio_write(pb, page->data, page->size);
ogg_update_checksum(s, pb, crc_offset);
put_flush_packet(pb);
......@@ -104,7 +104,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
if (size < 0)
return size;
put_buffer(s->pb, buf, size);
avio_write(s->pb, buf, size);
put_flush_packet(s->pb);
av_free(buf);
oggstream->page_count--;
......
......@@ -25,7 +25,7 @@
int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
{
put_buffer(s->pb, pkt->data, pkt->size);
avio_write(s->pb, pkt->data, pkt->size);
put_flush_packet(s->pb);
return 0;
}
......
......@@ -322,7 +322,7 @@ const AVCodecTag ff_codec_wav_tags[] = {
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
{
put_tag(pb, tag);
put_le32(pb, 0);
avio_wl32(pb, 0);
return url_ftell(pb);
}
......@@ -332,7 +332,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start)
pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET);
put_le32(pb, (uint32_t)(pos - start));
avio_wl32(pb, (uint32_t)(pos - start));
url_fseek(pb, pos, SEEK_SET);
}
......@@ -354,12 +354,12 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
|| av_get_bits_per_sample(enc->codec_id) > 16;
if (waveformatextensible) {
put_le16(pb, 0xfffe);
avio_wl16(pb, 0xfffe);
} else {
put_le16(pb, enc->codec_tag);
avio_wl16(pb, enc->codec_tag);
}
put_le16(pb, enc->channels);
put_le32(pb, enc->sample_rate);
avio_wl16(pb, enc->channels);
avio_wl32(pb, enc->sample_rate);
if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
bps = 0;
} else if (enc->codec_id == CODEC_ID_ADPCM_G726) {
......@@ -393,9 +393,9 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
} else {
bytespersec = enc->bit_rate / 8;
}
put_le32(pb, bytespersec); /* bytes per second */
put_le16(pb, blkalign); /* block align */
put_le16(pb, bps); /* bits per sample */
avio_wl32(pb, bytespersec); /* bytes per second */
avio_wl16(pb, blkalign); /* block align */
avio_wl16(pb, bps); /* bits per sample */
if (enc->codec_id == CODEC_ID_MP3) {
hdrsize += 12;
bytestream_put_le16(&riff_extradata, 1); /* wID */
......@@ -425,20 +425,20 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
}
if(waveformatextensible) { /* write WAVEFORMATEXTENSIBLE extensions */
hdrsize += 22;
put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
put_le16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */
put_le32(pb, enc->channel_layout); /* dwChannelMask */
put_le32(pb, enc->codec_tag); /* GUID + next 3 */
put_le32(pb, 0x00100000);
put_le32(pb, 0xAA000080);
put_le32(pb, 0x719B3800);
avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
avio_wl16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */
avio_wl32(pb, enc->channel_layout); /* dwChannelMask */
avio_wl32(pb, enc->codec_tag); /* GUID + next 3 */
avio_wl32(pb, 0x00100000);
avio_wl32(pb, 0xAA000080);
avio_wl32(pb, 0x719B3800);
} else if(riff_extradata - riff_extradata_start) {
put_le16(pb, riff_extradata - riff_extradata_start);
avio_wl16(pb, riff_extradata - riff_extradata_start);
}
put_buffer(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
if(hdrsize&1){
hdrsize++;
put_byte(pb, 0);
avio_w8(pb, 0);
}
return hdrsize;
......@@ -447,25 +447,25 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
/* BITMAPINFOHEADER header */
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
{
put_le32(pb, 40 + enc->extradata_size); /* size */
put_le32(pb, enc->width);
avio_wl32(pb, 40 + enc->extradata_size); /* size */
avio_wl32(pb, enc->width);
//We always store RGB TopDown
put_le32(pb, enc->codec_tag ? enc->height : -enc->height);
put_le16(pb, 1); /* planes */
avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height);
avio_wl16(pb, 1); /* planes */
put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
/* compression type */
put_le32(pb, enc->codec_tag);
put_le32(pb, enc->width * enc->height * 3);
put_le32(pb, 0);
put_le32(pb, 0);
put_le32(pb, 0);
put_le32(pb, 0);
avio_wl32(pb, enc->codec_tag);
avio_wl32(pb, enc->width * enc->height * 3);
avio_wl32(pb, 0);
avio_wl32(pb, 0);
avio_wl32(pb, 0);
avio_wl32(pb, 0);
put_buffer(pb, enc->extradata, enc->extradata_size);
avio_write(pb, enc->extradata, enc->extradata_size);
if (!for_asf && enc->extradata_size & 1)
put_byte(pb, 0);
avio_w8(pb, 0);
}
#endif //CONFIG_MUXERS
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -213,7 +213,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
if (!asf->pktbuf)
return AVERROR(EIO);
put_buffer(asf->pktbuf, buf + off, len - off);
avio_write(asf->pktbuf, buf + off, len - off);
url_fskip(pb, len - off);
if (!(flags & RTP_FLAG_MARKER))
return -1;
......
......@@ -68,7 +68,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0)
return ret;
}
put_buffer(data->dyn_buf, buf, len);
avio_write(data->dyn_buf, buf, len);
if (!(flags & RTP_FLAG_MARKER))
return AVERROR(EAGAIN);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment