add continuation packet

Add continuation type packet that would make it possible to send
commands using a piece of shared memory.
This commit is contained in:
Wim Taymans 2015-08-31 17:10:44 +02:00
parent 8d1ad2ea63
commit fd276b4820
2 changed files with 31 additions and 13 deletions

View file

@ -55,18 +55,27 @@ Wire
Fixed header Fixed header
<version> : 4 bytes : total message length <version> : 4 bytes : message version
<length> : 4 bytes : total message length <length> : 4 bytes : total message length
Followed by 1 or more type-length-data sections Followed by 1 or more type-length-data sections
<type> : 1 byte <type> : 1 byte
<length> : variable length, 7 bits, hight bit is continuation marker <length> : variable length, 7 bits, high bit is continuation marker
<data> : <length> bytes, see below for contents based on <type> <data> : <length> bytes, see below for contents based on <type>
Types: Types:
1: header 1: continuation section
Rest of the commands can be found in the shared memory region at
@offset and @size. A shared memory region is negotiated when the client
connects to the server.
<offset> : 8 bytes : offset
<size> : 8 bytes : size
2: header
Header for payload Header for payload
@ -75,27 +84,33 @@ Types:
<pts> : 8 bytes : presentation time <pts> : 8 bytes : presentation time
<dts-offset> : 8 bytes : dts-offset <dts-offset> : 8 bytes : dts-offset
2: fd-payload section 3: fd-payload section
Used to send a buffer between client and server. Used to send a block of data between client and server. The type of fd and
the possible operations on it are negotiated when the client connects.
<id> : 4 bytes : id of the fd-payload <id> : 4 bytes : id of the fd-payload
<offset> : 8 bytes : offset <offset> : 8 bytes : offset
<size> : 8 bytes : size <size> : 8 bytes : size
<fd-index> : 4 bytes : index of fd <fd-index> : 4 bytes : index of fd
3: release fd-payload 4: release fd-payload
Release a fd-payload with <id> Release a fd-payload with <id>
<id> : 4 bytes : the id number of the released fd-payload <id> : 4 bytes : the id number of the released fd-payload
4: format change 5: format change
Perform an in-band format change. The following data blocks will be in this
new format.
<format-id> : 1 byte : format id <format-id> : 1 byte : format id
<format> : 0-terminated : contains serialized format <format> : 0-terminated : contains serialized format
5: property changes 6: property changes
Notify a property change.
<key> : 0-terminated : key <key> : 0-terminated : key
<value> : 0-terminated : value <value> : 0-terminated : value

View file

@ -56,6 +56,8 @@ gpointer pinos_buffer_steal (PinosBuffer *buffer,
/** /**
* PinosPacketType: * PinosPacketType:
* @PINOS_PACKET_TYPE_INVALID: invalid packet type, ignore * @PINOS_PACKET_TYPE_INVALID: invalid packet type, ignore
* @PINOS_PACKET_TYPE_CONTINUATION: continuation packet, used internally to send
* commands using a shared memory region.
* @PINOS_PACKET_TYPE_HEADER: common packet header * @PINOS_PACKET_TYPE_HEADER: common packet header
* @PINOS_PACKET_TYPE_FD_PAYLOAD: packet contains fd-payload. An fd-payload contains * @PINOS_PACKET_TYPE_FD_PAYLOAD: packet contains fd-payload. An fd-payload contains
* the media data as a file descriptor * the media data as a file descriptor
@ -69,11 +71,12 @@ gpointer pinos_buffer_steal (PinosBuffer *buffer,
typedef enum { typedef enum {
PINOS_PACKET_TYPE_INVALID = 0, PINOS_PACKET_TYPE_INVALID = 0,
PINOS_PACKET_TYPE_HEADER = 1, PINOS_PACKET_TYPE_CONTINUATION = 1,
PINOS_PACKET_TYPE_FD_PAYLOAD = 2, PINOS_PACKET_TYPE_HEADER = 2,
PINOS_PACKET_TYPE_RELEASE_FD_PAYLOAD = 3, PINOS_PACKET_TYPE_FD_PAYLOAD = 3,
PINOS_PACKET_TYPE_FORMAT_CHANGE = 4, PINOS_PACKET_TYPE_RELEASE_FD_PAYLOAD = 4,
PINOS_PACKET_TYPE_PROPERTY_CHANGE = 5, PINOS_PACKET_TYPE_FORMAT_CHANGE = 5,
PINOS_PACKET_TYPE_PROPERTY_CHANGE = 6,
} PinosPacketType; } PinosPacketType;