syntax = "proto3";

package bilibili.pgc.gateway.player.v2;

import "google/protobuf/timestamp.proto";

//播放url
service PlayURL {
	//获取播放url
	//https://app.bilibili.com/bilibili.pgc.gateway.player.v2.PlayURL/PlayView
	rpc PlayView (PlayViewReq) returns (PlayViewReply);
}

//获取播放url-请求
message PlayViewReq{
	//目标剧集epid
    int64 epid = 1;
    
    //目标视频cid
    int64 cid = 2;
    
    //清晰度
    int64 qn = 3;
    
    //视频流版本
    int32 fnver = 4;
    
    //视频流功能
    int32 fnval = 5;
    
    //下载模式
    //0:播放 1:flv下载 2:dash下载
    uint32 download = 6;
    
    //
    int32 forceHost = 7;
    
    //是否允许4K
    bool fourk = 8;
    
    //
    string spmid = 9;
    
    //
    string fromSpmid = 10;
    
    //
    int32 teenagersMode = 11;
    
    //编码类型
    CodeType codetype = 12;
    
    //
    bool isPreview = 13;
    
    //
    int64 roomId = 14;
    
    //
    bool isNeedViewInfo = 15;
}

//获取播放url-回复
message PlayViewReply{
	//视频流信息
    VideoInfo info = 1;
    
    //用户播放界面配置
    PlayAbilityConf PlayConf = 2;
    
    //
    PlayViewBusinessInfo Business = 3;
    
    //
    Event event = 4;
    
    //
    ViewInfo viewInfo = 5;
}

//编码类型
enum CodeType {
    //默认
	NOCODE = 0;

    //H.264
	CODE264 = 1;

    //H.265
	CODE265 = 2;
}

//不满足条件信息
message Limit {
	//
	string title = 1;
	
	//
	string uri = 2;
	
	//
	string msg = 3;
}

//流媒体元数据
message streamInfo {
	//清晰度 qn
	uint32 quality = 1;
	
	//格式
	string format = 2;
	
	//格式描述
	string description = 3;
	
	//错误码
	uint32 errCode = 4;
	
	//不满足条件信息
	Limit limit = 5;
	
	//是否需要vip
	bool needVip = 6;
	
	//是否需要登录
	bool needLogin = 7;
	
	//是否完整
	bool intact = 8;
	
	//是否非全二压
	bool noRexcode = 9;
	
	//
	int64 attribute = 10;
	
	//新版格式描述
	string newDescription = 11;
	
	//格式文字
	string displayDesc = 12;
	
	//新版格式描述备注
	string superscript = 13;
}

//dash视频流
message DashVideo {
	//主线流
	string baseUrl = 1;
	
	//备用流
	repeated string backupUrl = 2;
	
	//带宽
	uint32 bandwidth = 3;
	
	//
	uint32 codecid = 4;
	
	//md5
	string md5 = 5;
	
	//大小
	uint64 size = 6;
	
	//
	uint32 audioId = 7;
	
	//是否非全二压
	bool noRexcode = 8;
}

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

//分段视频流
message SegmentVideo {
	//分段视频流列表
	repeated ResponseUrl segment = 1;
}

//视频流信息
message stream {
	//元数据
	streamInfo info = 1;
	
	//dash流
	DashVideo dashvideo = 2;
	
	//分段流
	SegmentVideo segmentvideo = 3;
}

//dash音频流
message DashAudio {
	//音质id
	uint32 id = 1;
	
	//主线流
	string baseUrl = 2;
	
	//备用流
	repeated string backupUrl = 3;
	
	//带宽
	uint32 bandwidth = 4;
	
	//
	uint32 codecid = 5;
	
	//md5
	string md5 = 6;
	
	//大小
	uint64 size = 7;
}

//杜比音频信息
message DolbyItem {
	//
	int32 type = 1;
	
	//音频流
	DashAudio audio = 2;
}

//视频url信息
message VideoInfo {
	//视频清晰度
    uint32 quality = 1;
    
    //视频格式
    string format = 2;
    
    //视频时长
    uint64 timelength = 3;
    
    //
    uint32 videoCodecid = 4;
    
    //视频流
    repeated stream streamList = 5;
    
    //伴音流
    repeated DashAudio audio = 6;
    
    //杜比伴音流
    DolbyItem dolby = 7;
}

