Commit 77eb5504 authored by Anton Khirnov's avatar Anton Khirnov Committed by Ronald S. Bultje

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: default avatarRonald S. Bultje <rsbultje@gmail.com>
parent 78e2380a
......@@ -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);