syntax = "proto3";

package bilibili.community.service.dm.v1;

//弹幕
service DM {
    //修改弹幕配置
    //https://app.bilibili.com/bilibili.community.service.dm.v1.DM/DmPlayerConfig
    rpc DmPlayerConfig (DmPlayerConfigReq) returns (Response);

    //获取分段弹幕
    //
    rpc DmSegMobile (DmSegMobileReq) returns (DmSegMobileReply);

    //获取弹幕元数据
    //https://app.bilibili.com/bilibili.community.service.dm.v1.DM/DmView
    rpc DmView (DmViewReq) returns (DmViewReply);
}

//修改弹幕配置-请求
message DmPlayerConfigReq{
    //
    int64 ts = 1;

    //
    PlayerDanmakuSwitch switch = 2;

    //
    PlayerDanmakuSwitchSave switchSave = 3;

    //
    PlayerDanmakuUseDefaultConfig useDefaultConfig = 4;

    //
    PlayerDanmakuAiRecommendedSwitch aiRecommendedSwitch = 5;

    //
    PlayerDanmakuAiRecommendedLevel aiRecommendedLevel = 6;

    //
    PlayerDanmakuBlocktop blocktop = 7;

    //
    PlayerDanmakuBlockscroll blockscroll = 8;

    //
    PlayerDanmakuBlockbottom blockbottom = 9;

    //
    PlayerDanmakuBlockcolorful blockcolorful = 10;

    //
    PlayerDanmakuBlockrepeat blockrepeat = 11;

    //
    PlayerDanmakuBlockspecial blockspecial = 12;

    //
    PlayerDanmakuOpacity opacity = 13;

    //
    PlayerDanmakuScalingfactor scalingfactor = 14;

    //
    PlayerDanmakuDomain domain = 15;

    //
    PlayerDanmakuSpeed speed = 16;

    //
    PlayerDanmakuEnableblocklist enableblocklist = 17;

    //
    InlinePlayerDanmakuSwitch inlinePlayerDanmakuSwitch = 18;
}

//修改弹幕配置-回复
message Response{
    //
    int32 code = 1;

    //
    string message = 2;
}

//获取分段弹幕-请求
message DmSegMobileReq{
	//稿件avid/漫画epid
    int64 pid = 1;
    
    //视频cid/漫画cid
    int64 oid = 2;
    
    //弹幕类型
    //1:视频 2:漫画
    int32 type = 3;
    
    //分段序号
    int64 segmentIndex = 4;
    
    //是否青少年模式
    int32 teenagersMode = 5;
}

//获取分段弹幕-回复
message DmSegMobileReply{
	//弹幕条目
    repeated DanmakuElem elems = 1;
    
    //是否已关闭弹幕
    //0:未关闭 1:已关闭
    int32 state = 2;
    
    //
    DanmakuAIFlag aiFlag = 3;
}

//获取弹幕元数据-请求
message DmViewReq{
	//稿件avid/漫画epid
    int64 pid = 1;
    
    //视频cid/漫画cid
    int64 oid = 2;
    
    //弹幕类型
    //1:视频 2:漫画
    int32 type = 3;
    
    //页面spm
    string spmid = 4;
    
    //是否冷启
    int32 isHardBoot = 5;
}

//获取弹幕元数据-回复
message DmViewReply{
    //是否已关闭弹幕
    //0:未关闭 1:已关闭
    bool closed = 1;
    
    //智能防挡弹幕蒙版信息
    VideoMask mask = 2;
    
    //视频字幕信息
    VideoSubtitle subtitle = 3;
    
    //高级弹幕专包url
    repeated string specialDms = 4;
    
    //云屏蔽配置信息
    DanmakuFlagConfig aiFlag = 5;
    
    //
    DanmuPlayerViewConfig playerConfig = 6;
    
    //
    int32 sendBoxStyle = 7;
    
    //是否允许
    bool allow = 8;
    
    //
    string checkBox = 9;
    
    //
    string checkBoxShowMsg = 10;
    
    //
    string textPlaceholder = 11;
    
    //弹幕输入框文案
    string inputPlaceholder = 12;
    
    //
    repeated string reportFilterContent = 13;
}

//
message DanmakuAIFlag{
	//
    repeated DanmakuFlag dmFlags = 1;
}

//弹幕条目
message DanmakuElem{
	//弹幕dmid
    int64 id = 1;
    
    //弹幕出现位置
    int32 progress = 2;
    
    //弹幕类型
    int32 mode = 3;
    
    //弹幕字号
    int32 fontsize = 4;
    
    //弹幕颜色
    uint32 color = 5;
    
    //发送着UID hash
    string midHash = 6;
    
    //弹幕正文
    string content = 7;
    
    //发送时间
    int64 ctime = 8;
    
    //权重
    int32 weight = 9;
    
    //动作
    string action = 10;
    
    //弹幕池
    int32 pool = 11;
    
    //弹幕dmid-str
    string idStr = 12;
    
    //弹幕属性
    //0:正常 4:高赞 16:?
    int32 attr = 13;
}

//
message DanmakuFlag{
	//
    int64 dmid = 1;
    
    //
    uint32 flag = 2;
}

