// Copyright 2020 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. // // This file is based on and intended as a replacement for Chrome's // /media/remoting/media_remoting_rpc.proto file. Structurally, the messaging // and enums are a reflection of Chrome's media stack. NOTE: all content // encryption related messaging has been removed, and replaced with `reserved` // keyword usages below. syntax = "proto2"; option optimize_for = LITE_RUNTIME; package openscreen.cast; // DecoderBuffer information which will be sent using RTP packets. The actual // decoder buffer is not included in this proto data structure. message DecoderBuffer { reserved 4, 7; reserved "decrypt_config", "splice_timestamp_usec"; optional int64 timestamp_usec = 1; optional int64 duration_usec = 2; optional bool is_key_frame = 3; optional int64 front_discard_usec = 5; optional int64 back_discard_usec = 6; optional bytes side_data = 8; // To distinguish from valid 0-length buffers optional bool is_eos = 9; } message Size { optional int32 width = 1; optional int32 height = 2; } message AudioDecoderConfig { reserved 2; reserved "encryption_scheme"; // Proto version of Chrome's media::Codec. enum Codec { kUnknownAudioCodec = 0; kCodecAAC = 1; kCodecMP3 = 2; kCodecPCM = 3; kCodecVorbis = 4; kCodecFLAC = 5; kCodecAMR_NB = 6; kCodecAMR_WB = 7; kCodecPCM_MULAW = 8; kCodecGSM_MS = 9; kCodecPCM_S16BE = 10; kCodecPCM_S24BE = 11; kCodecOpus = 12; kCodecEAC3 = 13; kCodecPCM_ALAW = 14; kCodecALAC = 15; kCodecAC3 = 16; kCodecMpegHAudio = 17; } // Proto version of Chrome's media::SampleFormat. enum SampleFormat { kUnknownSampleFormat = 0; kSampleFormatU8 = 1; kSampleFormatS16 = 2; kSampleFormatS32 = 3; kSampleFormatF32 = 4; kSampleFormatPlanarS16 = 5; kSampleFormatPlanarF32 = 6; kSampleFormatPlanarS32 = 7; kSampleFormatS24 = 8; kSampleFormatAc3 = 9; kSampleFormatEac3 = 10; kSampleFormatMpegHAudio = 11; }; // Proto version of Chrome's media::ChannelLayout. enum ChannelLayout { CHANNEL_LAYOUT_NONE = 0; CHANNEL_LAYOUT_UNSUPPORTED = 1; CHANNEL_LAYOUT_MONO = 2; CHANNEL_LAYOUT_STEREO = 3; CHANNEL_LAYOUT_2_1 = 4; CHANNEL_LAYOUT_SURROUND = 5; CHANNEL_LAYOUT_4_0 = 6; CHANNEL_LAYOUT_2_2 = 7; CHANNEL_LAYOUT_QUAD = 8; CHANNEL_LAYOUT_5_0 = 9; CHANNEL_LAYOUT_5_1 = 10; CHANNEL_LAYOUT_5_0_BACK = 11; CHANNEL_LAYOUT_5_1_BACK = 12; CHANNEL_LAYOUT_7_0 = 13; CHANNEL_LAYOUT_7_1 = 14; CHANNEL_LAYOUT_7_1_WIDE = 15; CHANNEL_LAYOUT_STEREO_DOWNMIX = 16; CHANNEL_LAYOUT_2POINT1 = 17; CHANNEL_LAYOUT_3_1 = 18; CHANNEL_LAYOUT_4_1 = 19; CHANNEL_LAYOUT_6_0 = 20; CHANNEL_LAYOUT_6_0_FRONT = 21; CHANNEL_LAYOUT_HEXAGONAL = 22; CHANNEL_LAYOUT_6_1 = 23; CHANNEL_LAYOUT_6_1_BACK = 24; CHANNEL_LAYOUT_6_1_FRONT = 25; CHANNEL_LAYOUT_7_0_FRONT = 26; CHANNEL_LAYOUT_7_1_WIDE_BACK = 27; CHANNEL_LAYOUT_OCTAGONAL = 28; CHANNEL_LAYOUT_DISCRETE = 29; CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30; CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31; CHANNEL_LAYOUT_BITSTREAM = 32; }; optional Codec codec = 1; optional SampleFormat sample_format = 3; optional ChannelLayout channel_layout = 4; optional int32 samples_per_second = 5; optional int64 seek_preroll_usec = 6; optional int32 codec_delay = 7; optional bytes extra_data = 8; } message Rect { optional int32 x = 1; optional int32 y = 2; optional int32 width = 3; optional int32 height = 4; } message VideoDecoderConfig { reserved 2; reserved "encryption_scheme"; // Proto version of Chrome's media::VideoCodec. enum Codec { kUnknownVideoCodec = 0; kCodecH264 = 1; kCodecVC1 = 2; kCodecMPEG2 = 3; kCodecMPEG4 = 4; kCodecTheora = 5; kCodecVP8 = 6; kCodecVP9 = 7; kCodecHEVC = 8; kCodecDolbyVision = 9; kCodecAV1 = 10; } // Proto version of Chrome's media::VideoCodecProfile. enum Profile { VIDEO_CODEC_PROFILE_UNKNOWN = -1; H264PROFILE_BASELINE = 0; H264PROFILE_MAIN = 1; H264PROFILE_EXTENDED = 2; H264PROFILE_HIGH = 3; H264PROFILE_HIGH10PROFILE = 4; H264PROFILE_HIGH422PROFILE = 5; H264PROFILE_HIGH444PREDICTIVEPROFILE = 6; H264PROFILE_SCALABLEBASELINE = 7; H264PROFILE_SCALABLEHIGH = 8; H264PROFILE_STEREOHIGH = 9; H264PROFILE_MULTIVIEWHIGH = 10; VP8PROFILE_ANY = 11; VP9PROFILE_PROFILE0 = 12; VP9PROFILE_PROFILE1 = 13; VP9PROFILE_PROFILE2 = 14; VP9PROFILE_PROFILE3 = 15; HEVCPROFILE_MAIN = 16; HEVCPROFILE_MAIN10 = 17; HEVCPROFILE_MAIN_STILL_PICTURE = 18; DOLBYVISION_PROFILE0 = 19; DOLBYVISION_PROFILE4 = 20; DOLBYVISION_PROFILE5 = 21; DOLBYVISION_PROFILE7 = 22; THEORAPROFILE_ANY = 23; AV1PROFILE_PROFILE_MAIN = 24; AV1PROFILE_PROFILE_HIGH = 25; AV1PROFILE_PROFILE_PRO = 26; DOLBYVISION_PROFILE8 = 27; DOLBYVISION_PROFILE9 = 28; }; // Proto version of Chrome's media::VideoPixelFormat. enum Format { reserved 8, 25; reserved "PIXEL_FORMAT_UYVY", "PIXEL_FORMAT_Y8"; PIXEL_FORMAT_UNKNOWN = 0; PIXEL_FORMAT_I420 = 1; PIXEL_FORMAT_YV12 = 2; PIXEL_FORMAT_I422 = 3; PIXEL_FORMAT_I420A = 4; PIXEL_FORMAT_I444 = 5; PIXEL_FORMAT_NV12 = 6; PIXEL_FORMAT_NV21 = 7; PIXEL_FORMAT_YUY2 = 9; PIXEL_FORMAT_ARGB = 10; PIXEL_FORMAT_XRGB = 11; PIXEL_FORMAT_RGB24 = 12; PIXEL_FORMAT_RGB32 = 13; PIXEL_FORMAT_MJPEG = 14; PIXEL_FORMAT_YUV420P9 = 16; PIXEL_FORMAT_YUV420P10 = 17; PIXEL_FORMAT_YUV422P9 = 18; PIXEL_FORMAT_YUV422P10 = 19; PIXEL_FORMAT_YUV444P9 = 20; PIXEL_FORMAT_YUV444P10 = 21; PIXEL_FORMAT_YUV420P12 = 22; PIXEL_FORMAT_YUV422P12 = 23; PIXEL_FORMAT_YUV444P12 = 24; PIXEL_FORMAT_Y16 = 26; PIXEL_FORMAT_ABGR = 27; PIXEL_FORMAT_XBGR = 28; PIXEL_FORMAT_P016LE = 29; PIXEL_FORMAT_XR30 = 30; PIXEL_FORMAT_XB30 = 31; }; // Proto version of Chrome's media::ColorSpace. enum ColorSpace { COLOR_SPACE_UNSPECIFIED = 0; COLOR_SPACE_JPEG = 1; COLOR_SPACE_HD_REC709 = 2; COLOR_SPACE_SD_REC601 = 3; }; optional Codec codec = 1; optional Profile profile = 3; optional Format format = 4; optional ColorSpace color_space = 5; optional Size coded_size = 6; optional Rect visible_rect = 7; optional Size natural_size = 8; optional bytes extra_data = 9; } message PipelineDecoderInfo { reserved 3; reserved "has_decrypting_demuxer_stream"; optional string decoder_name = 1; optional bool is_platform_decoder = 2; }; message PipelineStatistics { optional uint64 audio_bytes_decoded = 1; optional uint64 video_bytes_decoded = 2; optional uint32 video_frames_decoded = 3; optional uint32 video_frames_dropped = 4; optional int64 audio_memory_usage = 5; optional int64 video_memory_usage = 6; optional int64 video_frame_duration_average_usec = 7; optional PipelineDecoderInfo audio_decoder_info = 8; optional PipelineDecoderInfo video_decoder_info = 9; }; message AcquireDemuxer { optional int32 audio_demuxer_handle = 1; optional int32 video_demuxer_handle = 2; } message RendererInitialize { optional int32 client_handle = 1; optional int32 audio_demuxer_handle = 2; optional int32 video_demuxer_handle = 3; optional int32 callback_handle = 4; } message RendererFlushUntil { optional uint32 audio_count = 1; optional uint32 video_count = 2; optional int32 callback_handle = 3; } message RendererClientOnTimeUpdate { optional int64 time_usec = 1; optional int64 max_time_usec = 2; } message RendererClientOnBufferingStateChange { // Proto version of Chrome's media::BufferingState. enum State { BUFFERING_HAVE_NOTHING = 0; BUFFERING_HAVE_ENOUGH = 1; }; optional State state = 1; } message RendererClientOnAudioConfigChange { optional AudioDecoderConfig audio_decoder_config = 1; } message RendererClientOnVideoConfigChange { optional VideoDecoderConfig video_decoder_config = 1; } message DemuxerStreamReadUntil { optional int32 callback_handle = 1; optional uint32 count = 2; } message DemuxerStreamInitializeCallback { optional int32 type = 1; optional AudioDecoderConfig audio_decoder_config = 2; optional VideoDecoderConfig video_decoder_config = 3; } message DemuxerStreamReadUntilCallback { // Proto version of Chrome's media::DemuxerStream::Status. enum Status { kOk = 0; kAborted = 1; kConfigChanged = 2; kError = 3; }; optional Status status = 1; optional uint32 count = 2; optional AudioDecoderConfig audio_decoder_config = 3; optional VideoDecoderConfig video_decoder_config = 4; } message RpcMessage { enum RpcProc { reserved 3, 4, 1005, 2007, 2008, 4000 to 5003; // NOTE: Since ContentDecryptionModule is also deprecated, do not add new // enum values that begin with "RPC_CDM_". reserved "RPC_ACQUIRE_CDM", "RPC_ACQUIRE_CDM_DONE", "RPC_RC_ONWAITINGFORDECRYPTIONKEY", "RPC_RC_ONDURATIONCHANGE", "RPC_R_SETCDM"; // Remoting setup RPC_INTERNAL = 0; RPC_ACQUIRE_RENDERER = 1; RPC_ACQUIRE_RENDERER_DONE = 2; RPC_ACQUIRE_DEMUXER = 5; // Renderer message RPC_R_INITIALIZE = 1000; RPC_R_FLUSHUNTIL = 1001; RPC_R_STARTPLAYINGFROM = 1002; RPC_R_SETPLAYBACKRATE = 1003; RPC_R_SETVOLUME = 1004; // Renderer callbacks RPC_R_INITIALIZE_CALLBACK = 1100; RPC_R_FLUSHUNTIL_CALLBACK = 1101; RPC_R_SETCDM_CALLBACK = 1102; // Renderer client message RPC_RC_ONTIMEUPDATE = 2000; RPC_RC_ONBUFFERINGSTATECHANGE = 2001; RPC_RC_ONENDED = 2002; RPC_RC_ONERROR = 2003; RPC_RC_ONVIDEONATURALSIZECHANGE = 2004; RPC_RC_ONVIDEOOPACITYCHANGE = 2005; RPC_RC_ONSTATISTICSUPDATE = 2006; RPC_RC_ONAUDIOCONFIGCHANGE = 2009; RPC_RC_ONVIDEOCONFIGCHANGE = 2010; // DemuxerStream message RPC_DS_INITIALIZE = 3000; RPC_DS_READUNTIL = 3001; RPC_DS_ENABLEBITSTREAMCONVERTER = 3002; RPC_DS_ONERROR = 3003; // DemuxerStream callbacks RPC_DS_INITIALIZE_CALLBACK = 3100; RPC_DS_READUNTIL_CALLBACK = 3101; }; // Component base of RPC message handle. This allows both sender and receiver // to send or handle message in desired individual components. optional int32 handle = 1; // RpcProc of this RPC message optional RpcProc proc = 2; oneof rpc_oneof { // NOTE: reserved keyword is not supported by oneof. // reserved 102, 500 to 506, 600 to 603 // For simple RPC which only passes one parameters can use the following // various data type variables without using specific proto data structure. // RPC_ACQUIRE_RENDERER // RPC_ACQUIRE_RENDERER_DONE // RPC_ACQUIRE_CDM // RPC_ACQUIRE_CDM_DONE // RPC_DS_INITIALIZE_CALLBACK // RPC_DS_READ // RPC_CDM_SETCLIENT int32 integer_value = 3; // RPC_R_STARTPLAYINGFROM // RPC_RC_ONDURATIONCHANGE int64 integer64_value = 4; // RPC_R_SETPLAYBACKRATE // RPC_R_SETVOLUME double double_value = 5; // RPC_R_INITIALIZE_CALLBACK // RPC_R_SETCDM_CALLBACK // RPC_RC_ONVIDEOOPACITYCHANGE bool boolean_value = 6; // string only: // RPC_CDMC_ONSESSIONCLOSED string string_value = 7; // RPC_R_INITIALIZE RendererInitialize renderer_initialize_rpc = 100; // RPC_R_FLUSHUNTIL RendererFlushUntil renderer_flushuntil_rpc = 101; // RPC_ACQUIRE_DEMUXER AcquireDemuxer acquire_demuxer_rpc = 103; // RPC_RC_ONTIMEUPDATE RendererClientOnTimeUpdate rendererclient_ontimeupdate_rpc = 200; // RPC_RC_ONVIDEONATURALSIZECHANGE Size rendererclient_onvideonatualsizechange_rpc = 201; // RPC_RC_ONSTATISTICSUPDATE PipelineStatistics rendererclient_onstatisticsupdate_rpc = 202; // RPC_RC_ONBUFFERINGSTATECHANGE RendererClientOnBufferingStateChange rendererclient_onbufferingstatechange_rpc = 203; // RPC_RC_ONAUDIOCONFIGCHANGE RendererClientOnAudioConfigChange rendererclient_onaudioconfigchange_rpc = 204; // RPC_RC_ONVIDEOCONFIGCHANGE RendererClientOnVideoConfigChange rendererclient_onvideoconfigchange_rpc = 205; // RPC_DS_READUNTIL DemuxerStreamReadUntil demuxerstream_readuntil_rpc = 300; // RPC_DS_INITIALIZE_CALLBACK DemuxerStreamInitializeCallback demuxerstream_initializecb_rpc = 400; // RPC_DS_READUNTIL_CALLBACK DemuxerStreamReadUntilCallback demuxerstream_readuntilcb_rpc = 401; }; }