changeset 9431:932543edc1d2 libavcodec

Rename pbBufPtr() to put_bits_ptr(). The new name is more readable and consistent with the FFmpeg naming style.
author stefano
date Mon, 13 Apr 2009 16:59:38 +0000
parents e806d2145e72
children c9fda17dc042
files ac3enc.c bitstream.c gif.c h261enc.c h263.c ljpegenc.c mjpegenc.c mpegaudioenc.c mpegvideo_enc.c put_bits.h wmaenc.c
diffstat 11 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ac3enc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/ac3enc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -1117,10 +1117,10 @@
     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... */
--- a/bitstream.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/bitstream.c	Mon Apr 13 16:59:38 2009 +0000
@@ -91,7 +91,7 @@
         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);
     }
 
--- a/gif.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/gif.c	Mon Apr 13 16:59:38 2009 +0000
@@ -126,9 +126,9 @@
             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;
--- a/h261enc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/h261enc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -55,7 +55,7 @@
     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 */
 
--- a/h263.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/h263.c	Mon Apr 13 16:59:38 2009 +0000
@@ -245,7 +245,7 @@
     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 @@
 
 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;
--- a/ljpegenc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/ljpegenc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -181,7 +181,7 @@
     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;
 }
 
--- a/mjpegenc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/mjpegenc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -135,7 +135,7 @@
     /* 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 @@
     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 @@
        ||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;
--- a/mpegaudioenc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/mpegaudioenc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -781,7 +781,7 @@
     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)
--- a/mpegvideo_enc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/mpegvideo_enc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -1321,7 +1321,7 @@
         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 @@
                     }
 
                     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 @@
 #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 @@
     /* 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);
--- a/put_bits.h	Mon Apr 13 16:47:17 2009 +0000
+++ b/put_bits.h	Mon Apr 13 16:59:38 2009 +0000
@@ -263,7 +263,7 @@
  * 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);
--- a/wmaenc.c	Mon Apr 13 16:47:17 2009 +0000
+++ b/wmaenc.c	Mon Apr 13 16:59:38 2009 +0000
@@ -380,7 +380,7 @@
         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 =