Skip to content

Commit

Permalink
Tune api
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Nov 19, 2024
1 parent 64fd0ee commit eb7aee2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cidre/src/av/asset/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ impl Writer {
pub fn set_initial_segment_start_time(&mut self, val: cm::Time);

#[objc::msg_send(outputFileTypeProfile)]
pub fn output_file_type_profile(&self) -> Option<&av::FileTypeProfile>;
pub fn output_file_type_profile(&self) -> Option<arc::R<av::FileTypeProfile>>;

/// TODO: check throws
#[objc::msg_send(setOutputFileTypeProfile:)]
pub fn set_output_file_type_profile(&mut self, val: Option<&av::FileTypeProfile>);

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&mut self, val: Option<&D>);
Expand Down
8 changes: 4 additions & 4 deletions cidre/src/av/audio/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ impl Player {
pub fn duration(&self) -> ns::TimeInterval;

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&mut self, val: &D);

#[objc::msg_send(url)]
pub fn url(&self) -> Option<&ns::Url>;
pub fn url(&self) -> Option<arc::R<ns::Url>>;

#[objc::msg_send(data)]
pub fn data(&self) -> Option<&ns::Data>;
pub fn data(&self) -> Option<arc::R<ns::Data>>;

#[objc::msg_send(pan)]
pub fn pan(&self) -> f32;
Expand Down Expand Up @@ -148,7 +148,7 @@ impl Player {
pub fn settings(&self) -> &ns::Dictionary<ns::String, ns::Id>;

#[objc::msg_send(format)]
pub fn format(&self) -> &av::AudioFormat;
pub fn format(&self) -> arc::R<av::AudioFormat>;

#[objc::msg_send(isMeteringEnabled)]
pub fn is_metering_enabled(&self) -> bool;
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/av/kit/picture_in_picture_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl PipController {
pub fn set_can_start_pip_automatically_from_inline(&mut self, val: bool);

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: PipControllerDelegate>(&mut self, val: Option<&D>);
Expand Down
5 changes: 4 additions & 1 deletion cidre/src/av/media_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ impl FileType {
}
}

define_obj_type!(pub FileTypeProfile(ns::String));
define_obj_type!(
#[doc(alias = "AVFileTypeProfile")]
pub FileTypeProfile(ns::String)
);

/// File type profiles
impl FileTypeProfile {
Expand Down
4 changes: 2 additions & 2 deletions cidre/src/core_motion/headphone_motion_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl HeadphoneMotionManager {
pub fn authorization_status() -> cm::AuthorizationStatus;

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&mut self, val: Option<&D>);
Expand All @@ -23,7 +23,7 @@ impl HeadphoneMotionManager {
pub fn is_device_motion_active(&self) -> bool;

#[objc::msg_send(deviceMotion)]
pub fn device_motion(&self) -> Option<&cm::DeviceMotion>;
pub fn device_motion(&self) -> Option<arc::R<cm::DeviceMotion>>;

#[objc::msg_send(startDeviceMotionUpdates)]
pub fn start_device_motion_updates(&mut self);
Expand Down
6 changes: 3 additions & 3 deletions cidre/src/mc/browser_view_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ impl BrowserViewController {
}

#[objc::msg_send(browser)]
pub fn browser(&self) -> Option<&mc::NearbyServiceBrowser>;
pub fn browser(&self) -> Option<arc::R<mc::NearbyServiceBrowser>>;

#[objc::msg_send(session)]
pub fn session(&self) -> &mc::Session;
pub fn session(&self) -> arc::R<mc::Session>;

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&mut self, val: Option<&D>);
Expand Down
10 changes: 5 additions & 5 deletions cidre/src/mc/nearby_service_advertiser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ impl NearbyServiceAdvertiser {
pub fn stop_advertising_peer(&mut self);

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&self, val: Option<&D>);

#[objc::msg_send(myPeerID)]
pub fn my_peer_id(&self) -> &mc::PeerId;
pub fn my_peer_id(&self) -> arc::R<mc::PeerId>;

#[objc::msg_send(discoveryInfo)]
pub fn discovery_info(&self) -> Option<&ns::Dictionary<ns::String, ns::String>>;
pub fn discovery_info(&self) -> Option<arc::R<ns::Dictionary<ns::String, ns::String>>>;

#[objc::msg_send(serviceType)]
pub fn service_type(&self) -> &ns::String;
pub fn service_type(&self) -> arc::R<ns::String>;
}

#[objc::protocol(MCNearbyServiceAdvertiserDelegate)]
pub trait Delegate: objc::Obj {
/// Incoming invitation request. Call the invitation_handler block with true
/// Incoming invitation request. Call the invitation_handler block with true
/// and a valid session to connect the inviting peer to the session.
#[objc::msg_send(advertiser:didReceiveInvitationFromPeer:withContext:invitationHandler:)]
fn advertiser_did_receive_invitation_from_peer(
Expand Down
2 changes: 1 addition & 1 deletion cidre/src/mc/nearby_service_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl NearbyServiceBrowser {
);

#[objc::msg_send(delegate)]
pub fn delegate(&self) -> Option<&AnyDelegate>;
pub fn delegate(&self) -> Option<arc::R<AnyDelegate>>;

#[objc::msg_send(setDelegate:)]
pub fn set_delegate<D: Delegate>(&mut self, val: Option<&D>);
Expand Down

0 comments on commit eb7aee2

Please sign in to comment.