Skip to content

Commit

Permalink
avio: avio: avio_ prefixes for put_* functions
Browse files Browse the repository at this point in the history
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: Ronald S. Bultje <[email protected]>
  • Loading branch information
elenril authored and rbultje committed Feb 21, 2011
1 parent 78e2380 commit 77eb550
Show file tree
Hide file tree
Showing 59 changed files with 1,787 additions and 1,752 deletions.
6 changes: 3 additions & 3 deletions ffserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
12 changes: 6 additions & 6 deletions libavformat/a64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions libavformat/adtsenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 18 additions & 18 deletions libavformat/aiffenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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);

Expand All @@ -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;
}

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/amr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 77eb550

Please sign in to comment.