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