Exemplo n.º 1
0
G_GNUC_INTERNAL
void stream_h264_data(display_stream *st)
{
	int width, height;
	uint8_t *data;
	int size = stream_get_current_frame(st, &data);

	stream_get_dimensions(st, &width, &height);

	if(st->stream_width != width || st->stream_height != height) {
		st->stream_width = width;
		st->stream_height = height;

		stream_h264_finit(st);
		stream_h264_init(st);	

		st->rgba_buf = g_malloc0(st->stream_width * st->stream_height * 4);
	}

	st->out_frame = st->rgba_buf;

	av_init_packet(&st->packet);
	st->packet.data = data;
	st->packet.size = size;
	decode_packet(st, width, height);
	av_free_packet(&st->packet);
}
static void mjpeg_src_init(struct jpeg_decompress_struct *cinfo)
{
    display_stream *st = SPICE_CONTAINEROF(cinfo->src, display_stream, mjpeg_src);
    uint8_t *data;

    cinfo->src->bytes_in_buffer = stream_get_current_frame(st, &data);
    cinfo->src->next_input_byte = data;
}