Re: [RFC PATCH 1/2] EXPERIMENTAL protocol to send streams to server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> ---
>  spice/Makefile.am     |  1 +
>  spice/stream-device.h | 79
>  +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+)
>  create mode 100644 spice/stream-device.h
> 
> diff --git a/spice/Makefile.am b/spice/Makefile.am
> index a54ae89..4f9a607 100644
> --- a/spice/Makefile.am
> +++ b/spice/Makefile.am
> @@ -19,6 +19,7 @@ spice_protocol_include_HEADERS =		\
>  	types.h					\
>  	vd_agent.h				\
>  	vdi_dev.h				\
> +	stream-device.h				\
>  	$(NULL)
>  
>  -include $(top_srcdir)/git.mk
> diff --git a/spice/stream-device.h b/spice/stream-device.h

Victor on IRC commented than the name is perhaps not
that fine.
I don't have a better suggestion.

> new file mode 100644
> index 0000000..3ecbee4
> --- /dev/null
> +++ b/spice/stream-device.h
> @@ -0,0 +1,79 @@
> +/*
> +   Copyright (C) 2017 Red Hat, Inc.
> +
> +   This library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with this library; if not, see
> <http://www.gnu.org/licenses/>.
> +*/
> +
> +/*
> + * This header contains definition for the device that
> + * allows to send streamed data to the server.
> + */
> +
> +#ifndef SPICE_STREAM_DEVICE_H_
> +#define SPICE_STREAM_DEVICE_H_
> +
> +#include <spice/types.h>
> +
> +/*
> + * The structure are all "naturally aligned"
> + * containing integers up to 64 bit.
> + * All numbers are in little endian format.
> + */
> +

This is a bit different from the standard way we encode
the protocol but is more optimal as all fields are
already aligned.
Considering that's also a local protocol the small
amount of bytes added for padding are not that expensive.

> +#define STREAM_DEVICE_PROTOCOL 1
> +
> +typedef struct StreamDevHeader
> +{
> +    uint8_t protocol_version;
> +    uint8_t padding;
> +    /* as defined in StreamDevType enumeration */
> +    uint16_t type;
> +    uint32_t size;
> +} StreamDevHeader;
> +
> +typedef enum StreamDevType {
> +    /* invalid, do not use */
> +    STREAM_TYPE_INVALID = 0,
> +    /* allows to send version information */
> +    STREAM_TYPE_CAPABILITIES,
> +    /* send screen resolution */
> +    STREAM_TYPE_STREAM_FORMAT,

Perhaps too much STREAMs here.

> +    /* stream data */
> +    STREAM_TYPE_DATA,
> +} StreamDevType;
> +
> +/* generic extension capabilities */

Still not used... not clear what should be in here.

> +typedef struct StreamMsgCapabilities
> +{
> +    uint32_t num_capabilities;
> +    uint32_t capabilities[0];
> +} StreamMsgCapabilities;
> +
> +/* define the format of the stream, start a new stream */

This message is only guest -> host.

> +typedef struct StreamMsgStreamFormat
> +{
> +    uint32_t width;
> +    uint32_t height;
> +    /* as defined in SpiceVideoCodecType enumeration */
> +    uint8_t codec;
> +    uint8_t padding1[3];
> +} StreamMsgStreamFormat;
> +
> +/* this message contains just raw data */
> +typedef struct StreamMsgData
> +{
> +    uint8_t data[0];
> +} StreamMsgData;
> +
> +#endif /* SPICE_STREAM_DEVICE_H_ */

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]