Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions stremio-core-protobuf/proto/stremio/core/models/player.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ message Player {
optional stremio.core.types.Video.SeriesInfo series_info = 6;
optional stremio.core.types.LibraryItem library_item = 7;
optional StreamState stream_state = 8;
optional IntroOutro intro_outro = 9;

message VideoParams {
optional string hash = 1;
Expand Down Expand Up @@ -53,6 +54,15 @@ message Player {
optional stremio.core.types.ResourceRequest meta_request = 3;
optional stremio.core.types.ResourcePath subtitles_path = 4;
}
message IntroOutro {
optional IntroData intro = 1;
optional uint64 outro = 2;
}
message IntroData {
required uint64 from = 1;
required uint64 to = 2;
optional uint64 duration = 3;
}
}

message LoadableSubtitles {
Expand Down
21 changes: 21 additions & 0 deletions stremio-core-protobuf/src/model/fields/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use stremio_core::{
runtime::Env,
types::{
addon::ResourceRequest,
player::{IntroData, IntroOutro},
resource::Video,
streams::{AudioTrack, StreamItemState, SubtitleTrack},
},
Expand Down Expand Up @@ -74,6 +75,25 @@ impl FromProtobuf<VideoParams> for models::player::VideoParams {
}
}

impl ToProtobuf<models::player::IntroOutro, ()> for IntroOutro {
fn to_protobuf<E: Env + 'static>(&self, _args: &()) -> models::player::IntroOutro {
models::player::IntroOutro {
intro: self.intro.to_protobuf::<E>(&()),
outro: self.outro,
}
}
}

impl ToProtobuf<models::player::IntroData, ()> for IntroData {
fn to_protobuf<E: Env + 'static>(&self, _args: &()) -> models::player::IntroData {
models::player::IntroData {
from: self.from,
to: self.to,
duration: self.duration,
}
}
}

impl ToProtobuf<models::player::VideoParams, ()> for VideoParams {
fn to_protobuf<E: stremio_core::runtime::Env + 'static>(
&self,
Expand Down Expand Up @@ -194,6 +214,7 @@ impl ToProtobuf<models::Player, (&Ctx, &StreamingServer)> for Player {
series_info: self.series_info.to_protobuf::<E>(&()),
library_item: self.library_item.to_protobuf::<E>(&(*ctx, None)),
stream_state: self.stream_state.to_protobuf::<E>(&()),
intro_outro: self.intro_outro.to_protobuf::<E>(&()),
}
}
}
Expand Down