OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 |
5 // Protocol for event messages. | 5 // Protocol for event messages. |
6 | 6 |
7 syntax = "proto2"; | 7 syntax = "proto2"; |
8 | 8 |
9 option optimize_for = LITE_RUNTIME; | 9 option optimize_for = LITE_RUNTIME; |
10 | 10 |
11 package remoting; | 11 package remoting; |
12 | 12 |
13 // A message that gets sent to the client after the client is connected to the | |
14 // host. It contains information that the client needs to know about the host. | |
15 // NEXT ID: 3 | |
16 message InitClientMessage { | |
17 required int32 width = 1; | |
18 required int32 height = 2; | |
19 } | |
20 | |
21 // A message to denote the beginning of an update stream. It will be followed | |
22 // by 0 or more UpdateStreamPacketMessages and then a EndUpdateStreamMessage. | |
23 // NEXT ID: 1 | |
24 message BeginUpdateStreamMessage { | |
25 } | |
26 | |
27 // A message to denote the end of an update stream. | |
28 // NEXT ID: 1 | |
29 message EndUpdateStreamMessage { | |
30 } | |
31 | |
32 // Identifies how the image was encoded. | |
33 enum UpdateStreamEncoding { | |
34 EncodingInvalid = -1; | |
35 EncodingNone = 0; | |
36 EncodingZlib = 1; | |
37 EncodingVp8 = 2; | |
38 } | |
39 | |
40 // Identifies the pixel format. | |
41 // Note that this list should match exactly the same as | |
42 // media::VideoFrame::Format in media/base/video_frame.h. | |
43 enum PixelFormat { | |
44 PixelFormatInvalid = 0; | |
45 PixelFormatRgb555 = 1; | |
46 PixelFormatRgb565 = 2; | |
47 PixelFormatRgb24 = 3; | |
48 PixelFormatRgb32 = 4; | |
49 PixelFormatRgba = 5; | |
50 PixelFormatYv12 = 6; | |
51 PixelFormatYv16 = 7; | |
52 PixelFormatNv12 = 8; | |
53 PixelFormatEmpty = 9; | |
54 PixelFormatAscii = 10; | |
55 } | |
56 | |
57 // A message that denotes the beginning of an updating rectangle in an update | |
58 // stream packet. | |
59 // NEXT ID: 6 | |
60 message UpdateStreamBeginRect { | |
61 // X,Y coordinates (in screen pixels) for origin of this update. | |
62 required int32 x = 1; | |
63 required int32 y = 2; | |
64 | |
65 // Width, height (in screen pixels) for this update. | |
66 required int32 width = 3; | |
67 required int32 height = 4; | |
68 | |
69 // The encoding used for this image update. | |
70 optional UpdateStreamEncoding encoding = 5 [default=EncodingNone]; | |
71 | |
72 // The pixel format of this image. | |
73 optional PixelFormat pixel_format = 6 [default=PixelFormatRgb24]; | |
74 } | |
75 | |
76 // A message that contains partial data for updating an rectangle in an | |
77 // update stream packet. | |
78 // NEXT ID: 3 | |
79 message UpdateStreamRectData { | |
80 // The sequence number of the partial data for updating a rectangle. | |
81 optional int32 sequence_number = 1 [default=0]; | |
82 | |
83 // The partial data for updating a rectangle. | |
84 required bytes data = 2; | |
85 } | |
86 | |
87 // A message that denotes the end of an updating rectangle. | |
88 // NEXT ID: 1 | |
89 message UpdateStreamEndRect { | |
90 } | |
91 | |
92 // A message to denote a partial update stream. | |
93 // NEXT ID: 4 | |
94 message UpdateStreamPacketMessage { | |
95 optional UpdateStreamBeginRect begin_rect = 1; | |
96 optional UpdateStreamRectData rect_data = 2; | |
97 optional UpdateStreamEndRect end_rect = 3; | |
98 } | |
99 | |
100 // TODO(ajwong): Determine if these fields should be optional or required. | |
101 message RectangleFormat { | |
102 // X,Y coordinates (in screen pixels) for origin of this update. | |
103 required int32 x = 1; | |
104 required int32 y = 2; | |
105 | |
106 // Width, height (in screen pixels) for this update. | |
107 required int32 width = 3; | |
108 required int32 height = 4; | |
109 | |
110 // The encoding used for this image update. | |
111 optional UpdateStreamEncoding encoding = 5 [default = EncodingInvalid]; | |
112 | |
113 // The pixel format of this image. | |
114 optional PixelFormat pixel_format = 6 [default = PixelFormatRgb24]; | |
115 } | |
116 | |
117 message RectangleUpdatePacket { | |
118 // Bitmasks for use in the flags field below. | |
119 // | |
120 // The encoder may fragment one update into multiple packets depending on | |
121 // how the encoder outputs data. Thus, one update can logically consist of | |
122 // multiple packets. The FIRST_PACKET and LAST_PACKET flags are used to | |
123 // indicate the start and end of a logical update. Here are notable | |
124 // consequences: | |
125 // * Both FIRST_PACKET and LAST_PACKET may be set if an update is only | |
126 // one packet long. | |
127 // * The RectangleFormat is only supplied in a FIRST_PACKET. | |
128 // * An local update cannot change format between a FIRST_PACKET and | |
129 // a LAST_PACKET. | |
130 // * All packets in one logical update must be processed in order, and | |
131 // packets may not be skipped. | |
132 enum Flags { | |
133 FIRST_PACKET = 1; | |
134 LAST_PACKET = 2; | |
135 } | |
136 optional int32 flags = 1 [default = 0]; | |
137 | |
138 // The sequence number of the partial data for updating a rectangle. | |
139 optional int32 sequence_number = 2 [default = 0]; | |
140 | |
141 // This is provided on the first packet of the rectangle data, when | |
142 // the flags has FIRST_PACKET set. | |
143 optional RectangleFormat format = 3; | |
144 | |
145 optional bytes encoded_rect = 4; | |
146 } | |
147 | |
148 // Defines a keyboard event. | 13 // Defines a keyboard event. |
149 // NEXT ID: 3 | 14 // NEXT ID: 3 |
150 message KeyEvent { | 15 message KeyEvent { |
151 // The POSIX key code. | 16 // The POSIX key code. |
152 required int32 key = 1; | 17 required int32 key = 1; |
153 required bool pressed = 2; | 18 required bool pressed = 2; |
154 } | 19 } |
155 | 20 |
156 // Sets the absolute position of the mouse cursor. | 21 // Sets the absolute position of the mouse cursor. |
157 // dimension of the screen area. | 22 // dimension of the screen area. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Only one of the optional messages should be present. | 94 // Only one of the optional messages should be present. |
230 message ClientEventMessage { | 95 message ClientEventMessage { |
231 repeated Event events = 1; | 96 repeated Event events = 1; |
232 } | 97 } |
233 | 98 |
234 // Defines the message that is sent from host to client. | 99 // Defines the message that is sent from host to client. |
235 // Only one of the optional messages should be present. | 100 // Only one of the optional messages should be present. |
236 message HostEventMessage { | 101 message HostEventMessage { |
237 // TODO(hclam): Define the message. | 102 // TODO(hclam): Define the message. |
238 } | 103 } |
OLD | NEW |