syntax = "proto3";

package bilibili.playershared;

option java_multiple_files = true;

// ArcConf消息
message ArcConf {
  // 是否支持
  bool is_support = 1;
  // 是否禁用
  bool disabled = 2;
  // 额外内容
  ExtraContent extra_content = 3;
  // 不支持场景列表
  repeated int32 unsupport_scene = 4;
}

//
enum ArcType {
  //
  ARC_TYPE_NORMAL = 0;
  //
  ARC_TYPE_INTERACT = 1;
}

//
message BackgroundInfo {
  //
  string drawable_color = 1;
  //
  string drawable_bitmap_url = 2;
  //
  int32 effects = 3;
}

//
message BadgeInfo {
  //
  string text = 1;
  //
  string bg_color = 2;
  //
  string bg_color_night = 3;
  //
  string text_color = 4;
  //
  GradientColor bg_gradient_color = 5;
  //
  string img = 6;
}

//
enum BizType {
  //
  BIZ_TYPE_UNKNOWN = 0;
  //
  BIZ_TYPE_UGC = 1;
  //
  BIZ_TYPE_PGC = 2;
  //
  BIZ_TYPE_PUGV = 3;
}

//
message BottomDisplay {
  //
  TextInfo title = 1;
  //
  string icon = 2;
}

// 按钮组件
message Button {
  // 按钮文本
  string text = 1;
  // 按钮跳转链接
  string link = 2;
  // 埋点上报相关
  map<string, string> report_params = 3;
}

enum ButtonAction {
  //
  BUTTON_UNKNOWN = 0;
  //
  PAY = 1;
  //
  VIP = 2;
  //
  PACK = 3;
  //
  LINK = 4;
  //
  COUPON = 5;
  //
  DEMAND = 6;
  //
  DEMAND_PACK = 7;
  //
  FOLLOW = 8;
  //
  APPOINTMENT = 9;
  //
  VIP_FREE = 10;
  //
  TASK = 11;
  //
  CHARGINGPLUS = 12;
  //
  BP = 13;
  //
  PRE_SELL = 14;
}

//
message ButtonInfo {
  //
  string text = 1;
  //
  string text_color = 2;
  //
  string text_color_night = 3;
  //
  string bg_color = 4;
  //
  string bg_color_night = 5;
  //
  string link = 6;
  //
  ButtonAction action_type = 7;
  //
  BadgeInfo badge_info = 8;
  //
  Report report = 9;
  //
  string left_strikethrough_text = 10;
  //
  TextInfo simple_text_info = 11;
  //
  string simple_bg_color = 12;
  //
  string simple_bg_color_night = 13;
  //
  GradientColor bg_gradient_color = 14;
  //
  map<string, string> order_report_params = 15;
  //
  TaskParam task_param = 16;
  //
  string frame_color = 17;
  //
  string icon = 18;
}

// 视频编码
enum CodeType {
  NOCODE = 0; // 不指定
  CODE264 = 1; // H264
  CODE265 = 2; // H265
  CODEAV1 = 3; // AV1
}

//
message ComprehensiveToast {
  //
  int32 type = 1;
  //
  ButtonInfo button = 2;
  //
  int32 show_style_type = 3;
  //
  string icon = 4;
  //
  TextInfo toast_text = 5;
  //
  Report report = 6;
  //
  map<string, string> order_report_params = 7;
}

// 功能类型
enum ConfType {
  NoType = 0;
  FLIPCONF = 1;
  CASTCONF = 2;
  FEEDBACK = 3;
  SUBTITLE = 4;
  PLAYBACKRATE = 5;
  TIMEUP = 6;
  PLAYBACKMODE = 7;
  SCALEMODE = 8;
  BACKGROUNDPLAY = 9;
  LIKE = 10;
  DISLIKE = 11;
  COIN = 12;
  ELEC = 13;
  SHARE = 14;
  SCREENSHOT = 15;
  LOCKSCREEN = 16;
  RECOMMEND = 17;
  PLAYBACKSPEED = 18;
  DEFINITION = 19;
  SELECTIONS = 20;
  NEXT = 21;
  EDITDM = 22;
  SMALLWINDOW = 23;
  SHAKE = 24;
  OUTERDM = 25;
  INNERDM = 26;
  PANORAMA = 27;
  DOLBY = 28;
  COLORFILTER = 29;
  LOSSLESS = 30;
  FREYAENTER = 31;
  FREYAFULLENTER = 32;
  SKIPOPED = 33;
  RECORDSCREEN = 34;
  DUBBING = 35;
  LISTEN = 36;
}

//
message ConfValue {
  oneof value {
    //
    int32 switch_val = 1;
    //
    int32 selected_val = 2;
  }
}

// Dash条目
message DashItem {
  // 清晰度
  uint32 id = 1;
  // 主线流
  string base_url = 2;
  // 备用流
  repeated string backup_url = 3;
  // 带宽
  uint32 bandwidth = 4;
  // 编码id
  uint32 codecid = 5;
  // md5
  string md5 = 6;
  // 大小
  uint64 size = 7;
  // 帧率
  string frame_rate = 8;
  // DRM密钥
  string widevine_pssh = 9;
}

// 视频流信息: dash流
message DashVideo {
  // 主线流
  string base_url = 1;
  // 备用流
  repeated string backup_url = 2;
  // 带宽
  uint32 bandwidth = 3;
  // 编码id
  uint32 codecid = 4;
  // md5
  string md5 = 5;
  // 大小
  uint64 size = 6;
  // 伴音质量id
  uint32 audio_id = 7;
  // 是否非全二压
  bool no_rexcode = 8;
  // 帧率
  string frame_rate = 9;
  // 宽
  int32 width = 10;
  // 高
  int32 height = 11;
  // DRM密钥
  string widevine_pssh = 12;
}

//
message DeviceConf {
  ConfValue conf_value = 1;
}

//
message Dialog {
  //
  int32 style_type = 1;
  //
  BackgroundInfo background_info = 2;
  //
  TextInfo title = 3;
  //
  TextInfo subtitle = 4;
  //
  ImageInfo image = 5;
  //
  repeated ButtonInfo button = 6;
  //
  ButtonInfo bottom_desc = 7;
  //
  Report report = 8;
  //
  int32 count_down_sec = 9;
  //
  TextInfo right_bottom_desc = 10;
  //
  repeated BottomDisplay bottom_display = 11;
  //
  ExtData ext_data = 12;
  //
  int32 limit_action_type = 13;
}

// 当前分辨率信息
message Dimension {
  // 宽
  int32 width = 1;
  // 长
  int32 height = 2;
  // 旋转角度
  int32 rotate = 3;
}

// 杜比伴音流信息
message DolbyItem {
  // 杜比类型
  enum Type {
    NONE = 0;   // NONE
    COMMON = 1; // 普通杜比音效
    ATMOS = 2;  // 全景杜比音效
  }
  // 杜比类型
  Type type = 1;
  // 音频流
  repeated DashItem audio = 2;
}

// DRM类型
enum DrmTechType {
  //
  UNKNOWN_DRM = 0;
  //
  FAIR_PLAY = 1;
  //
  WIDE_VINE = 2;
  // 哔哩哔哩自研DRM
  BILI_DRM = 3;
}

enum Effects {
  //
  EFFECTS_UNKNOWN = 0;
  //
  GAUSSIAN_BLUR = 1;
  //
  HALF_ALPHA = 2;
}

// 事件
message Event {
  // 震动
  Shake shake = 1;
}

//
message ExtData {
  //
  ExtDataType type = 1;
  //
  oneof data {
    PlayListInfo play_list_info = 2;
  }
}

enum ExtDataType {
  //
  EXT_DATA_TYPE_UNKNOWN = 0;
  //
  PLAY_LIST = 1;
}

// ? 错误码补充信息
message ExtraContent {
  //
  string disable_reason = 1;
  //
  int64 disable_code = 2;
}

//
message GradientColor {
  //
  string start_color = 1;
  //
  string end_color = 2;
}

//
enum GuideStyle {
  //
  STYLE_UNKNOWN = 0;
  //
  HORIZONTAL_IMAGE = 1;
  //
  VERTICAL_TEXT = 2;
  //
  SIMPLE_TEXT = 3;
  //
  CHARGING_TEXT = 4;
}

// 播放历史
message History {
  //
  HistoryInfo current_video = 1;
  //
  HistoryInfo related_video = 2;
}

//
message HistoryInfo {
  //
  int64 progress = 1;
  //
  int64 last_play_cid = 2;
  //
  Toast toast = 3;
  //
  Toast toast_without_time = 4;
  //
  int64 last_play_aid = 5;
}

//
message ImageInfo {
  //
  string url = 1;
}

//
message Interaction {
  //
  Node history_node = 1;
  //
  int64 graph_version = 2;
  //
  string msg = 3;
  //
  int64 mark = 4;
}

enum LimitActionType {
  //
  LAT_UNKNOWN = 0;
  //
  SHOW_LIMIT_DIALOG = 1;
  //
  SKIP_CURRENT_EP = 2;
}

// HIRES伴音流信息
message LossLessItem {
  // 是否为hires
  bool is_lossless_audio = 1;
  // 音频流信息
  DashItem audio = 2;
  // 是否需要大会员
  bool need_vip = 3;
}

//
message Node {
  //
  int64 node_id = 1;
  //
  string title = 2;
  //
  int64 cid = 3;
}

//
message PlayArc {
  //
  BizType video_type = 1;
  //
  uint64 aid = 2;
  //
  uint64 cid = 3;
  //
  DrmTechType drm_tech_type = 4;
  //
  ArcType arc_type = 5;
  //
  Interaction interaction = 6;
  //
  Dimension dimension = 7;
  //
  int64 duration = 8;
  //
  bool is_preview = 9;
}

// 播放页信息-响应: PlayArcConf
message PlayArcConf {
  map<int32, ArcConf> arc_confs = 1;
}

//
message PlayDeviceConf {
  //
  map<int32, DeviceConf> device_confs = 1;
}

// 错误码
enum PlayErr {
  NoErr = 0;                   //
  WithMultiDeviceLoginErr = 1; // 管控类型的错误码
}

//
message PlayList {
  //
  int64 season_id = 1;
  //
  string title = 2;
  //
  string cover = 3;
  //
  string link = 4;
  //
  BadgeInfo badge_info = 5;
}

//
message PlayListInfo {
  //
  repeated PlayList play_list = 2;
}

// 视频下方广告 Banner
message PromptBar {
  //
  TextInfo title = 1;
  //
  TextInfo subtitle = 2;
  //
  string sub_title_icon = 3;
  //
  string bg_image = 4;
  //
  GradientColor bg_gradient_color = 5;
  //
  repeated ButtonInfo button = 6;
  //
  Report report = 7;
  //
  string full_screen_ip_icon = 8;
  //
  GradientColor full_screen_bg_gradient_color = 9;
}

// 播放页信息-响应: 高画质试看信息
message QnTrialInfo {
  // 能否试看高画质
  bool trial_able = 1;
  //
  int32 remaining_times = 2;
  //
  int32 start = 3;
  //
  int32 time_length = 4;
  //
  Toast start_toast = 5;
  //
  Toast end_toast = 6;
  //
  Button quality_open_tip_btn = 8;
}

//
message Report {
  //
  string show_event_id = 1;
  //
  string click_event_id = 2;
  //
  string extends = 3;
}

// Dash Response, 未使用
message ResponseDash {
  repeated DashItem video = 1;
  repeated DashItem audio = 2;
}

// 分段流条目
message ResponseUrl {
  // 分段序号
  uint32 order = 1;
  // 分段时长
  uint64 length = 2;
  // 分段大小
  uint64 size = 3;
  // 主线流
  string url = 4;
  // 备用流
  repeated string backup_url = 5;
  // md5
  string md5 = 6;
}

// 方案
message Scheme {
  enum ActionType {
    UNKNOWN = 0;
    SHOW_TOAST = 1;
  }
  //
  ActionType action_type = 1;
  //
  string toast = 2;
}

// 视频流信息: 分段流
message SegmentVideo {
  repeated ResponseUrl segment = 1;
}

// 震动
message Shake {
  //
  string file = 1;
}

enum ShowStyleType {
  //
  SHOW_STYLE_TYPE_UNKNOWN = 0;
  //
  SHOW_STYLE_TYPE_ORDINARY = 1;
  //
  SHOW_STYLE_TYPE_RESIDENT = 2;
}

// 视频流信息
message Stream {
  // 元数据
  StreamInfo stream_info = 1;
  // 流数据
  oneof content {
    // dash流
    DashVideo dash_video = 2;
    // 分段流
    SegmentVideo segment_video = 3;
  }
}

