Skip to content

Commit b98beb3

Browse files
committed
all: Use put_bytes_output() instead of put_bits_ptr - pb->buf
Avoids accessing internals of PutBitContext. Signed-off-by: Andreas Rheinhardt <[email protected]>
1 parent 0971fcf commit b98beb3

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

libavcodec/ljpegenc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
252252
ff_mjpeg_encode_picture_trailer(&pb, header_bits);
253253

254254
flush_put_bits(&pb);
255-
pkt->size = put_bits_ptr(&pb) - pb.buf;
255+
pkt->size = put_bytes_output(&pb);
256256
*got_packet = 1;
257257

258258
return 0;

libavcodec/proresenc_anatoliy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsig
382382
encode_acs(&pb, blocks, blocks_per_slice, qmat, scan);
383383

384384
flush_put_bits(&pb);
385-
return put_bits_ptr(&pb) - pb.buf;
385+
return put_bytes_output(&pb);
386386
}
387387

388388
static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx,

libavcodec/wmaenc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
425425
put_bits(&s->pb, 8, 'N');
426426

427427
flush_put_bits(&s->pb);
428-
av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align);
428+
av_assert0(put_bytes_output(&s->pb) == avctx->block_align);
429429

430430
if (frame->pts != AV_NOPTS_VALUE)
431431
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);

libavformat/mpegenc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int put_pack_header(AVFormatContext *ctx, uint8_t *buf,
125125
put_bits(&pb, 3, 0); /* stuffing length */
126126
}
127127
flush_put_bits(&pb);
128-
return put_bits_ptr(&pb) - pb.buf;
128+
return put_bytes_output(&pb);
129129
}
130130

131131
static int put_system_header(AVFormatContext *ctx, uint8_t *buf,
@@ -270,7 +270,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,
270270
}
271271

272272
flush_put_bits(&pb);
273-
size = put_bits_ptr(&pb) - pb.buf;
273+
size = put_bytes_output(&pb);
274274
/* patch packet size */
275275
AV_WB16(buf + 4, size - 6);
276276

libavformat/swfenc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void put_swf_rect(AVIOContext *pb,
124124
put_bits(&p, nbits, ymax & mask);
125125

126126
flush_put_bits(&p);
127-
avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
127+
avio_write(pb, buf, put_bytes_output(&p));
128128
}
129129

130130
static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
@@ -189,7 +189,7 @@ static void put_swf_matrix(AVIOContext *pb,
189189
put_bits(&p, nbits, ty);
190190

191191
flush_put_bits(&p);
192-
avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
192+
avio_write(pb, buf, put_bytes_output(&p));
193193
}
194194

195195
static int swf_write_header(AVFormatContext *s)
@@ -323,7 +323,7 @@ static int swf_write_header(AVFormatContext *s)
323323
put_bits(&p, 5, 0);
324324

325325
flush_put_bits(&p);
326-
avio_write(pb, buf1, put_bits_ptr(&p) - p.buf);
326+
avio_write(pb, buf1, put_bytes_output(&p));
327327

328328
put_swf_end_tag(s);
329329
}

0 commit comments

Comments
 (0)