From fb53b4a035c3682f5a8ab4241bde797ced539945 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 13 Apr 2009 16:59:38 +0000 Subject: [PATCH] Rename pbBufPtr() to put_bits_ptr(). The new name is more readable and consistent with the FFmpeg naming style. Originally committed as revision 18497 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3enc.c | 4 ++-- libavcodec/bitstream.c | 2 +- libavcodec/gif.c | 6 +++--- libavcodec/h261enc.c | 2 +- libavcodec/h263.c | 4 ++-- libavcodec/ljpegenc.c | 2 +- libavcodec/mjpegenc.c | 6 +++--- libavcodec/mpegaudioenc.c | 2 +- libavcodec/mpegvideo_enc.c | 8 ++++---- libavcodec/put_bits.h | 2 +- libavcodec/wmaenc.c | 2 +- libavformat/gif.c | 6 +++--- libavformat/mpegenc.c | 4 ++-- libavformat/swfenc.c | 6 +++--- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index c00d9d63ba..e851cdbc5c 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1117,10 +1117,10 @@ static int output_frame_end(AC3EncodeContext *s) flush_put_bits(&s->pb); /* add zero bytes to reach the frame size */ frame = s->pb.buf; - n = 2 * s->frame_size - (pbBufPtr(&s->pb) - frame) - 2; + n = 2 * s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2; assert(n >= 0); if(n>0) - memset(pbBufPtr(&s->pb), 0, n); + memset(put_bits_ptr(&s->pb), 0, n); /* Now we must compute both crcs : this is not so easy for crc1 because it is at the beginning of the data... */ diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 267fc818ec..efb5a3bfdb 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -91,7 +91,7 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) for(i=0; put_bits_count(pb)&31; i++) put_bits(pb, 8, src[i]); flush_put_bits(pb); - memcpy(pbBufPtr(pb), src+i, 2*words-i); + memcpy(put_bits_ptr(pb), src+i, 2*words-i); skip_put_bytes(pb, 2*words-i); } diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 6ab00e14ee..8cd51c5b74 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -126,9 +126,9 @@ static int gif_image_write_image(uint8_t **bytestream, put_bits(&p, 9, 0x101); /* end of stream */ flush_put_bits(&p); } - if(pbBufPtr(&p) - p.buf > 0) { - bytestream_put_byte(bytestream, pbBufPtr(&p) - p.buf); /* byte count of the packet */ - bytestream_put_buffer(bytestream, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */ + if(put_bits_ptr(&p) - p.buf > 0) { + bytestream_put_byte(bytestream, put_bits_ptr(&p) - p.buf); /* byte count of the packet */ + bytestream_put_buffer(bytestream, 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; diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index f24068820a..6a8565c509 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -55,7 +55,7 @@ void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number){ align_put_bits(&s->pb); /* Update the pointer to last GOB */ - s->ptr_lastgob = pbBufPtr(&s->pb); + s->ptr_lastgob = put_bits_ptr(&s->pb); put_bits(&s->pb, 20, 0x10); /* PSC */ diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 2a945c6eda..6e6d156866 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -245,7 +245,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number) align_put_bits(&s->pb); /* Update the pointer to last GOB */ - s->ptr_lastgob = pbBufPtr(&s->pb); + s->ptr_lastgob = put_bits_ptr(&s->pb); put_bits(&s->pb, 22, 0x20); /* PSC */ temp_ref= s->picture_number * (int64_t)coded_frame_rate * s->avctx->time_base.num / //FIXME use timestamp (coded_frame_rate_base * (int64_t)s->avctx->time_base.den); @@ -3053,7 +3053,7 @@ static inline void memsetw(short *tab, int val, int n) void ff_mpeg4_init_partitions(MpegEncContext *s) { - uint8_t *start= pbBufPtr(&s->pb); + uint8_t *start= put_bits_ptr(&s->pb); uint8_t *end= s->pb.buf_end; int size= end - start; int pb_size = (((intptr_t)start + size/3)&(~3)) - (intptr_t)start; diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index e53e07920f..6c9f058dce 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -181,7 +181,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in s->picture_number++; flush_put_bits(&s->pb); - return pbBufPtr(&s->pb) - s->pb.buf; + return put_bits_ptr(&s->pb) - s->pb.buf; // return (put_bits_count(&f->pb)+7)/8; } diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index bfab7cdcd4..8369e9c946 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -135,7 +135,7 @@ static void jpeg_table_header(MpegEncContext *s) /* huffman table */ put_marker(p, DHT); flush_put_bits(p); - ptr = pbBufPtr(p); + ptr = put_bits_ptr(p); put_bits(p, 16, 0); /* patched later */ size = 2; size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance, @@ -174,7 +174,7 @@ static void jpeg_put_comments(MpegEncContext *s) if(!(s->flags & CODEC_FLAG_BITEXACT)){ put_marker(p, COM); flush_put_bits(p); - ptr = pbBufPtr(p); + ptr = put_bits_ptr(p); put_bits(p, 16, 0); /* patched later */ ff_put_string(p, LIBAVCODEC_IDENT, 1); size = strlen(LIBAVCODEC_IDENT)+3; @@ -186,7 +186,7 @@ static void jpeg_put_comments(MpegEncContext *s) ||s->avctx->pix_fmt == PIX_FMT_YUV444P){ put_marker(p, COM); flush_put_bits(p); - ptr = pbBufPtr(p); + ptr = put_bits_ptr(p); put_bits(p, 16, 0); /* patched later */ ff_put_string(p, "CS=ITU601", 1); size = strlen("CS=ITU601")+3; diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 50a7b35120..de3081e2bf 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -781,7 +781,7 @@ static int MPA_encode_frame(AVCodecContext *avctx, encode_frame(s, bit_alloc, padding); s->nb_samples += MPA_FRAME_SIZE; - return pbBufPtr(&s->pb) - s->pb.buf; + return put_bits_ptr(&s->pb) - s->pb.buf; } static av_cold int MPA_encode_close(AVCodecContext *avctx) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 2500a410c6..cca2f7fe05 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1321,7 +1321,7 @@ vbv_retry: s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; }else{ - assert((pbBufPtr(&s->pb) == s->pb.buf)); + assert((put_bits_ptr(&s->pb) == s->pb.buf)); s->frame_bits=0; } assert((s->frame_bits&7)==0); @@ -2111,7 +2111,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ } assert((put_bits_count(&s->pb)&7) == 0); - current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; + current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; @@ -2121,7 +2121,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ #ifndef ALT_BITSTREAM_WRITER s->pb.buf_ptr= s->ptr_lastgob; #endif - assert(pbBufPtr(&s->pb) == s->ptr_lastgob); + assert(put_bits_ptr(&s->pb) == s->ptr_lastgob); } } @@ -2603,7 +2603,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ /* Send the last GOB if RTP */ if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; - pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; + pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob; /* Call the RTP callback to send the last GOB */ emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index 32b11f6445..2009a2be23 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -263,7 +263,7 @@ static inline void put_sbits(PutBitContext *pb, int bits, int32_t val) * Returns the pointer to the byte where the bitstream writer will put * the next bit. */ -static inline uint8_t* pbBufPtr(PutBitContext *s) +static inline uint8_t* put_bits_ptr(PutBitContext *s) { #ifdef ALT_BITSTREAM_WRITER return s->buf + (s->index>>3); diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 4977ab2a1e..a8ba6b0b66 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -380,7 +380,7 @@ static int encode_superframe(AVCodecContext *avctx, put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); - return pbBufPtr(&s->pb) - s->pb.buf; + return put_bits_ptr(&s->pb) - s->pb.buf; } AVCodec wmav1_encoder = diff --git a/libavformat/gif.c b/libavformat/gif.c index 7ac9499577..2b802a9dca 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -232,9 +232,9 @@ static int gif_image_write_image(ByteIOContext *pb, put_bits(&p, 9, 0x101); /* end of stream */ flush_put_bits(&p); } - if(pbBufPtr(&p) - p.buf > 0) { - put_byte(pb, pbBufPtr(&p) - p.buf); /* byte count of the packet */ - put_buffer(pb, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */ + 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 */ p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */ } left-=GIF_CHUNKS; diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 11a2deb033..8665030421 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -114,7 +114,7 @@ static int put_pack_header(AVFormatContext *ctx, put_bits(&pb, 3, 0); /* stuffing length */ } flush_put_bits(&pb); - return pbBufPtr(&pb) - pb.buf; + return put_bits_ptr(&pb) - pb.buf; } static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_stream_id) @@ -256,7 +256,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_str } flush_put_bits(&pb); - size = pbBufPtr(&pb) - pb.buf; + size = put_bits_ptr(&pb) - pb.buf; /* patch packet size */ buf[4] = (size - 6) >> 8; buf[5] = (size - 6) & 0xff; diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index a8556c85e4..af5da4ab3f 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -102,7 +102,7 @@ static void put_swf_rect(ByteIOContext *pb, put_bits(&p, nbits, ymax & mask); flush_put_bits(&p); - put_buffer(pb, buf, pbBufPtr(&p) - p.buf); + put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); } static void put_swf_line_edge(PutBitContext *pb, int dx, int dy) @@ -167,7 +167,7 @@ static void put_swf_matrix(ByteIOContext *pb, put_bits(&p, nbits, ty); flush_put_bits(&p); - put_buffer(pb, buf, pbBufPtr(&p) - p.buf); + put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); } static int swf_write_header(AVFormatContext *s) @@ -293,7 +293,7 @@ static int swf_write_header(AVFormatContext *s) put_bits(&p, 5, 0); flush_put_bits(&p); - put_buffer(pb, buf1, pbBufPtr(&p) - p.buf); + put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf); put_swf_end_tag(s); }