#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlayAbilityConf {
#[prost(bool, tag = "1")]
pub background_play_disable: bool,
#[prost(bool, tag = "2")]
pub flip_disable: bool,
#[prost(bool, tag = "3")]
pub cast_disable: bool,
#[prost(bool, tag = "4")]
pub feedback_disable: bool,
#[prost(bool, tag = "5")]
pub subtitle_disable: bool,
#[prost(bool, tag = "6")]
pub playback_rate_disable: bool,
#[prost(bool, tag = "7")]
pub time_up_disable: bool,
#[prost(bool, tag = "8")]
pub playback_mode_disable: bool,
#[prost(bool, tag = "9")]
pub scale_mode_disable: bool,
#[prost(bool, tag = "10")]
pub like_disable: bool,
#[prost(bool, tag = "11")]
pub dislike_disable: bool,
#[prost(bool, tag = "12")]
pub coin_disable: bool,
#[prost(bool, tag = "13")]
pub elec_disable: bool,
#[prost(bool, tag = "14")]
pub share_disable: bool,
#[prost(bool, tag = "15")]
pub screen_shot_disable: bool,
#[prost(bool, tag = "16")]
pub lock_screen_disable: bool,
#[prost(bool, tag = "17")]
pub recommend_disable: bool,
#[prost(bool, tag = "18")]
pub playback_speed_disable: bool,
#[prost(bool, tag = "19")]
pub definition_disable: bool,
#[prost(bool, tag = "20")]
pub selections_disable: bool,
#[prost(bool, tag = "21")]
pub next_disable: bool,
#[prost(bool, tag = "22")]
pub edit_dm_disable: bool,
#[prost(bool, tag = "25")]
pub outer_dm_disable: bool,
#[prost(bool, tag = "26")]
pub inner_dm_disable: bool,
#[prost(bool, tag = "27")]
pub small_window_disable: bool,
#[prost(string, tag = "28")]
pub cast_disable_reason_code: ::prost::alloc::string::String,
#[prost(string, tag = "29")]
pub cast_disable_reason_text: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PlayViewBusinessInfo {
#[prost(enumeration = "DrmTechType", tag = "1")]
pub drm_tech_type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlayViewReply {
#[prost(message, optional, tag = "1")]
pub video_info: ::core::option::Option<
super::super::super::super::app::playurl::v1::VideoInfo,
>,
#[prost(message, optional, tag = "2")]
pub play_conf: ::core::option::Option<PlayAbilityConf>,
#[prost(message, optional, tag = "3")]
pub business: ::core::option::Option<PlayViewBusinessInfo>,
#[prost(message, optional, tag = "4")]
pub risk_control: ::core::option::Option<RiskControl>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlayViewReq {
#[prost(int64, tag = "1")]
pub ep_id: i64,
#[prost(int64, tag = "2")]
pub cid: i64,
#[prost(int64, tag = "3")]
pub qn: i64,
#[prost(int32, tag = "4")]
pub fnver: i32,
#[prost(int32, tag = "5")]
pub fnval: i32,
#[prost(int32, tag = "6")]
pub download: i32,
#[prost(int32, tag = "7")]
pub force_host: i32,
#[prost(bool, tag = "8")]
pub fourk: bool,
#[prost(string, tag = "9")]
pub spmid: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub from_spmid: ::prost::alloc::string::String,
#[prost(int32, tag = "11")]
pub teenagers_mode: i32,
#[prost(
enumeration = "super::super::super::super::app::playurl::v1::CodeType",
tag = "12"
)]
pub prefer_codec_type: i32,
#[prost(bool, tag = "13")]
pub is_preview: bool,
#[prost(bool, tag = "14")]
pub is_raw_stream: bool,
#[prost(enumeration = "SecurityLevel", tag = "15")]
pub security_level: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectReply {
#[prost(message, optional, tag = "1")]
pub project: ::core::option::Option<
super::super::super::super::app::playurl::v1::PlayUrlReply,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectReq {
#[prost(int64, tag = "1")]
pub ep_id: i64,
#[prost(int64, tag = "2")]
pub cid: i64,
#[prost(int64, tag = "3")]
pub qn: i64,
#[prost(int32, tag = "4")]
pub fnver: i32,
#[prost(int32, tag = "5")]
pub fnval: i32,
#[prost(int32, tag = "6")]
pub download: i32,
#[prost(int32, tag = "7")]
pub force_host: i32,
#[prost(bool, tag = "8")]
pub fourk: bool,
#[prost(string, tag = "9")]
pub spmid: ::prost::alloc::string::String,
#[prost(string, tag = "10")]
pub from_spmid: ::prost::alloc::string::String,
#[prost(int32, tag = "11")]
pub protocol: i32,
#[prost(int32, tag = "12")]
pub device_type: i32,
#[prost(bool, tag = "13")]
pub flv_proj: bool,
#[prost(int64, tag = "14")]
pub aid: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RiskControl {
#[prost(bool, tag = "1")]
pub need_send_sms: bool,
#[prost(string, tag = "2")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub risk_message: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub action_desc: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub send_sms_url: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub buvid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DrmTechType {
Non = 0,
FairPlay = 1,
WideVine = 2,
BiliDrm = 3,
}
impl DrmTechType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Non => "NON",
Self::FairPlay => "FAIR_PLAY",
Self::WideVine => "WIDE_VINE",
Self::BiliDrm => "BILI_DRM",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NON" => Some(Self::Non),
"FAIR_PLAY" => Some(Self::FairPlay),
"WIDE_VINE" => Some(Self::WideVine),
"BILI_DRM" => Some(Self::BiliDrm),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SecurityLevel {
LevelUnknown = 0,
LevelL1 = 1,
LevelL2 = 2,
LevelL3 = 3,
}
impl SecurityLevel {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::LevelUnknown => "LEVEL_UNKNOWN",
Self::LevelL1 => "LEVEL_L1",
Self::LevelL2 => "LEVEL_L2",
Self::LevelL3 => "LEVEL_L3",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"LEVEL_UNKNOWN" => Some(Self::LevelUnknown),
"LEVEL_L1" => Some(Self::LevelL1),
"LEVEL_L2" => Some(Self::LevelL2),
"LEVEL_L3" => Some(Self::LevelL3),
_ => None,
}
}
}
pub mod play_url_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct PlayUrlClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PlayUrlClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PlayUrlClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
PlayUrlClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn play_view(
&mut self,
request: impl tonic::IntoRequest<super::PlayViewReq>,
) -> std::result::Result<tonic::Response<super::PlayViewReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.cheese.gateway.player.v1.PlayURL/PlayView",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.cheese.gateway.player.v1.PlayURL",
"PlayView",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn project(
&mut self,
request: impl tonic::IntoRequest<super::ProjectReq>,
) -> std::result::Result<tonic::Response<super::ProjectReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/bilibili.cheese.gateway.player.v1.PlayURL/Project",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"bilibili.cheese.gateway.player.v1.PlayURL",
"Project",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod play_url_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait PlayUrl: std::marker::Send + std::marker::Sync + 'static {
async fn play_view(
&self,
request: tonic::Request<super::PlayViewReq>,
) -> std::result::Result<tonic::Response<super::PlayViewReply>, tonic::Status>;
async fn project(
&self,
request: tonic::Request<super::ProjectReq>,
) -> std::result::Result<tonic::Response<super::ProjectReply>, tonic::Status>;
}
#[derive(Debug)]
pub struct PlayUrlServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> PlayUrlServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for PlayUrlServer<T>
where
T: PlayUrl,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/bilibili.cheese.gateway.player.v1.PlayURL/PlayView" => {
#[allow(non_camel_case_types)]
struct PlayViewSvc<T: PlayUrl>(pub Arc<T>);
impl<T: PlayUrl> tonic::server::UnaryService<super::PlayViewReq>
for PlayViewSvc<T> {
type Response = super::PlayViewReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PlayViewReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as PlayUrl>::play_view(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PlayViewSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/bilibili.cheese.gateway.player.v1.PlayURL/Project" => {
#[allow(non_camel_case_types)]
struct ProjectSvc<T: PlayUrl>(pub Arc<T>);
impl<T: PlayUrl> tonic::server::UnaryService<super::ProjectReq>
for ProjectSvc<T> {
type Response = super::ProjectReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProjectReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as PlayUrl>::project(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ProjectSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for PlayUrlServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "bilibili.cheese.gateway.player.v1.PlayURL";
impl<T> tonic::server::NamedService for PlayUrlServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}