From e08df0201902cfc69e073772762974db98903426 Mon Sep 17 00:00:00 2001 From: Yury Korolev Date: Tue, 12 Dec 2023 18:55:33 +0300 Subject: [PATCH] hls example start --- cidre/Cargo.toml | 7 - cidre/examples/av-asset-writer-hls/main.rs | 126 +++++++++++++ cidre/pomace/av/av.h | 5 + cidre/src/av.rs | 6 + cidre/src/av/asset/segment_report.rs | 3 +- cidre/src/av/asset/writer.rs | 24 ++- cidre/src/av/asset/writer_input.rs | 6 +- cidre/src/av/output_settings_assistant.rs | 208 +++++++++++++++++++++ cidre/src/cm/format_description_bridge.rs | 29 ++- cidre/src/lib.rs | 2 + cidre/src/objc.rs | 6 + cidre/src/sc.rs | 2 +- cidre/src/ut/_type.rs | 2 +- cidre/src/ut/core_types.rs | 2 +- 14 files changed, 395 insertions(+), 33 deletions(-) create mode 100644 cidre/examples/av-asset-writer-hls/main.rs create mode 100644 cidre/src/av/output_settings_assistant.rs diff --git a/cidre/Cargo.toml b/cidre/Cargo.toml index 2704f202..1f688fd4 100644 --- a/cidre/Cargo.toml +++ b/cidre/Cargo.toml @@ -122,13 +122,6 @@ required-features = ["am"] name = "am-device-mount-dev-image" required-features = ["am"] -[[example]] -name = "at-audio" - -[[example]] -name = "wk-web-view" -required-features = ["wk"] - [lib] # proc-macro = true #crate-type = ["staticlib", "rlib"] diff --git a/cidre/examples/av-asset-writer-hls/main.rs b/cidre/examples/av-asset-writer-hls/main.rs new file mode 100644 index 00000000..8d2b35d8 --- /dev/null +++ b/cidre/examples/av-asset-writer-hls/main.rs @@ -0,0 +1,126 @@ +use std::time::Duration; + +use cidre::{ + arc, av, av::AssetWriterDelegate, cm, define_obj_type, dispatch, ns, objc, sc, + sc::StreamOutput, ut, +}; + +#[repr(C)] +struct Context { + input: arc::R, + writer: arc::R, +} + +define_obj_type!( + OutputDelegate + sc::StreamOutputImpl, + Context, + OUTPUT_DELEGATE_CLS +); + +impl sc::StreamOutput for OutputDelegate {} + +#[objc::add_methods] +impl sc::StreamOutputImpl for OutputDelegate { + extern "C" fn impl_stream_did_output_sample_buf( + &mut self, + _cmd: Option<&cidre::objc::Sel>, + _stream: &sc::Stream, + sample_buffer: &mut cm::SampleBuf, + _kind: sc::OutputType, + ) { + if sample_buffer.image_buf().is_none() { + // skipping sample buffers without image buffers + eprint!("n"); + return; + } + let ctx = self.inner_mut(); + if ctx.input.is_ready_for_more_media_data() { + let res = unsafe { ctx.input.append_sample_buf_throws(sample_buffer) }; + if res { + eprint!("."); + } else { + eprint!("{:?}", ctx.writer.error()); + } + } else { + eprint!("x"); + } + } +} + +define_obj_type!( + WriterDelegate + av::AssetWriterDelegateImpl, + usize, + WRITER_DELEGATE_CLS +); + +impl AssetWriterDelegate for WriterDelegate {} + +#[objc::add_methods] +impl av::AssetWriterDelegateImpl for WriterDelegate { + extern "C" fn impl_asset_writer_did_output_segment_data_with_report( + &mut self, + _cmd: Option<&objc::Sel>, + _writer: &av::AssetWriter, + _segment_data: &ns::Data, + segment_type: av::AssetSegmentType, + segment_report: Option<&av::AssetSegmentReport>, + ) { + eprintln!("{segment_type:?} {segment_report:?}"); + if let Some(report) = segment_report { + let report = &report.track_reports()[0]; + eprintln!("duration: {:?}", report.duration().seconds()); + } + } +} + +#[tokio::main] +async fn main() { + const FPS: i32 = 30; + + let delegate = WriterDelegate::with(0); + let mut writer = av::AssetWriter::with_content_type(ut::Type::mpeg4movie()).unwrap(); + + let assist = + av::OutputSettingsAssistant::with_preset(av::OutputSettingsPreset::hevc_1920x1080()) + .unwrap(); + let mut input = av::AssetWriterInput::with_media_type_and_output_settings( + av::MediaType::video(), + assist.video_settings().as_deref(), + ) + .unwrap(); + input.set_expects_media_data_in_real_time(true); + + writer.add_input(&input).unwrap(); + writer.set_delegate(Some(delegate.as_ref())); + writer.set_output_file_type_profile(Some(av::FileTypeProfile::mpeg4_apple_hls())); + writer.set_preferred_output_segment_interval(cm::Time::with_seconds(6.0, 1)); + writer.set_initial_segment_start_time(cm::Time::zero()); + let queue = dispatch::Queue::serial_with_autoreleasepool(); + + let content = sc::ShareableContent::current().await.expect("content"); + let ref display = content.displays()[0]; + let mut cfg = sc::StreamCfg::new(); + cfg.set_minimum_frame_interval(cm::Time::new(1, FPS)); + cfg.set_width(display.width() as usize * 2); + cfg.set_height(display.height() as usize * 2); + let windows = ns::Array::new(); + let filter = sc::ContentFilter::with_display_excluding_windows(display, &windows); + let stream = sc::Stream::new(&filter, &cfg); + let output = OutputDelegate::with(Context { + input, + writer: writer.clone(), + }); + stream + .add_stream_output(output.as_ref(), sc::OutputType::Screen, Some(&queue)) + .expect("failed to add output"); + if writer.start_writing() { + writer.start_session_at_source_time(cm::Time::zero()); + stream.start().await.unwrap(); + } else { + eprintln!("failed? {:?}", writer.error()); + } + eprintln!("started"); + + tokio::time::sleep(Duration::from_secs(100)).await; + eprintln!("ended"); +} diff --git a/cidre/pomace/av/av.h b/cidre/pomace/av/av.h index 2423e7ee..68259f7d 100644 --- a/cidre/pomace/av/av.h +++ b/cidre/pomace/av/av.h @@ -37,6 +37,8 @@ Class AV_ASSET_READER; Class AV_ASSET_WRITER_INPUT; Class AV_ASSET_READER_TRACK_OUTPUT; +Class AV_OUTPUT_SETTINGS_ASSISTANT; + Class AV_AUDIO_TIME; Class AV_AUDIO_UNIT_EQ; @@ -77,6 +79,9 @@ static void av_initializer(void) AV_CAPTURE_MULTI_CAM_SESSION = [AVCaptureMultiCamSession class]; AV_CAPTURE_METADATA_INPUT = [AVCaptureMetadataInput class]; #endif + + AV_OUTPUT_SETTINGS_ASSISTANT = [AVOutputSettingsAssistant class]; + AV_AUDIO_PLAYER_NODE = [AVAudioPlayerNode class]; AV_AUDIO_ENGINE = [AVAudioEngine class]; diff --git a/cidre/src/av.rs b/cidre/src/av.rs index 6265aa64..297f0c03 100644 --- a/cidre/src/av.rs +++ b/cidre/src/av.rs @@ -78,6 +78,8 @@ pub mod asset; pub use asset::Asset; pub use asset::AssetCache; pub use asset::AssetWriter; +pub use asset::AssetWriterDelegate; +pub use asset::AssetWriterDelegateImpl; pub use asset::FragmentedAsset; pub use asset::FragmentedAssetMinder; pub use asset::FragmentedTrack as FragmentedAssetTrack; @@ -135,4 +137,8 @@ pub use sample_buffer::QueuedSampleBufRendering; pub use sample_buffer::QueuedSampleBufRenderingStatus; pub use sample_buffer::VideoRenderer as SampleBufVideoRenderer; +pub mod output_settings_assistant; +pub use output_settings_assistant::OutputSettingsAssistant; +pub use output_settings_assistant::OutputSettingsPreset; + mod time; diff --git a/cidre/src/av/asset/segment_report.rs b/cidre/src/av/asset/segment_report.rs index 20501941..250091a8 100644 --- a/cidre/src/av/asset/segment_report.rs +++ b/cidre/src/av/asset/segment_report.rs @@ -1,5 +1,6 @@ use crate::{av, cm, define_obj_type, ns, objc}; +#[derive(Debug, Eq, PartialEq, Copy, Clone)] #[doc(alias = "AVAssetSegmentType")] #[repr(isize)] pub enum SegmentType { @@ -24,7 +25,7 @@ impl SegmentReport { pub fn segment_type(&self) -> SegmentType; #[objc::msg_send(trackReports)] - pub fn track_reports(&self) -> ns::Array; + pub fn track_reports(&self) -> &ns::Array; } define_obj_type!( diff --git a/cidre/src/av/asset/writer.rs b/cidre/src/av/asset/writer.rs index f503898f..1b272df4 100644 --- a/cidre/src/av/asset/writer.rs +++ b/cidre/src/av/asset/writer.rs @@ -31,7 +31,10 @@ impl arc::A { ) -> Option>; #[objc::msg_send(initWithContentType:)] - pub fn init_with_content_type(self, output_content_type: &ut::Type) -> arc::R; + pub unsafe fn init_with_content_type_throws( + self, + output_content_type: &ut::Type, + ) -> arc::R; } impl Writer { @@ -69,6 +72,9 @@ impl Writer { #[objc::msg_send(cancelWriting)] pub fn cancel_writing(&mut self); + #[objc::msg_send(status)] + pub fn status(&self) -> Status; + #[objc::msg_send(error)] pub fn error(&self) -> Option<&ns::Error>; @@ -85,7 +91,7 @@ impl Writer { pub fn with_url_and_file_type<'ar>( url: &ns::Url, file_type: &av::FileType, - ) -> Result, &'ar ns::Error> { + ) -> Result, &'ar ns::Error> { let mut error = None; unsafe { let res = Self::alloc().init_with_url_file_type_err(url, file_type, &mut error); @@ -95,6 +101,14 @@ impl Writer { } } } + + pub fn with_content_type<'ar>( + output_content_type: &ut::Type, + ) -> Result, &'ar ns::Exception> { + ns::try_catch(|| unsafe { + Self::alloc().init_with_content_type_throws(output_content_type) + }) + } } /// AVAssetWriterSegmentation @@ -173,6 +187,8 @@ extern "C" { #[cfg(test)] mod tests { + use crate::ut; + #[test] fn basics() { use crate::{av, ns}; @@ -180,5 +196,9 @@ mod tests { let writer = av::AssetWriter::with_url_and_file_type(&url, av::FileType::mp4()).unwrap(); assert_eq!(writer.inputs().len(), 0); + + av::AssetWriter::with_content_type(&ut::Type::pdf()) + .expect_err("Can't create writer for pdf"); + av::AssetWriter::with_content_type(&ut::Type::mpeg4movie()).expect("Can't create viedeo"); } } diff --git a/cidre/src/av/asset/writer_input.rs b/cidre/src/av/asset/writer_input.rs index 42556c88..ef1a69e9 100644 --- a/cidre/src/av/asset/writer_input.rs +++ b/cidre/src/av/asset/writer_input.rs @@ -119,13 +119,13 @@ impl WriterInput { /// /// This method throws an exception if the sample buffer's media type does not match the asset writer input's media type. #[objc::msg_send(appendSampleBuffer:)] - pub fn append_sample_buffer_throws(&mut self, buffer: &cm::SampleBuf) -> bool; + pub unsafe fn append_sample_buf_throws(&mut self, buffer: &cm::SampleBuf) -> bool; - pub fn append_sample_buffer<'ar>( + pub fn append_sample_buf<'ar>( &mut self, buffer: &cm::SampleBuf, ) -> Result { - try_catch(|| self.append_sample_buffer_throws(buffer)) + try_catch(|| unsafe { self.append_sample_buf_throws(buffer) }) } #[objc::msg_send(requestMediaDataWhenReadyOnQueue:usingBlock:)] diff --git a/cidre/src/av/output_settings_assistant.rs b/cidre/src/av/output_settings_assistant.rs new file mode 100644 index 00000000..91029989 --- /dev/null +++ b/cidre/src/av/output_settings_assistant.rs @@ -0,0 +1,208 @@ +use crate::{arc, av, cm, define_cls, define_obj_type, ns, objc}; + +define_obj_type!( + #[doc(alias = "AVOutputSettingsPreset")] + pub OutputSettingsPreset(ns::String) +); + +impl OutputSettingsPreset { + /// A preset for H.264 video at 640 by 480 pixels. + #[doc(alias = "AVOutputSettingsPreset640x480")] + pub fn h264_640x480() -> &'static Self { + unsafe { AVOutputSettingsPreset640x480 } + } + + /// A preset for H.264 video at 960 by 540 pixels. + #[doc(alias = "AVOutputSettingsPreset960x540")] + pub fn h264_960x540() -> &'static Self { + unsafe { AVOutputSettingsPreset960x540 } + } + + /// A preset for H.264 video at 1280 by 720 pixels. + #[doc(alias = "AVOutputSettingsPreset1280x720")] + pub fn h264_1280x720() -> &'static Self { + unsafe { AVOutputSettingsPreset1280x720 } + } + + /// A preset for H.264 video at 1920 by 1080 pixels. + #[doc(alias = "AVOutputSettingsPreset1920x1080")] + pub fn h264_1920x1080() -> &'static Self { + unsafe { AVOutputSettingsPreset1920x1080 } + } + + /// A preset for H.264 video at 3840 by 2160 pixels. + #[doc(alias = "AVOutputSettingsPreset3840x2160")] + pub fn h264_3840x2160() -> &'static Self { + unsafe { AVOutputSettingsPreset3840x2160 } + } + + /// A preset for HEVC video at 1920 by 1080 pixels. + #[doc(alias = "AVOutputSettingsPresetHEVC1920x1080")] + pub fn hevc_1920x1080() -> &'static Self { + unsafe { AVOutputSettingsPresetHEVC1920x1080 } + } + + /// A preset for HEVC with Alpha video at 1920 by 1080 pixels. + #[doc(alias = "AVOutputSettingsPresetHEVC1920x1080WithAlpha")] + pub fn hevc_1920x1080_with_alhpa() -> &'static Self { + unsafe { AVOutputSettingsPresetHEVC1920x1080WithAlpha } + } + + /// A preset for HEVC video at 3840 by 2160 pixels. + #[doc(alias = "AVOutputSettingsPresetHEVC3840x2160")] + pub fn hevc_3840x2160() -> &'static Self { + unsafe { AVOutputSettingsPresetHEVC3840x2160 } + } + + /// A preset for HEVC with Alpha video at 3840 by 2160 pixels. + #[doc(alias = "AVOutputSettingsPresetHEVC3840x2160WithAlpha")] + pub fn hevc_3840x2160_with_alpha() -> &'static Self { + unsafe { AVOutputSettingsPresetHEVC3840x2160WithAlpha } + } + + /// A preset for HEVC video at 7680 by 4320 pixels. + #[cfg(target_os = "macos")] + #[doc(alias = "AVOutputSettingsPresetHEVC7680x4320")] + pub fn hevc_7680x4320() -> &'static Self { + unsafe { AVOutputSettingsPresetHEVC7680x4320 } + } + + /// A preset for MV-HEVC video at 960 by 960 pixels. + #[doc(alias = "AVOutputSettingsPresetMVHEVC960x960")] + pub fn mv_hevc_960x960() -> &'static Self { + unsafe { AVOutputSettingsPresetMVHEVC960x960 } + } + + /// A preset for MV-HEVC video at 1440 by 1440 pixels. + #[doc(alias = "AVOutputSettingsPresetMVHEVC1440x1440")] + pub fn mv_hevc_1440x1440() -> &'static Self { + unsafe { AVOutputSettingsPresetMVHEVC1440x1440 } + } +} + +#[link(name = "AVFoundation", kind = "framework")] +extern "C" { + static AVOutputSettingsPreset640x480: &'static OutputSettingsPreset; + static AVOutputSettingsPreset960x540: &'static OutputSettingsPreset; + static AVOutputSettingsPreset1280x720: &'static OutputSettingsPreset; + static AVOutputSettingsPreset1920x1080: &'static OutputSettingsPreset; + static AVOutputSettingsPreset3840x2160: &'static OutputSettingsPreset; + static AVOutputSettingsPresetHEVC1920x1080: &'static OutputSettingsPreset; + static AVOutputSettingsPresetHEVC1920x1080WithAlpha: &'static OutputSettingsPreset; + static AVOutputSettingsPresetHEVC3840x2160: &'static OutputSettingsPreset; + static AVOutputSettingsPresetHEVC3840x2160WithAlpha: &'static OutputSettingsPreset; + #[cfg(target_os = "macos")] + static AVOutputSettingsPresetHEVC7680x4320: &'static OutputSettingsPreset; + static AVOutputSettingsPresetMVHEVC960x960: &'static OutputSettingsPreset; + static AVOutputSettingsPresetMVHEVC1440x1440: &'static OutputSettingsPreset; +} + +define_obj_type!( + #[doc(alias = "AVOutputSettingsAssistant")] + pub OutputSettingsAssistant(ns::Id) +); + +impl OutputSettingsAssistant { + define_cls!(AV_OUTPUT_SETTINGS_ASSISTANT); + + #[objc::cls_msg_send(availableOutputSettingsPresets)] + pub fn available_presets_ar() -> arc::Rar>; + + #[objc::cls_rar_retain] + pub fn available_presets() -> arc::R>; + + #[objc::cls_msg_send(outputSettingsAssistantWithPreset:)] + pub fn with_preset_ar(preset: &OutputSettingsPreset) -> Option>; + + #[objc::cls_rar_retain] + pub fn with_preset(preset: &OutputSettingsPreset) -> Option>; + + #[objc::msg_send(audioSettings)] + pub fn audio_settings_ar(&self) -> Option>>; + + #[objc::rar_retain] + pub fn audio_settings(&self) -> Option>>; + + #[objc::msg_send(videoSettings)] + pub fn video_settings_ar(&self) -> Option>>; + + #[objc::rar_retain] + pub fn video_settings(&self) -> Option>>; + + #[objc::msg_send(outputFileType)] + pub fn output_file_type_ar(&self) -> arc::Rar; + + #[objc::rar_retain] + pub fn output_file_type(&self) -> arc::R; +} + +/// AVOutputSettingsAssistant_SourceInformation +impl OutputSettingsAssistant { + #[objc::msg_send(sourceAudioFormat)] + pub fn src_audio_format(&self) -> Option<&cm::AudioFormatDesc>; + + #[objc::msg_send(setSourceAudioFormat:)] + pub fn set_src_audio_format(&mut self, val: Option<&cm::AudioFormatDesc>); + #[objc::msg_send(sourceVideoFormat)] + pub fn src_video_format(&self) -> Option<&cm::VideoFormatDesc>; + + #[objc::msg_send(setSourceVideoFormat:)] + pub fn set_src_video_format(&mut self, val: Option<&cm::VideoFormatDesc>); + + #[objc::msg_send(sourceVideoAverageFrameDuration)] + pub fn src_video_average_frame_duration(&self) -> cm::Time; + + #[objc::msg_send(setSourceVideoAverageFrameDuration:)] + pub fn set_src_video_average_frame_duration(&mut self, val: cm::Time); +} + +#[link(name = "av", kind = "static")] +extern "C" { + static AV_OUTPUT_SETTINGS_ASSISTANT: &'static objc::Class; +} + +#[cfg(test)] +mod tests { + use crate::{av, objc}; + + #[test] + fn basics() { + let presets = objc::ar_pool(|| av::OutputSettingsAssistant::available_presets()); + + eprintln!( + "available presets {presets:?} {}", + presets.as_type_ref().retain_count() + ); + let presets = av::OutputSettingsAssistant::available_presets(); + + eprintln!( + "available presets {presets:?} {}", + presets.as_type_ref().retain_count() + ); + + let assistant = + av::OutputSettingsAssistant::with_preset(&av::OutputSettingsPreset::h264_640x480()) + .unwrap(); + eprintln!( + "assistant {assistant:?} {}", + assistant.as_type_ref().retain_count() + ); + + let audio1 = assistant.audio_settings().unwrap(); + let audio2 = assistant.audio_settings().unwrap(); + unsafe { + assert_ne!( + audio1.as_type_ref().as_type_ptr(), + audio2.as_type_ref().as_type_ptr() + ); + } + + let _ftype = assistant.output_file_type(); + + let video1 = assistant.video_settings().unwrap(); + eprintln!("video1 {video1:?}"); + + assert!(assistant.src_audio_format().is_none()); + assert!(assistant.src_video_format().is_none()); + } +} diff --git a/cidre/src/cm/format_description_bridge.rs b/cidre/src/cm/format_description_bridge.rs index dfd04995..ad23ae00 100644 --- a/cidre/src/cm/format_description_bridge.rs +++ b/cidre/src/cm/format_description_bridge.rs @@ -57,7 +57,7 @@ impl ImageDescFlavor { impl cm::VideoFormatDesc { /// Copies the contents of a cm::VideoFormatDescription to a cm::BlockBuffer in big-endian byte ordering. - pub fn as_be_image_desc_cm_buffer_in( + pub fn as_be_image_desc_cm_buf_in( &self, string_encoding: cf::StringEncoding, flavor: Option<&ImageDescFlavor>, @@ -76,19 +76,14 @@ impl cm::VideoFormatDesc { } } - pub fn as_be_image_desc_cm_buffer( + pub fn as_be_image_desc_cm_buf( &self, flavor: Option<&ImageDescFlavor>, ) -> Result, os::Status> { - Self::as_be_image_desc_cm_buffer_in( - self, - cf::StringEncoding::system_encoding(), - flavor, - None, - ) + Self::as_be_image_desc_cm_buf_in(self, cf::StringEncoding::system_encoding(), flavor, None) } - pub fn from_be_image_desc_buffer_in( + pub fn from_be_image_desc_buf_in( image_description_block_buffer: &cm::BlockBuf, string_encoding: cf::StringEncoding, flavor: Option<&ImageDescFlavor>, @@ -107,11 +102,11 @@ impl cm::VideoFormatDesc { } } - pub fn from_be_image_desc_buffer( + pub fn from_be_image_desc_buf( image_description_block_buffer: &cm::BlockBuf, flavor: Option<&ImageDescFlavor>, ) -> Result, os::Status> { - Self::from_be_image_desc_buffer_in( + Self::from_be_image_desc_buf_in( image_description_block_buffer, cf::StringEncoding::system_encoding(), flavor, @@ -207,7 +202,7 @@ impl cm::AudioFormatDesc { /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with /// garbage values (0xFFFF). The caller must overwrite these values with a valid dataRefIndex /// if writing the SampleDescription to a QuickTime/ISO file. - pub fn as_be_sound_desc_cm_buffer_in( + pub fn as_be_sound_desc_cm_buf_in( &self, flavor: Option<&SoundDescFlavor>, allocator: Option<&cf::Allocator>, @@ -224,11 +219,11 @@ impl cm::AudioFormatDesc { } } - pub fn as_be_sound_desc_cm_buffer( + pub fn as_be_sound_desc_cm_buf( &self, flavor: Option<&SoundDescFlavor>, ) -> Result, os::Status> { - Self::as_be_sound_desc_cm_buffer_in(self, flavor, None) + Self::as_be_sound_desc_cm_buf_in(self, flavor, None) } pub fn from_be_sound_desc_data_in( @@ -257,7 +252,7 @@ impl cm::AudioFormatDesc { Self::from_be_sound_desc_data_in(data, flavor, None) } - pub fn from_be_sound_desc_buffer_in( + pub fn from_be_sound_desc_buf_in( buffer: &cm::BlockBuf, flavor: Option<&SoundDescFlavor>, allocator: Option<&cf::Allocator>, @@ -275,11 +270,11 @@ impl cm::AudioFormatDesc { } #[inline] - pub fn from_be_sound_desc_buffer( + pub fn from_be_sound_desc_buf( buffer: &cm::BlockBuf, flavor: Option<&SoundDescFlavor>, ) -> Result, os::Status> { - Self::from_be_sound_desc_buffer_in(buffer, flavor, None) + Self::from_be_sound_desc_buf_in(buffer, flavor, None) } } diff --git a/cidre/src/lib.rs b/cidre/src/lib.rs index 3b9492a7..4a9587bd 100644 --- a/cidre/src/lib.rs +++ b/cidre/src/lib.rs @@ -111,6 +111,8 @@ pub mod cat; ))] pub mod ui; +/// UniformTypeIdentifiers +#[cfg(feature = "ut")] pub mod ut; pub mod time; diff --git a/cidre/src/objc.rs b/cidre/src/objc.rs index e3623f20..7e7a18a6 100644 --- a/cidre/src/objc.rs +++ b/cidre/src/objc.rs @@ -298,6 +298,7 @@ macro_rules! define_obj_type { ); impl $NewType { + #[allow(dead_code)] #[inline] pub fn inner(&self) -> &$InnerType { unsafe { @@ -307,6 +308,7 @@ macro_rules! define_obj_type { } } + #[allow(dead_code)] #[inline] pub fn inner_mut(&mut self) -> &mut $InnerType { unsafe { @@ -316,6 +318,7 @@ macro_rules! define_obj_type { } } + #[allow(dead_code)] pub fn register_cls() -> &'static $crate::objc::ClassInstExtra { let name = concat!(stringify!($CLS), "\0"); let cls = unsafe { $crate::objc::objc_allocateClassPair($crate::objc::NS_OBJECT, name.as_ptr(), 0) }; @@ -337,6 +340,7 @@ macro_rules! define_obj_type { unsafe { std::mem::transmute(cls) } } + #[allow(dead_code)] pub fn cls() -> &'static $crate::objc::ClassInstExtra { let name = concat!(stringify!($CLS), "\0"); let cls = unsafe { $crate::objc::objc_getClass(name.as_ptr()) }; @@ -346,6 +350,7 @@ macro_rules! define_obj_type { } } + #[allow(dead_code)] pub fn with(inner: $InnerType) -> $crate::arc::R { unsafe { Self::cls().alloc_init(inner).unwrap_unchecked() } } @@ -382,6 +387,7 @@ macro_rules! define_obj_type { } impl $NewType { + #[allow(dead_code)] #[inline] pub fn retained(&self) -> $crate::arc::R { unsafe { $crate::objc::Obj::retain(self) } diff --git a/cidre/src/sc.rs b/cidre/src/sc.rs index 7f9eaa66..ace66603 100644 --- a/cidre/src/sc.rs +++ b/cidre/src/sc.rs @@ -7,8 +7,8 @@ pub use stream::Delegate as StreamDelegate; pub use stream::DelegateImpl as StreamDelegateImpl; pub use stream::FrameInfo; pub use stream::FrameStatus; -pub use stream::Output as StreamOutputImpl; pub use stream::Output as StreamOutput; +pub use stream::OutputImpl as StreamOutputImpl; pub use stream::OutputType; pub use stream::PresenterOverlayAlertSetting; pub use stream::Stream; diff --git a/cidre/src/ut/_type.rs b/cidre/src/ut/_type.rs index 58fa34c7..b9fc416c 100644 --- a/cidre/src/ut/_type.rs +++ b/cidre/src/ut/_type.rs @@ -32,7 +32,7 @@ impl Type { pub fn preferred_mime_type(&self) -> Option<&ns::String>; #[objc::msg_send(localizedDescription)] - pub fn localized_description(&self) -> Option<&ns::String>; + pub fn localized_desc(&self) -> Option<&ns::String>; #[objc::msg_send(version)] pub fn version(&self) -> Option<&ns::String>; diff --git a/cidre/src/ut/core_types.rs b/cidre/src/ut/core_types.rs index b3d3dff2..def10045 100644 --- a/cidre/src/ut/core_types.rs +++ b/cidre/src/ut/core_types.rs @@ -990,7 +990,7 @@ impl ut::Type { /// conforms to: public.movie #[doc(alias = "UTTypeMPEG4Movie")] #[inline] - pub fn mpeg4video() -> &'static Self { + pub fn mpeg4movie() -> &'static Self { unsafe { UTTypeMPEG4Movie } }