summaryrefslogtreecommitdiffstats
path: root/remoting/proto/video.proto
blob: 394f8912e1ff4a13197149e65d1c174e9c521d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Protocol for video messages.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package remoting;

// TODO(ajwong): Determine if these fields should be optional or required.
message VideoPacketFormat {
  // Identifies how the image was encoded.
  enum Encoding {
    ENCODING_INVALID = -1;
    ENCODING_VERBATIM = 0;
    ENCODING_ZLIB = 1;
    ENCODING_VP8 = 2;
  };

  // X,Y coordinates (in screen pixels) for origin of this update.
  optional int32 x = 1;
  optional int32 y = 2;

  // Width, height (in screen pixels) for this update.
  optional int32 width = 3;
  optional int32 height = 4;

  // The encoding used for this image update.
  optional Encoding encoding = 5 [default = ENCODING_INVALID];
}

message VideoPacket {
  // Bitmasks for use in the flags field below.
  //
  // The encoder may fragment one update into multiple partitions.
  // Each partition may be divided into multiple packets depending on
  // how the encoder outputs data. Thus, one update can logically
  // consist of multiple packets. The FIRST_PACKET and LAST_PACKET
  // flags are used to indicate the start and end of a partition. The
  // LAST_PARTITION flag is set for the last packet in the last
  // partition. Here are notable consequences:
  //  * Both FIRST_PACKET and LAST_PACKET may be set if an update is only
  //    one packet long.
  //  * The VideoPacketFormat is only supplied in a FIRST_PACKET.
  //  * LAST_PARTITION can be set only in packet that has LAST_PACKET set.
  //  * An local update cannot change format between a FIRST_PACKET and
  //    a LAST_PACKET.
  //  * All packets in one logical update must be processed in order, and
  //    packets may not be skipped.
  enum Flags {
    FIRST_PACKET = 1;
    LAST_PACKET = 2;
    LAST_PARTITION = 4;
  }
  optional int32 flags = 1 [default = 0];

  // The sequence number of the partial data for updating a rectangle.
  optional int32 sequence_number = 2 [default = 0];

  optional int32 timestamp = 3 [default = 0];

  // This is provided on the first packet of the rectangle data, when
  // the flags has FIRST_PACKET set.
  optional VideoPacketFormat format = 4;

  optional bytes data = 5;
}