struct VectorDestinationManager {
jpeg_destination_mgr pub;
- std::vector<uint8_t> dest;
+ string dest;
VectorDestinationManager()
{
{
dest.resize(bytes_used + 4096);
dest.resize(dest.capacity());
- pub.next_output_byte = dest.data() + bytes_used;
+ pub.next_output_byte = (uint8_t *)dest.data() + bytes_used;
pub.free_in_buffer = dest.size() - bytes_used;
}
};
static_assert(std::is_standard_layout<VectorDestinationManager>::value, "");
-vector<uint8_t> encode_jpeg(const uint8_t *y_data, const uint8_t *cb_data, const uint8_t *cr_data, unsigned width, unsigned height)
+string encode_jpeg(const uint8_t *y_data, const uint8_t *cb_data, const uint8_t *cr_data, unsigned width, unsigned height)
{
VectorDestinationManager dest;
pkt.size = jpeg.size();
pkt.flags = AV_PKT_FLAG_KEY;
mux->add_packet(pkt, qf.output_pts, qf.output_pts);
-
- last_frame.assign(&jpeg[0], &jpeg[0] + jpeg.size());
+ last_frame = move(jpeg);
} else if (qf.type == QueuedFrame::FADED) {
glClientWaitSync(qf.fence.get(), /*flags=*/0, GL_TIMEOUT_IGNORED);
shared_ptr<Frame> frame = frame_from_pbo(qf.resources->pbo_contents, global_flags.width, global_flags.height);
// Now JPEG encode it, and send it on to the stream.
- vector<uint8_t> jpeg = encode_jpeg(frame->y.get(), frame->cb.get(), frame->cr.get(), global_flags.width, global_flags.height);
+ string jpeg = encode_jpeg(frame->y.get(), frame->cb.get(), frame->cr.get(), global_flags.width, global_flags.height);
AVPacket pkt;
av_init_packet(&pkt);
}
// Now JPEG encode it, and send it on to the stream.
- vector<uint8_t> jpeg = encode_jpeg(frame->y.get(), frame->cb.get(), frame->cr.get(), global_flags.width, global_flags.height);
+ string jpeg = encode_jpeg(frame->y.get(), frame->cb.get(), frame->cr.get(), global_flags.width, global_flags.height);
if (qf.flow_tex != 0) {
compute_flow->release_texture(qf.flow_tex);
}