You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
all: Use put_bytes_output() instead of put_bits_ptr - pb->buf
Avoids accessing internals of PutBitContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -252,7 +252,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
ff_mjpeg_encode_picture_trailer(&pb, header_bits);
|
ff_mjpeg_encode_picture_trailer(&pb, header_bits);
|
||||||
|
|
||||||
flush_put_bits(&pb);
|
flush_put_bits(&pb);
|
||||||
pkt->size = put_bits_ptr(&pb) - pb.buf;
|
pkt->size = put_bytes_output(&pb);
|
||||||
*got_packet = 1;
|
*got_packet = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsig
|
|||||||
encode_acs(&pb, blocks, blocks_per_slice, qmat, scan);
|
encode_acs(&pb, blocks, blocks_per_slice, qmat, scan);
|
||||||
|
|
||||||
flush_put_bits(&pb);
|
flush_put_bits(&pb);
|
||||||
return put_bits_ptr(&pb) - pb.buf;
|
return put_bytes_output(&pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx,
|
static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx,
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
put_bits(&s->pb, 8, 'N');
|
put_bits(&s->pb, 8, 'N');
|
||||||
|
|
||||||
flush_put_bits(&s->pb);
|
flush_put_bits(&s->pb);
|
||||||
av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align);
|
av_assert0(put_bytes_output(&s->pb) == avctx->block_align);
|
||||||
|
|
||||||
if (frame->pts != AV_NOPTS_VALUE)
|
if (frame->pts != AV_NOPTS_VALUE)
|
||||||
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
|
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ static int put_pack_header(AVFormatContext *ctx, uint8_t *buf,
|
|||||||
put_bits(&pb, 3, 0); /* stuffing length */
|
put_bits(&pb, 3, 0); /* stuffing length */
|
||||||
}
|
}
|
||||||
flush_put_bits(&pb);
|
flush_put_bits(&pb);
|
||||||
return put_bits_ptr(&pb) - pb.buf;
|
return put_bytes_output(&pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int put_system_header(AVFormatContext *ctx, uint8_t *buf,
|
static int put_system_header(AVFormatContext *ctx, uint8_t *buf,
|
||||||
@@ -270,7 +270,7 @@ static int put_system_header(AVFormatContext *ctx, uint8_t *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
flush_put_bits(&pb);
|
flush_put_bits(&pb);
|
||||||
size = put_bits_ptr(&pb) - pb.buf;
|
size = put_bytes_output(&pb);
|
||||||
/* patch packet size */
|
/* patch packet size */
|
||||||
AV_WB16(buf + 4, size - 6);
|
AV_WB16(buf + 4, size - 6);
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ static void put_swf_rect(AVIOContext *pb,
|
|||||||
put_bits(&p, nbits, ymax & mask);
|
put_bits(&p, nbits, ymax & mask);
|
||||||
|
|
||||||
flush_put_bits(&p);
|
flush_put_bits(&p);
|
||||||
avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
|
avio_write(pb, buf, put_bytes_output(&p));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
|
static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
|
||||||
@@ -189,7 +189,7 @@ static void put_swf_matrix(AVIOContext *pb,
|
|||||||
put_bits(&p, nbits, ty);
|
put_bits(&p, nbits, ty);
|
||||||
|
|
||||||
flush_put_bits(&p);
|
flush_put_bits(&p);
|
||||||
avio_write(pb, buf, put_bits_ptr(&p) - p.buf);
|
avio_write(pb, buf, put_bytes_output(&p));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int swf_write_header(AVFormatContext *s)
|
static int swf_write_header(AVFormatContext *s)
|
||||||
@@ -323,7 +323,7 @@ static int swf_write_header(AVFormatContext *s)
|
|||||||
put_bits(&p, 5, 0);
|
put_bits(&p, 5, 0);
|
||||||
|
|
||||||
flush_put_bits(&p);
|
flush_put_bits(&p);
|
||||||
avio_write(pb, buf1, put_bits_ptr(&p) - p.buf);
|
avio_write(pb, buf1, put_bytes_output(&p));
|
||||||
|
|
||||||
put_swf_end_tag(s);
|
put_swf_end_tag(s);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user