diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-02-21 19:28:17 +0100 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-02-21 14:25:15 -0500 |
commit | 77eb5504d3b3e1047900382350e0bc5e0bfb16b5 (patch) | |
tree | adb31feb8accd7dbaaa2ce1baf48fee96664abe1 /libavformat/mpegenc.c | |
parent | 78e2380a6d09e7a8b2a74d090abfb0a922e046f6 (diff) | |
download | ffmpeg-77eb5504d3b3e1047900382350e0bc5e0bfb16b5.tar.gz |
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: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/mpegenc.c')
-rw-r--r-- | libavformat/mpegenc.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index e5ee32d276..8c5c644f42 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -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++) { |