Skip to content

Commit

Permalink
chore(deps): bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyKomodo committed Oct 11, 2024
1 parent 61110b8 commit ae46c2c
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 325 deletions.
590 changes: 303 additions & 287 deletions Cargo.lock

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions ffmpeg/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ impl DecoderCodec {
pub fn new(codec_id: AVCodecID) -> Option<Self> {
// Safety: `avcodec_find_decoder` is safe to call.
let codec = unsafe { avcodec_find_decoder(codec_id) };
if codec.is_null() { None } else { Some(Self(codec)) }
if codec.is_null() {
None
} else {
Some(Self(codec))
}
}

pub fn by_name(name: &str) -> Option<Self> {
let c_name = std::ffi::CString::new(name).ok()?;
let codec = unsafe { avcodec_find_decoder_by_name(c_name.as_ptr()) };
if codec.is_null() { None } else { Some(Self(codec)) }
if codec.is_null() {
None
} else {
Some(Self(codec))
}
}

pub fn as_ptr(&self) -> *const AVCodec {
Expand Down Expand Up @@ -82,14 +90,22 @@ impl EncoderCodec {
pub fn new(codec_id: AVCodecID) -> Option<Self> {
// Safety: `avcodec_find_encoder` is safe to call.
let codec = unsafe { avcodec_find_encoder(codec_id) };
if codec.is_null() { None } else { Some(Self(codec)) }
if codec.is_null() {
None
} else {
Some(Self(codec))
}
}

pub fn by_name(name: &str) -> Option<Self> {
let c_name = std::ffi::CString::new(name).ok()?;
// Safety: `avcodec_find_encoder_by_name` is safe to call.
let codec = unsafe { avcodec_find_encoder_by_name(c_name.as_ptr()) };
if codec.is_null() { None } else { Some(Self(codec)) }
if codec.is_null() {
None
} else {
Some(Self(codec))
}
}

pub fn as_ptr(&self) -> *const AVCodec {
Expand Down
6 changes: 5 additions & 1 deletion ffmpeg/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ impl Dictionary {
// Safety: av_dict_set is safe to call
let ret = unsafe { av_dict_set(self.ptr.as_mut(), key.as_ptr(), value.as_ptr(), 0) };

if ret < 0 { Err(FfmpegError::Code(ret.into())) } else { Ok(()) }
if ret < 0 {
Err(FfmpegError::Code(ret.into()))
} else {
Ok(())
}
}

pub fn get(&self, key: &str) -> Option<String> {
Expand Down
12 changes: 10 additions & 2 deletions ffmpeg/src/filter_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ impl FilterGraph {
// Safety: avfilter_graph_config is safe to call
let ret = unsafe { avfilter_graph_config(self.as_mut_ptr(), std::ptr::null_mut()) };

if ret < 0 { Err(FfmpegError::Code(ret.into())) } else { Ok(()) }
if ret < 0 {
Err(FfmpegError::Code(ret.into()))
} else {
Ok(())
}
}

pub fn dump(&mut self) -> Option<String> {
Expand Down Expand Up @@ -190,7 +194,11 @@ impl Filter {
// valid
let filter = unsafe { avfilter_get_by_name(name.as_ptr()) };

if filter.is_null() { None } else { Some(Self(filter)) }
if filter.is_null() {
None
} else {
Some(Self(filter))
}
}

pub fn as_ptr(&self) -> *const AVFilter {
Expand Down
32 changes: 16 additions & 16 deletions ffmpeg/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,45 +130,45 @@ impl std::fmt::Debug for Frame {

impl VideoFrame {
pub fn width(&self) -> usize {
self.0.0.as_deref_except().width as usize
self.0 .0.as_deref_except().width as usize
}

pub fn height(&self) -> usize {
self.0.0.as_deref_except().height as usize
self.0 .0.as_deref_except().height as usize
}

pub fn sample_aspect_ratio(&self) -> AVRational {
self.0.0.as_deref_except().sample_aspect_ratio
self.0 .0.as_deref_except().sample_aspect_ratio
}

pub fn set_sample_aspect_ratio(&mut self, sample_aspect_ratio: AVRational) {
self.0.0.as_deref_mut_except().sample_aspect_ratio = sample_aspect_ratio;
self.0 .0.as_deref_mut_except().sample_aspect_ratio = sample_aspect_ratio;
}

pub fn set_width(&mut self, width: usize) {
self.0.0.as_deref_mut_except().width = width as i32;
self.0 .0.as_deref_mut_except().width = width as i32;
}

pub fn set_height(&mut self, height: usize) {
self.0.0.as_deref_mut_except().height = height as i32;
self.0 .0.as_deref_mut_except().height = height as i32;
}

pub fn is_keyframe(&self) -> bool {
self.0.0.as_deref_except().key_frame != 0
self.0 .0.as_deref_except().key_frame != 0
}

pub fn pict_type(&self) -> AVPictureType {
self.0.0.as_deref_except().pict_type
self.0 .0.as_deref_except().pict_type
}

pub fn set_pict_type(&mut self, pict_type: AVPictureType) {
self.0.0.as_deref_mut_except().pict_type = pict_type;
self.0 .0.as_deref_mut_except().pict_type = pict_type;
}

pub fn data(&self, index: usize) -> Option<&[u8]> {
unsafe {
self.0
.0
.0
.as_deref_except()
.data
.get(index)
Expand Down Expand Up @@ -212,27 +212,27 @@ impl std::ops::DerefMut for VideoFrame {

impl AudioFrame {
pub fn nb_samples(&self) -> i32 {
self.0.0.as_deref_except().nb_samples
self.0 .0.as_deref_except().nb_samples
}

pub fn set_nb_samples(&mut self, nb_samples: usize) {
self.0.0.as_deref_mut_except().nb_samples = nb_samples as i32;
self.0 .0.as_deref_mut_except().nb_samples = nb_samples as i32;
}

pub fn sample_rate(&self) -> i32 {
self.0.0.as_deref_except().sample_rate
self.0 .0.as_deref_except().sample_rate
}

pub fn set_sample_rate(&mut self, sample_rate: usize) {
self.0.0.as_deref_mut_except().sample_rate = sample_rate as i32;
self.0 .0.as_deref_mut_except().sample_rate = sample_rate as i32;
}

pub fn channel_layout(&self) -> u64 {
self.0.0.as_deref_except().channel_layout
self.0 .0.as_deref_except().channel_layout
}

pub fn set_channel_layout(&mut self, channel_layout: u64) {
self.0.0.as_deref_mut_except().channel_layout = channel_layout;
self.0 .0.as_deref_mut_except().channel_layout = channel_layout;
}
}

Expand Down
6 changes: 5 additions & 1 deletion ffmpeg/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use ffmpeg_sys_next::*;

pub fn check_i64(val: i64) -> Option<i64> {
if val == AV_NOPTS_VALUE { None } else { Some(val) }
if val == AV_NOPTS_VALUE {
None
} else {
Some(val)
}
}
6 changes: 3 additions & 3 deletions foundations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ rand = { version = "0.8", optional = true }
tracing = { version = "0.1", optional = true }
tracing-subscriber = { version = "0.3", optional = true }

opentelemetry = { version = "0.24", optional = true }
opentelemetry_sdk = { version = "0.24", optional = true }
opentelemetry-otlp = { version = "0.17", optional = true, features = ["http-proto"]}
opentelemetry = { version = "0.26.0", optional = true }
opentelemetry_sdk = { version = "0.26.0", optional = true }
opentelemetry-otlp = { version = "0.26.0", optional = true, features = ["http-proto"]}

anyhow = { version = "1" }

Expand Down
2 changes: 1 addition & 1 deletion foundations/examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hyper = { version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["tokio", "http2"] }
socket2 = "0.5"
http-body-util = "0.1"
opentelemetry = { version = "0.24" }
opentelemetry = { version = "0.26.0" }
rand = "0.8"
rustls-pemfile = { version = "2" }
rustls = "0.23"
Expand Down
11 changes: 7 additions & 4 deletions foundations/src/telemetry/env_filter/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,13 @@ impl FromStr for StaticDirective {
return Err(ParseError::msg("expected fields list to end with '}]'"));
}

let fields = maybe_fields
.trim_end_matches("}]")
.split(',')
.filter_map(|s| if s.is_empty() { None } else { Some(String::from(s)) });
let fields = maybe_fields.trim_end_matches("}]").split(',').filter_map(|s| {
if s.is_empty() {
None
} else {
Some(String::from(s))
}
});
field_names.extend(fields);
};
let level = part1.parse()?;
Expand Down
12 changes: 10 additions & 2 deletions foundations/src/telemetry/env_filter/env/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ impl PartialOrd for Match {
// === impl ValueMatch ===

fn value_match_f64(v: f64) -> ValueMatch {
if v.is_nan() { ValueMatch::NaN } else { ValueMatch::F64(v) }
if v.is_nan() {
ValueMatch::NaN
} else {
ValueMatch::F64(v)
}
}

impl ValueMatch {
Expand Down Expand Up @@ -473,7 +477,11 @@ impl SpanMatch {

#[inline]
pub(crate) fn filter(&self) -> Option<LevelFilter> {
if self.is_matched() { Some(self.level) } else { None }
if self.is_matched() {
Some(self.level)
} else {
None
}
}
}

Expand Down
1 change: 1 addition & 0 deletions foundations/src/telemetry/opentelemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod span_ext;
pub use exporter::BatchExporter;
pub use layer::{RatelimitSampler, SampleFunction, SampleResult, Sampler, ShouldSample, SpanObserver, SpanObserverLayer};
pub use node::SpanNode;
pub use opentelemetry::trace::Status;
use opentelemetry_otlp::SpanExporter;
pub use span_ext::OpenTelemetrySpanExt;

Expand Down
4 changes: 2 additions & 2 deletions image-processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ aws-config = "1.1"
aws-sdk-s3 = { version = "1.12", features = ["behavior-version-latest"] }
async-trait = "0.1"
anyhow = "1.0"
async-nats = "0.35"
async-nats = "0.37.0"
tonic = "0.12"
futures = "0.3"
thiserror = "1.0"
Expand All @@ -32,7 +32,7 @@ png = "0.17"
num_cpus = "1.16"
bytes = "1.0"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
fast_image_resize = "4"
fast_image_resize = "5.0.0"
chrono = { version = "0.4", features = ["serde"] }
url = { version = "2", features = ["serde"] }
http = "1"
Expand Down
3 changes: 1 addition & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version = "Two"
imports_granularity = "Module"
newline_style = "Unix"
normalize_comments = true
group_imports = "StdExternalCrate"
wrap_comments = true
edition = "2021"
style_edition = "2021"
format_macro_matchers = true
hard_tabs = true
reorder_impl_items = true
Expand Down

0 comments on commit ae46c2c

Please sign in to comment.