// 视频流信息: 元数据
message StreamInfo {
  // 清晰度
  uint32 quality = 1;
  // 格式
  string format = 2;
  // 格式描述
  string description = 3;
  // 错误码
  uint32 err_code = 4;
  // 不满足条件信息
  StreamLimit limit = 5;
  // 是否需要vip
  bool need_vip = 6;
  // 是否需要登录
  bool need_login = 7;
  // 是否完整
  bool intact = 8;
  // 是否非全二压
  bool no_rexcode = 9;
  // 清晰度属性位
  int64 attribute = 10;
  // 新版格式描述
  string new_description = 11;
  // 格式文字
  string display_desc = 12;
  // 新版格式描述备注
  string superscript = 13;
  //
  bool vip_free = 14;
  //
  string subtitle = 15;
  // 方案
  Scheme scheme = 16;
  // 支持drm
  bool support_drm = 17;
}

// 视频流信息: 流媒体元数据: 清晰度不满足条件信息
message StreamLimit {
  // 标题
  string title = 1;
  // 跳转地址
  string uri = 2;
  // 提示信息
  string msg = 3;
}

//
message TaskParam {
  //
  string task_type = 1;
  //
  int64 activity_id = 2;
  //
  int64 tips_id = 3;
}

//
message TextInfo {
  //
  string text = 1;
  //
  string text_color = 2;
  //
  string text_color_night = 3;
}

// Toast信息
message Toast {
  // toast文案
  string text = 1;
  // toast按钮
  Button button = 2;
}

enum ToastType {
  //
  TOAST_TYPE_UNKNOWN = 0;
  //
  VIP_CONTENT_REMIND = 1;
  //
  VIP_DEFINITION_REMIND = 2;
  //
  VIP_DEFINITION_GUIDE = 3;
  //
  OGV_VIDEO_START_TOAST = 4;
  //
  CHARGING_TOAST = 5;
}

//
enum UnsupportScene {
  //
  UNKNOWN_SCENE = 0;
  //
  PREMIERE = 1;
}

// 播放页信息-请求: 音视频VOD
message VideoVod {
  // 视频aid
  int64 aid = 1;
  // 视频cid
  int64 cid = 2;
  // 清晰度
  uint64 qn = 3;
  // 视频流版本
  int32 fnver = 4;
  // 视频流格式
  int32 fnval = 5;
  // 下载模式
  // 0:播放 1:flv下载 2:dash下载
  uint32 download = 6;
  // 流url强制是用域名
  // 0:允许使用ip 1:使用http 2:使用https
  int32 force_host = 7;
  // 是否4K
  bool fourk = 8;
  // 视频编码
  CodeType prefer_codec_type = 9;
  // 响度均衡
  uint64 voice_balance = 10;
}

message ViewInfo {
  //
  map<string, Dialog> dialog_map = 1;
  //
  PromptBar prompt_bar = 2;
  //
  repeated ComprehensiveToast toasts = 3;
}

// 播放页信息-响应: VOD音视频信息
message VodInfo {
  // 视频清晰度
  uint32 quality = 1;
  // 视频格式
  string format = 2;
  // 视频时长
  uint64 timelength = 3;
  // 视频编码id
  uint32 video_codecid = 4;
  // 视频流
  repeated Stream stream_list = 5;
  // 伴音流
  repeated DashItem dash_audio = 6;
  // 杜比伴音流
  DolbyItem dolby = 7;
  // 响度均衡操作信息
  VolumeInfo volume = 8;
  // HIRES伴音流信息
  LossLessItem loss_less_item = 9;
  // 是否支持投屏
  bool support_project = 10;
}

// 响度均衡操作信息
message VolumeInfo {
  // Measured integrated loudness 实际综合响度
  double measured_i = 1;
  // Measured loudness range 实际响度范围
  double measured_lra = 2;
  // Measured true peak 实际响度真峰值
  double measured_tp = 3;
  // Measured threshold 实际响度阈值
  double measured_threshold = 4;
  // Target offset gain(Gain is applied before the true-peak limiter) 目标增益Offset(增益在真实峰值限制器之前应用)
  double target_offset = 5;
  // Target integrated loudness 目标综合响度
  double target_i = 6;
  // Target true peak 目标响度真峰值
  double target_tp = 7;
}