• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// This file is based on and intended as a replacement for Chrome's
6// /media/remoting/media_remoting_rpc.proto file. Structurally, the messaging
7// and enums are a reflection of Chrome's media stack. NOTE: all content
8// encryption related messaging has been removed, and replaced with `reserved`
9// keyword usages below.
10
11syntax = "proto2";
12
13option optimize_for = LITE_RUNTIME;
14
15package openscreen.cast;
16
17// DecoderBuffer information which will be sent using RTP packets. The actual
18// decoder buffer is not included in this proto data structure.
19message DecoderBuffer {
20  reserved 4, 7;
21  reserved "decrypt_config", "splice_timestamp_usec";
22
23  optional int64 timestamp_usec = 1;
24  optional int64 duration_usec = 2;
25  optional bool is_key_frame = 3;
26  optional int64 front_discard_usec = 5;
27  optional int64 back_discard_usec = 6;
28  optional bytes side_data = 8;
29
30  // To distinguish from valid 0-length buffers
31  optional bool is_eos = 9;
32}
33
34message Size {
35  optional int32 width = 1;
36  optional int32 height = 2;
37}
38
39message AudioDecoderConfig {
40  reserved 2;
41  reserved "encryption_scheme";
42
43  // Proto version of Chrome's media::Codec.
44  enum Codec {
45    kUnknownAudioCodec = 0;
46    kCodecAAC = 1;
47    kCodecMP3 = 2;
48    kCodecPCM = 3;
49    kCodecVorbis = 4;
50    kCodecFLAC = 5;
51    kCodecAMR_NB = 6;
52    kCodecAMR_WB = 7;
53    kCodecPCM_MULAW = 8;
54    kCodecGSM_MS = 9;
55    kCodecPCM_S16BE = 10;
56    kCodecPCM_S24BE = 11;
57    kCodecOpus = 12;
58    kCodecEAC3 = 13;
59    kCodecPCM_ALAW = 14;
60    kCodecALAC = 15;
61    kCodecAC3 = 16;
62    kCodecMpegHAudio = 17;
63  }
64
65  // Proto version of Chrome's media::SampleFormat.
66  enum SampleFormat {
67    kUnknownSampleFormat = 0;
68    kSampleFormatU8 = 1;
69    kSampleFormatS16 = 2;
70    kSampleFormatS32 = 3;
71    kSampleFormatF32 = 4;
72    kSampleFormatPlanarS16 = 5;
73    kSampleFormatPlanarF32 = 6;
74    kSampleFormatPlanarS32 = 7;
75    kSampleFormatS24 = 8;
76    kSampleFormatAc3 = 9;
77    kSampleFormatEac3 = 10;
78    kSampleFormatMpegHAudio = 11;
79    kSampleFormatPlanarU8 = 12;
80  };
81
82  // Proto version of Chrome's media::ChannelLayout.
83  enum ChannelLayout {
84    CHANNEL_LAYOUT_NONE = 0;
85    CHANNEL_LAYOUT_UNSUPPORTED = 1;
86    CHANNEL_LAYOUT_MONO = 2;
87    CHANNEL_LAYOUT_STEREO = 3;
88    CHANNEL_LAYOUT_2_1 = 4;
89    CHANNEL_LAYOUT_SURROUND = 5;
90    CHANNEL_LAYOUT_4_0 = 6;
91    CHANNEL_LAYOUT_2_2 = 7;
92    CHANNEL_LAYOUT_QUAD = 8;
93    CHANNEL_LAYOUT_5_0 = 9;
94    CHANNEL_LAYOUT_5_1 = 10;
95    CHANNEL_LAYOUT_5_0_BACK = 11;
96    CHANNEL_LAYOUT_5_1_BACK = 12;
97    CHANNEL_LAYOUT_7_0 = 13;
98    CHANNEL_LAYOUT_7_1 = 14;
99    CHANNEL_LAYOUT_7_1_WIDE = 15;
100    CHANNEL_LAYOUT_STEREO_DOWNMIX = 16;
101    CHANNEL_LAYOUT_2POINT1 = 17;
102    CHANNEL_LAYOUT_3_1 = 18;
103    CHANNEL_LAYOUT_4_1 = 19;
104    CHANNEL_LAYOUT_6_0 = 20;
105    CHANNEL_LAYOUT_6_0_FRONT = 21;
106    CHANNEL_LAYOUT_HEXAGONAL = 22;
107    CHANNEL_LAYOUT_6_1 = 23;
108    CHANNEL_LAYOUT_6_1_BACK = 24;
109    CHANNEL_LAYOUT_6_1_FRONT = 25;
110    CHANNEL_LAYOUT_7_0_FRONT = 26;
111    CHANNEL_LAYOUT_7_1_WIDE_BACK = 27;
112    CHANNEL_LAYOUT_OCTAGONAL = 28;
113    CHANNEL_LAYOUT_DISCRETE = 29;
114    CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30;
115    CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31;
116    CHANNEL_LAYOUT_BITSTREAM = 32;
117  };
118
119  optional Codec codec = 1;
120  optional SampleFormat sample_format = 3;
121  optional ChannelLayout channel_layout = 4;
122  optional int32 samples_per_second = 5;
123  optional int64 seek_preroll_usec = 6;
124  optional int32 codec_delay = 7;
125  optional bytes extra_data = 8;
126}
127
128message Rect {
129  optional int32 x = 1;
130  optional int32 y = 2;
131  optional int32 width = 3;
132  optional int32 height = 4;
133}
134
135message VideoDecoderConfig {
136  reserved 2;
137  reserved "encryption_scheme";
138
139  // Proto version of Chrome's media::VideoCodec.
140  enum Codec {
141    kUnknownVideoCodec = 0;
142    kCodecH264 = 1;
143    kCodecVC1 = 2;
144    kCodecMPEG2 = 3;
145    kCodecMPEG4 = 4;
146    kCodecTheora = 5;
147    kCodecVP8 = 6;
148    kCodecVP9 = 7;
149    kCodecHEVC = 8;
150    kCodecDolbyVision = 9;
151    kCodecAV1 = 10;
152  }
153
154  // Proto version of Chrome's media::VideoCodecProfile.
155  enum Profile {
156    VIDEO_CODEC_PROFILE_UNKNOWN = -1;
157    H264PROFILE_BASELINE = 0;
158    H264PROFILE_MAIN = 1;
159    H264PROFILE_EXTENDED = 2;
160    H264PROFILE_HIGH = 3;
161    H264PROFILE_HIGH10PROFILE = 4;
162    H264PROFILE_HIGH422PROFILE = 5;
163    H264PROFILE_HIGH444PREDICTIVEPROFILE = 6;
164    H264PROFILE_SCALABLEBASELINE = 7;
165    H264PROFILE_SCALABLEHIGH = 8;
166    H264PROFILE_STEREOHIGH = 9;
167    H264PROFILE_MULTIVIEWHIGH = 10;
168    VP8PROFILE_ANY = 11;
169    VP9PROFILE_PROFILE0 = 12;
170    VP9PROFILE_PROFILE1 = 13;
171    VP9PROFILE_PROFILE2 = 14;
172    VP9PROFILE_PROFILE3 = 15;
173    HEVCPROFILE_MAIN = 16;
174    HEVCPROFILE_MAIN10 = 17;
175    HEVCPROFILE_MAIN_STILL_PICTURE = 18;
176    DOLBYVISION_PROFILE0 = 19;
177    DOLBYVISION_PROFILE4 = 20;
178    DOLBYVISION_PROFILE5 = 21;
179    DOLBYVISION_PROFILE7 = 22;
180    THEORAPROFILE_ANY = 23;
181    AV1PROFILE_PROFILE_MAIN = 24;
182    AV1PROFILE_PROFILE_HIGH = 25;
183    AV1PROFILE_PROFILE_PRO = 26;
184    DOLBYVISION_PROFILE8 = 27;
185    DOLBYVISION_PROFILE9 = 28;
186  };
187
188  // Proto version of Chrome's media::VideoPixelFormat.
189  enum Format {
190    reserved 8, 25;
191    reserved "PIXEL_FORMAT_UYVY", "PIXEL_FORMAT_Y8";
192
193    PIXEL_FORMAT_UNKNOWN = 0;
194    PIXEL_FORMAT_I420 = 1;
195    PIXEL_FORMAT_YV12 = 2;
196    PIXEL_FORMAT_I422 = 3;
197    PIXEL_FORMAT_I420A = 4;
198    PIXEL_FORMAT_I444 = 5;
199    PIXEL_FORMAT_NV12 = 6;
200    PIXEL_FORMAT_NV21 = 7;
201    PIXEL_FORMAT_YUY2 = 9;
202    PIXEL_FORMAT_ARGB = 10;
203    PIXEL_FORMAT_XRGB = 11;
204    PIXEL_FORMAT_RGB24 = 12;
205    PIXEL_FORMAT_RGB32 = 13;
206    PIXEL_FORMAT_MJPEG = 14;
207    PIXEL_FORMAT_YUV420P9 = 16;
208    PIXEL_FORMAT_YUV420P10 = 17;
209    PIXEL_FORMAT_YUV422P9 = 18;
210    PIXEL_FORMAT_YUV422P10 = 19;
211    PIXEL_FORMAT_YUV444P9 = 20;
212    PIXEL_FORMAT_YUV444P10 = 21;
213    PIXEL_FORMAT_YUV420P12 = 22;
214    PIXEL_FORMAT_YUV422P12 = 23;
215    PIXEL_FORMAT_YUV444P12 = 24;
216    PIXEL_FORMAT_Y16 = 26;
217    PIXEL_FORMAT_ABGR = 27;
218    PIXEL_FORMAT_XBGR = 28;
219    PIXEL_FORMAT_P016LE = 29;
220    PIXEL_FORMAT_XR30 = 30;
221    PIXEL_FORMAT_XB30 = 31;
222  };
223
224  // Proto version of Chrome's media::ColorSpace.
225  enum ColorSpace {
226    COLOR_SPACE_UNSPECIFIED = 0;
227    COLOR_SPACE_JPEG = 1;
228    COLOR_SPACE_HD_REC709 = 2;
229    COLOR_SPACE_SD_REC601 = 3;
230  };
231
232  optional Codec codec = 1;
233  optional Profile profile = 3;
234  optional Format format = 4;
235  optional ColorSpace color_space = 5;
236  optional Size coded_size = 6;
237  optional Rect visible_rect = 7;
238  optional Size natural_size = 8;
239  optional bytes extra_data = 9;
240}
241
242message AudioDecoderInfo {
243  reserved 3;
244  optional int64 decoder_type = 1;
245  optional bool is_platform_decoder = 2;
246};
247
248message VideoDecoderInfo {
249  reserved 3;
250  optional int64 decoder_type = 1;
251  optional bool is_platform_decoder = 2;
252};
253
254message PipelineStatistics {
255  optional uint64 audio_bytes_decoded = 1;
256  optional uint64 video_bytes_decoded = 2;
257  optional uint32 video_frames_decoded = 3;
258  optional uint32 video_frames_dropped = 4;
259  optional int64 audio_memory_usage = 5;
260  optional int64 video_memory_usage = 6;
261  optional int64 video_frame_duration_average_usec = 7;
262  optional AudioDecoderInfo audio_decoder_info = 8;
263  optional VideoDecoderInfo video_decoder_info = 9;
264};
265
266message AcquireDemuxer {
267  optional int32 audio_demuxer_handle = 1;
268  optional int32 video_demuxer_handle = 2;
269}
270
271message RendererInitialize {
272  optional int32 client_handle = 1;
273  optional int32 audio_demuxer_handle = 2;
274  optional int32 video_demuxer_handle = 3;
275  optional int32 callback_handle = 4;
276}
277
278message RendererFlushUntil {
279  optional uint32 audio_count = 1;
280  optional uint32 video_count = 2;
281  optional int32 callback_handle = 3;
282}
283
284message RendererClientOnTimeUpdate {
285  optional int64 time_usec = 1;
286  optional int64 max_time_usec = 2;
287}
288
289message RendererClientOnBufferingStateChange {
290  // Proto version of Chrome's media::BufferingState.
291  enum State {
292    BUFFERING_HAVE_NOTHING = 0;
293    BUFFERING_HAVE_ENOUGH = 1;
294  };
295
296  optional State state = 1;
297}
298
299message RendererClientOnAudioConfigChange {
300  optional AudioDecoderConfig audio_decoder_config = 1;
301}
302
303message RendererClientOnVideoConfigChange {
304  optional VideoDecoderConfig video_decoder_config = 1;
305}
306
307message DemuxerStreamReadUntil {
308  optional int32 callback_handle = 1;
309  optional uint32 count = 2;
310}
311
312message DemuxerStreamInitializeCallback {
313  optional int32 type = 1;
314  optional AudioDecoderConfig audio_decoder_config = 2;
315  optional VideoDecoderConfig video_decoder_config = 3;
316}
317
318message DemuxerStreamReadUntilCallback {
319  // Proto version of Chrome's media::DemuxerStream::Status.
320  enum Status {
321    kOk = 0;
322    kAborted = 1;
323    kConfigChanged = 2;
324    kError = 3;
325  };
326
327  optional Status status = 1;
328  optional uint32 count = 2;
329  optional AudioDecoderConfig audio_decoder_config = 3;
330  optional VideoDecoderConfig video_decoder_config = 4;
331}
332
333message RpcMessage {
334  enum RpcProc {
335    reserved 3, 4, 1005, 2007, 2008, 4000 to 5003;
336
337    // NOTE: Since ContentDecryptionModule is also deprecated, do not add new
338    // enum values that begin with "RPC_CDM_".
339    reserved "RPC_ACQUIRE_CDM", "RPC_ACQUIRE_CDM_DONE",
340        "RPC_RC_ONWAITINGFORDECRYPTIONKEY", "RPC_RC_ONDURATIONCHANGE",
341        "RPC_R_SETCDM";
342
343    // Remoting setup
344    RPC_INTERNAL = 0;
345    RPC_ACQUIRE_RENDERER = 1;
346    RPC_ACQUIRE_RENDERER_DONE = 2;
347    RPC_ACQUIRE_DEMUXER = 5;
348
349    // Renderer message
350    RPC_R_INITIALIZE = 1000;
351    RPC_R_FLUSHUNTIL = 1001;
352    RPC_R_STARTPLAYINGFROM = 1002;
353    RPC_R_SETPLAYBACKRATE = 1003;
354    RPC_R_SETVOLUME = 1004;
355
356    // Renderer callbacks
357    RPC_R_INITIALIZE_CALLBACK = 1100;
358    RPC_R_FLUSHUNTIL_CALLBACK = 1101;
359    RPC_R_SETCDM_CALLBACK = 1102;
360
361    // Renderer client message
362    RPC_RC_ONTIMEUPDATE = 2000;
363    RPC_RC_ONBUFFERINGSTATECHANGE = 2001;
364    RPC_RC_ONENDED = 2002;
365    RPC_RC_ONERROR = 2003;
366    RPC_RC_ONVIDEONATURALSIZECHANGE = 2004;
367    RPC_RC_ONVIDEOOPACITYCHANGE = 2005;
368    RPC_RC_ONSTATISTICSUPDATE = 2006;
369    RPC_RC_ONAUDIOCONFIGCHANGE = 2009;
370    RPC_RC_ONVIDEOCONFIGCHANGE = 2010;
371
372    // DemuxerStream message
373    RPC_DS_INITIALIZE = 3000;
374    RPC_DS_READUNTIL = 3001;
375    RPC_DS_ENABLEBITSTREAMCONVERTER = 3002;
376    RPC_DS_ONERROR = 3003;
377
378    // DemuxerStream callbacks
379    RPC_DS_INITIALIZE_CALLBACK = 3100;
380    RPC_DS_READUNTIL_CALLBACK = 3101;
381  };
382
383  // Component base of RPC message handle. This allows both sender and receiver
384  // to send or handle message in desired individual components.
385  optional int32 handle = 1;
386
387  // RpcProc of this RPC message
388  optional RpcProc proc = 2;
389
390  oneof rpc_oneof {
391    // NOTE: reserved keyword is not supported by oneof.
392    // reserved 102, 500 to 506, 600 to 603
393
394    // For simple RPC which only passes one parameters can use the following
395    // various data type variables without using specific proto data structure.
396    // RPC_ACQUIRE_RENDERER
397    // RPC_ACQUIRE_RENDERER_DONE
398    // RPC_ACQUIRE_CDM
399    // RPC_ACQUIRE_CDM_DONE
400    // RPC_DS_INITIALIZE_CALLBACK
401    // RPC_DS_READ
402    // RPC_CDM_SETCLIENT
403    int32 integer_value = 3;
404
405    // RPC_R_STARTPLAYINGFROM
406    // RPC_RC_ONDURATIONCHANGE
407    int64 integer64_value = 4;
408
409    // RPC_R_SETPLAYBACKRATE
410    // RPC_R_SETVOLUME
411    double double_value = 5;
412
413    // RPC_R_INITIALIZE_CALLBACK
414    // RPC_R_SETCDM_CALLBACK
415    // RPC_RC_ONVIDEOOPACITYCHANGE
416    bool boolean_value = 6;
417
418    // string only:
419    // RPC_CDMC_ONSESSIONCLOSED
420    string string_value = 7;
421
422    // RPC_R_INITIALIZE
423    RendererInitialize renderer_initialize_rpc = 100;
424
425    // RPC_R_FLUSHUNTIL
426    RendererFlushUntil renderer_flushuntil_rpc = 101;
427
428    // RPC_ACQUIRE_DEMUXER
429    AcquireDemuxer acquire_demuxer_rpc = 103;
430
431    // RPC_RC_ONTIMEUPDATE
432    RendererClientOnTimeUpdate rendererclient_ontimeupdate_rpc = 200;
433    // RPC_RC_ONVIDEONATURALSIZECHANGE
434    Size rendererclient_onvideonatualsizechange_rpc = 201;
435    // RPC_RC_ONSTATISTICSUPDATE
436    PipelineStatistics rendererclient_onstatisticsupdate_rpc = 202;
437    // RPC_RC_ONBUFFERINGSTATECHANGE
438    RendererClientOnBufferingStateChange
439        rendererclient_onbufferingstatechange_rpc = 203;
440    // RPC_RC_ONAUDIOCONFIGCHANGE
441    RendererClientOnAudioConfigChange rendererclient_onaudioconfigchange_rpc =
442        204;
443    // RPC_RC_ONVIDEOCONFIGCHANGE
444    RendererClientOnVideoConfigChange rendererclient_onvideoconfigchange_rpc =
445        205;
446
447    // RPC_DS_READUNTIL
448    DemuxerStreamReadUntil demuxerstream_readuntil_rpc = 300;
449
450    // RPC_DS_INITIALIZE_CALLBACK
451    DemuxerStreamInitializeCallback demuxerstream_initializecb_rpc = 400;
452    // RPC_DS_READUNTIL_CALLBACK
453    DemuxerStreamReadUntilCallback demuxerstream_readuntilcb_rpc = 401;
454  };
455}
456