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
release/0.6
Stefano Sabatini 16 years ago
parent 084c7cc54a
commit fb53b4a035
  1. 4
      libavcodec/ac3enc.c
  2. 2
      libavcodec/bitstream.c
  3. 6
      libavcodec/gif.c
  4. 2
      libavcodec/h261enc.c
  5. 4
      libavcodec/h263.c
  6. 2
      libavcodec/ljpegenc.c
  7. 6
      libavcodec/mjpegenc.c
  8. 2
      libavcodec/mpegaudioenc.c
  9. 8
      libavcodec/mpegvideo_enc.c
  10. 2
      libavcodec/put_bits.h
  11. 2
      libavcodec/wmaenc.c
  12. 6
      libavformat/gif.c
  13. 4
      libavformat/mpegenc.c
  14. 6
      libavformat/swfenc.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... */

@ -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);
}

@ -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;

@ -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 */

@ -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;

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

@ -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;

@ -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)

@ -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);

@ -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);

@ -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 =

@ -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;

@ -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;

@ -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);
}

Loading…
Cancel
Save