//云屏蔽配置信息
message DanmakuFlagConfig{
	//云屏蔽等级
    int32 recFlag = 1;
    
    //云屏蔽文案
    string recText = 2;
    
    //云屏蔽开关
    int32 recSwitch = 3;
}

//
message DanmuDefaultPlayerConfig{
    //
    bool playerDanmakuUseDefaultConfig = 1;

    //
    bool playerDanmakuAiRecommendedSwitch = 4;

    //
    int32 playerDanmakuAiRecommendedLevel = 5;

    //
    bool playerDanmakuBlocktop = 6;

    //
    bool playerDanmakuBlockscroll = 7;

    //
    bool playerDanmakuBlockbottom = 8;

    //
    bool playerDanmakuBlockcolorful = 9;

    //
    bool playerDanmakuBlockrepeat = 10;

    //
    bool playerDanmakuBlockspecial = 11;

    //
    float playerDanmakuOpacity = 12;

    //
    float playerDanmakuScalingfactor = 13;

    //
    float playerDanmakuDomain = 14;

    //
    int32 playerDanmakuSpeed = 15;

    //
    bool inlinePlayerDanmakuSwitch = 16;
}

//
message DanmuPlayerConfig{
    //
    bool playerDanmakuSwitch = 1;

    //
    bool playerDanmakuSwitchSave = 2;

    //
    bool playerDanmakuUseDefaultConfig = 3;

    //
    bool playerDanmakuAiRecommendedSwitch = 4;

    //
    int32 playerDanmakuAiRecommendedLevel = 5;

    //
    bool playerDanmakuBlocktop = 6;

    //
    bool playerDanmakuBlockscroll = 7;

    //
    bool playerDanmakuBlockbottom = 8;

    //
    bool playerDanmakuBlockcolorful = 9;

    //
    bool playerDanmakuBlockrepeat = 10;

    //
    bool playerDanmakuBlockspecial = 11;

    //
    float playerDanmakuOpacity = 12;

    //
    float playerDanmakuScalingfactor = 13;

    //
    float playerDanmakuDomain = 14;

    //
    int32 playerDanmakuSpeed = 15;

    //
    bool playerDanmakuEnableblocklist = 16;

    //
    bool inlinePlayerDanmakuSwitch = 17;

    //
    int32 inlinePlayerDanmakuConfig = 18;
}

//
message DanmuPlayerDynamicConfig{
    //
    int32 progress = 1;

    //
    float playerDanmakuDomain = 2;
}

//
message DanmuPlayerViewConfig{
    //
    DanmuDefaultPlayerConfig danmukuDefaultPlayerConfig = 1;

    //
    DanmuPlayerConfig danmukuPlayerConfig = 2;

    //
    repeated DanmuPlayerDynamicConfig danmukuPlayerDynamicConfig = 3;
}

//
message InlinePlayerDanmakuSwitch{
    //
    bool value = 1;
}

//
message PlayerDanmakuAiRecommendedLevel{
    //
    bool value = 1;
}

//
message PlayerDanmakuAiRecommendedSwitch{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlockbottom{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlockcolorful{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlockrepeat{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlockscroll{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlockspecial{
    //
    bool value = 1;
}

//
message PlayerDanmakuBlocktop{
    //
    bool value = 1;
}

//
message PlayerDanmakuDomain{
    //
    float value = 1;
}

//
message PlayerDanmakuEnableblocklist{
    //
    bool value = 1;
}

//
message PlayerDanmakuOpacity{
    //
    float value = 1;
}

//
message PlayerDanmakuScalingfactor{
    //
    float value = 1;
}

//
message PlayerDanmakuSpeed{
    //
    int32 value = 1;
}

//
message PlayerDanmakuSwitch{
    //
    bool value = 1;
}

//
message PlayerDanmakuSwitchSave{
    //
    bool value = 1;
}

//
message PlayerDanmakuUseDefaultConfig{
    //
    bool value = 1;
}

//单个字幕信息
message SubtitleItem{
	//字幕id
    int64 id = 1;
    
    //字幕id-str
    string idStr = 2;
    
    //字幕语言代码
    string lan = 3;
    
    //字幕语言
    string lanDoc = 4;
    
    //字幕文件url
    string subtitleUrl = 5;
    
    //字幕作者信息
    UserInfo author = 6;
}

//字幕作者信息
message UserInfo{
	//作者uid
    int64 mid = 1;
    
    //作者昵称
    string name = 2;
    
    //作者性别
    string sex = 3;
    
    //作者头像url
    string face = 4;
    
    //作者个人签名
    string sign = 5;
    
    //
    int32 rank = 6;
}

//智能防挡弹幕蒙版信息
message VideoMask{
	//视频cid
    int64 cid = 1;
    
    //平台
    //0:web端 1:app端
    int32 plat = 2;
    
    //帧率
    int32 fps = 3;
    
    //间隔时间
    int64 time = 4;
    
    //蒙版url
    string maskUrl = 5;
}

//视频字幕信息
message VideoSubtitle{
	//视频原语言代码
    string lan = 1;
    
    //视频原语言
    string lanDoc = 2;
    
    //视频字幕列表
    repeated SubtitleItem subtitles = 3;
}