//禁用功能配置
message PlayAbilityConf{
    //后台播放
    bool backgroundPlayDisable = 1;

    //镜像反转
    bool flipDisable = 2;

    //投屏
    bool castDisable = 3;

    //反馈
    bool feedbackDisable = 4;

    //字幕
    bool subtitleDisable = 5;

    //播放速度
    bool playbackRateDisable = 6;

    //定时停止
    bool timeUpDisable = 7;

    //播放方式
    bool playbackModeDisable = 8;

    //画面尺寸
    bool scaleModeDisable = 9;

    //赞
    bool likeDisable = 10;

    //踩
    bool dislikeDisable = 11;

    //投币
    bool coinDisable = 12;

    //充电
    bool elecDisable = 13;

    //分享
    bool shareDisable = 14;

    //截图
    bool screenShotDisable = 15;

    //锁定
    bool lockScreenDisable = 16;

    //相关推荐
    bool recommendDisable = 17;

    //播放速度
    bool playbackSpeedDisable = 18;

    //清晰度
    bool definitionDisable = 19;

    //选集
    bool selectionsDisable = 20;

    //下一集
    bool nextDisable = 21;

    //编辑弹幕
    bool editDmDisable = 22;

    //小窗
    bool smallWindowDisable = 23;

    //震动
    bool shakeDisable = 24;

    //
    bool outerDmDisable = 25;

    //
    bool innerDmDisable = 26;

    //
    bool freyaEnterDisable = 27;

    //杜比音效
    bool dolbyDisable = 28;
}

//
message PlayViewBusinessInfo {
	//
    bool isPreview = 1;

    //
    bool bp = 2;

    //
    string marlinToken = 3;
}

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

//
message Event {
	//
    Shake shake = 1;
}

//
message Report {
	//
	string showEventId = 1;

    //
	string clickEventId = 2;

    //
	string extends = 3;
}

//
message BadgeInfo {
	//
	string text = 1;

    //
	string bgColor = 2;

    //
	string bgColorNight = 3;
}

//
message ButtonInfo {
	//
	string text = 1;

    //
	string textColor = 2;

    //
	string textColorNight = 3;

    //
	string bgColor = 4;

    //
	string bgColorNight = 5;

    //
	string link = 6;

    //
	string actionType = 7;

    //
	BadgeInfo badgeInfo = 8;

    //
	Report report = 9;
}

//
message DialogConfig {
	//
	bool isShowCover = 1;

    //
	bool isOrientationEnable = 2;

    //
	bool isNestedScrollEnable = 3;

    //
	bool isForceHalfscreenEnable = 4;
}

//
message TextInfo {
	//
	string text = 1;

    //
	string textColor = 2;

    //
	string textColorNight = 3;
}

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

//
message Dialog {
	//
	int64 code = 1;

    //
	string msg = 2;

    //
	string type = 3;

    //
	string styleType = 4;

    //
	DialogConfig config = 5;

    //
	TextInfo title = 6;

    //
	TextInfo subtitle = 7;

    //
	ImageInfo image = 8;

    //
	repeated ButtonInfo button = 9;

    //
	ButtonInfo bottomDesc = 10;

    //
	Report report = 11;

    //
	int32 countDownSec = 12;
}

//
message Toast {
	//
	string text = 1;

    //
	ButtonInfo button = 2;
}

//
message CouponTextInfo {
	//
	string positivePreview = 1;

    //
	string section = 2;
}

//
message CouponToast {
	//
	CouponTextInfo textInfo = 1;

    //
	ButtonInfo button = 2;
}

//
message Coupon {
	//
	string couponToken = 1;

    //
	int64 type = 2;

    //
	string value = 3;

    //
	string useDesc = 4;

    //
	string title = 5;

    //
	string desc = 6;

    //
	string payButtonText = 7;

    //
	string payButtonTextLineThrough = 8;

    //
	string realAmount = 9;

    //
	google.protobuf.Timestamp expireTime = 10;
}

//
message PopWin {
	//
	string title = 1;

    //
	repeated Coupon coupon = 2;

    //
	repeated ButtonInfo button = 3;

    //
	string bottomText = 4;
}

//
message CouponInfo {
	//
	CouponToast toast = 1;

    //
	PopWin popWin = 2;
}

//
message EndPage {
	//
	Dialog dialog = 1;

    //
	bool hide = 2;
}

//
message ViewInfo {
	//
    Dialog dialog = 1;

    //
    Toast toast = 2;

    //
    CouponInfo couponInfo = 3;

    //
    repeated int64 demandNoPayEpids = 4;

    //
    EndPage endPage = 5;
}