mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 11:35:48 +00:00
Merge branch 'wivrn-offsets' into 'main'
feat: add offset x/y to wivrn profile See merge request gabmus/envision!28
This commit is contained in:
commit
c99cb03179
3 changed files with 53 additions and 1 deletions
|
@ -85,6 +85,10 @@ pub struct WivrnConfEncoder {
|
|||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub height: Option<f32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub offset_x: Option<f32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub offset_y: Option<f32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub group: Option<i32>,
|
||||
}
|
||||
|
||||
|
@ -96,6 +100,8 @@ impl Default for WivrnConfEncoder {
|
|||
bitrate: None,
|
||||
width: None,
|
||||
height: None,
|
||||
offset_x: None,
|
||||
offset_y: None,
|
||||
group: None,
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +124,8 @@ impl Default for WivrnConfig {
|
|||
bitrate: Some(100000000),
|
||||
width: Some(1.0),
|
||||
height: Some(1.0),
|
||||
offset_x: Some(0.0),
|
||||
offset_y: Some(0.0),
|
||||
group: None,
|
||||
}],
|
||||
}
|
||||
|
@ -162,5 +170,7 @@ mod tests {
|
|||
assert_eq!(conf.encoders.get(0).unwrap().bitrate, Some(100000000));
|
||||
assert_eq!(conf.encoders.get(0).unwrap().width, Some(1.0));
|
||||
assert_eq!(conf.encoders.get(0).unwrap().height, Some(1.0));
|
||||
assert_eq!(conf.encoders.get(0).unwrap().offset_x, Some(0.0));
|
||||
assert_eq!(conf.encoders.get(0).unwrap().offset_y, Some(0.0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ pub enum WivrnEncoderModelMsg {
|
|||
BitrateChanged(Option<u32>),
|
||||
WidthChanged(Option<f32>),
|
||||
HeightChanged(Option<f32>),
|
||||
OffsetXChanged(Option<f32>),
|
||||
OffsetYChanged(Option<f32>),
|
||||
GroupChanged(Option<i32>),
|
||||
Delete,
|
||||
}
|
||||
|
@ -134,6 +136,38 @@ impl AsyncFactoryComponent for WivrnEncoderModel {
|
|||
}
|
||||
}
|
||||
) -> adw::SpinRow,
|
||||
add: offset_x_row = &spin_row(
|
||||
"Offset X",
|
||||
None,
|
||||
self.encoder_conf.offset_x.unwrap_or(0.0).into(),
|
||||
0.0,
|
||||
1.0,
|
||||
0.01,
|
||||
{
|
||||
let sender = sender.clone();
|
||||
move |adj| {
|
||||
sender.input(Self::Input::OffsetXChanged(
|
||||
Some(adj.value() as f32)
|
||||
));
|
||||
}
|
||||
}
|
||||
) -> adw::SpinRow,
|
||||
add: offset_y_row = &spin_row(
|
||||
"Offset Y",
|
||||
None,
|
||||
self.encoder_conf.offset_y.unwrap_or(0.0).into(),
|
||||
0.0,
|
||||
1.0,
|
||||
0.01,
|
||||
{
|
||||
let sender = sender.clone();
|
||||
move |adj| {
|
||||
sender.input(Self::Input::OffsetYChanged(
|
||||
Some(adj.value() as f32)
|
||||
));
|
||||
}
|
||||
}
|
||||
) -> adw::SpinRow,
|
||||
add: group_row = &spin_row(
|
||||
"Group",
|
||||
None,
|
||||
|
@ -170,6 +204,12 @@ impl AsyncFactoryComponent for WivrnEncoderModel {
|
|||
Self::Input::HeightChanged(val) => {
|
||||
self.encoder_conf.height = val;
|
||||
}
|
||||
Self::Input::OffsetXChanged(val) => {
|
||||
self.encoder_conf.offset_x = val;
|
||||
}
|
||||
Self::Input::OffsetYChanged(val) => {
|
||||
self.encoder_conf.offset_y = val;
|
||||
}
|
||||
Self::Input::GroupChanged(val) => {
|
||||
self.encoder_conf.group = val;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
"codec": "h264",
|
||||
"bitrate": 100000000,
|
||||
"width": 1.0,
|
||||
"height": 1.0
|
||||
"height": 1.0,
|
||||
"offset_x": 0.0,
|
||||
"offset_y": 0.0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue