From 98b28d69cec4bc36f0f318ce9d6caef5fad438b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 8 Jul 2024 11:03:11 +0300 Subject: [PATCH] Update for new debug log macro syntax Part-of: --- audio/audiofx/src/audioloudnorm/imp.rs | 68 +-- audio/audiofx/src/audiornnoise/imp.rs | 15 +- audio/audiofx/src/ebur128level/imp.rs | 43 +- audio/audiofx/src/hrtfrender/imp.rs | 14 +- audio/claxon/src/claxondec/imp.rs | 24 +- audio/csound/src/filter/imp.rs | 10 +- audio/lewton/src/lewtondec/imp.rs | 36 +- audio/spotify/src/common.rs | 6 +- audio/spotify/src/spotifyaudiosrc/imp.rs | 18 +- generic/file/src/filesink/imp.rs | 21 +- generic/file/src/filesrc/imp.rs | 19 +- generic/gopbuffer/src/gopbuffer/imp.rs | 63 ++- generic/inter/src/sink/imp.rs | 4 +- generic/inter/src/src/imp.rs | 2 +- generic/sodium/src/decrypter/imp.rs | 77 +-- generic/sodium/src/encrypter/imp.rs | 18 +- .../threadshare/examples/standalone/macros.rs | 12 +- .../standalone/sink/async_mutex/imp.rs | 31 +- .../standalone/sink/sync_mutex/imp.rs | 31 +- .../examples/standalone/sink/task/imp.rs | 34 +- .../examples/standalone/src/imp.rs | 58 ++- generic/threadshare/src/appsrc/imp.rs | 66 +-- generic/threadshare/src/audiotestsrc/imp.rs | 56 +-- generic/threadshare/src/dataqueue.rs | 64 ++- generic/threadshare/src/inputselector/imp.rs | 18 +- generic/threadshare/src/jitterbuffer/imp.rs | 119 ++--- generic/threadshare/src/proxy/imp.rs | 112 ++--- generic/threadshare/src/queue/imp.rs | 100 ++-- generic/threadshare/src/runtime/pad.rs | 82 ++-- generic/threadshare/src/socket.rs | 24 +- generic/threadshare/src/tcpclientsrc/imp.rs | 81 ++-- generic/threadshare/src/udpsink/imp.rs | 72 +-- generic/threadshare/src/udpsrc/imp.rs | 84 ++-- generic/threadshare/tests/pad.rs | 70 +-- generic/threadshare/tests/pipeline.rs | 8 +- mux/flavors/src/flvdemux/imp.rs | 72 +-- mux/fmp4/src/fmp4mux/imp.rs | 444 ++++++++++-------- mux/mp4/src/mp4mux/imp.rs | 232 +++++---- net/aws/src/s3hlssink/imp.rs | 57 ++- net/aws/src/s3sink/multipartsink.rs | 41 +- net/aws/src/s3sink/putobjectsink.rs | 24 +- net/aws/src/s3src/imp.rs | 8 +- net/aws/src/transcribe_parse/imp.rs | 8 +- net/aws/src/transcriber/imp.rs | 109 +++-- net/aws/src/transcriber/transcribe.rs | 14 +- net/aws/src/transcriber/translate.rs | 18 +- net/hlssink3/src/hlsbasesink.rs | 44 +- net/hlssink3/src/hlscmafsink/imp.rs | 32 +- net/hlssink3/src/hlssink3/imp.rs | 22 +- net/mpegtslive/src/mpegtslive/imp.rs | 14 +- net/ndi/src/device_provider/imp.rs | 12 +- net/ndi/src/ndisink/imp.rs | 20 +- net/ndi/src/ndisinkcombiner/imp.rs | 50 +- net/ndi/src/ndisrc/imp.rs | 26 +- net/ndi/src/ndisrc/receiver.rs | 28 +- net/ndi/src/ndisrcdemux/imp.rs | 132 ++++-- net/onvif/src/onvifmetadatacombiner/imp.rs | 48 +- net/onvif/src/onvifmetadatadepay/imp.rs | 13 +- net/onvif/src/onvifmetadataoverlay/imp.rs | 36 +- net/onvif/src/onvifmetadataparse/imp.rs | 130 ++--- net/quinn/src/quinnquicsink/imp.rs | 34 +- net/quinn/src/quinnquicsrc/imp.rs | 45 +- net/raptorq/src/raptorqdec/imp.rs | 22 +- net/raptorq/src/raptorqenc/imp.rs | 20 +- net/reqwest/src/reqwesthttpsrc/imp.rs | 58 +-- net/rtp/src/ac3/depay/imp.rs | 48 +- net/rtp/src/ac3/pay/imp.rs | 43 +- net/rtp/src/av1/common/error.rs | 4 +- net/rtp/src/av1/depay/imp.rs | 51 +- net/rtp/src/av1/pay/imp.rs | 18 +- net/rtp/src/baseaudiopay/imp.rs | 18 +- net/rtp/src/basedepay/imp.rs | 272 +++++++---- net/rtp/src/basepay/imp.rs | 235 ++++++--- net/rtp/src/gcc/imp.rs | 14 +- net/rtp/src/jpeg/depay/imp.rs | 60 ++- net/rtp/src/jpeg/pay/imp.rs | 40 +- net/rtp/src/klv/depay/imp.rs | 33 +- net/rtp/src/klv/pay/imp.rs | 8 +- net/rtp/src/mp2t/depay/imp.rs | 64 ++- net/rtp/src/mp2t/pay/imp.rs | 19 +- net/rtp/src/mp4a/depay/imp.rs | 42 +- net/rtp/src/mp4a/pay/imp.rs | 19 +- net/rtp/src/mp4g/depay/imp.rs | 90 +++- net/rtp/src/mp4g/pay/imp.rs | 151 ++++-- net/rtp/src/opus/depay/imp.rs | 21 +- net/rtp/src/opus/pay/imp.rs | 28 +- net/rtp/src/pcmau/depay/imp.rs | 2 +- net/rtp/src/rtpbin2/rtprecv.rs | 86 ++-- net/rtp/src/rtpbin2/rtpsend.rs | 20 +- net/rtp/src/vp8/depay/imp.rs | 35 +- net/rtp/src/vp8/pay/imp.rs | 32 +- net/rtp/src/vp9/depay/imp.rs | 59 ++- net/rtp/src/vp9/pay/imp.rs | 24 +- net/rtsp/src/rtspsrc/imp.rs | 18 +- net/webrtc/src/aws_kvs_signaller/imp.rs | 40 +- net/webrtc/src/janusvr_signaller/imp.rs | 55 ++- net/webrtc/src/livekit_signaller/imp.rs | 66 +-- net/webrtc/src/signaller/imp.rs | 50 +- net/webrtc/src/webrtcsink/homegrown_cc.rs | 14 +- net/webrtc/src/webrtcsink/imp.rs | 238 ++++++---- net/webrtc/src/webrtcsrc/imp.rs | 344 ++++++++------ net/webrtc/src/whip_signaller/imp.rs | 106 +++-- net/webrtchttp/src/whepsrc/imp.rs | 64 +-- net/webrtchttp/src/whipsink/imp.rs | 30 +- text/ahead/src/textahead/imp.rs | 6 +- text/json/src/jsongstenc/imp.rs | 4 +- text/json/src/jsongstparse/imp.rs | 83 ++-- text/regex/src/gstregex/imp.rs | 12 +- text/wrap/src/gsttextwrap/imp.rs | 37 +- tutorial/src/identity/imp.rs | 12 +- tutorial/src/progressbin/imp.rs | 4 +- tutorial/src/rgb2gray/imp.rs | 6 +- tutorial/src/sinesrc/imp.rs | 44 +- tutorial/tutorial-1.md | 6 +- tutorial/tutorial-2.md | 50 +- .../src/fallbacksrc/custom_source/imp.rs | 16 +- utils/fallbackswitch/src/fallbacksrc/imp.rs | 202 ++++---- .../fallbackswitch/src/fallbackswitch/imp.rs | 74 +-- utils/livesync/src/livesync/imp.rs | 121 +++-- utils/togglerecord/src/togglerecord/imp.rs | 176 +++---- utils/tracers/src/buffer_lateness/imp.rs | 20 +- utils/tracers/src/pad_push_timings/imp.rs | 18 +- utils/tracers/src/pipeline_snapshot/imp.rs | 12 +- utils/tracers/src/queue_levels/imp.rs | 20 +- .../uriplaylistbin/src/uriplaylistbin/imp.rs | 18 +- video/cdg/src/cdgdec/imp.rs | 9 +- video/cdg/src/cdgparse/imp.rs | 2 +- video/closedcaption/src/ccdetect/imp.rs | 10 +- video/closedcaption/src/cea608overlay/imp.rs | 37 +- video/closedcaption/src/cea608tocea708/imp.rs | 24 +- video/closedcaption/src/cea608tojson/imp.rs | 34 +- video/closedcaption/src/cea608tott/imp.rs | 37 +- video/closedcaption/src/cea708mux/imp.rs | 30 +- video/closedcaption/src/cea708overlay/imp.rs | 45 +- video/closedcaption/src/jsontovtt/imp.rs | 38 +- video/closedcaption/src/mcc_enc/imp.rs | 16 +- video/closedcaption/src/mcc_parse/imp.rs | 94 ++-- video/closedcaption/src/scc_enc/imp.rs | 27 +- video/closedcaption/src/scc_parse/imp.rs | 90 ++-- video/closedcaption/src/transcriberbin/imp.rs | 66 ++- video/closedcaption/src/tttocea608/imp.rs | 29 +- video/closedcaption/src/tttocea708/imp.rs | 16 +- video/closedcaption/src/tttojson/imp.rs | 2 +- video/dav1d/src/dav1ddec/imp.rs | 62 +-- video/gif/src/gifenc/imp.rs | 6 +- video/gtk4/src/lib.rs | 2 +- video/gtk4/src/sink/imp.rs | 114 ++--- video/gtk4/src/sink/paintable/imp.rs | 10 +- video/hsv/src/hsvdetector/imp.rs | 14 +- video/hsv/src/hsvfilter/imp.rs | 10 +- video/png/src/pngenc/imp.rs | 10 +- video/rav1e/src/rav1enc/imp.rs | 30 +- video/videofx/src/border/imp.rs | 14 +- video/videofx/src/colordetect/imp.rs | 10 +- video/videofx/src/videocompare/imp.rs | 20 +- video/webp/src/dec/imp.rs | 8 +- 156 files changed, 4513 insertions(+), 3278 deletions(-) diff --git a/audio/audiofx/src/audioloudnorm/imp.rs b/audio/audiofx/src/audioloudnorm/imp.rs index e2ab7645..44d3b5e5 100644 --- a/audio/audiofx/src/audioloudnorm/imp.rs +++ b/audio/audiofx/src/audioloudnorm/imp.rs @@ -263,7 +263,7 @@ impl State { // Drains everything fn drain(&mut self, imp: &AudioLoudNorm) -> Result { - gst::debug!(CAT, imp: imp, "Draining"); + gst::debug!(CAT, imp = imp, "Draining"); let (pts, distance) = self.adapter.prev_pts(); let distance_samples = distance / self.info.bpf() as u64; @@ -298,7 +298,7 @@ impl State { self.frame_type = FrameType::Final; } else if src.is_empty() { // Nothing to drain at all - gst::debug!(CAT, imp: imp, "No data to drain"); + gst::debug!(CAT, imp = imp, "No data to drain"); return Err(gst::FlowError::Eos); } @@ -341,7 +341,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Calculated global loudness for first frame {} with peak {}", global, true_peak @@ -395,7 +395,7 @@ impl State { self.prev_delta = self.delta[self.index]; gst::debug!( CAT, - imp: imp, + imp = imp, "Initializing for first frame with gain adjustment of {}", self.prev_delta ); @@ -457,7 +457,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Applying gain adjustment {}-{}", gain, gain_next @@ -531,7 +531,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Calculated global loudness {}, short term loudness {} and relative threshold {}", global, shortterm, @@ -554,7 +554,7 @@ impl State { self.above_threshold = true; gst::debug!( CAT, - imp: imp, + imp = imp, "Above threshold now ({} >= {}, {} > -70)", shortterm_out, self.target_i, @@ -582,7 +582,7 @@ impl State { self.prev_delta = self.delta[self.index]; gst::debug!( CAT, - imp: imp, + imp = imp, "Calculated new gain adjustment {}", self.prev_delta ); @@ -776,7 +776,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Applying linear gain adjustment of {}", self.offset ); @@ -855,7 +855,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Found peak {} at sample {}, going to attack state at sample {} (gain reduction {}-{})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -992,7 +992,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Found new peak {} at sample {}, restarting attack state at sample {} (gain reduction {}-{})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1041,7 +1041,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Found new peak {} at sample {}, adjusting attack state at sample {} (gain reduction {}-{})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1056,7 +1056,7 @@ impl State { // to ensure that we at least sustain it for that long afterwards. gst::debug!( CAT, - imp: imp, + imp = imp, "Found new low peak {} at sample {} in attack state at sample {}", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1072,7 +1072,7 @@ impl State { // If we reached the target gain reduction, go into sustain state. gst::debug!( CAT, - imp: imp, + imp = imp, "Going to sustain state at sample {} (gain reduction {})", smp_cnt, self.gain_reduction[1] @@ -1151,7 +1151,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Found new peak {} at sample {}, going back to attack state at sample {} (gain reduction {}-{})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1162,7 +1162,7 @@ impl State { } else { gst::debug!( CAT, - imp: imp, + imp = imp, "Found new peak {} at sample {}, going sustain further at sample {} (gain reduction {})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1189,7 +1189,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Going to release state for sample {} at sample {} (gain reduction {}-1.0)", smp_cnt + LIMITER_RELEASE_WINDOW, smp_cnt, @@ -1259,7 +1259,7 @@ impl State { gst::debug!( CAT, - imp: imp, + imp = imp, "Found new peak {} at sample {}, going back to attack state at sample {} (gain reduction {}-{})", peak_value, smp_cnt + LIMITER_ATTACK_WINDOW, @@ -1271,7 +1271,7 @@ impl State { self.gain_reduction[1] = current_gain_reduction; gst::debug!( CAT, - imp: imp, + imp = imp, "Going from release to sustain state at sample {} because of low peak {} at sample {} (gain reduction {})", smp_cnt, peak_value, @@ -1312,7 +1312,7 @@ impl State { self.limiter_state = LimiterState::Out; gst::debug!( CAT, - imp: imp, + imp = imp, "Leaving release state and going to out state at sample {}", smp_cnt, ); @@ -1350,7 +1350,7 @@ impl State { self.gain_reduction[1] = self.target_tp / max; gst::debug!( CAT, - imp: imp, + imp = imp, "Reducing gain for start of first frame by {} ({} > {}) and going to sustain state", self.gain_reduction[1], max, @@ -1366,7 +1366,7 @@ impl State { let channels = self.info.channels() as usize; let nb_samples = dst.len() / channels; - gst::debug!(CAT, imp: imp, "Running limiter for {} samples", nb_samples); + gst::debug!(CAT, imp = imp, "Running limiter for {} samples", nb_samples); // For the first frame we can't adjust the gain before it smoothly anymore so instead // apply the gain reduction immediately if we get above the threshold and move to sustain @@ -1535,12 +1535,12 @@ impl AudioLoudNorm { _pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, imp: self, "Handling buffer {:?}", buffer); + gst::log!(CAT, imp = self, "Handling buffer {:?}", buffer); let mut state_guard = self.state.borrow_mut(); let state = match *state_guard { None => { - gst::error!(CAT, imp: self, "Not negotiated yet"); + gst::error!(CAT, imp = self, "Not negotiated yet"); return Err(gst::FlowError::NotNegotiated); } Some(ref mut state) => state, @@ -1548,7 +1548,7 @@ impl AudioLoudNorm { let mut outbufs = vec![]; if buffer.flags().contains(gst::BufferFlags::DISCONT) { - gst::debug!(CAT, imp: self, "Draining on discontinuity"); + gst::debug!(CAT, imp = self, "Draining on discontinuity"); match state.drain(self) { Ok(outbuf) => { outbufs.push(outbuf); @@ -1566,7 +1566,7 @@ impl AudioLoudNorm { drop(state_guard); for buffer in outbufs { - gst::log!(CAT, imp: self, "Outputting buffer {:?}", buffer); + gst::log!(CAT, imp = self, "Outputting buffer {:?}", buffer); self.srcpad.push(buffer)?; } @@ -1576,17 +1576,17 @@ impl AudioLoudNorm { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(c) => { let caps = c.caps(); - gst::info!(CAT, obj: pad, "Got caps {:?}", caps); + gst::info!(CAT, obj = pad, "Got caps {:?}", caps); let info = match gst_audio::AudioInfo::from_caps(caps) { Ok(info) => info, Err(_) => { - gst::error!(CAT, obj: pad, "Failed to parse caps"); + gst::error!(CAT, obj = pad, "Failed to parse caps"); return false; } }; @@ -1604,9 +1604,9 @@ impl AudioLoudNorm { drop(state); if let Some(outbuf) = outbuf { - gst::log!(CAT, imp: self, "Outputting buffer {:?}", outbuf); + gst::log!(CAT, imp = self, "Outputting buffer {:?}", outbuf); if let Err(err) = self.srcpad.push(outbuf) { - gst::error!(CAT, imp: self, "Failed to push drained data: {}", err); + gst::error!(CAT, imp = self, "Failed to push drained data: {}", err); return false; } @@ -1626,11 +1626,11 @@ impl AudioLoudNorm { drop(state); if let Some(outbuf) = outbuf { - gst::log!(CAT, imp: self, "Outputting buffer {:?}", outbuf); + gst::log!(CAT, imp = self, "Outputting buffer {:?}", outbuf); if let Err(err) = self.srcpad.push(outbuf) { gst::error!( CAT, - imp: self, + imp = self, "Failed to push drained data on EOS: {}", err ); @@ -1660,7 +1660,7 @@ impl AudioLoudNorm { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Latency(q) => { let mut peer_query = gst::query::Latency::new(); diff --git a/audio/audiofx/src/audiornnoise/imp.rs b/audio/audiofx/src/audiornnoise/imp.rs index 8ed211ca..592bef8e 100644 --- a/audio/audiofx/src/audiornnoise/imp.rs +++ b/audio/audiofx/src/audiornnoise/imp.rs @@ -113,7 +113,7 @@ impl AudioRNNoise { let settings = *self.settings.lock().unwrap(); let mut buffer = gst::Buffer::with_size(available).map_err(|e| { - gst::error!(CAT, imp: self, "Failed to allocate buffer at EOS {:?}", e); + gst::error!(CAT, imp = self, "Failed to allocate buffer at EOS {:?}", e); gst::FlowError::Flushing })?; @@ -214,7 +214,7 @@ impl AudioRNNoise { ); } - gst::trace!(CAT, imp: self, "Voice activity: {}", vad); + gst::trace!(CAT, imp = self, "Voice activity: {}", vad); if vad < settings.vad_threshold { out_frame.fill(0.0); } else { @@ -237,8 +237,9 @@ impl AudioRNNoise { gst::trace!( CAT, - imp: self, - "rms: {}, level: {}, has_voice : {} ", rms, + imp = self, + "rms: {}, level: {}, has_voice : {} ", + rms, level, has_voice ); @@ -345,7 +346,7 @@ impl BaseTransformImpl for AudioRNNoise { use gst::EventView; if let EventView::Eos(_) = event.view() { - gst::debug!(CAT, imp: self, "Handling EOS"); + gst::debug!(CAT, imp = self, "Handling EOS"); if self.drain().is_err() { return false; } @@ -361,7 +362,7 @@ impl BaseTransformImpl for AudioRNNoise { let (live, mut min, mut max) = upstream_query.result(); gst::debug!( CAT, - imp: self, + imp = self, "Peer latency: live {} min {} max {}", live, min, @@ -406,7 +407,7 @@ impl AudioFilterImpl for AudioRNNoise { })?; } - gst::debug!(CAT, imp: self, "Set caps to {:?}", info); + gst::debug!(CAT, imp = self, "Set caps to {:?}", info); let mut denoisers = vec![]; for _i in 0..info.channels() { diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index a2ec1b0f..4daaca09 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -129,7 +129,7 @@ impl ObjectImpl for EbuR128Level { let this = args[0].get::().unwrap(); let imp = this.imp(); - gst::info!(CAT, obj: this, "Resetting measurements",); + gst::info!(CAT, obj = this, "Resetting measurements",); imp.reset.store(true, atomic::Ordering::SeqCst); None @@ -175,7 +175,7 @@ impl ObjectImpl for EbuR128Level { let mode = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing mode from {:?} to {:?}", settings.mode, mode @@ -186,7 +186,7 @@ impl ObjectImpl for EbuR128Level { let post_messages = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing post-messages from {} to {}", settings.post_messages, post_messages @@ -197,7 +197,7 @@ impl ObjectImpl for EbuR128Level { let interval = value.get::().unwrap().nseconds(); gst::info!( CAT, - imp: self, + imp = self, "Changing interval from {} to {}", settings.interval, interval, @@ -286,7 +286,7 @@ impl BaseTransformImpl for EbuR128Level { // Drop state let _ = self.state.borrow_mut().take(); - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -377,7 +377,7 @@ impl BaseTransformImpl for EbuR128Level { Ok(loudness) => s.set("momentary-loudness", loudness), Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Failed to get momentary loudness: {}", err ), @@ -389,7 +389,7 @@ impl BaseTransformImpl for EbuR128Level { Ok(loudness) => s.set("shortterm-loudness", loudness), Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Failed to get shortterm loudness: {}", err ), @@ -401,7 +401,7 @@ impl BaseTransformImpl for EbuR128Level { Ok(loudness) => s.set("global-loudness", loudness), Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Failed to get global loudness: {}", err ), @@ -411,7 +411,7 @@ impl BaseTransformImpl for EbuR128Level { Ok(threshold) => s.set("relative-threshold", threshold), Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Failed to get relative threshold: {}", err ), @@ -422,7 +422,12 @@ impl BaseTransformImpl for EbuR128Level { match state.ebur128.loudness_range() { Ok(range) => s.set("loudness-range", range), Err(err) => { - gst::error!(CAT, imp: self, "Failed to get loudness range: {}", err) + gst::error!( + CAT, + imp = self, + "Failed to get loudness range: {}", + err + ) } } } @@ -435,7 +440,7 @@ impl BaseTransformImpl for EbuR128Level { match peaks { Ok(peaks) => s.set("sample-peak", peaks), Err(err) => { - gst::error!(CAT, imp: self, "Failed to get sample peaks: {}", err) + gst::error!(CAT, imp = self, "Failed to get sample peaks: {}", err) } } } @@ -448,12 +453,12 @@ impl BaseTransformImpl for EbuR128Level { match peaks { Ok(peaks) => s.set("true-peak", peaks), Err(err) => { - gst::error!(CAT, imp: self, "Failed to get true peaks: {}", err) + gst::error!(CAT, imp = self, "Failed to get true peaks: {}", err) } } } - gst::debug!(CAT, imp: self, "Posting message {}", s); + gst::debug!(CAT, imp = self, "Posting message {}", s); let msg = gst::message::Element::builder(s).src(&*self.obj()).build(); @@ -504,7 +509,7 @@ impl AudioFilterImpl for EbuR128Level { } fn setup(&self, info: &gst_audio::AudioInfo) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Configured for caps {:?}", info); + gst::debug!(CAT, imp = self, "Configured for caps {:?}", info); let settings = *self.settings.lock().unwrap(); @@ -567,7 +572,7 @@ impl AudioFilterImpl for EbuR128Level { val => { gst::debug!( CAT, - imp: self, + imp = self, "Unknown channel position {:?}, ignoring channel", val ); @@ -745,12 +750,12 @@ fn interleaved_channel_data_into_slice<'a, T: FromByteSlice>( ) -> Result<&'a [T], gst::FlowError> { buf.plane_data(0) .map_err(|err| { - gst::error!(CAT, imp: imp, "Failed to get audio data: {}", err); + gst::error!(CAT, imp = imp, "Failed to get audio data: {}", err); gst::FlowError::Error })? .as_slice_of::() .map_err(|err| { - gst::error!(CAT, imp: imp, "Failed to handle audio data: {}", err); + gst::error!(CAT, imp = imp, "Failed to handle audio data: {}", err); gst::FlowError::Error }) } @@ -764,12 +769,12 @@ fn non_interleaved_channel_data_into_slices<'a, T: FromByteSlice>( .map(|c| { buf.plane_data(c) .map_err(|err| { - gst::error!(CAT, imp: imp, "Failed to get audio data: {}", err); + gst::error!(CAT, imp = imp, "Failed to get audio data: {}", err); gst::FlowError::Error })? .as_slice_of::() .map_err(|err| { - gst::error!(CAT, imp: imp, "Failed to handle audio data: {}", err); + gst::error!(CAT, imp = imp, "Failed to handle audio data: {}", err); gst::FlowError::Error }) }) diff --git a/audio/audiofx/src/hrtfrender/imp.rs b/audio/audiofx/src/hrtfrender/imp.rs index 5ca5253e..d6aeaa8d 100644 --- a/audio/audiofx/src/hrtfrender/imp.rs +++ b/audio/audiofx/src/hrtfrender/imp.rs @@ -224,7 +224,7 @@ impl HrtfRender { let mut outbuf = gst_audio::AudioBufferRef::from_buffer_ref_writable(outbuf, &state.outinfo).map_err( |err| { - gst::error!(CAT, imp: self, "Failed to map buffer : {}", err); + gst::error!(CAT, imp = self, "Failed to map buffer : {}", err); gst::FlowError::Error }, )?; @@ -248,13 +248,13 @@ impl HrtfRender { while state.adapter.available() >= inblksz { let inbuf = state.adapter.take_buffer(inblksz).map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map buffer"); + gst::error!(CAT, imp = self, "Failed to map buffer"); gst::FlowError::Error })?; let inbuf = gst_audio::AudioBuffer::from_buffer_readable(inbuf, &state.ininfo) .map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map buffer"); + gst::error!(CAT, imp = self, "Failed to map buffer"); gst::FlowError::Error })?; @@ -624,7 +624,7 @@ impl BaseTransformImpl for HrtfRender { gst::log!( CAT, - imp: self, + imp = self, "Adapter size: {}, input size {}, transformed size {}", state.adapter.available(), size, @@ -670,7 +670,7 @@ impl BaseTransformImpl for HrtfRender { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, @@ -741,7 +741,7 @@ impl BaseTransformImpl for HrtfRender { adapter: gst_base::UniqueAdapter::new(), }); - gst::debug!(CAT, imp: self, "Configured for caps {}", incaps); + gst::debug!(CAT, imp = self, "Configured for caps {}", incaps); Ok(()) } @@ -749,7 +749,7 @@ impl BaseTransformImpl for HrtfRender { fn sink_event(&self, event: gst::Event) -> bool { use gst::EventView; - gst::debug!(CAT, imp: self, "Handling event {:?}", event); + gst::debug!(CAT, imp = self, "Handling event {:?}", event); match event.view() { EventView::FlushStop(_) => { diff --git a/audio/claxon/src/claxondec/imp.rs b/audio/claxon/src/claxondec/imp.rs index 001559e3..830ce4c9 100644 --- a/audio/claxon/src/claxondec/imp.rs +++ b/audio/claxon/src/claxondec/imp.rs @@ -115,7 +115,7 @@ impl AudioDecoderImpl for ClaxonDec { } fn set_format(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Setting format {:?}", caps); + gst::debug!(CAT, imp = self, "Setting format {:?}", caps); let mut audio_info: Option = None; @@ -124,15 +124,15 @@ impl AudioDecoderImpl for ClaxonDec { let streamheaders = streamheaders.as_slice(); if streamheaders.len() < 2 { - gst::debug!(CAT, imp: self, "Not enough streamheaders, trying in-band"); + gst::debug!(CAT, imp = self, "Not enough streamheaders, trying in-band"); } else { let ident_buf = streamheaders[0].get::>(); if let Ok(Some(ident_buf)) = ident_buf { - gst::debug!(CAT, imp: self, "Got streamheader buffers"); + gst::debug!(CAT, imp = self, "Got streamheader buffers"); let inmap = ident_buf.map_readable().unwrap(); if inmap[0..7] != [0x7f, b'F', b'L', b'A', b'C', 0x01, 0x00] { - gst::debug!(CAT, imp: self, "Unknown streamheader format"); + gst::debug!(CAT, imp = self, "Unknown streamheader format"); } else if let Ok(tstreaminfo) = claxon_streaminfo(&inmap[13..]) { if let Ok(taudio_info) = gstaudioinfo(&tstreaminfo) { // To speed up negotiation @@ -142,7 +142,7 @@ impl AudioDecoderImpl for ClaxonDec { { gst::debug!( CAT, - imp: self, + imp = self, "Error to negotiate output from based on in-caps streaminfo" ); } @@ -165,7 +165,7 @@ impl AudioDecoderImpl for ClaxonDec { &self, inbuf: Option<&gst::Buffer>, ) -> Result { - gst::debug!(CAT, imp: self, "Handling buffer {:?}", inbuf); + gst::debug!(CAT, imp = self, "Handling buffer {:?}", inbuf); let inbuf = match inbuf { None => return Ok(gst::FlowSuccess::Ok), @@ -173,7 +173,7 @@ impl AudioDecoderImpl for ClaxonDec { }; let inmap = inbuf.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Failed to buffer readable"); + gst::error!(CAT, imp = self, "Failed to buffer readable"); gst::FlowError::Error })?; @@ -181,18 +181,18 @@ impl AudioDecoderImpl for ClaxonDec { let state = state_guard.as_mut().ok_or(gst::FlowError::NotNegotiated)?; if inmap.as_slice() == b"fLaC" { - gst::debug!(CAT, imp: self, "fLaC buffer received"); + gst::debug!(CAT, imp = self, "fLaC buffer received"); } else if inmap[0] & 0x7F == 0x00 { - gst::debug!(CAT, imp: self, "Streaminfo header buffer received"); + gst::debug!(CAT, imp = self, "Streaminfo header buffer received"); return self.handle_streaminfo_header(state, inmap.as_ref()); } else if inmap[0] == 0b1111_1111 && inmap[1] & 0b1111_1100 == 0b1111_1000 { - gst::debug!(CAT, imp: self, "Data buffer received"); + gst::debug!(CAT, imp = self, "Data buffer received"); return self.handle_data(state, inmap.as_ref()); } else { // info about other headers in flacparse and https://xiph.org/flac/format.html gst::debug!( CAT, - imp: self, + imp = self, "Other header buffer received {:?}", inmap[0] & 0x7F ); @@ -220,7 +220,7 @@ impl ClaxonDec { gst::debug!( CAT, - imp: self, + imp = self, "Successfully parsed headers: {:?}", audio_info ); diff --git a/audio/csound/src/filter/imp.rs b/audio/csound/src/filter/imp.rs index 0121f27c..dfe0d9f7 100644 --- a/audio/csound/src/filter/imp.rs +++ b/audio/csound/src/filter/imp.rs @@ -191,7 +191,7 @@ impl CsoundFilter { (avail / state.in_info.channels() as usize) * state.out_info.channels() as usize; let mut buffer = gst::Buffer::with_size(out_bytes).map_err(|e| { - gst::error!(CAT, imp: self, "Failed to allocate buffer at EOS {:?}", e); + gst::error!(CAT, imp = self, "Failed to allocate buffer at EOS {:?}", e); gst::FlowError::Flushing })?; @@ -246,7 +246,7 @@ impl CsoundFilter { gst::log!( CAT, - imp: self, + imp = self, "Generating output at: {} - duration: {}", pts.display(), duration.display(), @@ -481,7 +481,7 @@ impl BaseTransformImpl for CsoundFilter { csound.reset(); let _ = self.state.lock().unwrap().take(); - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -490,7 +490,7 @@ impl BaseTransformImpl for CsoundFilter { use gst::EventView; if let EventView::Eos(_) = event.view() { - gst::log!(CAT, imp: self, "Handling Eos"); + gst::log!(CAT, imp = self, "Handling Eos"); if self.drain().is_err() { return false; } @@ -535,7 +535,7 @@ impl BaseTransformImpl for CsoundFilter { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, diff --git a/audio/lewton/src/lewtondec/imp.rs b/audio/lewton/src/lewtondec/imp.rs index 51bb4d76..7b61a271 100644 --- a/audio/lewton/src/lewtondec/imp.rs +++ b/audio/lewton/src/lewtondec/imp.rs @@ -120,7 +120,7 @@ impl AudioDecoderImpl for LewtonDec { } fn set_format(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Setting format {:?}", caps); + gst::debug!(CAT, imp = self, "Setting format {:?}", caps); // When the caps are changing we require new headers let mut state_guard = self.state.borrow_mut(); @@ -138,7 +138,7 @@ impl AudioDecoderImpl for LewtonDec { if let Ok(Some(streamheaders)) = s.get_optional::("streamheader") { let streamheaders = streamheaders.as_slice(); if streamheaders.len() < 3 { - gst::debug!(CAT, imp: self, "Not enough streamheaders, trying in-band"); + gst::debug!(CAT, imp = self, "Not enough streamheaders, trying in-band"); return Ok(()); } @@ -148,7 +148,7 @@ impl AudioDecoderImpl for LewtonDec { if let (Ok(Some(ident_buf)), Ok(Some(comment_buf)), Ok(Some(setup_buf))) = (ident_buf, comment_buf, setup_buf) { - gst::debug!(CAT, imp: self, "Got streamheader buffers"); + gst::debug!(CAT, imp = self, "Got streamheader buffers"); state.header_bufs = (Some(ident_buf), Some(comment_buf), Some(setup_buf)); } } @@ -157,7 +157,7 @@ impl AudioDecoderImpl for LewtonDec { } fn flush(&self, _hard: bool) { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); let mut state_guard = self.state.borrow_mut(); if let Some(ref mut state) = *state_guard { @@ -169,7 +169,7 @@ impl AudioDecoderImpl for LewtonDec { &self, inbuf: Option<&gst::Buffer>, ) -> Result { - gst::debug!(CAT, imp: self, "Handling buffer {:?}", inbuf); + gst::debug!(CAT, imp = self, "Handling buffer {:?}", inbuf); let inbuf = match inbuf { None => return Ok(gst::FlowSuccess::Ok), @@ -177,7 +177,7 @@ impl AudioDecoderImpl for LewtonDec { }; let inmap = inbuf.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Failed to buffer readable"); + gst::error!(CAT, imp = self, "Failed to buffer readable"); gst::FlowError::Error })?; @@ -191,7 +191,7 @@ impl AudioDecoderImpl for LewtonDec { if state.headerset.is_some() { return Ok(gst::FlowSuccess::Ok); } else { - gst::error!(CAT, imp: self, "Got empty packet before all headers"); + gst::error!(CAT, imp = self, "Got empty packet before all headers"); return Err(gst::FlowError::Error); } } @@ -219,14 +219,14 @@ impl LewtonDec { ) -> Result { // ident header if indata[0] == 0x01 { - gst::debug!(CAT, imp: self, "Got ident header buffer"); + gst::debug!(CAT, imp = self, "Got ident header buffer"); state.header_bufs = (Some(inbuf.clone()), None, None); } else if indata[0] == 0x03 { // comment header if state.header_bufs.0.is_none() { - gst::warning!(CAT, imp: self, "Got comment header before ident header"); + gst::warning!(CAT, imp = self, "Got comment header before ident header"); } else { - gst::debug!(CAT, imp: self, "Got comment header buffer"); + gst::debug!(CAT, imp = self, "Got comment header buffer"); state.header_bufs.1 = Some(inbuf.clone()); } } else if indata[0] == 0x05 { @@ -234,11 +234,11 @@ impl LewtonDec { if state.header_bufs.0.is_none() || state.header_bufs.1.is_none() { gst::warning!( CAT, - imp: self, + imp = self, "Got setup header before ident/comment header" ); } else { - gst::debug!(CAT, imp: self, "Got setup header buffer"); + gst::debug!(CAT, imp = self, "Got setup header buffer"); state.header_bufs.2 = Some(inbuf.clone()); } } @@ -263,7 +263,7 @@ impl LewtonDec { // First try to parse the headers let ident_map = ident_buf.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map ident buffer readable"); + gst::error!(CAT, imp = self, "Failed to map ident buffer readable"); gst::FlowError::Error })?; let ident = lewton::header::read_header_ident(ident_map.as_ref()).map_err(|err| { @@ -276,7 +276,7 @@ impl LewtonDec { })?; let comment_map = comment_buf.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map comment buffer readable"); + gst::error!(CAT, imp = self, "Failed to map comment buffer readable"); gst::FlowError::Error })?; let comment = lewton::header::read_header_comment(comment_map.as_ref()).map_err(|err| { @@ -289,7 +289,7 @@ impl LewtonDec { })?; let setup_map = setup_buf.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map setup buffer readable"); + gst::error!(CAT, imp = self, "Failed to map setup buffer readable"); gst::FlowError::Error })?; let setup = lewton::header::read_header_setup( @@ -327,7 +327,7 @@ impl LewtonDec { if gst_audio::channel_reorder_map(from, to, &mut map[..channels]).is_err() { gst::error!( CAT, - imp: self, + imp = self, "Failed to generate channel reorder map from {:?} to {:?}", from, to, @@ -343,7 +343,7 @@ impl LewtonDec { gst::debug!( CAT, - imp: self, + imp = self, "Successfully parsed headers: {:?}", audio_info ); @@ -396,7 +396,7 @@ impl LewtonDec { } let sample_count = decoded.samples.len() / audio_info.channels() as usize; - gst::debug!(CAT, imp: self, "Got {} decoded samples", sample_count); + gst::debug!(CAT, imp = self, "Got {} decoded samples", sample_count); if sample_count == 0 { return self.obj().finish_frame(None, 1); diff --git a/audio/spotify/src/common.rs b/audio/spotify/src/common.rs index 5cd6b5f6..d2056153 100644 --- a/audio/spotify/src/common.rs +++ b/audio/spotify/src/common.rs @@ -135,7 +135,7 @@ impl Settings { if !self.username.is_empty() && self.username != cached_cred.username { gst::debug!( cat, - obj: &src, + obj = &src, "ignore cached credentials for user {} which mismatch user {}", cached_cred.username, self.username @@ -143,7 +143,7 @@ impl Settings { } else { gst::debug!( cat, - obj: &src, + obj = &src, "reuse cached credentials for user {}", cached_cred.username ); @@ -162,7 +162,7 @@ impl Settings { gst::debug!( cat, - obj: &src, + obj = &src, "credentials not in cache or cached credentials invalid", ); diff --git a/audio/spotify/src/spotifyaudiosrc/imp.rs b/audio/spotify/src/spotifyaudiosrc/imp.rs index 1c51dc6f..699b2bd6 100644 --- a/audio/spotify/src/spotifyaudiosrc/imp.rs +++ b/audio/spotify/src/spotifyaudiosrc/imp.rs @@ -209,7 +209,7 @@ impl BaseSrcImpl for SpotifyAudioSrc { fn stop(&self) -> Result<(), gst::ErrorMessage> { if let Some(state) = self.state.lock().unwrap().take() { - gst::debug!(CAT, imp: self, "stopping"); + gst::debug!(CAT, imp = self, "stopping"); state.player.stop(); state.player_channel_handle.abort(); // FIXME: not sure why this is needed to unblock BufferSink::write(), dropping State should drop the receiver @@ -270,13 +270,13 @@ impl PushSrcImpl for SpotifyAudioSrc { match res { Err(_aborted) => { - gst::debug!(CAT, imp: self, "setup has been cancelled"); + gst::debug!(CAT, imp = self, "setup has been cancelled"); setup_thread = self.setup_thread.lock().unwrap(); *setup_thread = SetupThread::Cancelled; return Err(gst::FlowError::Flushing); } Ok(Err(err)) => { - gst::error!(CAT, imp: self, "failed to start: {err:?}"); + gst::error!(CAT, imp = self, "failed to start: {err:?}"); gst::element_imp_error!(self, gst::ResourceError::Settings, ["{err:?}"]); setup_thread = self.setup_thread.lock().unwrap(); *setup_thread = SetupThread::None; @@ -295,15 +295,15 @@ impl PushSrcImpl for SpotifyAudioSrc { match state.receiver.recv().unwrap() { Message::Buffer(buffer) => { - gst::log!(CAT, imp: self, "got buffer of size {}", buffer.size()); + gst::log!(CAT, imp = self, "got buffer of size {}", buffer.size()); Ok(CreateSuccess::NewBuffer(buffer)) } Message::Eos => { - gst::debug!(CAT, imp: self, "eos"); + gst::debug!(CAT, imp = self, "eos"); Err(gst::FlowError::Eos) } Message::Unavailable => { - gst::error!(CAT, imp: self, "track is not available"); + gst::error!(CAT, imp = self, "track is not available"); gst::element_imp_error!( self, gst::ResourceError::NotFound, @@ -352,7 +352,7 @@ impl URIHandlerImpl for SpotifyAudioSrc { } fn set_uri(&self, uri: &str) -> Result<(), glib::Error> { - gst::debug!(CAT, imp: self, "set URI: {}", uri); + gst::debug!(CAT, imp = self, "set URI: {}", uri); let url = url::Url::parse(uri) .map_err(|e| glib::Error::new(gst::URIError::BadUri, &format!("{e:?}")))?; @@ -364,7 +364,7 @@ impl URIHandlerImpl for SpotifyAudioSrc { self.obj().set_property(&key, value.as_ref()); } _ => { - gst::warning!(CAT, imp: self, "unsupported query: {}={}", key, value); + gst::warning!(CAT, imp = self, "unsupported query: {}={}", key, value); } } } @@ -420,7 +420,7 @@ impl SpotifyAudioSrc { let session = common.connect_session(src.clone(), &CAT).await?; let track = common.track_id()?; - gst::debug!(CAT, imp: self, "Requesting bitrate {:?}", bitrate); + gst::debug!(CAT, imp = self, "Requesting bitrate {:?}", bitrate); (session, track, bitrate) }; diff --git a/generic/file/src/filesink/imp.rs b/generic/file/src/filesink/imp.rs index 23f4456e..f96a88e0 100644 --- a/generic/file/src/filesink/imp.rs +++ b/generic/file/src/filesink/imp.rs @@ -81,20 +81,20 @@ impl FileSink { Some(ref location_cur) => { gst::info!( CAT, - imp: self, + imp = self, "Changing `location` from {:?} to {}", location_cur, location, ); } None => { - gst::info!(CAT, imp: self, "Setting `location` to {}", location,); + gst::info!(CAT, imp = self, "Setting `location` to {}", location,); } } Some(location) } None => { - gst::info!(CAT, imp: self, "Resetting `location` to None",); + gst::info!(CAT, imp = self, "Resetting `location` to None",); None } }; @@ -140,7 +140,12 @@ impl ObjectImpl for FileSink { }; if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to set property `location`: {}", err); + gst::error!( + CAT, + imp = self, + "Failed to set property `location`: {}", + err + ); } } _ => unimplemented!(), @@ -222,10 +227,10 @@ impl BaseSinkImpl for FileSink { ] ) })?; - gst::debug!(CAT, imp: self, "Opened file {:?}", file); + gst::debug!(CAT, imp = self, "Opened file {:?}", file); *state = State::Started { file, position: 0 }; - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -240,7 +245,7 @@ impl BaseSinkImpl for FileSink { } *state = State::Stopped; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -260,7 +265,7 @@ impl BaseSinkImpl for FileSink { } }; - gst::trace!(CAT, imp: self, "Rendering {:?}", buffer); + gst::trace!(CAT, imp = self, "Rendering {:?}", buffer); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to map buffer"]); gst::FlowError::Error diff --git a/generic/file/src/filesrc/imp.rs b/generic/file/src/filesrc/imp.rs index 137a2de5..46cc0059 100644 --- a/generic/file/src/filesrc/imp.rs +++ b/generic/file/src/filesrc/imp.rs @@ -94,20 +94,20 @@ impl FileSrc { Some(ref location_cur) => { gst::info!( CAT, - imp: self, + imp = self, "Changing `location` from {:?} to {}", location_cur, location, ); } None => { - gst::info!(CAT, imp: self, "Setting `location to {}", location,); + gst::info!(CAT, imp = self, "Setting `location to {}", location,); } } Some(location) } None => { - gst::info!(CAT, imp: self, "Resetting `location` to None",); + gst::info!(CAT, imp = self, "Resetting `location` to None",); None } }; @@ -148,7 +148,12 @@ impl ObjectImpl for FileSrc { }; if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to set property `location`: {}", err); + gst::error!( + CAT, + imp = self, + "Failed to set property `location`: {}", + err + ); } } _ => unimplemented!(), @@ -250,11 +255,11 @@ impl BaseSrcImpl for FileSrc { ) })?; - gst::debug!(CAT, imp: self, "Opened file {:?}", file); + gst::debug!(CAT, imp = self, "Opened file {:?}", file); *state = State::Started { file, position: 0 }; - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -270,7 +275,7 @@ impl BaseSrcImpl for FileSrc { *state = State::Stopped; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } diff --git a/generic/gopbuffer/src/gopbuffer/imp.rs b/generic/gopbuffer/src/gopbuffer/imp.rs index cc9fe555..6f76fdd0 100644 --- a/generic/gopbuffer/src/gopbuffer/imp.rs +++ b/generic/gopbuffer/src/gopbuffer/imp.rs @@ -164,12 +164,16 @@ impl Stream { let pts = segment .to_running_time_full(pts_position) .ok_or_else(|| { - gst::error!(CAT, obj: self.sinkpad, "Couldn't convert PTS to running time"); + gst::error!( + CAT, + obj = self.sinkpad, + "Couldn't convert PTS to running time" + ); gst::FlowError::Error })? .positive() .unwrap_or_else(|| { - gst::warning!(CAT, obj: self.sinkpad, "Negative PTSs are not supported"); + gst::warning!(CAT, obj = self.sinkpad, "Negative PTSs are not supported"); gst::ClockTime::ZERO }); let end_pts = segment @@ -177,14 +181,14 @@ impl Stream { .ok_or_else(|| { gst::error!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Couldn't convert end PTS to running time" ); gst::FlowError::Error })? .positive() .unwrap_or_else(|| { - gst::warning!(CAT, obj: self.sinkpad, "Negative PTSs are not supported"); + gst::warning!(CAT, obj = self.sinkpad, "Negative PTSs are not supported"); gst::ClockTime::ZERO }); @@ -198,7 +202,11 @@ impl Stream { .unwrap_or(dts_position); let dts = segment.to_running_time_full(dts_position).ok_or_else(|| { - gst::error!(CAT, obj: self.sinkpad, "Couldn't convert DTS to running time"); + gst::error!( + CAT, + obj = self.sinkpad, + "Couldn't convert DTS to running time" + ); gst::FlowError::Error })?; @@ -207,7 +215,7 @@ impl Stream { .ok_or_else(|| { gst::error!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Couldn't convert end DTS to running time" ); gst::FlowError::Error @@ -239,7 +247,7 @@ impl Stream { if let Some(prev_gop) = self.queued_gops.get_mut(1) { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Updating previous GOP starting at PTS {} to end PTS {}", prev_gop.earliest_pts, pts, @@ -258,7 +266,7 @@ impl Stream { if self.delta_frames.requires_dts() { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Previous GOP has final earliest PTS at {}", prev_gop.earliest_pts ); @@ -281,7 +289,7 @@ impl Stream { if gop.earliest_pts > pts && !gop.final_earliest_pts { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Updating current GOP earliest PTS from {} to {}", gop.earliest_pts, pts @@ -292,7 +300,7 @@ impl Stream { if prev_gop.end_pts < pts { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Updating previous GOP starting PTS {} end time from {} to {}", pts, prev_gop.end_pts, @@ -311,7 +319,7 @@ impl Stream { if gop.start_pts <= dts && !gop.final_earliest_pts { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "GOP has final earliest PTS at {}", gop.earliest_pts ); @@ -337,7 +345,7 @@ impl Stream { ) { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Queued full GOPs duration updated to {}", prev_gop.end_pts.saturating_sub(first_gop.earliest_pts), ); @@ -345,7 +353,7 @@ impl Stream { gst::debug!( CAT, - obj: self.sinkpad, + obj = self.sinkpad, "Queued duration updated to {}", Option::zip(self.queued_gops.front(), self.queued_gops.back()) .map(|(end, start)| end.end_pts.saturating_sub(start.start_pts)) @@ -412,7 +420,7 @@ impl GopBuffer { ) -> Result { let obj = self.obj(); if buffer.pts().is_none() { - gst::error!(CAT, obj: obj, "Require timestamped buffers!"); + gst::error!(CAT, obj = obj, "Require timestamped buffers!"); return Err(gst::FlowError::Error); } @@ -429,12 +437,12 @@ impl GopBuffer { if stream.delta_frames.intra_only() && buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) { - gst::error!(CAT, obj: pad, "Intra-only stream with delta units"); + gst::error!(CAT, obj = pad, "Intra-only stream with delta units"); return Err(gst::FlowError::Error); } if stream.delta_frames.requires_dts() && buffer.dts().is_none() { - gst::error!(CAT, obj: pad, "Require DTS for video streams"); + gst::error!(CAT, obj = pad, "Require DTS for video streams"); return Err(gst::FlowError::Error); } @@ -468,7 +476,7 @@ impl GopBuffer { let stored_duration_without_oldest = newest_ts.saturating_sub(oldest_ts); gst::trace!( CAT, - obj: obj, + obj = obj, "newest_pts {}, second oldest_pts {}, stored_duration_without_oldest_gop {}, min-time {}", newest_ts.display(), oldest_ts.display(), @@ -497,7 +505,7 @@ impl GopBuffer { .opt_saturating_sub(oldest_ts) .is_some_and(|diff| diff > gst::Signed::Positive(max_time)) { - gst::warning!(CAT, obj: obj, "Stored data has overflowed the maximum allowed stored time {}, pushing oldest GOP", max_time.display()); + gst::warning!(CAT, obj = obj, "Stored data has overflowed the maximum allowed stored time {}, pushing oldest GOP", max_time.display()); gops_to_push.push(stream.oldest_gop().unwrap()); } else { break; @@ -527,11 +535,11 @@ impl GopBuffer { stream.delta_frames = delta_frames; } gst::EventView::FlushStop(_flush) => { - gst::debug!(CAT, obj: obj, "flushing stored data"); + gst::debug!(CAT, obj = obj, "flushing stored data"); stream.flush(); } gst::EventView::Eos(_eos) => { - gst::debug!(CAT, obj: obj, "draining data at EOS"); + gst::debug!(CAT, obj = obj, "draining data at EOS"); let gops = stream.drain_all().collect::>(); let srcpad = stream.srcpad.clone(); drop(state); @@ -555,7 +563,12 @@ impl GopBuffer { if event.is_serialized() { if stream.peek_oldest_gop().is_none() { // if there is nothing queued, the event can go straight through - gst::trace!(CAT, obj: obj, "nothing queued, event {:?} passthrough", event.structure().map(|s| s.name().as_str())); + gst::trace!( + CAT, + obj = obj, + "nothing queued, event {:?} passthrough", + event.structure().map(|s| s.name().as_str()) + ); drop(state); return gst::Pad::event_default(pad, Some(&*obj), event); } @@ -573,7 +586,11 @@ impl GopBuffer { let obj = self.obj(); if query.is_serialized() { // TODO: serialized queries somehow? - gst::warning!(CAT, obj: pad, "Serialized queries are currently not supported"); + gst::warning!( + CAT, + obj = pad, + "Serialized queries are currently not supported" + ); return false; } gst::Pad::query_default(pad, Some(&*obj), query) @@ -604,7 +621,7 @@ impl GopBuffer { gst::debug!( CAT, - obj: pad, + obj = pad, "Latency query response: live {} min {} max {}", live, min, diff --git a/generic/inter/src/sink/imp.rs b/generic/inter/src/sink/imp.rs index 25e2fb3a..2057e6c6 100644 --- a/generic/inter/src/sink/imp.rs +++ b/generic/inter/src/sink/imp.rs @@ -108,7 +108,7 @@ impl ObjectImpl for InterSink { InterStreamProducer::acquire(&settings.producer_name, &appsink) { drop(settings); - gst::error!(CAT, imp: self, "{err}"); + gst::error!(CAT, imp = self, "{err}"); self.post_error_message(gst::error_msg!( gst::StreamError::Failed, ["{err}"] @@ -191,7 +191,7 @@ impl ElementImpl for InterSink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if transition == gst::StateChange::ReadyToPaused { if let Err(err) = self.prepare() { diff --git a/generic/inter/src/src/imp.rs b/generic/inter/src/src/imp.rs index 211b9cba..5bf7ba06 100644 --- a/generic/inter/src/src/imp.rs +++ b/generic/inter/src/src/imp.rs @@ -177,7 +177,7 @@ impl ElementImpl for InterSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if transition == gst::StateChange::ReadyToPaused { if let Err(err) = self.prepare() { diff --git a/generic/sodium/src/decrypter/imp.rs b/generic/sodium/src/decrypter/imp.rs index 1ae81283..37d547c1 100644 --- a/generic/sodium/src/decrypter/imp.rs +++ b/generic/sodium/src/decrypter/imp.rs @@ -112,7 +112,7 @@ impl State { gst::FlowError::Error })?; - gst::debug!(CAT, obj: pad, "Returned pull size: {}", map.len()); + gst::debug!(CAT, obj = pad, "Returned pull size: {}", map.len()); let mut nonce = add_nonce(self.initial_nonce.unwrap(), chunk_index); let block_size = self.block_size.expect("Block size wasn't set") as usize + box_::MACBYTES; @@ -144,8 +144,8 @@ impl State { adapter_offset: usize, ) -> Result { let avail = self.adapter.available(); - gst::debug!(CAT, obj: pad, "Avail: {}", avail); - gst::debug!(CAT, obj: pad, "Adapter offset: {}", adapter_offset); + gst::debug!(CAT, obj = pad, "Avail: {}", avail); + gst::debug!(CAT, obj = pad, "Adapter offset: {}", adapter_offset); // if this underflows, the available buffer in the adapter is smaller than the // requested offset, which means we have reached EOS @@ -189,7 +189,7 @@ impl State { Err(e) => { gst::error!( CAT, - obj: pad, + obj = pad, "Failed to map provided buffer writable: {}", e ); @@ -197,7 +197,7 @@ impl State { } }; if let Err(e) = self.adapter.copy(0, &mut map[..available_size]) { - gst::error!(CAT, obj: pad, "Failed to copy into provided buffer: {}", e); + gst::error!(CAT, obj = pad, "Failed to copy into provided buffer: {}", e); return Err(gst::FlowError::Error); } if map.len() != available_size { @@ -278,7 +278,7 @@ impl Decrypter { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Scheduling(q) => { @@ -288,12 +288,12 @@ impl Decrypter { return res; } - gst::log!(CAT, obj: pad, "Upstream returned {:?}", peer_query); + gst::log!(CAT, obj = pad, "Upstream returned {:?}", peer_query); let (flags, min, max, align) = peer_query.result(); q.set(flags, min, max, align); q.add_scheduling_modes(&[gst::PadMode::Pull]); - gst::log!(CAT, obj: pad, "Returning {:?}", q.query_mut()); + gst::log!(CAT, obj = pad, "Returning {:?}", q.query_mut()); true } QueryViewMut::Duration(q) => { @@ -334,7 +334,7 @@ impl Decrypter { // subtrack the MAC of each block let size = size - total_chunks * box_::MACBYTES as u64; - gst::debug!(CAT, obj: pad, "Setting duration bytes: {}", size); + gst::debug!(CAT, obj = pad, "Setting duration bytes: {}", size); q.set(size.bytes()); true @@ -402,9 +402,9 @@ impl Decrypter { let state = state.as_mut().unwrap(); state.initial_nonce = Some(nonce); - gst::debug!(CAT, imp: self, "Setting nonce to: {:?}", nonce.0); + gst::debug!(CAT, imp = self, "Setting nonce to: {:?}", nonce.0); state.block_size = Some(block_size); - gst::debug!(CAT, imp: self, "Setting block size to: {}", block_size); + gst::debug!(CAT, imp = self, "Setting block size to: {}", block_size); Ok(()) } @@ -420,8 +420,8 @@ impl Decrypter { + (chunk_index * block_size as u64) + (chunk_index * box_::MACBYTES as u64); - gst::debug!(CAT, obj: pad, "Pull offset: {}", pull_offset); - gst::debug!(CAT, obj: pad, "block size: {}", block_size); + gst::debug!(CAT, obj = pad, "Pull offset: {}", pull_offset); + gst::debug!(CAT, obj = pad, "block size: {}", block_size); // calculate how many chunks are needed, if we need something like 3.2 // round the number to 4 and cut the buffer afterwards. @@ -440,7 +440,7 @@ impl Decrypter { // Read at least one chunk in case 0 bytes were requested let total_chunks = u32::max((checked - 1) / block_size, 1); - gst::debug!(CAT, obj: pad, "Blocks to be pulled: {}", total_chunks); + gst::debug!(CAT, obj = pad, "Blocks to be pulled: {}", total_chunks); // Pull a buffer of all the chunks we will need let checked_size = total_chunks.checked_mul(block_size).ok_or_else(|| { @@ -457,23 +457,34 @@ impl Decrypter { })?; let total_size = checked_size + (total_chunks * box_::MACBYTES as u32); - gst::debug!(CAT, obj: pad, "Requested pull size: {}", total_size); + gst::debug!(CAT, obj = pad, "Requested pull size: {}", total_size); - self.sinkpad.pull_range(pull_offset, total_size).map_err(|err| { - match err { - gst::FlowError::Flushing => { - gst::debug!(CAT, obj: self.sinkpad, "Pausing after pulling buffer, reason: flushing"); - } - gst::FlowError::Eos => { - gst::debug!(CAT, obj: self.sinkpad, "Eos"); - } - flow => { - gst::error!(CAT, obj: self.sinkpad, "Failed to pull, reason: {:?}", flow); - } - }; + self.sinkpad + .pull_range(pull_offset, total_size) + .map_err(|err| { + match err { + gst::FlowError::Flushing => { + gst::debug!( + CAT, + obj = self.sinkpad, + "Pausing after pulling buffer, reason: flushing" + ); + } + gst::FlowError::Eos => { + gst::debug!(CAT, obj = self.sinkpad, "Eos"); + } + flow => { + gst::error!( + CAT, + obj = self.sinkpad, + "Failed to pull, reason: {:?}", + flow + ); + } + }; - err - }) + err + }) } fn range( @@ -493,11 +504,11 @@ impl Decrypter { state.block_size.expect("Block size wasn't set") }; - gst::debug!(CAT, obj: pad, "Requested offset: {}", offset); - gst::debug!(CAT, obj: pad, "Requested size: {}", requested_size); + gst::debug!(CAT, obj = pad, "Requested offset: {}", offset); + gst::debug!(CAT, obj = pad, "Requested size: {}", requested_size); let chunk_index = offset / block_size as u64; - gst::debug!(CAT, obj: pad, "Stream Block index: {}", chunk_index); + gst::debug!(CAT, obj = pad, "Stream Block index: {}", chunk_index); let pull_offset = offset - (chunk_index * block_size as u64); assert!(pull_offset <= u32::MAX as u64); @@ -670,7 +681,7 @@ impl ElementImpl for Decrypter { &self, transition: gst::StateChange, ) -> Result { - gst::debug!(CAT, imp: self, "Changing state {:?}", transition); + gst::debug!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/sodium/src/encrypter/imp.rs b/generic/sodium/src/encrypter/imp.rs index b6560e0f..9119d59a 100644 --- a/generic/sodium/src/encrypter/imp.rs +++ b/generic/sodium/src/encrypter/imp.rs @@ -166,7 +166,7 @@ impl Encrypter { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut buffers = BufferVec::new(); let mut state_guard = self.state.lock().unwrap(); @@ -193,7 +193,7 @@ impl Encrypter { for buffer in buffers { self.srcpad.push(buffer).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to push buffer {:?}", err); + gst::error!(CAT, imp = self, "Failed to push buffer {:?}", err); err })?; } @@ -204,7 +204,7 @@ impl Encrypter { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(_) => { @@ -236,7 +236,7 @@ impl Encrypter { for buffer in buffers { if let Err(err) = self.srcpad.push(buffer) { - gst::error!(CAT, imp: self, "Failed to push buffer at EOS {:?}", err); + gst::error!(CAT, imp = self, "Failed to push buffer at EOS {:?}", err); return false; } } @@ -250,7 +250,7 @@ impl Encrypter { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(_) => false, @@ -261,7 +261,7 @@ impl Encrypter { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -271,7 +271,7 @@ impl Encrypter { gst::GenericFormattedValue::none_for_format(format), gst::GenericFormattedValue::none_for_format(format), ); - gst::log!(CAT, obj: pad, "Returning {:?}", q.query_mut()); + gst::log!(CAT, obj = pad, "Returning {:?}", q.query_mut()); true } QueryViewMut::Duration(q) => { @@ -311,7 +311,7 @@ impl Encrypter { // add static offsets let size = size + crate::HEADERS_SIZE as u64; - gst::debug!(CAT, obj: pad, "Setting duration bytes: {}", size); + gst::debug!(CAT, obj = pad, "Setting duration bytes: {}", size); q.set(size.bytes()); true @@ -492,7 +492,7 @@ impl ElementImpl for Encrypter { &self, transition: gst::StateChange, ) -> Result { - gst::debug!(CAT, imp: self, "Changing state {:?}", transition); + gst::debug!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/examples/standalone/macros.rs b/generic/threadshare/examples/standalone/macros.rs index dc6043ef..18003345 100644 --- a/generic/threadshare/examples/standalone/macros.rs +++ b/generic/threadshare/examples/standalone/macros.rs @@ -1,19 +1,19 @@ macro_rules! debug_or_trace { - ($cat:expr, $raise_log_level:expr, $qual:ident: $obj:expr, $rest:tt $(,)?) => { + ($cat:expr, $raise_log_level:expr, $qual:ident = $obj:expr, $rest:tt $(,)?) => { if $raise_log_level { - gst::debug!($cat, $qual: $obj, $rest); + gst::debug!($cat, $qual = $obj, $rest); } else { - gst::trace!($cat, $qual: $obj, $rest); + gst::trace!($cat, $qual = $obj, $rest); } }; } macro_rules! log_or_trace { - ($cat:expr, $raise_log_level:expr, $qual:ident: $obj:expr, $rest:tt $(,)?) => { + ($cat:expr, $raise_log_level:expr, $qual:ident = $obj:expr, $rest:tt $(,)?) => { if $raise_log_level { - gst::log!($cat, $qual: $obj, $rest); + gst::log!($cat, $qual = $obj, $rest); } else { - gst::trace!($cat, $qual: $obj, $rest); + gst::trace!($cat, $qual = $obj, $rest); } }; } diff --git a/generic/threadshare/examples/standalone/sink/async_mutex/imp.rs b/generic/threadshare/examples/standalone/sink/async_mutex/imp.rs index 75613181..df27d33d 100644 --- a/generic/threadshare/examples/standalone/sink/async_mutex/imp.rs +++ b/generic/threadshare/examples/standalone/sink/async_mutex/imp.rs @@ -43,14 +43,14 @@ impl PadSinkHandlerInner { log_or_trace!( CAT, self.is_main_elem, - obj: elem, + obj = elem, "Discarding {buffer:?} (flushing)" ); return Err(gst::FlowError::Flushing); } - debug_or_trace!(CAT, self.is_main_elem, obj: elem, "Received {buffer:?}"); + debug_or_trace!(CAT, self.is_main_elem, obj = elem, "Received {buffer:?}"); let dts = buffer .dts() @@ -67,18 +67,23 @@ impl PadSinkHandlerInner { stats.add_buffer(latency, interval); } - debug_or_trace!(CAT, self.is_main_elem, obj: elem, "o latency {latency:.2?}"); debug_or_trace!( CAT, self.is_main_elem, - obj: elem, + obj = elem, + "o latency {latency:.2?}" + ); + debug_or_trace!( + CAT, + self.is_main_elem, + obj = elem, "o interval {interval:.2?}", ); } self.last_dts = Some(dts); - log_or_trace!(CAT, self.is_main_elem, obj: elem, "Buffer processed"); + log_or_trace!(CAT, self.is_main_elem, obj = elem, "Buffer processed"); Ok(()) } @@ -117,7 +122,7 @@ impl PadSinkHandler for AsyncPadSinkHandler { EventView::Eos(_) => { { let mut inner = self.0.lock().await; - debug_or_trace!(CAT, inner.is_main_elem, obj: elem, "EOS"); + debug_or_trace!(CAT, inner.is_main_elem, obj = elem, "EOS"); inner.is_flushing = true; } @@ -196,7 +201,7 @@ pub struct AsyncMutexSink { impl AsyncMutexSink { fn prepare(&self) -> Result<(), gst::ErrorMessage> { let settings = self.settings.lock().unwrap(); - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Preparing"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Preparing"); let stats = if settings.logs_stats { Some(Stats::new( settings.max_buffers, @@ -207,25 +212,25 @@ impl AsyncMutexSink { }; self.sink_pad_handler.prepare(settings.is_main_elem, stats); - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Prepared"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Prepared"); Ok(()) } fn stop(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopping"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopping"); self.sink_pad_handler.stop(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopped"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Starting"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Starting"); self.sink_pad_handler.start(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Started"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Started"); Ok(()) } @@ -311,7 +316,7 @@ impl ElementImpl for AsyncMutexSink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {transition:?}"); + gst::trace!(CAT, imp = self, "Changing state {transition:?}"); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/examples/standalone/sink/sync_mutex/imp.rs b/generic/threadshare/examples/standalone/sink/sync_mutex/imp.rs index 18957e40..6b86471b 100644 --- a/generic/threadshare/examples/standalone/sink/sync_mutex/imp.rs +++ b/generic/threadshare/examples/standalone/sink/sync_mutex/imp.rs @@ -42,14 +42,14 @@ impl PadSinkHandlerInner { log_or_trace!( CAT, self.is_main_elem, - obj: elem, + obj = elem, "Discarding {buffer:?} (flushing)" ); return Err(gst::FlowError::Flushing); } - debug_or_trace!(CAT, self.is_main_elem, obj: elem, "Received {buffer:?}"); + debug_or_trace!(CAT, self.is_main_elem, obj = elem, "Received {buffer:?}"); let dts = buffer .dts() @@ -66,18 +66,23 @@ impl PadSinkHandlerInner { stats.add_buffer(latency, interval); } - debug_or_trace!(CAT, self.is_main_elem, obj: elem, "o latency {latency:.2?}"); debug_or_trace!( CAT, self.is_main_elem, - obj: elem, + obj = elem, + "o latency {latency:.2?}" + ); + debug_or_trace!( + CAT, + self.is_main_elem, + obj = elem, "o interval {interval:.2?}", ); } self.last_dts = Some(dts); - log_or_trace!(CAT, self.is_main_elem, obj: elem, "Buffer processed"); + log_or_trace!(CAT, self.is_main_elem, obj = elem, "Buffer processed"); Ok(()) } @@ -116,7 +121,7 @@ impl PadSinkHandler for SyncPadSinkHandler { EventView::Eos(_) => { { let mut inner = self.0.lock().unwrap(); - debug_or_trace!(CAT, inner.is_main_elem, obj: elem, "EOS"); + debug_or_trace!(CAT, inner.is_main_elem, obj = elem, "EOS"); inner.is_flushing = true; } @@ -189,7 +194,7 @@ pub struct DirectSink { impl DirectSink { fn prepare(&self) -> Result<(), gst::ErrorMessage> { let settings = self.settings.lock().unwrap(); - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Preparing"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Preparing"); let stats = if settings.logs_stats { Some(Stats::new( settings.max_buffers, @@ -200,25 +205,25 @@ impl DirectSink { }; self.sink_pad_handler.prepare(settings.is_main_elem, stats); - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Prepared"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Prepared"); Ok(()) } fn stop(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopping"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopping"); self.sink_pad_handler.stop(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopped"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Starting"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Starting"); self.sink_pad_handler.start(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Started"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Started"); Ok(()) } @@ -304,7 +309,7 @@ impl ElementImpl for DirectSink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {transition:?}"); + gst::trace!(CAT, imp = self, "Changing state {transition:?}"); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/examples/standalone/sink/task/imp.rs b/generic/threadshare/examples/standalone/sink/task/imp.rs index 1ac86965..bb82cfde 100644 --- a/generic/threadshare/examples/standalone/sink/task/imp.rs +++ b/generic/threadshare/examples/standalone/sink/task/imp.rs @@ -68,7 +68,7 @@ impl PadSinkHandler for TaskPadSinkHandler { } EventView::Eos(_) => { let is_main_elem = elem.imp().settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, obj: elem, "EOS"); + debug_or_trace!(CAT, is_main_elem, obj = elem, "EOS"); // When each element sends its own EOS message, // it takes ages for the pipeline to process all of them. @@ -137,13 +137,13 @@ impl TaskImpl for TaskSinkTask { type Item = StreamItem; fn prepare(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Preparing Task"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Preparing Task"); future::ok(()).boxed() } fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Starting Task"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Starting Task"); self.last_dts = None; if let Some(stats) = self.stats.as_mut() { stats.start(); @@ -156,7 +156,7 @@ impl TaskImpl for TaskSinkTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Stopping Task"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Stopping Task"); self.flush(); Ok(()) } @@ -172,7 +172,7 @@ impl TaskImpl for TaskSinkTask { fn handle_item(&mut self, item: StreamItem) -> BoxFuture<'_, Result<(), gst::FlowError>> { async move { - debug_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Received {item:?}"); + debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Received {item:?}"); match item { StreamItem::Buffer(buffer) => { @@ -194,20 +194,20 @@ impl TaskImpl for TaskSinkTask { debug_or_trace!( CAT, self.is_main_elem, - obj: self.elem, + obj = self.elem, "o latency {latency:.2?}", ); debug_or_trace!( CAT, self.is_main_elem, - obj: self.elem, + obj = self.elem, "o interval {interval:.2?}", ); } self.last_dts = Some(dts); - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Buffer processed"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Buffer processed"); } StreamItem::Event(evt) => { if let EventView::Segment(evt) = evt.view() { @@ -249,7 +249,7 @@ impl TaskSink { None }; - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Preparing"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Preparing"); let ts_ctx = Context::acquire(&settings.context, settings.context_wait).map_err(|err| { error_msg!( @@ -265,32 +265,32 @@ impl TaskSink { *self.item_sender.lock().unwrap() = Some(item_sender); - debug_or_trace!(CAT, settings.is_main_elem, imp: self, "Prepared"); + debug_or_trace!(CAT, settings.is_main_elem, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Unpreparing"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Unprepared"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopping"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopping"); self.task.stop().block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopped"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Starting"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Starting"); self.task.start().block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Started"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Started"); Ok(()) } @@ -376,7 +376,7 @@ impl ElementImpl for TaskSink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {transition:?}"); + gst::trace!(CAT, imp = self, "Changing state {transition:?}"); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/examples/standalone/src/imp.rs b/generic/threadshare/examples/standalone/src/imp.rs index 821025f9..ae6cc7ef 100644 --- a/generic/threadshare/examples/standalone/src/imp.rs +++ b/generic/threadshare/examples/standalone/src/imp.rs @@ -103,7 +103,7 @@ impl TaskImpl for SrcTask { let settings = imp.settings.lock().unwrap(); self.is_main_elem = settings.is_main_elem; - log_or_trace!(CAT, self.is_main_elem, imp: imp, "Preparing Task"); + log_or_trace!(CAT, self.is_main_elem, imp = imp, "Preparing Task"); self.push_period = settings.push_period; self.num_buffers = settings.num_buffers; @@ -113,12 +113,17 @@ impl TaskImpl for SrcTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Starting Task"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Starting Task"); if self.need_initial_events { let imp = self.elem.imp(); - debug_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Pushing initial events"); + debug_or_trace!( + CAT, + self.is_main_elem, + obj = self.elem, + "Pushing initial events" + ); let stream_id = format!("{:08x}{:08x}", rand::random::(), rand::random::()); @@ -157,7 +162,7 @@ impl TaskImpl for SrcTask { } fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Stopping Task"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Stopping Task"); self.buffer_pool.set_active(false).unwrap(); self.timer = None; self.need_initial_events = true; @@ -167,9 +172,9 @@ impl TaskImpl for SrcTask { fn try_next(&mut self) -> BoxFuture<'_, Result<(), gst::FlowError>> { async move { - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Awaiting timer"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Awaiting timer"); self.timer.as_mut().unwrap().next().await; - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Timer ticked"); + log_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Timer ticked"); Ok(()) } @@ -190,13 +195,18 @@ impl TaskImpl for SrcTask { buffer }) .map_err(|err| { - gst::error!(CAT, obj: self.elem, "Failed to acquire buffer {err}"); + gst::error!(CAT, obj = self.elem, "Failed to acquire buffer {err}"); err })?; - debug_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Forwarding buffer"); + debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Forwarding buffer"); self.elem.imp().src_pad.push(buffer).await?; - log_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Successfully pushed buffer"); + log_or_trace!( + CAT, + self.is_main_elem, + obj = self.elem, + "Successfully pushed buffer" + ); self.buffer_count += 1; @@ -213,22 +223,22 @@ impl TaskImpl for SrcTask { async move { match err { gst::FlowError::Eos => { - debug_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Pushing EOS"); + debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Pushing EOS"); let imp = self.elem.imp(); if !imp.src_pad.push_event(gst::event::Eos::new()).await { - gst::error!(CAT, imp: imp, "Error pushing EOS"); + gst::error!(CAT, imp = imp, "Error pushing EOS"); } task::Trigger::Stop } gst::FlowError::Flushing => { - debug_or_trace!(CAT, self.is_main_elem, obj: self.elem, "Flushing"); + debug_or_trace!(CAT, self.is_main_elem, obj = self.elem, "Flushing"); task::Trigger::FlushStart } err => { - gst::error!(CAT, obj: self.elem, "Got error {err}"); + gst::error!(CAT, obj = self.elem, "Got error {err}"); gst::element_error!( &self.elem, gst::StreamError::Failed, @@ -254,7 +264,7 @@ pub struct TestSrc { impl TestSrc { fn prepare(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Preparing"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Preparing"); let settings = self.settings.lock().unwrap(); let ts_ctx = Context::acquire(&settings.context, settings.context_wait).map_err(|err| { @@ -269,41 +279,41 @@ impl TestSrc { .prepare(SrcTask::new(self.obj().clone()), ts_ctx) .block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Prepared"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Unpreparing"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - debug_or_trace!(CAT, is_main_elem, imp: self, "Unprepared"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopping"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopping"); self.task.stop().block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Stopped"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Starting"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Starting"); self.task.start().block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Started"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { let is_main_elem = self.settings.lock().unwrap().is_main_elem; - debug_or_trace!(CAT, is_main_elem, imp: self, "Pausing"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Pausing"); self.task.pause().block_on()?; - debug_or_trace!(CAT, is_main_elem, imp: self, "Paused"); + debug_or_trace!(CAT, is_main_elem, imp = self, "Paused"); Ok(()) } @@ -453,7 +463,7 @@ impl ElementImpl for TestSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {transition:?}"); + gst::trace!(CAT, imp = self, "Changing state {transition:?}"); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/appsrc/imp.rs b/generic/threadshare/src/appsrc/imp.rs index a239e6a8..f056b62a 100644 --- a/generic/threadshare/src/appsrc/imp.rs +++ b/generic/threadshare/src/appsrc/imp.rs @@ -82,7 +82,7 @@ impl PadSrcHandler for AppSrcPadHandler { type ElementImpl = AppSrc; fn src_event(self, pad: &gst::Pad, imp: &AppSrc, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); use gst::EventView; let ret = match event.view() { @@ -94,16 +94,16 @@ impl PadSrcHandler for AppSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", event); + gst::log!(CAT, obj = pad, "Handled {:?}", event); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", event); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", event); } ret } fn src_query(self, pad: &gst::Pad, imp: &AppSrc, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); use gst::QueryViewMut; let ret = match query.view_mut() { @@ -135,9 +135,9 @@ impl PadSrcHandler for AppSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", query); + gst::log!(CAT, obj = pad, "Handled {:?}", query); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", query); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", query); } ret } @@ -169,11 +169,11 @@ impl AppSrcTask { } async fn push_item(&mut self, item: StreamItem) -> Result { - gst::log!(CAT, obj: self.element, "Handling {:?}", item); + gst::log!(CAT, obj = self.element, "Handling {:?}", item); let appsrc = self.element.imp(); if self.need_initial_events { - gst::debug!(CAT, obj: self.element, "Pushing initial events"); + gst::debug!(CAT, obj = self.element, "Pushing initial events"); let stream_id = format!("{:08x}{:08x}", rand::random::(), rand::random::()); let stream_start_evt = gst::event::StreamStart::builder(&stream_id) @@ -203,7 +203,7 @@ impl AppSrcTask { match item { StreamItem::Buffer(buffer) => { - gst::log!(CAT, obj: self.element, "Forwarding {:?}", buffer); + gst::log!(CAT, obj = self.element, "Forwarding {:?}", buffer); appsrc.src_pad.push(buffer).await } StreamItem::Event(event) => { @@ -213,7 +213,7 @@ impl AppSrcTask { Err(gst::FlowError::Eos) } _ => { - gst::log!(CAT, obj: self.element, "Forwarding {:?}", event); + gst::log!(CAT, obj = self.element, "Forwarding {:?}", event); appsrc.src_pad.push_event(event).await; Ok(gst::FlowSuccess::Ok) } @@ -241,18 +241,18 @@ impl TaskImpl for AppSrcTask { let res = self.push_item(item).await; match res { Ok(_) => { - gst::log!(CAT, obj: self.element, "Successfully pushed item"); + gst::log!(CAT, obj = self.element, "Successfully pushed item"); } Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); let appsrc = self.element.imp(); appsrc.src_pad.push_event(gst::event::Eos::new()).await; } Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.element, "Flushing"); + gst::debug!(CAT, obj = self.element, "Flushing"); } Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {}", err); + gst::error!(CAT, obj = self.element, "Got error {}", err); gst::element_error!( &self.element, gst::StreamError::Failed, @@ -269,13 +269,13 @@ impl TaskImpl for AppSrcTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task"); + gst::log!(CAT, obj = self.element, "Stopping task"); self.flush(); self.need_initial_events = true; self.need_segment = true; - gst::log!(CAT, obj: self.element, "Task stopped"); + gst::log!(CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -283,12 +283,12 @@ impl TaskImpl for AppSrcTask { fn flush_start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Starting task flush"); + gst::log!(CAT, obj = self.element, "Starting task flush"); self.flush(); self.need_segment = true; - gst::log!(CAT, obj: self.element, "Task flush started"); + gst::log!(CAT, obj = self.element, "Task flush started"); Ok(()) } .boxed() @@ -308,7 +308,7 @@ impl AppSrc { fn push_buffer(&self, mut buffer: gst::Buffer) -> bool { let state = self.task.lock_state(); if *state != TaskState::Started && *state != TaskState::Paused { - gst::debug!(CAT, imp: self, "Rejecting buffer due to element state"); + gst::debug!(CAT, imp = self, "Rejecting buffer due to element state"); return false; } @@ -323,7 +323,7 @@ impl AppSrc { buffer.set_dts(now.opt_checked_sub(base_time).ok().flatten()); buffer.set_pts(None); } else { - gst::error!(CAT, imp: self, "Don't have a clock yet"); + gst::error!(CAT, imp = self, "Don't have a clock yet"); return false; } } @@ -336,7 +336,7 @@ impl AppSrc { { Ok(_) => true, Err(err) => { - gst::error!(CAT, imp: self, "Failed to queue buffer: {}", err); + gst::error!(CAT, imp = self, "Failed to queue buffer: {}", err); false } } @@ -352,14 +352,14 @@ impl AppSrc { match sender.try_send(StreamItem::Event(gst::event::Eos::new())) { Ok(_) => true, Err(err) => { - gst::error!(CAT, imp: self, "Failed to queue EOS: {}", err); + gst::error!(CAT, imp = self, "Failed to queue EOS: {}", err); false } } } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap(); let context = @@ -386,38 +386,38 @@ impl AppSrc { .prepare(AppSrcTask::new(self.obj().clone(), receiver), context) .block_on()?; - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); *self.sender.lock().unwrap() = None; self.task.unprepare().block_on().unwrap(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().block_on()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().block_on()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Pausing"); + gst::debug!(CAT, imp = self, "Pausing"); self.task.pause().block_on()?; - gst::debug!(CAT, imp: self, "Paused"); + gst::debug!(CAT, imp = self, "Paused"); Ok(()) } } @@ -598,7 +598,7 @@ impl ElementImpl for AppSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/audiotestsrc/imp.rs b/generic/threadshare/src/audiotestsrc/imp.rs index a628c193..b633686e 100644 --- a/generic/threadshare/src/audiotestsrc/imp.rs +++ b/generic/threadshare/src/audiotestsrc/imp.rs @@ -90,7 +90,7 @@ impl PadSrcHandler for AudioTestSrcPadHandler { type ElementImpl = AudioTestSrc; fn src_query(self, pad: &gst::Pad, imp: &Self::ElementImpl, query: &mut gst::QueryRef) -> bool { - gst::debug!(CAT, obj: pad, "Received {query:?}"); + gst::debug!(CAT, obj = pad, "Received {query:?}"); if let gst::QueryViewMut::Latency(q) = query.view_mut() { let settings = imp.settings.lock().unwrap(); @@ -187,17 +187,17 @@ impl AudioTestSrcTask { } let mut caps = pad.peer_query_caps(Some(&DEFAULT_CAPS)); - gst::debug!(CAT, imp: imp, "Peer returned {caps:?}"); + gst::debug!(CAT, imp = imp, "Peer returned {caps:?}"); if caps.is_empty() { pad.mark_reconfigure(); let err = gst::error_msg!(gst::CoreError::Pad, ["No common Caps"]); - gst::error!(CAT, imp: imp, "{err}"); + gst::error!(CAT, imp = imp, "{err}"); return Err(err); } if caps.is_any() { - gst::debug!(CAT, imp: imp, "Using our own Caps"); + gst::debug!(CAT, imp = imp, "Using our own Caps"); caps = DEFAULT_CAPS.clone(); } @@ -205,7 +205,7 @@ impl AudioTestSrcTask { let caps = caps.make_mut(); let s = caps.structure_mut(0).ok_or_else(|| { let err = gst::error_msg!(gst::CoreError::Pad, ["Invalid peer Caps structure"]); - gst::error!(CAT, imp: imp, "{err}"); + gst::error!(CAT, imp = imp, "{err}"); err })?; @@ -227,7 +227,7 @@ impl AudioTestSrcTask { } caps.fixate(); - gst::debug!(CAT, imp: imp, "fixated to {caps:?}"); + gst::debug!(CAT, imp = imp, "fixated to {caps:?}"); imp.src_pad.push_event(gst::event::Caps::new(&caps)).await; @@ -241,7 +241,7 @@ impl TaskImpl for AudioTestSrcTask { type Item = gst::Buffer; fn prepare(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { - gst::log!(CAT, obj: self.elem, "Preparing Task"); + gst::log!(CAT, obj = self.elem, "Preparing Task"); let imp = self.elem.imp(); let settings = imp.settings.lock().unwrap(); @@ -260,10 +260,10 @@ impl TaskImpl for AudioTestSrcTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.elem, "Starting Task"); + gst::log!(CAT, obj = self.elem, "Starting Task"); if self.need_initial_events { - gst::debug!(CAT, obj: self.elem, "Pushing initial events"); + gst::debug!(CAT, obj = self.elem, "Pushing initial events"); let stream_id = format!("{:08x}{:08x}", rand::random::(), rand::random::()); @@ -311,14 +311,14 @@ impl TaskImpl for AudioTestSrcTask { } fn pause(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { - gst::log!(CAT, obj: self.elem, "Pausing Task"); + gst::log!(CAT, obj = self.elem, "Pausing Task"); self.buffer_pool.set_active(false).unwrap(); future::ok(()).boxed() } fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { - gst::log!(CAT, obj: self.elem, "Stopping Task"); + gst::log!(CAT, obj = self.elem, "Stopping Task"); self.need_initial_events = true; self.accumulator = 0.0; @@ -331,7 +331,7 @@ impl TaskImpl for AudioTestSrcTask { let mut buffer = match self.buffer_pool.acquire_buffer(None) { Ok(buffer) => buffer, Err(err) => { - gst::error!(CAT, obj: self.elem, "Failed to acquire buffer {}", err); + gst::error!(CAT, obj = self.elem, "Failed to acquire buffer {}", err); return future::err(err).boxed(); } }; @@ -399,9 +399,9 @@ impl TaskImpl for AudioTestSrcTask { async move { let imp = self.elem.imp(); - gst::debug!(CAT, imp: imp, "Pushing {buffer:?}"); + gst::debug!(CAT, imp = imp, "Pushing {buffer:?}"); imp.src_pad.push(buffer).await?; - gst::log!(CAT, imp: imp, "Successfully pushed buffer"); + gst::log!(CAT, imp = imp, "Successfully pushed buffer"); self.buffer_count += 1; @@ -442,12 +442,12 @@ impl TaskImpl for AudioTestSrcTask { async move { match err { gst::FlowError::Flushing => { - gst::debug!(CAT, obj: self.elem, "Flushing"); + gst::debug!(CAT, obj = self.elem, "Flushing"); task::Trigger::FlushStart } gst::FlowError::Eos => { - gst::debug!(CAT, obj: self.elem, "EOS"); + gst::debug!(CAT, obj = self.elem, "EOS"); self.elem .imp() .src_pad @@ -457,7 +457,7 @@ impl TaskImpl for AudioTestSrcTask { task::Trigger::Stop } err => { - gst::error!(CAT, obj: self.elem, "Got error {err}"); + gst::error!(CAT, obj = self.elem, "Got error {err}"); gst::element_error!( &self.elem, gst::StreamError::Failed, @@ -482,7 +482,7 @@ pub struct AudioTestSrc { impl AudioTestSrc { fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap(); let context = @@ -498,37 +498,37 @@ impl AudioTestSrc { .prepare(AudioTestSrcTask::new(self.obj().clone()), context) .block_on()?; - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().block_on()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().block_on()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Pausing"); + gst::debug!(CAT, imp = self, "Pausing"); self.task.pause().block_on()?; - gst::debug!(CAT, imp: self, "Paused"); + gst::debug!(CAT, imp = self, "Paused"); Ok(()) } @@ -695,7 +695,7 @@ impl ElementImpl for AudioTestSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {transition:?}"); + gst::trace!(CAT, imp = self, "Changing state {transition:?}"); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/dataqueue.rs b/generic/threadshare/src/dataqueue.rs index 289d2b8e..9ca33ba8 100644 --- a/generic/threadshare/src/dataqueue.rs +++ b/generic/threadshare/src/dataqueue.rs @@ -126,10 +126,14 @@ impl DataQueue { pub fn start(&self) { let mut inner = self.0.lock().unwrap(); if inner.state == DataQueueState::Started { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Data queue already Started"); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Data queue already Started" + ); return; } - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Starting data queue"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Starting data queue"); inner.state = DataQueueState::Started; inner.wake(); } @@ -137,10 +141,14 @@ impl DataQueue { pub fn stop(&self) { let mut inner = self.0.lock().unwrap(); if inner.state == DataQueueState::Stopped { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Data queue already Stopped"); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Data queue already Stopped" + ); return; } - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Stopping data queue"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Stopping data queue"); inner.state = DataQueueState::Stopped; inner.wake(); } @@ -148,7 +156,7 @@ impl DataQueue { pub fn clear(&self) { let mut inner = self.0.lock().unwrap(); - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Clearing data queue"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Clearing data queue"); let src_pad = inner.src_pad.clone(); for item in inner.queue.drain(..) { @@ -162,7 +170,7 @@ impl DataQueue { } } - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Data queue cleared"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Data queue cleared"); } pub fn push(&self, item: DataQueueItem) -> Result<(), DataQueueItem> { @@ -171,7 +179,7 @@ impl DataQueue { if inner.state == DataQueueState::Stopped { gst::debug!( DATA_QUEUE_CAT, - obj: inner.element, + obj = inner.element, "Rejecting item {:?} in state {:?}", item, inner.state @@ -179,7 +187,12 @@ impl DataQueue { return Err(item); } - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Pushing item {:?}", item); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Pushing item {:?}", + item + ); let (count, bytes) = item.size(); let queue_ts = inner.queue.iter().filter_map(|i| i.timestamp()).next(); @@ -187,14 +200,26 @@ impl DataQueue { if let Some(max) = inner.max_size_buffers { if max <= inner.cur_size_buffers { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Queue is full (buffers): {} <= {}", max, inner.cur_size_buffers); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Queue is full (buffers): {} <= {}", + max, + inner.cur_size_buffers + ); return Err(item); } } if let Some(max) = inner.max_size_bytes { if max <= inner.cur_size_bytes { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Queue is full (bytes): {} <= {}", max, inner.cur_size_bytes); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Queue is full (bytes): {} <= {}", + max, + inner.cur_size_bytes + ); return Err(item); } } @@ -208,7 +233,13 @@ impl DataQueue { }; if max <= level { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Queue is full (time): {} <= {}", max, level); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Queue is full (time): {} <= {}", + max, + level + ); return Err(item); } } @@ -231,10 +262,15 @@ impl DataQueue { match inner.state { DataQueueState::Started => match inner.queue.pop_front() { None => { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Data queue is empty"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Data queue is empty"); } Some(item) => { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Popped item {:?}", item); + gst::debug!( + DATA_QUEUE_CAT, + obj = inner.element, + "Popped item {:?}", + item + ); let (count, bytes) = item.size(); inner.cur_size_buffers -= count; @@ -244,7 +280,7 @@ impl DataQueue { } }, DataQueueState::Stopped => { - gst::debug!(DATA_QUEUE_CAT, obj: inner.element, "Data queue Stopped"); + gst::debug!(DATA_QUEUE_CAT, obj = inner.element, "Data queue Stopped"); return None; } } diff --git a/generic/threadshare/src/inputselector/imp.rs b/generic/threadshare/src/inputselector/imp.rs index 8c78e54e..bef6d7f5 100644 --- a/generic/threadshare/src/inputselector/imp.rs +++ b/generic/threadshare/src/inputselector/imp.rs @@ -139,7 +139,7 @@ impl InputSelectorPadSinkHandler { } if is_active { - gst::log!(CAT, obj: pad, "Forwarding {:?}", buffer); + gst::log!(CAT, obj = pad, "Forwarding {:?}", buffer); if switched_pad && !buffer.flags().contains(gst::BufferFlags::DISCONT) { let buffer = buffer.make_mut(); @@ -172,7 +172,7 @@ impl PadSinkHandler for InputSelectorPadSinkHandler { list: gst::BufferList, ) -> BoxFuture<'static, Result> { async move { - gst::log!(CAT, obj: pad, "Handling buffer list {:?}", list); + gst::log!(CAT, obj = pad, "Handling buffer list {:?}", list); // TODO: Ideally we would keep the list intact and forward it in one go for buffer in list.iter_owned() { self.handle_item(&pad, &elem, buffer).await?; @@ -229,14 +229,14 @@ impl PadSinkHandler for InputSelectorPadSinkHandler { } fn sink_query(self, pad: &gst::Pad, imp: &InputSelector, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); if query.is_serialized() { // FIXME: How can we do this (drops ALLOCATION and DRAIN)? - gst::log!(CAT, obj: pad, "Dropping serialized query {:?}", query); + gst::log!(CAT, obj = pad, "Dropping serialized query {:?}", query); false } else { - gst::log!(CAT, obj: pad, "Forwarding query {:?}", query); + gst::log!(CAT, obj = pad, "Forwarding query {:?}", query); imp.src_pad.gst_pad().peer_query(query) } } @@ -249,7 +249,7 @@ impl PadSrcHandler for InputSelectorPadSrcHandler { type ElementImpl = InputSelector; fn src_query(self, pad: &gst::Pad, imp: &InputSelector, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); use gst::QueryViewMut; match query.view_mut() { @@ -339,9 +339,9 @@ static CAT: Lazy = Lazy::new(|| { impl InputSelector { fn unprepare(&self) { let mut state = self.state.lock().unwrap(); - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); *state = State::default(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } } @@ -515,7 +515,7 @@ impl ElementImpl for InputSelector { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if let gst::StateChange::ReadyToNull = transition { self.unprepare(); diff --git a/generic/threadshare/src/jitterbuffer/imp.rs b/generic/threadshare/src/jitterbuffer/imp.rs index 56610c67..2e72f9b7 100644 --- a/generic/threadshare/src/jitterbuffer/imp.rs +++ b/generic/threadshare/src/jitterbuffer/imp.rs @@ -144,7 +144,7 @@ impl SinkHandler { // For resetting if seqnum discontinuities fn reset(&self, inner: &mut SinkHandlerInner, jb: &JitterBuffer) -> BTreeSet { - gst::info!(CAT, imp: jb, "Resetting"); + gst::info!(CAT, imp = jb, "Resetting"); let mut state = jb.state.lock().unwrap(); state.jbuf.flush(); @@ -176,17 +176,17 @@ impl SinkHandler { ) -> Result { let s = caps.structure(0).ok_or(gst::FlowError::Error)?; - gst::debug!(CAT, imp: jb, "Parsing {:?}", caps); + gst::debug!(CAT, imp = jb, "Parsing {:?}", caps); let payload = s.get::("payload").map_err(|err| { - gst::debug!(CAT, imp: jb, "Caps 'payload': {}", err); + gst::debug!(CAT, imp = jb, "Caps 'payload': {}", err); gst::FlowError::Error })?; if pt != 0 && payload as u8 != pt { gst::debug!( CAT, - imp: jb, + imp = jb, "Caps 'payload' ({}) doesn't match payload type ({})", payload, pt @@ -196,12 +196,12 @@ impl SinkHandler { inner.last_pt = Some(pt); let clock_rate = s.get::("clock-rate").map_err(|err| { - gst::debug!(CAT, imp: jb, "Caps 'clock-rate': {}", err); + gst::debug!(CAT, imp = jb, "Caps 'clock-rate': {}", err); gst::FlowError::Error })?; if clock_rate <= 0 { - gst::debug!(CAT, imp: jb, "Caps 'clock-rate' <= 0"); + gst::debug!(CAT, imp = jb, "Caps 'clock-rate' <= 0"); return Err(gst::FlowError::Error); } state.clock_rate = Some(clock_rate as u32); @@ -258,7 +258,7 @@ impl SinkHandler { gst::debug!( CAT, - imp: jb, + imp = jb, "Handling big gap, gap packets length: {}", gap_packets_length ); @@ -272,7 +272,7 @@ impl SinkHandler { for gap_packet in inner.gap_packets.iter() { gst::log!( CAT, - imp: jb, + imp = jb, "Looking at gap packet with seq {}", gap_packet.seq, ); @@ -292,7 +292,7 @@ impl SinkHandler { } } - gst::debug!(CAT, imp: jb, "all consecutive: {}", all_consecutive); + gst::debug!(CAT, imp = jb, "all consecutive: {}", all_consecutive); if all_consecutive && gap_packets_length > 3 { reset = true; @@ -334,7 +334,7 @@ impl SinkHandler { gst::log!( CAT, - imp: jb, + imp = jb, "Storing buffer, seq: {}, rtptime: {}, pt: {}", seq, rtptime, @@ -367,7 +367,7 @@ impl SinkHandler { inner.last_pt = Some(pt); state.clock_rate = None; - gst::debug!(CAT, obj: pad, "New payload type: {}", pt); + gst::debug!(CAT, obj = pad, "New payload type: {}", pt); if let Some(caps) = pad.current_caps() { /* Ignore errors at this point, as we want to emit request-pt-map */ @@ -381,7 +381,7 @@ impl SinkHandler { let caps = element .emit_by_name::>("request-pt-map", &[&(pt as u32)]) .ok_or_else(|| { - gst::error!(CAT, obj: pad, "Signal 'request-pt-map' returned None"); + gst::error!(CAT, obj = pad, "Signal 'request-pt-map' returned None"); gst::FlowError::Error })?; let mut state = jb.state.lock().unwrap(); @@ -404,7 +404,7 @@ impl SinkHandler { if pts.is_none() { gst::debug!( CAT, - imp: jb, + imp = jb, "cannot calculate a valid pts for #{}, discard", seq ); @@ -437,7 +437,7 @@ impl SinkHandler { if gap <= 0 { state.stats.num_late += 1; - gst::debug!(CAT, imp: jb, "Dropping late {}", seq); + gst::debug!(CAT, imp = jb, "Dropping late {}", seq); return Ok(gst::FlowSuccess::Ok); } } @@ -481,7 +481,7 @@ impl SinkHandler { state.earliest_seqnum = Some(seq); } - gst::log!(CAT, obj: pad, "Stored buffer"); + gst::log!(CAT, obj = pad, "Stored buffer"); Ok(gst::FlowSuccess::Ok) } @@ -531,7 +531,7 @@ impl SinkHandler { { gst::debug!( CAT, - obj: pad, + obj = pad, "Rescheduling for new item {} < {}", next_wakeup.display(), previous_next_wakeup.display(), @@ -555,7 +555,7 @@ impl PadSinkHandler for SinkHandler { buffer: gst::Buffer, ) -> BoxFuture<'static, Result> { async move { - gst::debug!(CAT, obj: pad, "Handling {:?}", buffer); + gst::debug!(CAT, obj = pad, "Handling {:?}", buffer); self.enqueue_item(pad, elem.imp(), Some(buffer)) } .boxed() @@ -564,11 +564,11 @@ impl PadSinkHandler for SinkHandler { fn sink_event(self, pad: &gst::Pad, jb: &JitterBuffer, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); if let EventView::FlushStart(..) = event.view() { if let Err(err) = jb.task.flush_start().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStart failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStart failed {:?}", err); gst::element_imp_error!( jb, gst::StreamError::Failed, @@ -579,7 +579,7 @@ impl PadSinkHandler for SinkHandler { } } - gst::log!(CAT, obj: pad, "Forwarding {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding {:?}", event); jb.src_pad.gst_pad().push_event(event) } @@ -590,7 +590,7 @@ impl PadSinkHandler for SinkHandler { event: gst::Event, ) -> BoxFuture<'static, bool> { async move { - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); let jb = elem.imp(); @@ -603,7 +603,7 @@ impl PadSinkHandler for SinkHandler { } EventView::FlushStop(..) => { if let Err(err) = jb.task.flush_stop().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStop failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStop failed {:?}", err); gst::element_error!( elem, gst::StreamError::Failed, @@ -626,7 +626,7 @@ impl PadSinkHandler for SinkHandler { if forward { // FIXME: These events should really be queued up and stay in order - gst::log!(CAT, obj: pad, "Forwarding serialized {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding serialized {:?}", event); jb.src_pad.push_event(event).await } else { true @@ -665,7 +665,7 @@ impl SrcHandler { gst::debug!( CAT, - obj: element, + obj = element, "Generating lost events seq: {}, last popped seq: {:?}", seqnum, last_popped_seqnum, @@ -801,11 +801,22 @@ impl SrcHandler { }; for event in lost_events { - gst::debug!(CAT, obj: jb.src_pad.gst_pad(), "Pushing lost event {:?}", event); + gst::debug!( + CAT, + obj = jb.src_pad.gst_pad(), + "Pushing lost event {:?}", + event + ); let _ = jb.src_pad.push_event(event).await; } - gst::debug!(CAT, obj: jb.src_pad.gst_pad(), "Pushing {:?} with seq {:?}", buffer, seq); + gst::debug!( + CAT, + obj = jb.src_pad.gst_pad(), + "Pushing {:?} with seq {:?}", + buffer, + seq + ); jb.src_pad.push(buffer).await } @@ -824,7 +835,7 @@ impl SrcHandler { gst::debug!( CAT, - obj: element, + obj = element, "Now is {}, EOS {}, earliest pts is {}, packet_spacing {} and latency {}", now.display(), state.eos, @@ -834,7 +845,7 @@ impl SrcHandler { ); if state.eos { - gst::debug!(CAT, obj: element, "EOS, not waiting"); + gst::debug!(CAT, obj = element, "EOS, not waiting"); return (now, Some((now, Duration::ZERO))); } @@ -854,7 +865,7 @@ impl SrcHandler { gst::debug!( CAT, - obj: element, + obj = element, "Next wakeup at {} with delay {}", next_wakeup.display(), delay @@ -870,12 +881,12 @@ impl PadSrcHandler for SrcHandler { fn src_event(self, pad: &gst::Pad, jb: &JitterBuffer, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); match event.view() { EventView::FlushStart(..) => { if let Err(err) = jb.task.flush_start().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStart failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStart failed {:?}", err); gst::element_imp_error!( jb, gst::StreamError::Failed, @@ -887,7 +898,7 @@ impl PadSrcHandler for SrcHandler { } EventView::FlushStop(..) => { if let Err(err) = jb.task.flush_stop().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStop failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStop failed {:?}", err); gst::element_imp_error!( jb, gst::StreamError::Failed, @@ -900,14 +911,14 @@ impl PadSrcHandler for SrcHandler { _ => (), } - gst::log!(CAT, obj: pad, "Forwarding {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding {:?}", event); jb.sink_pad.gst_pad().push_event(event) } fn src_query(self, pad: &gst::Pad, jb: &JitterBuffer, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Forwarding {:?}", query); + gst::log!(CAT, obj = pad, "Forwarding {:?}", query); match query.view_mut() { QueryViewMut::Latency(q) => { @@ -1030,7 +1041,7 @@ impl TaskImpl for JitterBufferTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Starting task"); + gst::log!(CAT, obj = self.element, "Starting task"); self.src_pad_handler.clear(); self.sink_pad_handler.clear(); @@ -1043,7 +1054,7 @@ impl TaskImpl for JitterBufferTask { state.jbuf.set_delay(latency); *jb.state.lock().unwrap() = state; - gst::log!(CAT, obj: self.element, "Task started"); + gst::log!(CAT, obj = self.element, "Task started"); Ok(()) } .boxed() @@ -1103,9 +1114,9 @@ impl TaskImpl for JitterBufferTask { // Got aborted, reschedule if needed if let Some(delay_fut) = delay_fut { - gst::debug!(CAT, obj: self.element, "Waiting"); + gst::debug!(CAT, obj = self.element, "Waiting"); if let Err(Aborted) = delay_fut.await { - gst::debug!(CAT, obj: self.element, "Waiting aborted"); + gst::debug!(CAT, obj = self.element, "Waiting aborted"); return Ok(()); } } @@ -1123,7 +1134,7 @@ impl TaskImpl for JitterBufferTask { gst::debug!( CAT, - obj: self.element, + obj = self.element, "Woke up at {}, earliest_pts {}", now.display(), state.earliest_pts.display() @@ -1179,13 +1190,13 @@ impl TaskImpl for JitterBufferTask { if let Err(err) = res { match err { gst::FlowError::Eos => { - gst::debug!(CAT, obj: self.element, "Pushing EOS event"); + gst::debug!(CAT, obj = self.element, "Pushing EOS event"); let _ = jb.src_pad.push_event(gst::event::Eos::new()).await; } gst::FlowError::Flushing => { - gst::debug!(CAT, obj: self.element, "Flushing") + gst::debug!(CAT, obj = self.element, "Flushing") } - err => gst::error!(CAT, obj: self.element, "Error {}", err), + err => gst::error!(CAT, obj = self.element, "Error {}", err), } return Err(err); @@ -1201,7 +1212,7 @@ impl TaskImpl for JitterBufferTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task"); + gst::log!(CAT, obj = self.element, "Stopping task"); let jb = self.element.imp(); let mut jb_state = jb.state.lock().unwrap(); @@ -1215,7 +1226,7 @@ impl TaskImpl for JitterBufferTask { *jb_state = State::default(); - gst::log!(CAT, obj: self.element, "Task stopped"); + gst::log!(CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -1242,7 +1253,7 @@ static CAT: Lazy = Lazy::new(|| { impl JitterBuffer { fn clear_pt_map(&self) { - gst::debug!(CAT, imp: self, "Clearing PT map"); + gst::debug!(CAT, imp = self, "Clearing PT map"); let mut state = self.state.lock().unwrap(); state.clock_rate = None; @@ -1250,7 +1261,7 @@ impl JitterBuffer { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let context = { let settings = self.settings.lock().unwrap(); @@ -1264,28 +1275,28 @@ impl JitterBuffer { ) .block_on()?; - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().block_on()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().block_on()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } } @@ -1528,7 +1539,7 @@ impl ElementImpl for JitterBuffer { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/proxy/imp.rs b/generic/threadshare/src/proxy/imp.rs index c2353907..bb68c7f4 100644 --- a/generic/threadshare/src/proxy/imp.rs +++ b/generic/threadshare/src/proxy/imp.rs @@ -217,7 +217,7 @@ impl PadSinkHandler for ProxySinkPadHandler { buffer: gst::Buffer, ) -> BoxFuture<'static, Result> { async move { - gst::log!(SINK_CAT, obj: pad, "Handling {:?}", buffer); + gst::log!(SINK_CAT, obj = pad, "Handling {:?}", buffer); let imp = elem.imp(); imp.enqueue_item(DataQueueItem::Buffer(buffer)).await } @@ -231,7 +231,7 @@ impl PadSinkHandler for ProxySinkPadHandler { list: gst::BufferList, ) -> BoxFuture<'static, Result> { async move { - gst::log!(SINK_CAT, obj: pad, "Handling {:?}", list); + gst::log!(SINK_CAT, obj = pad, "Handling {:?}", list); let imp = elem.imp(); imp.enqueue_item(DataQueueItem::BufferList(list)).await } @@ -239,7 +239,7 @@ impl PadSinkHandler for ProxySinkPadHandler { } fn sink_event(self, pad: &gst::Pad, imp: &ProxySink, event: gst::Event) -> bool { - gst::debug!(SINK_CAT, obj: pad, "Handling non-serialized {:?}", event); + gst::debug!(SINK_CAT, obj = pad, "Handling non-serialized {:?}", event); let src_pad = { let proxy_ctx = imp.proxy_ctx.lock().unwrap(); @@ -257,12 +257,12 @@ impl PadSinkHandler for ProxySinkPadHandler { } if let Some(src_pad) = src_pad { - gst::log!(SINK_CAT, obj: pad, "Forwarding non-serialized {:?}", event); + gst::log!(SINK_CAT, obj = pad, "Forwarding non-serialized {:?}", event); src_pad.push_event(event) } else { gst::error!( SINK_CAT, - obj: pad, + obj = pad, "No src pad to forward non-serialized {:?} to", event ); @@ -277,7 +277,7 @@ impl PadSinkHandler for ProxySinkPadHandler { event: gst::Event, ) -> BoxFuture<'static, bool> { async move { - gst::log!(SINK_CAT, obj: pad, "Handling serialized {:?}", event); + gst::log!(SINK_CAT, obj = pad, "Handling serialized {:?}", event); let imp = elem.imp(); @@ -290,7 +290,7 @@ impl PadSinkHandler for ProxySinkPadHandler { _ => (), } - gst::log!(SINK_CAT, obj: pad, "Queuing serialized {:?}", event); + gst::log!(SINK_CAT, obj = pad, "Queuing serialized {:?}", event); imp.enqueue_item(DataQueueItem::Event(event)).await.is_ok() } .boxed() @@ -319,7 +319,7 @@ impl ProxySink { let proxy_ctx = self.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); - gst::log!(SINK_CAT, imp: self, "Trying to empty pending queue"); + gst::log!(SINK_CAT, imp = self, "Trying to empty pending queue"); let ProxyContextInner { pending_queue: ref mut pq, @@ -344,7 +344,7 @@ impl ProxySink { receiver } else { - gst::log!(SINK_CAT, imp: self, "Pending queue is empty now"); + gst::log!(SINK_CAT, imp = self, "Pending queue is empty now"); *pq = None; return; } @@ -355,13 +355,13 @@ impl ProxySink { receiver } } else { - gst::log!(SINK_CAT, imp: self, "Flushing, dropping pending queue"); + gst::log!(SINK_CAT, imp = self, "Flushing, dropping pending queue"); *pq = None; return; } }; - gst::log!(SINK_CAT, imp: self, "Waiting for more queue space"); + gst::log!(SINK_CAT, imp = self, "Waiting for more queue space"); let _ = more_queue_space_receiver.await; } } @@ -431,18 +431,18 @@ impl ProxySink { gst::log!( SINK_CAT, - imp: self, + imp = self, "Proxy is full - Pushing first item on pending queue" ); if schedule_now { - gst::log!(SINK_CAT, imp: self, "Scheduling pending queue now"); + gst::log!(SINK_CAT, imp = self, "Scheduling pending queue now"); pending_queue.scheduled = true; let wait_fut = self.schedule_pending_queue(); Some(wait_fut) } else { - gst::log!(SINK_CAT, imp: self, "Scheduling pending queue later"); + gst::log!(SINK_CAT, imp = self, "Scheduling pending queue later"); None } @@ -462,7 +462,7 @@ impl ProxySink { }; if let Some(wait_fut) = wait_fut { - gst::log!(SINK_CAT, imp: self, "Blocking until queue has space again"); + gst::log!(SINK_CAT, imp = self, "Blocking until queue has space again"); wait_fut.await; } @@ -472,7 +472,7 @@ impl ProxySink { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SINK_CAT, imp: self, "Preparing"); + gst::debug!(SINK_CAT, imp = self, "Preparing"); let proxy_context = self.settings.lock().unwrap().proxy_context.to_string(); @@ -491,22 +491,22 @@ impl ProxySink { *self.proxy_ctx.lock().unwrap() = Some(proxy_ctx); - gst::debug!(SINK_CAT, imp: self, "Prepared"); + gst::debug!(SINK_CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(SINK_CAT, imp: self, "Unpreparing"); + gst::debug!(SINK_CAT, imp = self, "Unpreparing"); *self.proxy_ctx.lock().unwrap() = None; - gst::debug!(SINK_CAT, imp: self, "Unprepared"); + gst::debug!(SINK_CAT, imp = self, "Unprepared"); } fn start(&self) { let proxy_ctx = self.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); - gst::debug!(SINK_CAT, imp: self, "Starting"); + gst::debug!(SINK_CAT, imp = self, "Starting"); { let settings = self.settings.lock().unwrap(); @@ -516,19 +516,19 @@ impl ProxySink { shared_ctx.last_res = Ok(gst::FlowSuccess::Ok); - gst::debug!(SINK_CAT, imp: self, "Started"); + gst::debug!(SINK_CAT, imp = self, "Started"); } fn stop(&self) { let proxy_ctx = self.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); - gst::debug!(SINK_CAT, imp: self, "Stopping"); + gst::debug!(SINK_CAT, imp = self, "Stopping"); let _ = shared_ctx.pending_queue.take(); shared_ctx.last_res = Err(gst::FlowError::Flushing); - gst::debug!(SINK_CAT, imp: self, "Stopped"); + gst::debug!(SINK_CAT, imp = self, "Stopped"); } } @@ -631,7 +631,7 @@ impl ElementImpl for ProxySink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(SINK_CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(SINK_CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { @@ -666,7 +666,7 @@ impl PadSrcHandler for ProxySrcPadHandler { type ElementImpl = ProxySrc; fn src_event(self, pad: &gst::Pad, imp: &ProxySrc, event: gst::Event) -> bool { - gst::log!(SRC_CAT, obj: pad, "Handling {:?}", event); + gst::log!(SRC_CAT, obj = pad, "Handling {:?}", event); let sink_pad = { let proxy_ctx = imp.proxy_ctx.lock().unwrap(); @@ -683,7 +683,7 @@ impl PadSrcHandler for ProxySrcPadHandler { match event.view() { EventView::FlushStart(..) => { if let Err(err) = imp.task.flush_start().await_maybe_on_context() { - gst::error!(SRC_CAT, obj: pad, "FlushStart failed {:?}", err); + gst::error!(SRC_CAT, obj = pad, "FlushStart failed {:?}", err); gst::element_imp_error!( imp, gst::StreamError::Failed, @@ -695,7 +695,7 @@ impl PadSrcHandler for ProxySrcPadHandler { } EventView::FlushStop(..) => { if let Err(err) = imp.task.flush_stop().await_maybe_on_context() { - gst::error!(SRC_CAT, obj: pad, "FlushStop failed {:?}", err); + gst::error!(SRC_CAT, obj = pad, "FlushStop failed {:?}", err); gst::element_imp_error!( imp, gst::StreamError::Failed, @@ -709,16 +709,16 @@ impl PadSrcHandler for ProxySrcPadHandler { } if let Some(sink_pad) = sink_pad { - gst::log!(SRC_CAT, obj: pad, "Forwarding {:?}", event); + gst::log!(SRC_CAT, obj = pad, "Forwarding {:?}", event); sink_pad.push_event(event) } else { - gst::error!(SRC_CAT, obj: pad, "No sink pad to forward {:?} to", event); + gst::error!(SRC_CAT, obj = pad, "No sink pad to forward {:?} to", event); false } } fn src_query(self, pad: &gst::Pad, _proxysrc: &ProxySrc, query: &mut gst::QueryRef) -> bool { - gst::log!(SRC_CAT, obj: pad, "Handling {:?}", query); + gst::log!(SRC_CAT, obj = pad, "Handling {:?}", query); use gst::QueryViewMut; let ret = match query.view_mut() { @@ -750,9 +750,9 @@ impl PadSrcHandler for ProxySrcPadHandler { }; if ret { - gst::log!(SRC_CAT, obj: pad, "Handled {:?}", query); + gst::log!(SRC_CAT, obj = pad, "Handled {:?}", query); } else { - gst::log!(SRC_CAT, obj: pad, "Didn't handle {:?}", query); + gst::log!(SRC_CAT, obj = pad, "Didn't handle {:?}", query); } ret @@ -783,15 +783,15 @@ impl ProxySrcTask { match item { DataQueueItem::Buffer(buffer) => { - gst::log!(SRC_CAT, obj: self.element, "Forwarding {:?}", buffer); + gst::log!(SRC_CAT, obj = self.element, "Forwarding {:?}", buffer); proxysrc.src_pad.push(buffer).await.map(drop) } DataQueueItem::BufferList(list) => { - gst::log!(SRC_CAT, obj: self.element, "Forwarding {:?}", list); + gst::log!(SRC_CAT, obj = self.element, "Forwarding {:?}", list); proxysrc.src_pad.push_list(list).await.map(drop) } DataQueueItem::Event(event) => { - gst::log!(SRC_CAT, obj: self.element, "Forwarding {:?}", event); + gst::log!(SRC_CAT, obj = self.element, "Forwarding {:?}", event); proxysrc.src_pad.push_event(event).await; Ok(()) } @@ -804,7 +804,7 @@ impl TaskImpl for ProxySrcTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(SRC_CAT, obj: self.element, "Starting task"); + gst::log!(SRC_CAT, obj = self.element, "Starting task"); let proxysrc = self.element.imp(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); @@ -818,7 +818,7 @@ impl TaskImpl for ProxySrcTask { self.dataqueue.start(); - gst::log!(SRC_CAT, obj: self.element, "Task started"); + gst::log!(SRC_CAT, obj = self.element, "Task started"); Ok(()) } .boxed() @@ -840,25 +840,25 @@ impl TaskImpl for ProxySrcTask { let proxysrc = self.element.imp(); match res { Ok(()) => { - gst::log!(SRC_CAT, obj: self.element, "Successfully pushed item"); + gst::log!(SRC_CAT, obj = self.element, "Successfully pushed item"); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); shared_ctx.last_res = Ok(gst::FlowSuccess::Ok); } Err(gst::FlowError::Flushing) => { - gst::debug!(SRC_CAT, obj: self.element, "Flushing"); + gst::debug!(SRC_CAT, obj = self.element, "Flushing"); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); shared_ctx.last_res = Err(gst::FlowError::Flushing); } Err(gst::FlowError::Eos) => { - gst::debug!(SRC_CAT, obj: self.element, "EOS"); + gst::debug!(SRC_CAT, obj = self.element, "EOS"); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); shared_ctx.last_res = Err(gst::FlowError::Eos); } Err(err) => { - gst::error!(SRC_CAT, obj: self.element, "Got error {}", err); + gst::error!(SRC_CAT, obj = self.element, "Got error {}", err); gst::element_error!( &self.element, gst::StreamError::Failed, @@ -878,7 +878,7 @@ impl TaskImpl for ProxySrcTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(SRC_CAT, obj: self.element, "Stopping task"); + gst::log!(SRC_CAT, obj = self.element, "Stopping task"); let proxysrc = self.element.imp(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); @@ -893,7 +893,7 @@ impl TaskImpl for ProxySrcTask { pending_queue.notify_more_queue_space(); } - gst::log!(SRC_CAT, obj: self.element, "Task stopped"); + gst::log!(SRC_CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -901,7 +901,7 @@ impl TaskImpl for ProxySrcTask { fn flush_start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(SRC_CAT, obj: self.element, "Starting task flush"); + gst::log!(SRC_CAT, obj = self.element, "Starting task flush"); let proxysrc = self.element.imp(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); @@ -911,7 +911,7 @@ impl TaskImpl for ProxySrcTask { shared_ctx.last_res = Err(gst::FlowError::Flushing); - gst::log!(SRC_CAT, obj: self.element, "Task flush started"); + gst::log!(SRC_CAT, obj = self.element, "Task flush started"); Ok(()) } .boxed() @@ -937,7 +937,7 @@ static SRC_CAT: Lazy = Lazy::new(|| { impl ProxySrc { fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SRC_CAT, imp: self, "Preparing"); + gst::debug!(SRC_CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap().clone(); @@ -991,13 +991,13 @@ impl ProxySrc { .prepare(ProxySrcTask::new(self.obj().clone(), dataqueue), ts_ctx) .block_on()?; - gst::debug!(SRC_CAT, imp: self, "Prepared"); + gst::debug!(SRC_CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(SRC_CAT, imp: self, "Unpreparing"); + gst::debug!(SRC_CAT, imp = self, "Unpreparing"); { let settings = self.settings.lock().unwrap(); @@ -1010,27 +1010,27 @@ impl ProxySrc { *self.dataqueue.lock().unwrap() = None; *self.proxy_ctx.lock().unwrap() = None; - gst::debug!(SRC_CAT, imp: self, "Unprepared"); + gst::debug!(SRC_CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SRC_CAT, imp: self, "Stopping"); + gst::debug!(SRC_CAT, imp = self, "Stopping"); self.task.stop().await_maybe_on_context()?; - gst::debug!(SRC_CAT, imp: self, "Stopped"); + gst::debug!(SRC_CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SRC_CAT, imp: self, "Starting"); + gst::debug!(SRC_CAT, imp = self, "Starting"); self.task.start().await_maybe_on_context()?; - gst::debug!(SRC_CAT, imp: self, "Started"); + gst::debug!(SRC_CAT, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SRC_CAT, imp: self, "Pausing"); + gst::debug!(SRC_CAT, imp = self, "Pausing"); self.task.pause().block_on()?; - gst::debug!(SRC_CAT, imp: self, "Paused"); + gst::debug!(SRC_CAT, imp = self, "Paused"); Ok(()) } } @@ -1190,7 +1190,7 @@ impl ElementImpl for ProxySrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(SRC_CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(SRC_CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/queue/imp.rs b/generic/threadshare/src/queue/imp.rs index f44f0d74..5a291e79 100644 --- a/generic/threadshare/src/queue/imp.rs +++ b/generic/threadshare/src/queue/imp.rs @@ -89,7 +89,7 @@ impl PadSinkHandler for QueuePadSinkHandler { buffer: gst::Buffer, ) -> BoxFuture<'static, Result> { async move { - gst::log!(CAT, obj: pad, "Handling {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling {:?}", buffer); let imp = elem.imp(); imp.enqueue_item(DataQueueItem::Buffer(buffer)).await } @@ -103,7 +103,7 @@ impl PadSinkHandler for QueuePadSinkHandler { list: gst::BufferList, ) -> BoxFuture<'static, Result> { async move { - gst::log!(CAT, obj: pad, "Handling {:?}", list); + gst::log!(CAT, obj = pad, "Handling {:?}", list); let imp = elem.imp(); imp.enqueue_item(DataQueueItem::BufferList(list)).await } @@ -111,11 +111,11 @@ impl PadSinkHandler for QueuePadSinkHandler { } fn sink_event(self, pad: &gst::Pad, imp: &Queue, event: gst::Event) -> bool { - gst::debug!(CAT, obj: pad, "Handling non-serialized {:?}", event); + gst::debug!(CAT, obj = pad, "Handling non-serialized {:?}", event); if let gst::EventView::FlushStart(..) = event.view() { if let Err(err) = imp.task.flush_start().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStart failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStart failed {:?}", err); gst::element_imp_error!( imp, gst::StreamError::Failed, @@ -126,7 +126,7 @@ impl PadSinkHandler for QueuePadSinkHandler { } } - gst::log!(CAT, obj: pad, "Forwarding non-serialized {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding non-serialized {:?}", event); imp.src_pad.gst_pad().push_event(event) } @@ -137,13 +137,13 @@ impl PadSinkHandler for QueuePadSinkHandler { event: gst::Event, ) -> BoxFuture<'static, bool> { async move { - gst::log!(CAT, obj: pad, "Handling serialized {:?}", event); + gst::log!(CAT, obj = pad, "Handling serialized {:?}", event); let imp = elem.imp(); if let gst::EventView::FlushStop(..) = event.view() { if let Err(err) = imp.task.flush_stop().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStop failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStop failed {:?}", err); gst::element_imp_error!( imp, gst::StreamError::Failed, @@ -154,21 +154,21 @@ impl PadSinkHandler for QueuePadSinkHandler { } } - gst::log!(CAT, obj: pad, "Queuing serialized {:?}", event); + gst::log!(CAT, obj = pad, "Queuing serialized {:?}", event); imp.enqueue_item(DataQueueItem::Event(event)).await.is_ok() } .boxed() } fn sink_query(self, pad: &gst::Pad, imp: &Queue, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); if query.is_serialized() { // FIXME: How can we do this? - gst::log!(CAT, obj: pad, "Dropping serialized {:?}", query); + gst::log!(CAT, obj = pad, "Dropping serialized {:?}", query); false } else { - gst::log!(CAT, obj: pad, "Forwarding {:?}", query); + gst::log!(CAT, obj = pad, "Forwarding {:?}", query); imp.src_pad.gst_pad().peer_query(query) } } @@ -181,18 +181,18 @@ impl PadSrcHandler for QueuePadSrcHandler { type ElementImpl = Queue; fn src_event(self, pad: &gst::Pad, imp: &Queue, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); use gst::EventView; match event.view() { EventView::FlushStart(..) => { if let Err(err) = imp.task.flush_start().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStart failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStart failed {:?}", err); } } EventView::FlushStop(..) => { if let Err(err) = imp.task.flush_stop().await_maybe_on_context() { - gst::error!(CAT, obj: pad, "FlushStop failed {:?}", err); + gst::error!(CAT, obj = pad, "FlushStop failed {:?}", err); gst::element_imp_error!( imp, gst::StreamError::Failed, @@ -205,12 +205,12 @@ impl PadSrcHandler for QueuePadSrcHandler { _ => (), } - gst::log!(CAT, obj: pad, "Forwarding {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding {:?}", event); imp.sink_pad.gst_pad().push_event(event) } fn src_query(self, pad: &gst::Pad, imp: &Queue, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); if let gst::QueryViewMut::Scheduling(q) = query.view_mut() { let mut new_query = gst::query::Scheduling::new(); @@ -219,7 +219,7 @@ impl PadSrcHandler for QueuePadSrcHandler { return res; } - gst::log!(CAT, obj: pad, "Upstream returned {:?}", new_query); + gst::log!(CAT, obj = pad, "Upstream returned {:?}", new_query); let (flags, min, max, align) = new_query.result(); q.set(flags, min, max, align); @@ -231,11 +231,11 @@ impl PadSrcHandler for QueuePadSrcHandler { .filter(|m| m != &gst::PadMode::Pull) .collect::>(), ); - gst::log!(CAT, obj: pad, "Returning {:?}", q.query_mut()); + gst::log!(CAT, obj = pad, "Returning {:?}", q.query_mut()); return true; } - gst::log!(CAT, obj: pad, "Forwarding {:?}", query); + gst::log!(CAT, obj = pad, "Forwarding {:?}", query); imp.sink_pad.gst_pad().peer_query(query) } } @@ -260,15 +260,15 @@ impl QueueTask { match item { DataQueueItem::Buffer(buffer) => { - gst::log!(CAT, obj: self.element, "Forwarding {:?}", buffer); + gst::log!(CAT, obj = self.element, "Forwarding {:?}", buffer); queue.src_pad.push(buffer).await.map(drop) } DataQueueItem::BufferList(list) => { - gst::log!(CAT, obj: self.element, "Forwarding {:?}", list); + gst::log!(CAT, obj = self.element, "Forwarding {:?}", list); queue.src_pad.push_list(list).await.map(drop) } DataQueueItem::Event(event) => { - gst::log!(CAT, obj: self.element, "Forwarding {:?}", event); + gst::log!(CAT, obj = self.element, "Forwarding {:?}", event); queue.src_pad.push_event(event).await; Ok(()) } @@ -281,7 +281,7 @@ impl TaskImpl for QueueTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Starting task"); + gst::log!(CAT, obj = self.element, "Starting task"); let queue = self.element.imp(); let mut last_res = queue.last_res.lock().unwrap(); @@ -290,7 +290,7 @@ impl TaskImpl for QueueTask { *last_res = Ok(gst::FlowSuccess::Ok); - gst::log!(CAT, obj: self.element, "Task started"); + gst::log!(CAT, obj = self.element, "Task started"); Ok(()) } .boxed() @@ -312,20 +312,20 @@ impl TaskImpl for QueueTask { let queue = self.element.imp(); match res { Ok(()) => { - gst::log!(CAT, obj: self.element, "Successfully pushed item"); + gst::log!(CAT, obj = self.element, "Successfully pushed item"); *queue.last_res.lock().unwrap() = Ok(gst::FlowSuccess::Ok); } Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.element, "Flushing"); + gst::debug!(CAT, obj = self.element, "Flushing"); *queue.last_res.lock().unwrap() = Err(gst::FlowError::Flushing); } Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); *queue.last_res.lock().unwrap() = Err(gst::FlowError::Eos); queue.src_pad.push_event(gst::event::Eos::new()).await; } Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {}", err); + gst::error!(CAT, obj = self.element, "Got error {}", err); gst::element_error!( &self.element, gst::StreamError::Failed, @@ -343,7 +343,7 @@ impl TaskImpl for QueueTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task"); + gst::log!(CAT, obj = self.element, "Stopping task"); let queue = self.element.imp(); let mut last_res = queue.last_res.lock().unwrap(); @@ -357,7 +357,7 @@ impl TaskImpl for QueueTask { *last_res = Err(gst::FlowError::Flushing); - gst::log!(CAT, obj: self.element, "Task stopped"); + gst::log!(CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -365,7 +365,7 @@ impl TaskImpl for QueueTask { fn flush_start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Starting task flush"); + gst::log!(CAT, obj = self.element, "Starting task flush"); let queue = self.element.imp(); let mut last_res = queue.last_res.lock().unwrap(); @@ -378,7 +378,7 @@ impl TaskImpl for QueueTask { *last_res = Err(gst::FlowError::Flushing); - gst::log!(CAT, obj: self.element, "Task flush started"); + gst::log!(CAT, obj = self.element, "Task flush started"); Ok(()) } .boxed() @@ -453,7 +453,7 @@ impl Queue { } let mut pending_queue_grd = self.pending_queue.lock().unwrap(); - gst::log!(CAT, imp: self, "Trying to empty pending queue"); + gst::log!(CAT, imp = self, "Trying to empty pending queue"); if let Some(pending_queue) = pending_queue_grd.as_mut() { let mut failed_item = None; @@ -470,17 +470,17 @@ impl Queue { receiver } else { - gst::log!(CAT, imp: self, "Pending queue is empty now"); + gst::log!(CAT, imp = self, "Pending queue is empty now"); *pending_queue_grd = None; return; } } else { - gst::log!(CAT, imp: self, "Flushing, dropping pending queue"); + gst::log!(CAT, imp = self, "Flushing, dropping pending queue"); return; } }; - gst::log!(CAT, imp: self, "Waiting for more queue space"); + gst::log!(CAT, imp = self, "Waiting for more queue space"); let _ = more_queue_space_receiver.await; } } @@ -489,7 +489,7 @@ impl Queue { let wait_fut = { let dataqueue = self.dataqueue.lock().unwrap(); let dataqueue = dataqueue.as_ref().ok_or_else(|| { - gst::error!(CAT, imp: self, "No DataQueue"); + gst::error!(CAT, imp = self, "No DataQueue"); gst::FlowError::Error })?; @@ -518,18 +518,18 @@ impl Queue { gst::log!( CAT, - imp: self, + imp = self, "Queue is full - Pushing first item on pending queue" ); if schedule_now { - gst::log!(CAT, imp: self, "Scheduling pending queue now"); + gst::log!(CAT, imp = self, "Scheduling pending queue now"); pending_queue.as_mut().unwrap().scheduled = true; let wait_fut = self.schedule_pending_queue(); Some(wait_fut) } else { - gst::log!(CAT, imp: self, "Scheduling pending queue later"); + gst::log!(CAT, imp = self, "Scheduling pending queue later"); None } } else { @@ -542,7 +542,7 @@ impl Queue { }; if let Some(wait_fut) = wait_fut { - gst::log!(CAT, imp: self, "Blocking until queue has space again"); + gst::log!(CAT, imp = self, "Blocking until queue has space again"); wait_fut.await; } @@ -550,7 +550,7 @@ impl Queue { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap().clone(); @@ -588,13 +588,13 @@ impl Queue { .prepare(QueueTask::new(self.obj().clone(), dataqueue), context) .block_on()?; - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); @@ -603,20 +603,20 @@ impl Queue { *self.last_res.lock().unwrap() = Ok(gst::FlowSuccess::Ok); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().await_maybe_on_context()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().await_maybe_on_context()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } } @@ -777,7 +777,7 @@ impl ElementImpl for Queue { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/runtime/pad.rs b/generic/threadshare/src/runtime/pad.rs index 865dbf84..3856f083 100644 --- a/generic/threadshare/src/runtime/pad.rs +++ b/generic/threadshare/src/runtime/pad.rs @@ -129,7 +129,7 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static { if pad.is_active() { gst::debug!( RUNTIME_CAT, - obj: pad, + obj = pad, "Already activated in {:?} mode ", pad.mode() ); @@ -137,7 +137,12 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static { } pad.activate_mode(gst::PadMode::Push, true).map_err(|err| { - gst::error!(RUNTIME_CAT, obj: pad, "Error in PadSrc activate: {:?}", err); + gst::error!( + RUNTIME_CAT, + obj = pad, + "Error in PadSrc activate: {:?}", + err + ); gst::loggable_error!(RUNTIME_CAT, "Error in PadSrc activate: {:?}", err) }) } @@ -153,7 +158,7 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static { } fn src_event(self, pad: &gst::Pad, imp: &Self::ElementImpl, event: gst::Event) -> bool { - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", event); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", event); let elem = imp.obj(); // FIXME with GAT on `Self::ElementImpl`, we should be able to @@ -178,13 +183,13 @@ pub trait PadSrcHandler: Clone + Send + Sync + 'static { } fn src_query(self, pad: &gst::Pad, imp: &Self::ElementImpl, query: &mut gst::QueryRef) -> bool { - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", query); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", query); if query.is_serialized() { // FIXME serialized queries should be handled with the dataflow // but we can't return a `Future` because we couldn't honor QueryRef's lifetime false } else { - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", query); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", query); let elem = imp.obj(); // FIXME with GAT on `Self::ElementImpl`, we should be able to @@ -217,48 +222,61 @@ impl PadSrcInner { } pub async fn push(&self, buffer: gst::Buffer) -> Result { - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Pushing {:?}", buffer); + gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", buffer); let success = self.gst_pad.push(buffer).map_err(|err| { - gst::error!(RUNTIME_CAT, - obj: self.gst_pad, + gst::error!( + RUNTIME_CAT, + obj = self.gst_pad, "Failed to push Buffer to PadSrc: {:?}", err, ); err })?; - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Processing any pending sub tasks"); + gst::log!( + RUNTIME_CAT, + obj = self.gst_pad, + "Processing any pending sub tasks" + ); Context::drain_sub_tasks().await?; Ok(success) } pub async fn push_list(&self, list: gst::BufferList) -> Result { - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Pushing {:?}", list); + gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", list); let success = self.gst_pad.push_list(list).map_err(|err| { gst::error!( RUNTIME_CAT, - obj: self.gst_pad, + obj = self.gst_pad, "Failed to push BufferList to PadSrc: {:?}", err, ); err })?; - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Processing any pending sub tasks"); + gst::log!( + RUNTIME_CAT, + obj = self.gst_pad, + "Processing any pending sub tasks" + ); Context::drain_sub_tasks().await?; Ok(success) } pub async fn push_event(&self, event: gst::Event) -> bool { - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Pushing {:?}", event); + gst::log!(RUNTIME_CAT, obj = self.gst_pad, "Pushing {:?}", event); let was_handled = self.gst_pad.push_event(event); - gst::log!(RUNTIME_CAT, obj: self.gst_pad, "Processing any pending sub tasks"); + gst::log!( + RUNTIME_CAT, + obj = self.gst_pad, + "Processing any pending sub tasks" + ); if Context::drain_sub_tasks().await.is_err() { return false; } @@ -365,7 +383,7 @@ impl PadSrc { H::ElementImpl::catch_panic_pad_function( parent, || { - gst::error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSrc activate"); + gst::error!(RUNTIME_CAT, obj = gst_pad, "Panic in PadSrc activate"); Err(gst::loggable_error!( RUNTIME_CAT, "Panic in PadSrc activate" @@ -383,7 +401,7 @@ impl PadSrc { H::ElementImpl::catch_panic_pad_function( parent, || { - gst::error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSrc activatemode"); + gst::error!(RUNTIME_CAT, obj = gst_pad, "Panic in PadSrc activatemode"); Err(gst::loggable_error!( RUNTIME_CAT, "Panic in PadSrc activatemode" @@ -392,7 +410,7 @@ impl PadSrc { move |imp| { gst::log!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "ActivateMode {:?}, {}", mode, active @@ -401,7 +419,7 @@ impl PadSrc { if mode == gst::PadMode::Pull { gst::error!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "Pull mode not supported by PadSrc" ); return Err(gst::loggable_error!( @@ -442,7 +460,7 @@ impl PadSrc { } else { gst::fixme!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "Serialized Query not supported" ); false @@ -507,7 +525,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static { if pad.is_active() { gst::debug!( RUNTIME_CAT, - obj: pad, + obj = pad, "Already activated in {:?} mode ", pad.mode() ); @@ -517,7 +535,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static { pad.activate_mode(gst::PadMode::Push, true).map_err(|err| { gst::error!( RUNTIME_CAT, - obj: pad, + obj = pad, "Error in PadSink activate: {:?}", err ); @@ -555,7 +573,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static { fn sink_event(self, pad: &gst::Pad, imp: &Self::ElementImpl, event: gst::Event) -> bool { assert!(!event.is_serialized()); - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", event); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", event); let elem = imp.obj(); // FIXME with GAT on `Self::ElementImpl`, we should be able to @@ -581,7 +599,7 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static { let element = unsafe { elem.unsafe_cast::() }; async move { - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", event); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", event); gst::Pad::event_default(&pad, Some(&element), event) } @@ -624,12 +642,12 @@ pub trait PadSinkHandler: Clone + Send + Sync + 'static { query: &mut gst::QueryRef, ) -> bool { if query.is_serialized() { - gst::log!(RUNTIME_CAT, obj: pad, "Dropping {:?}", query); + gst::log!(RUNTIME_CAT, obj = pad, "Dropping {:?}", query); // FIXME serialized queries should be handled with the dataflow // but we can't return a `Future` because we couldn't honor QueryRef's lifetime false } else { - gst::log!(RUNTIME_CAT, obj: pad, "Handling {:?}", query); + gst::log!(RUNTIME_CAT, obj = pad, "Handling {:?}", query); let elem = imp.obj(); // FIXME with GAT on `Self::ElementImpl`, we should be able to @@ -764,7 +782,7 @@ impl PadSink { H::ElementImpl::catch_panic_pad_function( parent, || { - gst::error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSink activate"); + gst::error!(RUNTIME_CAT, obj = gst_pad, "Panic in PadSink activate"); Err(gst::loggable_error!( RUNTIME_CAT, "Panic in PadSink activate" @@ -782,7 +800,11 @@ impl PadSink { H::ElementImpl::catch_panic_pad_function( parent, || { - gst::error!(RUNTIME_CAT, obj: gst_pad, "Panic in PadSink activatemode"); + gst::error!( + RUNTIME_CAT, + obj = gst_pad, + "Panic in PadSink activatemode" + ); Err(gst::loggable_error!( RUNTIME_CAT, "Panic in PadSink activatemode" @@ -791,7 +813,7 @@ impl PadSink { move |imp| { gst::log!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "ActivateMode {:?}, {}", mode, active @@ -800,7 +822,7 @@ impl PadSink { if mode == gst::PadMode::Pull { gst::error!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "Pull mode not supported by PadSink" ); return Err(gst::loggable_error!( @@ -923,7 +945,7 @@ impl PadSink { } else { gst::fixme!( RUNTIME_CAT, - obj: gst_pad, + obj = gst_pad, "Serialized Query not supported" ); false diff --git a/generic/threadshare/src/socket.rs b/generic/threadshare/src/socket.rs index 9f9af5fb..889bcca2 100644 --- a/generic/threadshare/src/socket.rs +++ b/generic/threadshare/src/socket.rs @@ -74,7 +74,7 @@ impl Socket { buffer_pool.set_active(true).map_err(|err| { gst::error!( SOCKET_CAT, - obj: element, + obj = element, "Failed to prepare socket: {}", err ); @@ -122,7 +122,7 @@ impl Socket { pub async fn try_next( &mut self, ) -> Result<(gst::Buffer, Option), SocketError> { - gst::log!(SOCKET_CAT, obj: self.element, "Trying to read data"); + gst::log!(SOCKET_CAT, obj = self.element, "Trying to read data"); if self.mapped_buffer.is_none() { match self.buffer_pool.acquire_buffer(None) { @@ -130,7 +130,12 @@ impl Socket { self.mapped_buffer = Some(buffer.into_mapped_buffer_writable().unwrap()); } Err(err) => { - gst::debug!(SOCKET_CAT, obj: self.element, "Failed to acquire buffer {:?}", err); + gst::debug!( + SOCKET_CAT, + obj = self.element, + "Failed to acquire buffer {:?}", + err + ); return Err(SocketError::Gst(err)); } } @@ -149,7 +154,7 @@ impl Socket { // so as to display another message gst::debug!( SOCKET_CAT, - obj: self.element, + obj = self.element, "Read {} bytes at {} (clock {})", len, running_time.display(), @@ -157,7 +162,7 @@ impl Socket { ); running_time } else { - gst::debug!(SOCKET_CAT, obj: self.element, "Read {} bytes", len); + gst::debug!(SOCKET_CAT, obj = self.element, "Read {} bytes", len); gst::ClockTime::NONE }; @@ -173,7 +178,7 @@ impl Socket { Ok((buffer, saddr)) } Err(err) => { - gst::debug!(SOCKET_CAT, obj: self.element, "Read error {:?}", err); + gst::debug!(SOCKET_CAT, obj = self.element, "Read error {:?}", err); Err(SocketError::Io(err)) } @@ -184,7 +189,12 @@ impl Socket { impl Drop for Socket { fn drop(&mut self) { if let Err(err) = self.buffer_pool.set_active(false) { - gst::error!(SOCKET_CAT, obj: self.element, "Failed to unprepare socket: {}", err); + gst::error!( + SOCKET_CAT, + obj = self.element, + "Failed to unprepare socket: {}", + err + ); } } } diff --git a/generic/threadshare/src/tcpclientsrc/imp.rs b/generic/threadshare/src/tcpclientsrc/imp.rs index cc10b674..20d4be14 100644 --- a/generic/threadshare/src/tcpclientsrc/imp.rs +++ b/generic/threadshare/src/tcpclientsrc/imp.rs @@ -102,7 +102,7 @@ impl PadSrcHandler for TcpClientSrcPadHandler { type ElementImpl = TcpClientSrc; fn src_event(self, pad: &gst::Pad, imp: &TcpClientSrc, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); use gst::EventView; let ret = match event.view() { @@ -114,16 +114,16 @@ impl PadSrcHandler for TcpClientSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", event); + gst::log!(CAT, obj = pad, "Handled {:?}", event); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", event); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", event); } ret } fn src_query(self, pad: &gst::Pad, imp: &TcpClientSrc, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); use gst::QueryViewMut; let ret = match query.view_mut() { @@ -155,9 +155,9 @@ impl PadSrcHandler for TcpClientSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", query); + gst::log!(CAT, obj = pad, "Handled {:?}", query); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", query); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", query); } ret @@ -196,12 +196,12 @@ impl TcpClientSrcTask { &mut self, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: self.element, "Handling {:?}", buffer); + gst::log!(CAT, obj = self.element, "Handling {:?}", buffer); let tcpclientsrc = self.element.imp(); if self.need_initial_events { - gst::debug!(CAT, obj: self.element, "Pushing initial events"); + gst::debug!(CAT, obj = self.element, "Pushing initial events"); let stream_id = format!("{:08x}{:08x}", rand::random::(), rand::random::()); let stream_start_evt = gst::event::StreamStart::builder(&stream_id) @@ -240,20 +240,20 @@ impl TcpClientSrcTask { let res = tcpclientsrc.src_pad.push(buffer).await; match res { Ok(_) => { - gst::log!(CAT, obj: self.element, "Successfully pushed buffer"); + gst::log!(CAT, obj = self.element, "Successfully pushed buffer"); } Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.element, "Flushing"); + gst::debug!(CAT, obj = self.element, "Flushing"); } Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); tcpclientsrc .src_pad .push_event(gst::event::Eos::new()) .await; } Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {}", err); + gst::error!(CAT, obj = self.element, "Got error {}", err); gst::element_error!( self.element, gst::StreamError::Failed, @@ -272,7 +272,12 @@ impl TaskImpl for TcpClientSrcTask { fn prepare(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Preparing task connecting to {:?}", self.saddr); + gst::log!( + CAT, + obj = self.element, + "Preparing task connecting to {:?}", + self.saddr + ); let socket = Async::::connect(self.saddr) .await @@ -297,7 +302,7 @@ impl TaskImpl for TcpClientSrcTask { })?, ); - gst::log!(CAT, obj: self.element, "Task prepared"); + gst::log!(CAT, obj = self.element, "Task prepared"); Ok(()) } .boxed() @@ -334,25 +339,25 @@ impl TaskImpl for TcpClientSrcTask { futures::select! { event_res = event_fut => match event_res { Some(event) => { - gst::debug!(CAT, obj: self.element, "Handling element level event {event:?}"); + gst::debug!(CAT, obj = self.element, "Handling element level event {event:?}"); match event.view() { gst::EventView::Eos(_) => Err(gst::FlowError::Eos), ev => { - gst::error!(CAT, obj: self.element, "Unexpected event {ev:?} on channel"); + gst::error!(CAT, obj = self.element, "Unexpected event {ev:?} on channel"); Err(gst::FlowError::Error) } } } None => { - gst::error!(CAT, obj: self.element, "Unexpected return on event channel"); + gst::error!(CAT, obj = self.element, "Unexpected return on event channel"); Err(gst::FlowError::Error) } }, socket_res = socket_fut => match socket_res { Ok((buffer, _saddr)) => Ok(buffer), Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {err:#}"); + gst::error!(CAT, obj = self.element, "Got error {err:#}"); match err { SocketError::Gst(err) => { @@ -387,9 +392,9 @@ impl TaskImpl for TcpClientSrcTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task"); + gst::log!(CAT, obj = self.element, "Stopping task"); self.need_initial_events = true; - gst::log!(CAT, obj: self.element, "Task stopped"); + gst::log!(CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -397,9 +402,9 @@ impl TaskImpl for TcpClientSrcTask { fn flush_stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task flush"); + gst::log!(CAT, obj = self.element, "Stopping task flush"); self.need_initial_events = true; - gst::log!(CAT, obj: self.element, "Task flush stopped"); + gst::log!(CAT, obj = self.element, "Task flush stopped"); Ok(()) } .boxed() @@ -409,12 +414,12 @@ impl TaskImpl for TcpClientSrcTask { async move { match err { gst::FlowError::Flushing => { - gst::debug!(CAT, obj: self.element, "Flushing"); + gst::debug!(CAT, obj = self.element, "Flushing"); task::Trigger::FlushStart } gst::FlowError::Eos => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); self.element .imp() .src_pad @@ -424,7 +429,7 @@ impl TaskImpl for TcpClientSrcTask { task::Trigger::Stop } err => { - gst::error!(CAT, obj: self.element, "Got error {err}"); + gst::error!(CAT, obj = self.element, "Got error {err}"); gst::element_error!( &self.element, gst::StreamError::Failed, @@ -458,7 +463,7 @@ static CAT: Lazy = Lazy::new(|| { impl TcpClientSrc { fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap().clone(); let context = @@ -520,35 +525,35 @@ impl TcpClientSrc { state.event_sender = Some(sender); drop(state); - gst::debug!(CAT, imp: self, "Preparing asynchronously"); + gst::debug!(CAT, imp = self, "Preparing asynchronously"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().block_on()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().block_on()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Pausing"); + gst::debug!(CAT, imp = self, "Pausing"); self.task.pause().block_on()?; - gst::debug!(CAT, imp: self, "Paused"); + gst::debug!(CAT, imp = self, "Paused"); Ok(()) } @@ -708,7 +713,7 @@ impl ElementImpl for TcpClientSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { @@ -750,13 +755,13 @@ impl ElementImpl for TcpClientSrc { fn send_event(&self, event: gst::Event) -> bool { use gst::EventView; - gst::debug!(CAT, imp: self, "Handling element level event {event:?}"); + gst::debug!(CAT, imp = self, "Handling element level event {event:?}"); match event.view() { EventView::Eos(_) => { if self.state() != TaskState::Started { if let Err(err) = self.start() { - gst::error!(CAT, imp: self, "Failed to start task thread {err:?}"); + gst::error!(CAT, imp = self, "Failed to start task thread {err:?}"); } } diff --git a/generic/threadshare/src/udpsink/imp.rs b/generic/threadshare/src/udpsink/imp.rs index 6c0ab11a..6cf802ef 100644 --- a/generic/threadshare/src/udpsink/imp.rs +++ b/generic/threadshare/src/udpsink/imp.rs @@ -200,17 +200,17 @@ impl UdpSinkPadHandler { futures::executor::block_on(async move { let mut inner = self.0.lock().await; if inner.clients.contains(&addr) { - gst::warning!(CAT, imp: imp, "Not adding client {addr:?} again"); + gst::warning!(CAT, imp = imp, "Not adding client {addr:?} again"); return; } match inner.configure_client(&addr) { Ok(()) => { - gst::info!(CAT, imp: imp, "Added client {addr:?}"); + gst::info!(CAT, imp = imp, "Added client {addr:?}"); inner.clients.insert(addr); } Err(err) => { - gst::error!(CAT, imp: imp, "Failed to add client {addr:?}: {err}"); + gst::error!(CAT, imp = imp, "Failed to add client {addr:?}: {err}"); imp.obj().post_error_message(err); } } @@ -221,16 +221,16 @@ impl UdpSinkPadHandler { futures::executor::block_on(async move { let mut inner = self.0.lock().await; if inner.clients.take(&addr).is_none() { - gst::warning!(CAT, imp: imp, "Not removing unknown client {addr:?}"); + gst::warning!(CAT, imp = imp, "Not removing unknown client {addr:?}"); return; } match inner.unconfigure_client(&addr) { Ok(()) => { - gst::info!(CAT, imp: imp, "Removed client {addr:?}"); + gst::info!(CAT, imp = imp, "Removed client {addr:?}"); } Err(err) => { - gst::error!(CAT, imp: imp, "Failed to remove client {addr:?}: {err}"); + gst::error!(CAT, imp = imp, "Failed to remove client {addr:?}: {err}"); imp.obj().post_error_message(err); } } @@ -241,9 +241,9 @@ impl UdpSinkPadHandler { futures::executor::block_on(async move { let mut inner = self.0.lock().await; if new_clients.is_empty() { - gst::info!(CAT, imp: imp, "Clearing clients"); + gst::info!(CAT, imp = imp, "Clearing clients"); } else { - gst::info!(CAT, imp: imp, "Replacing clients"); + gst::info!(CAT, imp = imp, "Replacing clients"); } let old_clients = std::mem::take(&mut inner.clients); @@ -255,19 +255,19 @@ impl UdpSinkPadHandler { // client is already configured inner.clients.insert(*addr); } else if let Err(err) = inner.unconfigure_client(addr) { - gst::error!(CAT, imp: imp, "Failed to remove client {addr:?}: {err}"); + gst::error!(CAT, imp = imp, "Failed to remove client {addr:?}: {err}"); res = Err(err); } else { - gst::info!(CAT, imp: imp, "Removed client {addr:?}"); + gst::info!(CAT, imp = imp, "Removed client {addr:?}"); } } for addr in new_clients.into_iter() { if let Err(err) = inner.configure_client(&addr) { - gst::error!(CAT, imp: imp, "Failed to add client {addr:?}: {err}"); + gst::error!(CAT, imp = imp, "Failed to add client {addr:?}: {err}"); res = Err(err); } else { - gst::info!(CAT, imp: imp, "Added client {addr:?}"); + gst::info!(CAT, imp = imp, "Added client {addr:?}"); inner.clients.insert(addr); } } @@ -319,7 +319,7 @@ impl PadSinkHandler for UdpSinkPadHandler { event: gst::Event, ) -> BoxFuture<'static, bool> { async move { - gst::debug!(CAT, obj: elem, "Handling {event:?}"); + gst::debug!(CAT, obj = elem, "Handling {event:?}"); match event.view() { EventView::Eos(_) => { @@ -343,7 +343,7 @@ impl PadSinkHandler for UdpSinkPadHandler { } fn sink_event(self, _pad: &gst::Pad, imp: &UdpSink, event: gst::Event) -> bool { - gst::debug!(CAT, imp: imp, "Handling {event:?}"); + gst::debug!(CAT, imp = imp, "Handling {event:?}"); if let EventView::FlushStart(..) = event.view() { block_on_or_add_sub_task(async move { @@ -554,7 +554,7 @@ impl UdpSinkPadHandlerInner { }; if let Some(socket) = socket.as_mut() { - gst::log!(CAT, obj: elem, "Sending to {client:?}"); + gst::log!(CAT, obj = elem, "Sending to {client:?}"); socket.send_to(&data, *client).await.map_err(|err| { gst::element_error!( elem, @@ -575,7 +575,7 @@ impl UdpSinkPadHandlerInner { } } - gst::log!(CAT, obj: elem, "Sent buffer {buffer:?} to all clients"); + gst::log!(CAT, obj = elem, "Sent buffer {buffer:?} to all clients"); Ok(gst::FlowSuccess::Ok) } @@ -585,7 +585,7 @@ impl UdpSinkPadHandlerInner { let now = elem.current_running_time(); if let Ok(Some(delay)) = running_time.opt_checked_sub(now) { - gst::trace!(CAT, obj: elem, "sync: waiting {delay}"); + gst::trace!(CAT, obj = elem, "sync: waiting {delay}"); runtime::timer::delay_for(delay.into()).await; } } @@ -596,7 +596,7 @@ impl UdpSinkPadHandlerInner { buffer: gst::Buffer, ) -> Result { if self.is_flushing { - gst::info!(CAT, obj: elem, "Discarding {buffer:?} (flushing)"); + gst::info!(CAT, obj = elem, "Discarding {buffer:?} (flushing)"); return Err(gst::FlowError::Flushing); } @@ -612,14 +612,14 @@ impl UdpSinkPadHandlerInner { self.sync(elem, rtime).await; if self.is_flushing { - gst::info!(CAT, obj: elem, "Discarding {buffer:?} (flushing)"); + gst::info!(CAT, obj = elem, "Discarding {buffer:?} (flushing)"); return Err(gst::FlowError::Flushing); } } } - gst::debug!(CAT, obj: elem, "Handling {buffer:?}"); + gst::debug!(CAT, obj = elem, "Handling {buffer:?}"); self.render(elem, buffer).await.map_err(|err| { element_error!( @@ -698,7 +698,7 @@ impl UdpSink { }; let saddr = SocketAddr::new(bind_addr, bind_port as u16); - gst::debug!(CAT, imp: self, "Binding to {:?}", saddr); + gst::debug!(CAT, imp = self, "Binding to {:?}", saddr); let socket = match family { SocketFamily::Ipv4 => socket2::Socket::new( @@ -718,7 +718,7 @@ impl UdpSink { Err(err) => { gst::warning!( CAT, - imp: self, + imp = self, "Failed to create {} socket: {}", match family { SocketFamily::Ipv4 => "IPv4", @@ -771,7 +771,7 @@ impl UdpSink { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let mut settings = self.settings.lock().unwrap(); @@ -789,36 +789,36 @@ impl UdpSink { .prepare(self, socket, socket_v6, &settings)?; *self.ts_ctx.lock().unwrap() = Some(ts_ctx); - gst::debug!(CAT, imp: self, "Started preparation"); + gst::debug!(CAT, imp = self, "Started preparation"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.sink_pad_handler.unprepare(); *self.ts_ctx.lock().unwrap() = None; - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.sink_pad_handler.stop(); - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.sink_pad_handler.start(); - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn try_into_socket_addr(&self, host: &str, port: i32) -> Result { let addr: IpAddr = match host.parse() { Err(err) => { - gst::error!(CAT, imp: self, "Failed to parse host {}: {}", host, err); + gst::error!(CAT, imp = self, "Failed to parse host {}: {}", host, err); return Err(()); } Ok(addr) => addr, @@ -826,7 +826,7 @@ impl UdpSink { let port: u16 = match port.try_into() { Err(err) => { - gst::error!(CAT, imp: self, "Invalid port {}: {}", port, err); + gst::error!(CAT, imp = self, "Invalid port {}: {}", port, err); return Err(()); } Ok(port) => port, @@ -1088,19 +1088,19 @@ impl ObjectImpl for UdpSink { Err(()) => { gst::error!( CAT, - imp: self, + imp = self, "Invalid socket address {addr}:{port}" ); None } }, Err(err) => { - gst::error!(CAT, imp: self, "Invalid port {err}"); + gst::error!(CAT, imp = self, "Invalid port {err}"); None } } } else { - gst::error!(CAT, imp: self, "Invalid client {client}"); + gst::error!(CAT, imp = self, "Invalid client {client}"); None } }); @@ -1215,7 +1215,7 @@ impl ElementImpl for UdpSink { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { diff --git a/generic/threadshare/src/udpsrc/imp.rs b/generic/threadshare/src/udpsrc/imp.rs index 67af0f41..749361e8 100644 --- a/generic/threadshare/src/udpsrc/imp.rs +++ b/generic/threadshare/src/udpsrc/imp.rs @@ -119,7 +119,7 @@ impl PadSrcHandler for UdpSrcPadHandler { type ElementImpl = UdpSrc; fn src_event(self, pad: &gst::Pad, imp: &UdpSrc, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", event); + gst::log!(CAT, obj = pad, "Handling {:?}", event); use gst::EventView; let ret = match event.view() { @@ -131,16 +131,16 @@ impl PadSrcHandler for UdpSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", event); + gst::log!(CAT, obj = pad, "Handled {:?}", event); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", event); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", event); } ret } fn src_query(self, pad: &gst::Pad, imp: &UdpSrc, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling {:?}", query); + gst::log!(CAT, obj = pad, "Handling {:?}", query); use gst::QueryViewMut; let ret = match query.view_mut() { @@ -172,9 +172,9 @@ impl PadSrcHandler for UdpSrcPadHandler { }; if ret { - gst::log!(CAT, obj: pad, "Handled {:?}", query); + gst::log!(CAT, obj = pad, "Handled {:?}", query); } else { - gst::log!(CAT, obj: pad, "Didn't handle {:?}", query); + gst::log!(CAT, obj = pad, "Didn't handle {:?}", query); } ret @@ -211,7 +211,7 @@ impl TaskImpl for UdpSrcTask { let udpsrc = self.element.imp(); let mut settings = udpsrc.settings.lock().unwrap(); - gst::debug!(CAT, obj: self.element, "Preparing Task"); + gst::debug!(CAT, obj = self.element, "Preparing Task"); self.retrieve_sender_address = settings.retrieve_sender_address; @@ -268,7 +268,7 @@ impl TaskImpl for UdpSrcTask { let saddr = SocketAddr::new(bind_addr, port as u16); gst::debug!( CAT, - obj: self.element, + obj = self.element, "Binding to {:?} for multicast group {:?}", saddr, addr @@ -277,7 +277,7 @@ impl TaskImpl for UdpSrcTask { saddr } else { let saddr = SocketAddr::new(addr, port as u16); - gst::debug!(CAT, obj: self.element, "Binding to {:?}", saddr); + gst::debug!(CAT, obj = self.element, "Binding to {:?}", saddr); saddr }; @@ -407,7 +407,7 @@ impl TaskImpl for UdpSrcTask { fn unprepare(&mut self) -> BoxFuture<'_, ()> { async move { - gst::debug!(CAT, obj: self.element, "Unpreparing Task"); + gst::debug!(CAT, obj = self.element, "Unpreparing Task"); let udpsrc = self.element.imp(); udpsrc.settings.lock().unwrap().used_socket = None; self.element.notify("used-socket"); @@ -417,12 +417,12 @@ impl TaskImpl for UdpSrcTask { fn start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Starting task"); + gst::log!(CAT, obj = self.element, "Starting task"); self.socket .as_mut() .unwrap() .set_clock(self.element.clock(), self.element.base_time()); - gst::log!(CAT, obj: self.element, "Task started"); + gst::log!(CAT, obj = self.element, "Task started"); Ok(()) } .boxed() @@ -439,18 +439,18 @@ impl TaskImpl for UdpSrcTask { futures::select! { event_res = event_fut => match event_res { Some(event) => { - gst::debug!(CAT, obj: self.element, "Handling element level event {event:?}"); + gst::debug!(CAT, obj = self.element, "Handling element level event {event:?}"); match event.view() { gst::EventView::Eos(_) => Err(gst::FlowError::Eos), ev => { - gst::error!(CAT, obj: self.element, "Unexpected event {ev:?} on channel"); + gst::error!(CAT, obj = self.element, "Unexpected event {ev:?} on channel"); Err(gst::FlowError::Error) } } } None => { - gst::error!(CAT, obj: self.element, "Unexpected return on event channel"); + gst::error!(CAT, obj = self.element, "Unexpected return on event channel"); Err(gst::FlowError::Error) } }, @@ -468,7 +468,7 @@ impl TaskImpl for UdpSrcTask { Ok(buffer) }, Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {err:#}"); + gst::error!(CAT, obj = self.element, "Got error {err:#}"); match err { SocketError::Gst(err) => { @@ -499,11 +499,11 @@ impl TaskImpl for UdpSrcTask { fn handle_item(&mut self, buffer: gst::Buffer) -> BoxFuture<'_, Result<(), gst::FlowError>> { async { - gst::log!(CAT, obj: self.element, "Handling {:?}", buffer); + gst::log!(CAT, obj = self.element, "Handling {:?}", buffer); let udpsrc = self.element.imp(); if self.need_initial_events { - gst::debug!(CAT, obj: self.element, "Pushing initial events"); + gst::debug!(CAT, obj = self.element, "Pushing initial events"); let stream_id = format!("{:08x}{:08x}", rand::random::(), rand::random::()); @@ -534,14 +534,14 @@ impl TaskImpl for UdpSrcTask { let res = udpsrc.src_pad.push(buffer).await.map(drop); match res { - Ok(_) => gst::log!(CAT, obj: self.element, "Successfully pushed buffer"), - Err(gst::FlowError::Flushing) => gst::debug!(CAT, obj: self.element, "Flushing"), + Ok(_) => gst::log!(CAT, obj = self.element, "Successfully pushed buffer"), + Err(gst::FlowError::Flushing) => gst::debug!(CAT, obj = self.element, "Flushing"), Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); udpsrc.src_pad.push_event(gst::event::Eos::new()).await; } Err(err) => { - gst::error!(CAT, obj: self.element, "Got error {}", err); + gst::error!(CAT, obj = self.element, "Got error {}", err); gst::element_error!( self.element, gst::StreamError::Failed, @@ -558,10 +558,10 @@ impl TaskImpl for UdpSrcTask { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task"); + gst::log!(CAT, obj = self.element, "Stopping task"); self.need_initial_events = true; self.need_segment = true; - gst::log!(CAT, obj: self.element, "Task stopped"); + gst::log!(CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -569,9 +569,9 @@ impl TaskImpl for UdpSrcTask { fn flush_stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(CAT, obj: self.element, "Stopping task flush"); + gst::log!(CAT, obj = self.element, "Stopping task flush"); self.need_segment = true; - gst::log!(CAT, obj: self.element, "Stopped task flush"); + gst::log!(CAT, obj = self.element, "Stopped task flush"); Ok(()) } .boxed() @@ -581,12 +581,12 @@ impl TaskImpl for UdpSrcTask { async move { match err { gst::FlowError::Flushing => { - gst::debug!(CAT, obj: self.element, "Flushing"); + gst::debug!(CAT, obj = self.element, "Flushing"); task::Trigger::FlushStart } gst::FlowError::Eos => { - gst::debug!(CAT, obj: self.element, "EOS"); + gst::debug!(CAT, obj = self.element, "EOS"); self.element .imp() .src_pad @@ -596,7 +596,7 @@ impl TaskImpl for UdpSrcTask { task::Trigger::Stop } err => { - gst::error!(CAT, obj: self.element, "Got error {err}"); + gst::error!(CAT, obj = self.element, "Got error {err}"); gst::element_error!( &self.element, gst::StreamError::Failed, @@ -630,7 +630,7 @@ static CAT: Lazy = Lazy::new(|| { impl UdpSrc { fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap(); let context = @@ -653,35 +653,35 @@ impl UdpSrc { state.event_sender = Some(sender); drop(state); - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(CAT, imp: self, "Unpreparing"); + gst::debug!(CAT, imp = self, "Unpreparing"); self.task.unprepare().block_on().unwrap(); - gst::debug!(CAT, imp: self, "Unprepared"); + gst::debug!(CAT, imp = self, "Unprepared"); } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); self.task.stop().block_on()?; - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); self.task.start().block_on()?; - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn pause(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Pausing"); + gst::debug!(CAT, imp = self, "Pausing"); self.task.pause().block_on()?; - gst::debug!(CAT, imp: self, "Paused"); + gst::debug!(CAT, imp = self, "Paused"); Ok(()) } @@ -898,7 +898,7 @@ impl ElementImpl for UdpSrc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { @@ -940,13 +940,13 @@ impl ElementImpl for UdpSrc { fn send_event(&self, event: gst::Event) -> bool { use gst::EventView; - gst::debug!(CAT, imp: self, "Handling element level event {event:?}"); + gst::debug!(CAT, imp = self, "Handling element level event {event:?}"); match event.view() { EventView::Eos(_) => { if self.state() != TaskState::Started { if let Err(err) = self.start() { - gst::error!(CAT, imp: self, "Failed to start task thread {err:?}"); + gst::error!(CAT, imp = self, "Failed to start task thread {err:?}"); } } diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index 406b1503..f7bece0b 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -88,7 +88,7 @@ mod imp_src { type ElementImpl = ElementSrcTest; fn src_event(self, pad: &gst::Pad, imp: &ElementSrcTest, event: gst::Event) -> bool { - gst::log!(SRC_CAT, obj: pad, "Handling {:?}", event); + gst::log!(SRC_CAT, obj = pad, "Handling {:?}", event); let ret = match event.view() { EventView::FlushStart(..) => { @@ -100,9 +100,9 @@ mod imp_src { }; if ret { - gst::log!(SRC_CAT, obj: pad, "Handled {:?}", event); + gst::log!(SRC_CAT, obj = pad, "Handled {:?}", event); } else { - gst::log!(SRC_CAT, obj: pad, "Didn't handle {:?}", event); + gst::log!(SRC_CAT, obj = pad, "Didn't handle {:?}", event); } ret @@ -127,7 +127,7 @@ mod imp_src { while let Ok(Some(_item)) = self.receiver.try_next() {} } async fn push_item(&self, item: Item) -> Result { - gst::debug!(SRC_CAT, obj: self.element, "Handling {:?}", item); + gst::debug!(SRC_CAT, obj = self.element, "Handling {:?}", item); let elementsrctest = self.element.imp(); match item { @@ -148,7 +148,7 @@ mod imp_src { fn try_next(&mut self) -> BoxFuture<'_, Result> { async move { self.receiver.next().await.ok_or_else(|| { - gst::log!(SRC_CAT, obj: self.element, "SrcPad channel aborted"); + gst::log!(SRC_CAT, obj = self.element, "SrcPad channel aborted"); gst::FlowError::Eos }) } @@ -159,9 +159,9 @@ mod imp_src { async move { let res = self.push_item(item).await.map(drop); match res { - Ok(_) => gst::log!(SRC_CAT, obj: self.element, "Successfully pushed item"), + Ok(_) => gst::log!(SRC_CAT, obj = self.element, "Successfully pushed item"), Err(gst::FlowError::Flushing) => { - gst::debug!(SRC_CAT, obj: self.element, "Flushing") + gst::debug!(SRC_CAT, obj = self.element, "Flushing") } Err(err) => panic!("Got error {err}"), } @@ -173,9 +173,9 @@ mod imp_src { fn stop(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(SRC_CAT, obj: self.element, "Stopping task"); + gst::log!(SRC_CAT, obj = self.element, "Stopping task"); self.flush(); - gst::log!(SRC_CAT, obj: self.element, "Task stopped"); + gst::log!(SRC_CAT, obj = self.element, "Task stopped"); Ok(()) } .boxed() @@ -183,9 +183,9 @@ mod imp_src { fn flush_start(&mut self) -> BoxFuture<'_, Result<(), gst::ErrorMessage>> { async move { - gst::log!(SRC_CAT, obj: self.element, "Starting task flush"); + gst::log!(SRC_CAT, obj = self.element, "Starting task flush"); self.flush(); - gst::log!(SRC_CAT, obj: self.element, "Task flush started"); + gst::log!(SRC_CAT, obj = self.element, "Task flush started"); Ok(()) } .boxed() @@ -219,7 +219,7 @@ mod imp_src { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(SRC_CAT, imp: self, "Preparing"); + gst::debug!(SRC_CAT, imp = self, "Preparing"); let settings = self.settings.lock().unwrap().clone(); let context = @@ -240,36 +240,36 @@ mod imp_src { ) .block_on()?; - gst::debug!(SRC_CAT, imp: self, "Prepared"); + gst::debug!(SRC_CAT, imp = self, "Prepared"); Ok(()) } fn unprepare(&self) { - gst::debug!(SRC_CAT, imp: self, "Unpreparing"); + gst::debug!(SRC_CAT, imp = self, "Unpreparing"); *self.sender.lock().unwrap() = None; self.task.unprepare().block_on().unwrap(); - gst::debug!(SRC_CAT, imp: self, "Unprepared"); + gst::debug!(SRC_CAT, imp = self, "Unprepared"); } fn stop(&self) { - gst::debug!(SRC_CAT, imp: self, "Stopping"); + gst::debug!(SRC_CAT, imp = self, "Stopping"); self.task.stop().await_maybe_on_context().unwrap(); - gst::debug!(SRC_CAT, imp: self, "Stopped"); + gst::debug!(SRC_CAT, imp = self, "Stopped"); } fn start(&self) { - gst::debug!(SRC_CAT, imp: self, "Starting"); + gst::debug!(SRC_CAT, imp = self, "Starting"); self.task.start().await_maybe_on_context().unwrap(); - gst::debug!(SRC_CAT, imp: self, "Started"); + gst::debug!(SRC_CAT, imp = self, "Started"); } fn pause(&self) { - gst::debug!(SRC_CAT, imp: self, "Pausing"); + gst::debug!(SRC_CAT, imp = self, "Pausing"); self.task.pause().block_on().unwrap(); - gst::debug!(SRC_CAT, imp: self, "Paused"); + gst::debug!(SRC_CAT, imp = self, "Paused"); } } @@ -366,7 +366,7 @@ mod imp_src { &self, transition: gst::StateChange, ) -> Result { - gst::log!(SRC_CAT, imp: self, "Changing state {:?}", transition); + gst::log!(SRC_CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { @@ -464,7 +464,7 @@ mod imp_sink { } fn sink_event(self, pad: &gst::Pad, imp: &ElementSinkTest, event: gst::Event) -> bool { - gst::debug!(SINK_CAT, obj: pad, "Handling non-serialized {:?}", event); + gst::debug!(SINK_CAT, obj = pad, "Handling non-serialized {:?}", event); match event.view() { EventView::FlushStart(..) => { @@ -482,7 +482,7 @@ mod imp_sink { event: gst::Event, ) -> BoxFuture<'static, bool> { async move { - gst::log!(SINK_CAT, obj: pad, "Handling serialized {:?}", event); + gst::log!(SINK_CAT, obj = pad, "Handling serialized {:?}", event); let imp = elem.imp(); if let EventView::FlushStop(..) = event.view() { @@ -505,7 +505,7 @@ mod imp_sink { impl ElementSinkTest { async fn forward_item(&self, item: Item) -> Result { if !self.flushing.load(Ordering::SeqCst) { - gst::debug!(SINK_CAT, imp: self, "Forwarding {:?}", item); + gst::debug!(SINK_CAT, imp = self, "Forwarding {:?}", item); let mut sender = self .sender .lock() @@ -521,7 +521,7 @@ mod imp_sink { } else { gst::debug!( SINK_CAT, - imp: self, + imp = self, "Not forwarding {:?} due to flushing", item ); @@ -530,31 +530,31 @@ mod imp_sink { } fn start(&self) { - gst::debug!(SINK_CAT, imp: self, "Starting"); + gst::debug!(SINK_CAT, imp = self, "Starting"); self.flushing.store(false, Ordering::SeqCst); - gst::debug!(SINK_CAT, imp: self, "Started"); + gst::debug!(SINK_CAT, imp = self, "Started"); } fn stop(&self) { - gst::debug!(SINK_CAT, imp: self, "Stopping"); + gst::debug!(SINK_CAT, imp = self, "Stopping"); self.flushing.store(true, Ordering::SeqCst); - gst::debug!(SINK_CAT, imp: self, "Stopped"); + gst::debug!(SINK_CAT, imp = self, "Stopped"); } pub fn push_flush_start(&self) { - gst::debug!(SINK_CAT, imp: self, "Pushing FlushStart"); + gst::debug!(SINK_CAT, imp = self, "Pushing FlushStart"); self.sink_pad .gst_pad() .push_event(gst::event::FlushStart::new()); - gst::debug!(SINK_CAT, imp: self, "FlushStart pushed"); + gst::debug!(SINK_CAT, imp = self, "FlushStart pushed"); } pub fn push_flush_stop(&self) { - gst::debug!(SINK_CAT, imp: self, "Pushing FlushStop"); + gst::debug!(SINK_CAT, imp = self, "Pushing FlushStop"); self.sink_pad .gst_pad() .push_event(gst::event::FlushStop::new(true)); - gst::debug!(SINK_CAT, imp: self, "FlushStop pushed"); + gst::debug!(SINK_CAT, imp = self, "FlushStop pushed"); } } @@ -657,7 +657,7 @@ mod imp_sink { &self, transition: gst::StateChange, ) -> Result { - gst::log!(SINK_CAT, imp: self, "Changing state {:?}", transition); + gst::log!(SINK_CAT, imp = self, "Changing state {:?}", transition); if let gst::StateChange::PausedToReady = transition { self.stop(); diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs index eb49c31b..2735df8f 100644 --- a/generic/threadshare/tests/pipeline.rs +++ b/generic/threadshare/tests/pipeline.rs @@ -364,7 +364,7 @@ fn eos() { sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { - gst::debug!(CAT, obj: appsink, "eos: pulling sample"); + gst::debug!(CAT, obj = appsink, "eos: pulling sample"); let _ = appsink.pull_sample().unwrap(); sample_notifier.send(()).unwrap(); @@ -376,7 +376,7 @@ fn eos() { ); fn push_buffer(src: &gst::Element) -> bool { - gst::debug!(CAT, obj: src, "eos: pushing buffer"); + gst::debug!(CAT, obj = src, "eos: pushing buffer"); src.emit_by_name::("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])]) } @@ -498,7 +498,7 @@ fn premature_shutdown() { sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { - gst::debug!(CAT, obj: appsink, "premature_shutdown: pulling sample"); + gst::debug!(CAT, obj = appsink, "premature_shutdown: pulling sample"); let _sample = appsink.pull_sample().unwrap(); appsink_sender.send(()).unwrap(); @@ -511,7 +511,7 @@ fn premature_shutdown() { fn push_buffer(src: &gst::Element, intent: &str) -> bool { gst::debug!( CAT, - obj: src, + obj = src, "premature_shutdown: pushing buffer {}", intent ); diff --git a/mux/flavors/src/flvdemux/imp.rs b/mux/flavors/src/flvdemux/imp.rs index 528d3dae..7d0d411a 100644 --- a/mux/flavors/src/flvdemux/imp.rs +++ b/mux/flavors/src/flvdemux/imp.rs @@ -311,10 +311,10 @@ impl FlvDemux { // gst::SchedulingFlags::SEEKABLE, // ) // { - // gst::debug!(CAT, obj: pad, "Activating in Pull mode"); + // gst::debug!(CAT, obj = pad, "Activating in Pull mode"); // gst::PadMode::Pull // } else { - gst::debug!(CAT, obj: pad, "Activating in Push mode"); + gst::debug!(CAT, obj = pad, "Activating in Push mode"); gst::PadMode::Push // } }; @@ -366,7 +366,7 @@ impl FlvDemux { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Eos(..) => { // TODO implement @@ -453,7 +453,7 @@ impl FlvDemux { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut adapter = self.adapter.lock().unwrap(); adapter.push(buffer); @@ -466,7 +466,7 @@ impl FlvDemux { let header = match self.find_header(&mut adapter) { Ok(header) => header, Err(_) => { - gst::trace!(CAT, imp: self, "Need more data"); + gst::trace!(CAT, imp = self, "Need more data"); return Ok(gst::FlowSuccess::Ok); } }; @@ -495,7 +495,7 @@ impl FlvDemux { } => { let avail = adapter.available(); if avail == 0 { - gst::trace!(CAT, imp: self, "Need more data"); + gst::trace!(CAT, imp = self, "Need more data"); return Ok(gst::FlowSuccess::Ok); } let skip = cmp::min(avail, *skip_left as usize); @@ -507,7 +507,7 @@ impl FlvDemux { match res { Ok(None) => { - gst::trace!(CAT, imp: self, "Need more data"); + gst::trace!(CAT, imp = self, "Need more data"); return Ok(gst::FlowSuccess::Ok); } Ok(Some(events)) => { @@ -534,7 +534,7 @@ impl FlvDemux { let data = adapter.map(9).unwrap(); if let Ok((_, header)) = flavors::header(&data) { - gst::debug!(CAT, imp: self, "Found FLV header: {:?}", header); + gst::debug!(CAT, imp = self, "Found FLV header: {:?}", header); drop(data); adapter.flush(9); @@ -597,7 +597,7 @@ impl FlvDemux { let res = pad.push(buffer); gst::trace!( CAT, - imp: self, + imp = self, "Pushing buffer for stream {:?} returned {:?}", stream, res @@ -687,7 +687,7 @@ impl StreamingState { match be_u32::<_, (_, nom::error::ErrorKind)>(&data[0..4]) { Err(_) => unreachable!(), Ok((_, previous_size)) => { - gst::trace!(CAT, imp: imp, "Previous tag size {}", previous_size); + gst::trace!(CAT, imp = imp, "Previous tag size {}", previous_size); // Nothing to do here, we just consume it for now } } @@ -703,7 +703,7 @@ impl StreamingState { Ok((_, tag_header)) => tag_header, }; - gst::trace!(CAT, imp: imp, "Parsed tag header {:?}", tag_header); + gst::trace!(CAT, imp = imp, "Parsed tag header {:?}", tag_header); drop(data); @@ -715,17 +715,17 @@ impl StreamingState { match tag_header.tag_type { flavors::TagType::Script => { - gst::trace!(CAT, imp: imp, "Found script tag"); + gst::trace!(CAT, imp = imp, "Found script tag"); Ok(self.handle_script_tag(imp, &tag_header, adapter)) } flavors::TagType::Audio => { - gst::trace!(CAT, imp: imp, "Found audio tag"); + gst::trace!(CAT, imp = imp, "Found audio tag"); self.handle_audio_tag(imp, &tag_header, adapter) } flavors::TagType::Video => { - gst::trace!(CAT, imp: imp, "Found video tag"); + gst::trace!(CAT, imp = imp, "Found video tag"); self.handle_video_tag(imp, &tag_header, adapter) } @@ -747,10 +747,10 @@ impl StreamingState { match flavors::script_data(&data) { Ok((_, ref script_data)) if script_data.name == "onMetaData" => { - gst::trace!(CAT, imp: imp, "Got script tag: {:?}", script_data); + gst::trace!(CAT, imp = imp, "Got script tag: {:?}", script_data); let metadata = Metadata::new(script_data); - gst::debug!(CAT, imp: imp, "Got metadata: {:?}", metadata); + gst::debug!(CAT, imp = imp, "Got metadata: {:?}", metadata); let audio_changed = self .audio @@ -778,10 +778,10 @@ impl StreamingState { } } Ok((_, ref script_data)) => { - gst::trace!(CAT, imp: imp, "Got script tag: {:?}", script_data); + gst::trace!(CAT, imp = imp, "Got script tag: {:?}", script_data); } Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => { - gst::error!(CAT, imp: imp, "Error parsing script tag: {:?}", err); + gst::error!(CAT, imp = imp, "Error parsing script tag: {:?}", err); } Err(nom::Err::Incomplete(_)) => { // ignore @@ -801,7 +801,7 @@ impl StreamingState { ) -> SmallVec<[Event; 4]> { let mut events = SmallVec::new(); - gst::trace!(CAT, imp: imp, "Got audio data header: {:?}", data_header); + gst::trace!(CAT, imp = imp, "Got audio data header: {:?}", data_header); let new_audio_format = AudioFormat::new(data_header, &self.metadata, &self.aac_sequence_header); @@ -809,7 +809,7 @@ impl StreamingState { if self.audio.as_ref() != Some(&new_audio_format) { gst::debug!( CAT, - imp: imp, + imp = imp, "Got new audio format: {:?}", new_audio_format ); @@ -827,7 +827,7 @@ impl StreamingState { && self.audio.is_some() && !self.got_all_streams { - gst::debug!(CAT, imp: imp, "Have all expected streams now"); + gst::debug!(CAT, imp = imp, "Have all expected streams now"); self.got_all_streams = true; events.push(Event::HaveAllStreams); } @@ -846,7 +846,7 @@ impl StreamingState { adapter.flush((tag_header.data_size - 1) as usize); gst::warning!( CAT, - imp: imp, + imp = imp, "Too small packet for AAC packet header {}", tag_header.data_size ); @@ -857,14 +857,14 @@ impl StreamingState { match flavors::aac_audio_packet_header(&data) { Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => { - gst::error!(CAT, imp: imp, "Invalid AAC audio packet header: {:?}", err); + gst::error!(CAT, imp = imp, "Invalid AAC audio packet header: {:?}", err); drop(data); adapter.flush((tag_header.data_size - 1) as usize); Ok(true) } Err(nom::Err::Incomplete(_)) => unreachable!(), Ok((_, header)) => { - gst::trace!(CAT, imp: imp, "Got AAC packet header {:?}", header); + gst::trace!(CAT, imp = imp, "Got AAC packet header {:?}", header); match header.packet_type { flavors::AACPacketType::SequenceHeader => { drop(data); @@ -872,7 +872,7 @@ impl StreamingState { let buffer = adapter .take_buffer((tag_header.data_size - 1 - 1) as usize) .unwrap(); - gst::debug!(CAT, imp: imp, "Got AAC sequence header {:?}", buffer,); + gst::debug!(CAT, imp = imp, "Got AAC sequence header {:?}", buffer,); self.aac_sequence_header = Some(buffer); Ok(true) @@ -898,7 +898,7 @@ impl StreamingState { let data = adapter.map(1).unwrap(); let data_header = match flavors::audio_data_header(&data) { Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => { - gst::error!(CAT, imp: imp, "Invalid audio data header: {:?}", err); + gst::error!(CAT, imp = imp, "Invalid audio data header: {:?}", err); drop(data); adapter.flush(tag_header.data_size as usize); return Ok(SmallVec::new()); @@ -943,7 +943,7 @@ impl StreamingState { gst::trace!( CAT, - imp: imp, + imp = imp, "Outputting audio buffer {:?} for tag {:?}", buffer, tag_header, @@ -963,7 +963,7 @@ impl StreamingState { ) -> SmallVec<[Event; 4]> { let mut events = SmallVec::new(); - gst::trace!(CAT, imp: imp, "Got video data header: {:?}", data_header); + gst::trace!(CAT, imp = imp, "Got video data header: {:?}", data_header); let new_video_format = VideoFormat::new(data_header, &self.metadata, &self.avc_sequence_header); @@ -971,7 +971,7 @@ impl StreamingState { if self.video.as_ref() != Some(&new_video_format) { gst::debug!( CAT, - imp: imp, + imp = imp, "Got new video format: {:?}", new_video_format ); @@ -989,7 +989,7 @@ impl StreamingState { && self.video.is_some() && !self.got_all_streams { - gst::debug!(CAT, imp: imp, "Have all expected streams now"); + gst::debug!(CAT, imp = imp, "Have all expected streams now"); self.got_all_streams = true; events.push(Event::HaveAllStreams); } @@ -1008,7 +1008,7 @@ impl StreamingState { adapter.flush((tag_header.data_size - 1) as usize); gst::warning!( CAT, - imp: imp, + imp = imp, "Too small packet for AVC packet header {}", tag_header.data_size ); @@ -1018,14 +1018,14 @@ impl StreamingState { let data = adapter.map(4).unwrap(); match flavors::avc_video_packet_header(&data) { Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => { - gst::error!(CAT, imp: imp, "Invalid AVC video packet header: {:?}", err); + gst::error!(CAT, imp = imp, "Invalid AVC video packet header: {:?}", err); drop(data); adapter.flush((tag_header.data_size - 1) as usize); Ok(None) } Err(nom::Err::Incomplete(_)) => unreachable!(), Ok((_, header)) => { - gst::trace!(CAT, imp: imp, "Got AVC packet header {:?}", header); + gst::trace!(CAT, imp = imp, "Got AVC packet header {:?}", header); match header.packet_type { flavors::AVCPacketType::SequenceHeader => { drop(data); @@ -1035,7 +1035,7 @@ impl StreamingState { .unwrap(); gst::debug!( CAT, - imp: imp, + imp = imp, "Got AVC sequence header {:?} of size {}", buffer, tag_header.data_size - 1 - 4 @@ -1071,7 +1071,7 @@ impl StreamingState { let data = adapter.map(1).unwrap(); let data_header = match flavors::video_data_header(&data) { Err(nom::Err::Error(err)) | Err(nom::Err::Failure(err)) => { - gst::error!(CAT, imp: imp, "Invalid video data header: {:?}", err); + gst::error!(CAT, imp = imp, "Invalid video data header: {:?}", err); drop(data); adapter.flush(tag_header.data_size as usize); return Ok(SmallVec::new()); @@ -1147,7 +1147,7 @@ impl StreamingState { gst::trace!( CAT, - imp: imp, + imp = imp, "Outputting video buffer {:?} for tag {:?}, keyframe: {}", buffer, tag_header, diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index 8cb80ee1..d1062dcf 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -290,17 +290,17 @@ impl FMP4Mux { } if delta_frames.requires_dts() && buffer.dts().is_none() { - gst::error!(CAT, obj: sinkpad, "Require DTS for video streams"); + gst::error!(CAT, obj = sinkpad, "Require DTS for video streams"); return Err(gst::FlowError::Error); } if buffer.pts().is_none() { - gst::error!(CAT, obj: sinkpad, "Require timestamped buffers"); + gst::error!(CAT, obj = sinkpad, "Require timestamped buffers"); return Err(gst::FlowError::Error); } if delta_frames.intra_only() && buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) { - gst::error!(CAT, obj: sinkpad, "Intra-only stream with delta units"); + gst::error!(CAT, obj = sinkpad, "Intra-only stream with delta units"); return Err(gst::FlowError::Error); } @@ -335,7 +335,7 @@ impl FMP4Mux { let segment = match stream.sinkpad.segment().downcast::().ok() { Some(segment) => segment, None => { - gst::error!(CAT, obj: stream.sinkpad, "Got buffer before segment"); + gst::error!(CAT, obj = stream.sinkpad, "Got buffer before segment"); return Err(gst::FlowError::Error); } }; @@ -347,12 +347,16 @@ impl FMP4Mux { let pts = segment .to_running_time_full(pts_position) .ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Couldn't convert PTS to running time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Couldn't convert PTS to running time" + ); gst::FlowError::Error })? .positive() .unwrap_or_else(|| { - gst::warning!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); + gst::warning!(CAT, obj = stream.sinkpad, "Negative PTSs are not supported"); gst::ClockTime::ZERO }); @@ -361,14 +365,14 @@ impl FMP4Mux { .ok_or_else(|| { gst::error!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Couldn't convert end PTS to running time" ); gst::FlowError::Error })? .positive() .unwrap_or_else(|| { - gst::warning!(CAT, obj: stream.sinkpad, "Negative PTSs are not supported"); + gst::warning!(CAT, obj = stream.sinkpad, "Negative PTSs are not supported"); gst::ClockTime::ZERO }); @@ -381,7 +385,11 @@ impl FMP4Mux { let end_dts_position = duration.opt_add(dts_position).unwrap_or(dts_position); let dts = segment.to_running_time_full(dts_position).ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Couldn't convert DTS to running time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Couldn't convert DTS to running time" + ); gst::FlowError::Error })?; @@ -390,7 +398,7 @@ impl FMP4Mux { .ok_or_else(|| { gst::error!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Couldn't convert end DTS to running time" ); gst::FlowError::Error @@ -436,7 +444,11 @@ impl FMP4Mux { // Calculate from the mapping running_time_to_utc_time(pts, running_time_utc_time_mapping).ok_or_else( || { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative PTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative PTS UTC time" + ); gst::FlowError::Error }, )? @@ -445,31 +457,43 @@ impl FMP4Mux { }; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Mapped PTS running time {pts} to UTC time {utc_time}" ); let end_pts_utc_time = running_time_to_utc_time(end_pts, (pts, utc_time)).ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative end PTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative end PTS UTC time" + ); gst::FlowError::Error })?; let (dts_utc_time, end_dts_utc_time) = if let Some(dts) = dts { let dts_utc_time = running_time_to_utc_time(dts, (pts, utc_time)).ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative DTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative DTS UTC time" + ); gst::FlowError::Error })?; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Mapped DTS running time {dts} to UTC time {dts_utc_time}" ); let end_dts_utc_time = running_time_to_utc_time(end_dts.unwrap(), (pts, utc_time)) .ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative end DTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative end DTS UTC time" + ); gst::FlowError::Error })?; @@ -508,7 +532,7 @@ impl FMP4Mux { if last.saturating_sub(first) > gst::Signed::Positive(limit) { gst::error!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Got no UTC time in the first {limit} of the stream" ); return Err(gst::FlowError::Error); @@ -545,12 +569,16 @@ impl FMP4Mux { for pre_queued_buffer in stream.pre_queue.iter_mut() { let pts_utc_time = running_time_to_utc_time(pre_queued_buffer.pts, mapping) .ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative PTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative PTS UTC time" + ); gst::FlowError::Error })?; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Mapped PTS running time {} to UTC time {pts_utc_time}", pre_queued_buffer.pts, ); @@ -558,31 +586,41 @@ impl FMP4Mux { let end_pts_utc_time = running_time_to_utc_time(pre_queued_buffer.end_pts, mapping) .ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative end PTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative end PTS UTC time" + ); gst::FlowError::Error })?; pre_queued_buffer.end_pts = end_pts_utc_time; if let Some(dts) = pre_queued_buffer.dts { let dts_utc_time = running_time_to_utc_time(dts, mapping).ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative DTS UTC time"); + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative DTS UTC time" + ); gst::FlowError::Error })?; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Mapped DTS running time {dts} to UTC time {dts_utc_time}" ); pre_queued_buffer.dts = Some(gst::Signed::Positive(dts_utc_time)); - let end_dts_utc_time = running_time_to_utc_time( - pre_queued_buffer.end_dts.unwrap(), - mapping, - ) - .ok_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative DTS UTC time"); - gst::FlowError::Error - })?; + let end_dts_utc_time = + running_time_to_utc_time(pre_queued_buffer.end_dts.unwrap(), mapping) + .ok_or_else(|| { + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative DTS UTC time" + ); + gst::FlowError::Error + })?; pre_queued_buffer.end_dts = Some(gst::Signed::Positive(end_dts_utc_time)); } } @@ -620,7 +658,7 @@ impl FMP4Mux { { gst::trace!( CAT, - imp: self, + imp = self, "All streams are currently filled and have to be drained" ); return Ok(None); @@ -634,10 +672,10 @@ impl FMP4Mux { Ok(Some(buffer)) => buffer, Ok(None) | Err(gst_base::AGGREGATOR_FLOW_NEED_DATA) => { if stream.sinkpad.is_eos() { - gst::trace!(CAT, obj: stream.sinkpad, "Stream is EOS"); + gst::trace!(CAT, obj = stream.sinkpad, "Stream is EOS"); } else { all_have_data_or_eos = false; - gst::trace!(CAT, obj: stream.sinkpad, "Stream has no buffer"); + gst::trace!(CAT, obj = stream.sinkpad, "Stream has no buffer"); } continue; } @@ -646,7 +684,7 @@ impl FMP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream has running time PTS {} / DTS {} queued", pre_queued_buffer.pts, pre_queued_buffer.dts.display(), @@ -671,21 +709,21 @@ impl FMP4Mux { if !timeout && !all_have_data_or_eos { gst::trace!( CAT, - imp: self, + imp = self, "No timeout and not all streams have a buffer or are EOS" ); Ok(None) } else if let Some((stream, earliest_running_time)) = earliest_stream { gst::trace!( CAT, - imp: self, + imp = self, "Stream {} is earliest stream with running time {}", stream.sinkpad.name(), earliest_running_time ); Ok(Some(stream)) } else { - gst::trace!(CAT, imp: self, "No streams have data queued currently"); + gst::trace!(CAT, imp = self, "No streams have data queued currently"); Ok(None) } } @@ -696,7 +734,12 @@ impl FMP4Mux { stream: &mut Stream, mut pre_queued_buffer: PreQueuedBuffer, ) -> Result<(), gst::FlowError> { - gst::trace!(CAT, obj: stream.sinkpad, "Handling buffer {:?}", pre_queued_buffer); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Handling buffer {:?}", + pre_queued_buffer + ); let delta_frames = stream.delta_frames; @@ -705,7 +748,7 @@ impl FMP4Mux { if pre_queued_buffer.pts < stream.current_position { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Decreasing PTS {} < {}", pre_queued_buffer.pts, stream.current_position, @@ -734,7 +777,7 @@ impl FMP4Mux { let dts_offset = stream.dts_offset.unwrap(); if dts > dts_offset { - gst::warning!(CAT, obj: stream.sinkpad, "DTS before first DTS"); + gst::warning!(CAT, obj = stream.sinkpad, "DTS before first DTS"); gst::ClockTime::ZERO } else { dts_offset - dts @@ -753,7 +796,7 @@ impl FMP4Mux { gst::Signed::Negative(dts) => { let dts_offset = stream.dts_offset.unwrap(); if dts > dts_offset { - gst::warning!(CAT, obj: stream.sinkpad, "End DTS before first DTS"); + gst::warning!(CAT, obj = stream.sinkpad, "End DTS before first DTS"); gst::ClockTime::ZERO } else { dts_offset - dts @@ -767,7 +810,7 @@ impl FMP4Mux { if dts < stream.current_position { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Decreasing DTS {} < {}", dts, stream.current_position, @@ -796,7 +839,7 @@ impl FMP4Mux { if !buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Starting new GOP at PTS {} DTS {} (DTS offset {})", pts, dts.display(), @@ -810,13 +853,18 @@ impl FMP4Mux { && s.name().as_str() == "video/x-av1" { let buf_map = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Failed to map buffer"); - gst::FlowError::Error - })?; - stream.extra_header_data = read_seq_header_obu_bytes(buf_map.as_slice()).map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Failed to parse AV1 SequenceHeader OBU"); + gst::error!(CAT, obj = stream.sinkpad, "Failed to map buffer"); gst::FlowError::Error })?; + stream.extra_header_data = + read_seq_header_obu_bytes(buf_map.as_slice()).map_err(|_| { + gst::error!( + CAT, + obj = stream.sinkpad, + "Failed to parse AV1 SequenceHeader OBU" + ); + gst::FlowError::Error + })?; } let gop = Gop { @@ -840,7 +888,7 @@ impl FMP4Mux { if let Some(prev_gop) = stream.queued_gops.get_mut(1) { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Updating previous GOP starting at PTS {} to end PTS {} DTS {}", prev_gop.earliest_pts, pts, @@ -860,7 +908,7 @@ impl FMP4Mux { if delta_frames.requires_dts() { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Previous GOP has final earliest PTS at {}", prev_gop.earliest_pts ); @@ -890,7 +938,7 @@ impl FMP4Mux { if gop.earliest_pts > pts && !gop.final_earliest_pts { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Updating current GOP earliest PTS from {} to {}", gop.earliest_pts, pts @@ -902,7 +950,7 @@ impl FMP4Mux { if prev_gop.end_pts < pts { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Updating previous GOP starting PTS {} end time from {} to {}", pts, prev_gop.end_pts, @@ -922,7 +970,7 @@ impl FMP4Mux { if gop.start_pts <= dts && !gop.final_earliest_pts { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP has final earliest PTS at {}", gop.earliest_pts ); @@ -936,7 +984,7 @@ impl FMP4Mux { } else { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Waiting for keyframe at the beginning of the stream" ); } @@ -947,7 +995,7 @@ impl FMP4Mux { ) { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Queued full GOPs duration updated to {}", prev_gop.end_pts.saturating_sub(first_gop.earliest_pts), ); @@ -955,7 +1003,7 @@ impl FMP4Mux { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Queued duration updated to {}", Option::zip(stream.queued_gops.front(), stream.queued_gops.back()) .map(|(end, start)| end.end_pts.saturating_sub(start.start_pts)) @@ -1014,7 +1062,7 @@ impl FMP4Mux { // In chunk mode gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Current chunk start {}, current fragment start {}", chunk_start_pts, fragment_start_pts, @@ -1026,7 +1074,7 @@ impl FMP4Mux { if fragment_end_pts < chunk_end_pts { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Current chunk end {}, current fragment end {}. Fragment end before chunk end, extending fragment", chunk_end_pts, fragment_end_pts, @@ -1034,7 +1082,7 @@ impl FMP4Mux { } else { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Current chunk end {}, current fragment end {}", chunk_end_pts, fragment_end_pts, @@ -1049,7 +1097,7 @@ impl FMP4Mux { if let Some(gop) = stream.queued_gops.back() { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {} start PTS {}, GOP end PTS {}", stream.queued_gops.len() - 1, gop.start_pts, @@ -1067,7 +1115,11 @@ impl FMP4Mux { b.buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) }) { - gst::debug!(CAT, obj: stream.sinkpad, "Stream's first GOP starting after this fragment"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream's first GOP starting after this fragment" + ); stream.fragment_filled = true; return; } @@ -1083,13 +1135,17 @@ impl FMP4Mux { { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {gop_idx} start PTS {}, GOP end PTS {}", gop.start_pts, gop.end_pts, ); if gop.end_pts >= fragment_end_pts { - gst::debug!(CAT, obj: stream.sinkpad, "Stream queued enough data for finishing this fragment"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream queued enough data for finishing this fragment" + ); stream.fragment_filled = true; return; } @@ -1102,14 +1158,18 @@ impl FMP4Mux { if let Some(gop) = stream.queued_gops.back() { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {} start PTS {}, GOP end PTS {}", stream.queued_gops.len() - 1, gop.start_pts, gop.end_pts, ); if gop.start_pts > chunk_end_pts { - gst::debug!(CAT, obj: stream.sinkpad, "Stream's first GOP starting after this chunk"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream's first GOP starting after this chunk" + ); stream.chunk_filled = true; return; } @@ -1124,7 +1184,7 @@ impl FMP4Mux { None => { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Chunked mode and want to finish fragment but no GOP with final end PTS known yet", ); return; @@ -1133,7 +1193,7 @@ impl FMP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {gop_idx} start PTS {}, GOP end PTS {} (final {})", gop.start_pts, gop.end_pts, @@ -1146,7 +1206,11 @@ impl FMP4Mux { && (gop_idx > 0 || last_pts.is_some_and(|last_pts| last_pts.saturating_sub(chunk_start_pts) > chunk_duration)) { - gst::debug!(CAT, obj: stream.sinkpad, "Stream queued enough data for this chunk"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream queued enough data for this chunk" + ); stream.chunk_filled = true; } } @@ -1155,7 +1219,7 @@ impl FMP4Mux { let fragment_end_pts = fragment_start_pts + settings.fragment_duration; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Current fragment start {}, current fragment end {}", fragment_start_pts, fragment_start_pts + settings.fragment_duration, @@ -1166,14 +1230,18 @@ impl FMP4Mux { if let Some(gop) = stream.queued_gops.back() { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {} start PTS {}, GOP end PTS {}", stream.queued_gops.len() - 1, gop.start_pts, gop.end_pts, ); if gop.start_pts > fragment_end_pts { - gst::debug!(CAT, obj: stream.sinkpad, "Stream's first GOP starting after this fragment"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream's first GOP starting after this fragment" + ); stream.fragment_filled = true; return; } @@ -1187,21 +1255,29 @@ impl FMP4Mux { { Some(gop) => gop, None => { - gst::trace!(CAT, obj: stream.sinkpad, "Fragment mode but no GOP with final end PTS known yet"); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Fragment mode but no GOP with final end PTS known yet" + ); return; } }; gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "GOP {gop_idx} start PTS {}, GOP end PTS {}", gop.start_pts, gop.end_pts, ); if gop.end_pts >= fragment_end_pts { - gst::debug!(CAT, obj: stream.sinkpad, "Stream queued enough data for this fragment"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream queued enough data for this fragment" + ); stream.fragment_filled = true; } } @@ -1265,7 +1341,7 @@ impl FMP4Mux { // The earliest PTS is known and as such the start of the first and second fragment. gst::info!( CAT, - imp: self, + imp = self, "Got earliest PTS {}, start DTS {} (timeout: {timeout}, all eos: {all_eos})", earliest_pts, start_dts.display() @@ -1306,7 +1382,7 @@ impl FMP4Mux { if current_position.is_some_and(|current_position| current_position > fku_time) { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Sending first force-keyunit event late for running time {} at {}", fku_time, current_position.display(), @@ -1315,7 +1391,7 @@ impl FMP4Mux { } else { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Sending first force-keyunit event for running time {}", fku_time, ); @@ -1391,7 +1467,7 @@ impl FMP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Draining from {} up to end PTS {} / duration {}", chunk_start_pts, dequeue_end_pts, @@ -1409,9 +1485,10 @@ impl FMP4Mux { if fragment_filled { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Fragment filled, current GOP start {} end {} (final {})", - gop.start_pts, gop.end_pts, + gop.start_pts, + gop.end_pts, gop.final_end_pts || all_eos || stream.sinkpad.is_eos() ); @@ -1425,11 +1502,7 @@ impl FMP4Mux { && (gop.end_pts <= dequeue_end_pts || (gops.is_empty() && chunk_end_pts.is_none())) { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Pushing whole GOP", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Pushing whole GOP",); gops.push(stream.queued_gops.pop_back().unwrap()); continue; } @@ -1444,24 +1517,25 @@ impl FMP4Mux { if gop.start_pts >= dequeue_end_pts || (!gop.final_earliest_pts && !all_eos && !stream.sinkpad.is_eos()) { - gst::trace!( - CAT, - obj: stream.sinkpad, - "GOP starts after fragment end", - ); + gst::trace!(CAT, obj = stream.sinkpad, "GOP starts after fragment end",); break; } else if chunk_end_pts.is_none() { - gst::info!(CAT, obj: stream.sinkpad, "Don't have a full GOP at the end of a fragment for the first stream"); + gst::info!( + CAT, + obj = stream.sinkpad, + "Don't have a full GOP at the end of a fragment for the first stream" + ); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } else { - gst::info!(CAT, obj: stream.sinkpad, "Including incomplete GOP"); + gst::info!(CAT, obj = stream.sinkpad, "Including incomplete GOP"); } } else { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Chunk filled, current GOP start {} end {} (final {})", - gop.start_pts, gop.end_pts, + gop.start_pts, + gop.end_pts, gop.final_end_pts || all_eos || stream.sinkpad.is_eos() ); } @@ -1469,20 +1543,12 @@ impl FMP4Mux { if gop.end_pts <= dequeue_end_pts && (gop.final_end_pts || all_eos || stream.sinkpad.is_eos()) { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Pushing whole GOP", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Pushing whole GOP",); gops.push(stream.queued_gops.pop_back().unwrap()); } else if gop.start_pts >= dequeue_end_pts || (!gop.final_earliest_pts && !all_eos && !stream.sinkpad.is_eos()) { - gst::trace!( - CAT, - obj: stream.sinkpad, - "GOP starts after chunk end", - ); + gst::trace!(CAT, obj = stream.sinkpad, "GOP starts after chunk end",); break; } else { let gop = stream.queued_gops.back_mut().unwrap(); @@ -1507,7 +1573,7 @@ impl FMP4Mux { // in the future. gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "First buffer of GOP too far in the future", ); break; @@ -1518,16 +1584,12 @@ impl FMP4Mux { // after the end. We still take it here and remove the whole GOP. if split_index == gop.buffers.len() - 1 { if gop.final_end_pts || all_eos || stream.sinkpad.is_eos() { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Pushing whole GOP", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Pushing whole GOP",); gops.push(stream.queued_gops.pop_back().unwrap()); } else { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Can't push whole GOP as it's not final yet", ); } @@ -1545,7 +1607,7 @@ impl FMP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Splitting GOP and keeping PTS {}", gop.buffers[0].pts, ); @@ -1574,7 +1636,11 @@ impl FMP4Mux { .flags() .contains(gst::BufferFlags::DELTA_UNIT) { - gst::error!(CAT, obj: stream.sinkpad, "First buffer of a new fragment is not a keyframe"); + gst::error!( + CAT, + obj = stream.sinkpad, + "First buffer of a new fragment is not a keyframe" + ); } } } @@ -1590,7 +1656,7 @@ impl FMP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Draining from {} up to end PTS {} / duration {}", chunk_start_pts, dequeue_end_pts, @@ -1600,9 +1666,10 @@ impl FMP4Mux { while let Some(gop) = stream.queued_gops.back() { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Current GOP start {} end {} (final {})", - gop.start_pts, gop.end_pts, + gop.start_pts, + gop.end_pts, gop.final_end_pts || all_eos || stream.sinkpad.is_eos() ); @@ -1614,7 +1681,7 @@ impl FMP4Mux { if !gop.final_end_pts && !all_eos && !stream.sinkpad.is_eos() { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Not including GOP without final end PTS", ); break; @@ -1627,19 +1694,11 @@ impl FMP4Mux { && gop.end_pts > dequeue_end_pts && (chunk_end_pts.is_some() || !gops.is_empty()) { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Not including GOP yet", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Not including GOP yet",); break; } - gst::trace!( - CAT, - obj: stream.sinkpad, - "Pushing complete GOP", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Pushing complete GOP",); gops.push(stream.queued_gops.pop_back().unwrap()); } } @@ -1699,11 +1758,7 @@ impl FMP4Mux { && buffer.buffer.flags().contains(gst::BufferFlags::DROPPABLE) && buffer.buffer.size() == 0 { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Skipping gap buffer {buffer:?}", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Skipping gap buffer {buffer:?}",); continue; } @@ -1766,7 +1821,7 @@ impl FMP4Mux { (gst::Signed::Positive(pts) - gst::Signed::Positive(dts)).nseconds(), ) .map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference"); + gst::error!(CAT, obj = stream.sinkpad, "Too big PTS/DTS difference"); gst::FlowError::Error })?, ) @@ -1893,7 +1948,7 @@ impl FMP4Mux { // taken in its place. gst::info!( CAT, - imp: self, + imp = self, "Starting to drain at {} (fragment start {}, fragment end {}, chunk start {}, chunk end {})", chunk_start_pts, fragment_start_pts, @@ -1926,7 +1981,7 @@ impl FMP4Mux { chunk_end_pts = Some(last_gop.end_pts); gst::info!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Draining up to PTS {} for this chunk", last_gop.end_pts, ); @@ -1948,13 +2003,13 @@ impl FMP4Mux { if settings.chunk_duration.is_some() { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Don't have anything to drain for the first stream on timeout in a live pipeline", ); } else { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Don't have a complete GOP for the first stream on timeout in a live pipeline", ); } @@ -1974,11 +2029,7 @@ impl FMP4Mux { } if gops.is_empty() { - gst::info!( - CAT, - obj: stream.sinkpad, - "Draining no buffers", - ); + gst::info!(CAT, obj = stream.sinkpad, "Draining no buffers",); drained_streams.push(( super::FragmentHeaderStream { @@ -2001,7 +2052,7 @@ impl FMP4Mux { ) { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Queued full GOPs duration updated to {}", prev_gop.end_pts.saturating_sub(first_gop.earliest_pts), ); @@ -2009,7 +2060,7 @@ impl FMP4Mux { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Queued duration updated to {}", Option::zip(stream.queued_gops.front(), stream.queued_gops.back()) .map(|(end, start)| end.end_pts.saturating_sub(start.start_pts)) @@ -2029,11 +2080,7 @@ impl FMP4Mux { ) = match buffers { Some(res) => res, None => { - gst::info!( - CAT, - obj: stream.sinkpad, - "Drained only gap buffers", - ); + gst::info!(CAT, obj = stream.sinkpad, "Drained only gap buffers",); drained_streams.push(( super::FragmentHeaderStream { @@ -2051,7 +2098,7 @@ impl FMP4Mux { gst::info!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Draining {} worth of buffers starting at PTS {} DTS {}, DTS offset {}", end_pts.saturating_sub(earliest_pts), earliest_pts, @@ -2217,7 +2264,7 @@ impl FMP4Mux { if current_position.is_some_and(|current_position| current_position > fku_time) { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Sending force-keyunit event late for running time {} at {}", fku_time, current_position.display(), @@ -2226,7 +2273,7 @@ impl FMP4Mux { } else { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Sending force-keyunit event for running time {}", fku_time, ); @@ -2254,9 +2301,9 @@ impl FMP4Mux { upstream_events: &mut Vec<(super::FMP4MuxPad, gst::Event)>, ) -> Result<(Option, Option), gst::FlowError> { if at_eos { - gst::info!(CAT, imp: self, "Draining at EOS"); + gst::info!(CAT, imp = self, "Draining at EOS"); } else if timeout { - gst::info!(CAT, imp: self, "Draining at timeout"); + gst::info!(CAT, imp = self, "Draining at timeout"); } else { for stream in &state.streams { if !stream.chunk_filled && !stream.fragment_filled && !stream.sinkpad.is_eos() { @@ -2265,7 +2312,7 @@ impl FMP4Mux { } gst::info!( CAT, - imp: self, + imp = self, "Draining because all streams have enough data queued" ); } @@ -2322,7 +2369,7 @@ impl FMP4Mux { gst::debug!( CAT, - imp: self, + imp = self, concat!( "Draining chunk (fragment start: {} fragment end: {}) ", "from PTS {} to {}" @@ -2375,7 +2422,7 @@ impl FMP4Mux { .map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Failed to create FMP4 fragment header: {}", err ); @@ -2450,9 +2497,14 @@ impl FMP4Mux { if fragment_filled { state.fragment_start_pts = Some(chunk_end_pts); - gst::info!(CAT, imp: self, "Starting new fragment at {}", chunk_end_pts,); + gst::info!( + CAT, + imp = self, + "Starting new fragment at {}", + chunk_end_pts, + ); } else { - gst::info!(CAT, imp: self, "Starting new chunk at {}", chunk_end_pts,); + gst::info!(CAT, imp = self, "Starting new chunk at {}", chunk_end_pts,); } state.chunk_start_pts = Some(chunk_end_pts); @@ -2501,7 +2553,7 @@ impl FMP4Mux { Err(err) => { if err == gst_base::AGGREGATOR_FLOW_NEED_DATA { assert!(!all_eos); - gst::debug!(CAT, imp: self, "Need more data"); + gst::debug!(CAT, imp = self, "Need more data"); state.timeout_delay += 1.seconds(); } @@ -2513,7 +2565,7 @@ impl FMP4Mux { // EOS add the footers. if buffer_list.is_none() { if settings.write_mfra && all_eos { - gst::debug!(CAT, imp: self, "Writing mfra box"); + gst::debug!(CAT, imp = self, "Writing mfra box"); match boxes::create_mfra(&state.streams[0].caps, &state.fragment_offsets) { Ok(mut mfra) => { { @@ -2529,7 +2581,7 @@ impl FMP4Mux { buffers.extend(buffer_list); } Err(err) => { - gst::error!(CAT, imp: self, "Failed to create mfra box: {}", err); + gst::error!(CAT, imp = self, "Failed to create mfra box: {}", err); } } } @@ -2572,12 +2624,12 @@ impl FMP4Mux { let caps = match pad.current_caps() { Some(caps) => caps, None => { - gst::warning!(CAT, obj: pad, "Skipping pad without caps"); + gst::warning!(CAT, obj = pad, "Skipping pad without caps"); continue; } }; - gst::info!(CAT, obj: pad, "Configuring caps {:?}", caps); + gst::info!(CAT, obj = pad, "Configuring caps {:?}", caps); let s = caps.structure(0).unwrap(); @@ -2586,7 +2638,7 @@ impl FMP4Mux { match s.name().as_str() { "video/x-h264" | "video/x-h265" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without codec_data"); + gst::error!(CAT, obj = pad, "Received caps without codec_data"); return Err(gst::FlowError::NotNegotiated); } delta_frames = DeltaFrames::Bidirectional; @@ -2596,7 +2648,7 @@ impl FMP4Mux { } "video/x-vp9" => { if !s.has_field_with_type("colorimetry", str::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without colorimetry"); + gst::error!(CAT, obj = pad, "Received caps without colorimetry"); return Err(gst::FlowError::NotNegotiated); } delta_frames = DeltaFrames::PredictiveOnly; @@ -2607,7 +2659,7 @@ impl FMP4Mux { "image/jpeg" => (), "audio/mpeg" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without codec_data"); + gst::error!(CAT, obj = pad, "Received caps without codec_data"); return Err(gst::FlowError::NotNegotiated); } } @@ -2618,18 +2670,23 @@ impl FMP4Mux { .and_then(|a| a.first().and_then(|v| v.get::().ok())) { if gst_pbutils::codec_utils_opus_parse_header(&header, None).is_err() { - gst::error!(CAT, obj: pad, "Received invalid Opus header"); + gst::error!(CAT, obj = pad, "Received invalid Opus header"); return Err(gst::FlowError::NotNegotiated); } } else if gst_pbutils::codec_utils_opus_parse_caps(&caps, None).is_err() { - gst::error!(CAT, obj: pad, "Received invalid Opus caps"); + gst::error!(CAT, obj = pad, "Received invalid Opus caps"); return Err(gst::FlowError::NotNegotiated); } } "audio/x-flac" => { discard_header_buffers = true; if let Err(e) = s.get::("streamheader") { - gst::error!(CAT, obj: pad, "Muxing FLAC into MP4 needs streamheader: {}", e); + gst::error!( + CAT, + obj = pad, + "Muxing FLAC into MP4 needs streamheader: {}", + e + ); return Err(gst::FlowError::NotNegotiated); }; } @@ -2656,7 +2713,7 @@ impl FMP4Mux { } if state.streams.is_empty() { - gst::error!(CAT, imp: self, "No streams available"); + gst::error!(CAT, imp = self, "No streams available"); return Err(gst::FlowError::Error); } @@ -2740,7 +2797,7 @@ impl FMP4Mux { }, }) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to create FMP4 header: {}", err); + gst::error!(CAT, imp = self, "Failed to create FMP4 header: {}", err); gst::FlowError::Error })?; @@ -2777,7 +2834,7 @@ impl FMP4Mux { /// Finish the stream be rewriting / updating headers. fn finish(&self, settings: &Settings) { // Do remaining EOS handling after the end of the stream was pushed. - gst::debug!(CAT, imp: self, "Doing EOS handling"); + gst::debug!(CAT, imp = self, "Doing EOS handling"); if settings.header_update_mode == super::HeaderUpdateMode::None { // Need to output new headers if started again after EOS @@ -2805,7 +2862,7 @@ impl FMP4Mux { if let Err(err) = aggregator.finish_buffer_list(buffer_list) { gst::error!( CAT, - imp: self, + imp = self, "Failed pushing updated header buffer downstream: {:?}", err, ); @@ -2813,7 +2870,7 @@ impl FMP4Mux { } else { gst::error!( CAT, - imp: self, + imp = self, "Can't rewrite header because downstream is not seekable" ); } @@ -2825,7 +2882,7 @@ impl FMP4Mux { if let Err(err) = aggregator.finish_buffer_list(buffer_list) { gst::error!( CAT, - imp: self, + imp = self, "Failed pushing updated header buffer downstream: {:?}", err, ); @@ -2837,7 +2894,7 @@ impl FMP4Mux { Err(err) => { gst::error!( CAT, - imp: self, + imp = self, "Failed to generate updated header: {:?}", err ); @@ -3060,7 +3117,7 @@ impl ElementImpl for FMP4Mux { if state.stream_header.is_some() { gst::error!( CAT, - imp: self, + imp = self, "Can't request new pads after header was generated" ); return None; @@ -3083,7 +3140,7 @@ impl AggregatorImpl for FMP4Mux { ) -> bool { use gst::QueryViewMut; - gst::trace!(CAT, obj: aggregator_pad, "Handling query {:?}", query); + gst::trace!(CAT, obj = aggregator_pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Caps(q) => { @@ -3117,14 +3174,14 @@ impl AggregatorImpl for FMP4Mux { ) -> Result { use gst::EventView; - gst::trace!(CAT, obj: aggregator_pad, "Handling event {:?}", event); + gst::trace!(CAT, obj = aggregator_pad, "Handling event {:?}", event); match event.view() { EventView::Segment(ev) => { if ev.segment().format() != gst::Format::Time { gst::warning!( CAT, - obj: aggregator_pad, + obj = aggregator_pad, "Received non-TIME segment, replacing with default TIME segment" ); let segment = gst::FormattedSegment::::new(); @@ -3141,7 +3198,7 @@ impl AggregatorImpl for FMP4Mux { fn sink_event(&self, aggregator_pad: &gst_base::AggregatorPad, event: gst::Event) -> bool { use gst::EventView; - gst::trace!(CAT, obj: aggregator_pad, "Handling event {:?}", event); + gst::trace!(CAT, obj = aggregator_pad, "Handling event {:?}", event); match event.view() { EventView::Segment(ev) => { @@ -3151,7 +3208,7 @@ impl AggregatorImpl for FMP4Mux { .clone() .downcast::() .expect("non-TIME segment"); - gst::info!(CAT, obj: aggregator_pad, "Received segment {:?}", segment); + gst::info!(CAT, obj = aggregator_pad, "Received segment {:?}", segment); // Only forward the segment event verbatim if this is a single stream variant. // Otherwise we have to produce a default segment and re-timestamp all buffers @@ -3167,7 +3224,12 @@ impl AggregatorImpl for FMP4Mux { EventView::Tag(ev) => { if let Some(tag_value) = ev.tag().get::() { let lang = tag_value.get(); - gst::trace!(CAT, imp: self, "Received language code from tags: {:?}", lang); + gst::trace!( + CAT, + imp = self, + "Received language code from tags: {:?}", + lang + ); // Language as ISO-639-2/T if lang.len() == 3 && lang.chars().all(|c| c.is_ascii_lowercase()) { @@ -3190,7 +3252,7 @@ impl AggregatorImpl for FMP4Mux { fn src_query(&self, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::trace!(CAT, imp: self, "Handling query {:?}", query); + gst::trace!(CAT, imp = self, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -3205,7 +3267,7 @@ impl AggregatorImpl for FMP4Mux { fn src_event(&self, event: gst::Event) -> bool { use gst::EventView; - gst::trace!(CAT, imp: self, "Handling event {:?}", event); + gst::trace!(CAT, imp = self, "Handling event {:?}", event); match event.view() { EventView::Seek(_ev) => false, @@ -3234,7 +3296,7 @@ impl AggregatorImpl for FMP4Mux { } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::trace!(CAT, imp: self, "Stopping"); + gst::trace!(CAT, imp = self, "Stopping"); let _ = self.parent_stop(); @@ -3244,7 +3306,7 @@ impl AggregatorImpl for FMP4Mux { } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::trace!(CAT, imp: self, "Starting"); + gst::trace!(CAT, imp = self, "Starting"); self.parent_start()?; @@ -3287,7 +3349,7 @@ impl AggregatorImpl for FMP4Mux { all_eos = state.streams.iter().all(|stream| stream.sinkpad.is_eos()); if all_eos { - gst::debug!(CAT, imp: self, "All streams are EOS now"); + gst::debug!(CAT, imp = self, "All streams are EOS now"); let fragment_start_pts = state.fragment_start_pts; let chunk_start_pts = state.chunk_start_pts; @@ -3330,12 +3392,12 @@ impl AggregatorImpl for FMP4Mux { } if let Some(caps) = caps { - gst::debug!(CAT, imp: self, "Setting caps on source pad: {:?}", caps); + gst::debug!(CAT, imp = self, "Setting caps on source pad: {:?}", caps); self.obj().set_src_caps(&caps); } for buffer_list in buffers { - gst::trace!(CAT, imp: self, "Pushing buffer list {:?}", buffer_list); + gst::trace!(CAT, imp = self, "Pushing buffer list {:?}", buffer_list); self.obj().finish_buffer_list(buffer_list)?; } diff --git a/mux/mp4/src/mp4mux/imp.rs b/mux/mp4/src/mp4mux/imp.rs index f5a5244e..bd19ba7b 100644 --- a/mux/mp4/src/mp4mux/imp.rs +++ b/mux/mp4/src/mp4mux/imp.rs @@ -180,17 +180,17 @@ impl MP4Mux { } if delta_frames.requires_dts() && buffer.dts().is_none() { - gst::error!(CAT, obj: sinkpad, "Require DTS for video streams"); + gst::error!(CAT, obj = sinkpad, "Require DTS for video streams"); return Err(gst::FlowError::Error); } if buffer.pts().is_none() { - gst::error!(CAT, obj: sinkpad, "Require timestamped buffers"); + gst::error!(CAT, obj = sinkpad, "Require timestamped buffers"); return Err(gst::FlowError::Error); } if delta_frames.intra_only() && buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) { - gst::error!(CAT, obj: sinkpad, "Intra-only stream with delta units"); + gst::error!(CAT, obj = sinkpad, "Intra-only stream with delta units"); return Err(gst::FlowError::Error); } @@ -216,7 +216,7 @@ impl MP4Mux { let mut segment = match sinkpad.segment().downcast::().ok() { Some(segment) => segment, None => { - gst::error!(CAT, obj: sinkpad, "Got buffer before segment"); + gst::error!(CAT, obj = sinkpad, "Got buffer before segment"); return Err(gst::FlowError::Error); } }; @@ -242,7 +242,7 @@ impl MP4Mux { // Calculate from the mapping running_time_to_utc_time(pts, running_time_utc_time_mapping).ok_or_else( || { - gst::error!(CAT, obj: sinkpad, "Stream has negative PTS UTC time"); + gst::error!(CAT, obj = sinkpad, "Stream has negative PTS UTC time"); gst::FlowError::Error }, )? @@ -252,7 +252,7 @@ impl MP4Mux { gst::trace!( CAT, - obj: sinkpad, + obj = sinkpad, "Mapped PTS running time {pts} to UTC time {utc_time}" ); @@ -263,12 +263,12 @@ impl MP4Mux { if let Some(dts) = dts { let dts_utc_time = running_time_to_utc_time(dts, (pts, utc_time)).ok_or_else(|| { - gst::error!(CAT, obj: sinkpad, "Stream has negative DTS UTC time"); + gst::error!(CAT, obj = sinkpad, "Stream has negative DTS UTC time"); gst::FlowError::Error })?; gst::trace!( CAT, - obj: sinkpad, + obj = sinkpad, "Mapped DTS running time {dts} to UTC time {dts_utc_time}" ); buffer.set_dts(dts_utc_time); @@ -317,7 +317,7 @@ impl MP4Mux { { gst::error!( CAT, - obj: sinkpad, + obj = sinkpad, "Got no UTC time in the first 6s of the stream" ); return Err(gst::FlowError::Error); @@ -326,7 +326,7 @@ impl MP4Mux { let Some(buffer) = sinkpad.pop_buffer() else { if sinkpad.is_eos() { - gst::error!(CAT, obj: sinkpad, "Got no UTC time before EOS"); + gst::error!(CAT, obj = sinkpad, "Got no UTC time before EOS"); return Err(gst::FlowError::Error); } else { return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); @@ -342,7 +342,7 @@ impl MP4Mux { let segment = match sinkpad.segment().downcast::().ok() { Some(segment) => segment, None => { - gst::error!(CAT, obj: sinkpad, "Got buffer before segment"); + gst::error!(CAT, obj = sinkpad, "Got buffer before segment"); return Err(gst::FlowError::Error); } }; @@ -358,7 +358,7 @@ impl MP4Mux { let running_time = segment.to_running_time_full(buffer.pts().unwrap()).unwrap(); gst::info!( CAT, - obj: sinkpad, + obj = sinkpad, "Got initial UTC time {utc_time} at PTS running time {running_time}", ); @@ -374,12 +374,12 @@ impl MP4Mux { let pts = segment.to_running_time_full(buffer.pts().unwrap()).unwrap(); let pts_utc_time = running_time_to_utc_time(pts, mapping).ok_or_else(|| { - gst::error!(CAT, obj: sinkpad, "Stream has negative PTS UTC time"); + gst::error!(CAT, obj = sinkpad, "Stream has negative PTS UTC time"); gst::FlowError::Error })?; gst::trace!( CAT, - obj: sinkpad, + obj = sinkpad, "Mapped PTS running time {pts} to UTC time {pts_utc_time}" ); buffer.set_pts(pts_utc_time); @@ -387,12 +387,12 @@ impl MP4Mux { if let Some(dts) = buffer.dts() { let dts = segment.to_running_time_full(dts).unwrap(); let dts_utc_time = running_time_to_utc_time(dts, mapping).ok_or_else(|| { - gst::error!(CAT, obj: sinkpad, "Stream has negative DTS UTC time"); + gst::error!(CAT, obj = sinkpad, "Stream has negative DTS UTC time"); gst::FlowError::Error })?; gst::trace!( CAT, - obj: sinkpad, + obj = sinkpad, "Mapped DTS running time {dts} to UTC time {dts_utc_time}" ); buffer.set_dts(dts_utc_time); @@ -432,7 +432,7 @@ impl MP4Mux { let segment = match stream.sinkpad.segment().downcast::().ok() { Some(segment) => segment, None => { - gst::error!(CAT, obj: stream.sinkpad, "Got buffer before segment"); + gst::error!(CAT, obj = stream.sinkpad, "Got buffer before segment"); return Err(gst::FlowError::Error); } }; @@ -486,13 +486,13 @@ impl MP4Mux { let dur = buffer.duration().unwrap_or(gst::ClockTime::ZERO); gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream is EOS, using {dur} as duration for queued buffer", ); let pts = pts + dur; if stream.end_pts.map_or(true, |end_pts| end_pts < pts) { - gst::trace!(CAT, obj: stream.sinkpad, "Stream end PTS {pts}"); + gst::trace!(CAT, obj = stream.sinkpad, "Stream end PTS {pts}"); stream.end_pts = Some(pts); } @@ -500,7 +500,11 @@ impl MP4Mux { return Ok(()); } else { - gst::trace!(CAT, obj: stream.sinkpad, "Stream has no buffer queued"); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Stream has no buffer queued" + ); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } } @@ -521,7 +525,7 @@ impl MP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream has buffer with timestamp {next_timestamp} queued", ); @@ -531,7 +535,7 @@ impl MP4Mux { .unwrap_or_else(|| { gst::warning!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream timestamps going backwards {next_timestamp} < {timestamp}", ); gst::ClockTime::ZERO @@ -539,13 +543,13 @@ impl MP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Using {dur} as duration for queued buffer", ); let pts = pts + dur; if stream.end_pts.map_or(true, |end_pts| end_pts < pts) { - gst::trace!(CAT, obj: stream.sinkpad, "Stream end PTS {pts}"); + gst::trace!(CAT, obj = stream.sinkpad, "Stream end PTS {pts}"); stream.end_pts = Some(pts); } @@ -558,13 +562,18 @@ impl MP4Mux { && s.name().as_str() == "video/x-av1" { let buf_map = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Failed to map buffer"); - gst::FlowError::Error - })?; - stream.extra_header_data = read_seq_header_obu_bytes(buf_map.as_slice()).map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Failed to parse AV1 SequenceHeader OBU"); + gst::error!(CAT, obj = stream.sinkpad, "Failed to map buffer"); gst::FlowError::Error })?; + stream.extra_header_data = read_seq_header_obu_bytes(buf_map.as_slice()) + .map_err(|_| { + gst::error!( + CAT, + obj = stream.sinkpad, + "Failed to parse AV1 SequenceHeader OBU" + ); + gst::FlowError::Error + })?; } return Ok(()); @@ -576,15 +585,15 @@ impl MP4Mux { Some(res) => res, None => { if stream.sinkpad.is_eos() { - gst::trace!( - CAT, - obj: stream.sinkpad, - "Stream is EOS", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Stream is EOS",); return Err(gst::FlowError::Eos); } else { - gst::trace!(CAT, obj: stream.sinkpad, "Stream has no buffer queued"); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Stream has no buffer queued" + ); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } } @@ -594,9 +603,16 @@ impl MP4Mux { let pts_position = buffer.pts().unwrap(); let dts_position = buffer.dts(); - let pts = segment.to_running_time_full(pts_position).unwrap() - .positive().unwrap_or_else(|| { - gst::error!(CAT, obj: stream.sinkpad, "Stream has negative PTS running time"); + let pts = segment + .to_running_time_full(pts_position) + .unwrap() + .positive() + .unwrap_or_else(|| { + gst::error!( + CAT, + obj = stream.sinkpad, + "Stream has negative PTS running time" + ); gst::ClockTime::ZERO }); @@ -608,7 +624,7 @@ impl MP4Mux { let dts = dts.unwrap(); if stream.start_dts.is_none() { - gst::debug!(CAT, obj: stream.sinkpad, "Stream start DTS {dts}"); + gst::debug!(CAT, obj = stream.sinkpad, "Stream start DTS {dts}"); stream.start_dts = Some(dts); } @@ -621,7 +637,7 @@ impl MP4Mux { .earliest_pts .map_or(true, |earliest_pts| earliest_pts > pts) { - gst::debug!(CAT, obj: stream.sinkpad, "Stream earliest PTS {pts}"); + gst::debug!(CAT, obj = stream.sinkpad, "Stream earliest PTS {pts}"); stream.earliest_pts = Some(pts); } @@ -630,7 +646,7 @@ impl MP4Mux { let dts = dts.unwrap(); // set above Some(i64::try_from((pts - dts).nseconds()).map_err(|_| { - gst::error!(CAT, obj: stream.sinkpad, "Too big PTS/DTS difference"); + gst::error!(CAT, obj = stream.sinkpad, "Too big PTS/DTS difference"); gst::FlowError::Error })?) } else { @@ -639,7 +655,7 @@ impl MP4Mux { gst::trace!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream has buffer of size {} with timestamp {timestamp} pending", buffer.size(), ); @@ -686,7 +702,7 @@ impl MP4Mux { })) { gst::trace!(CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Continuing current chunk: single stream {single_stream}, or {} >= {} and {} >= {}", gst::format::Bytes::from_u64(stream.queued_chunk_bytes), settings.interleave_bytes.map(gst::format::Bytes::from_u64).display(), @@ -696,16 +712,25 @@ impl MP4Mux { } state.current_stream_idx = None; - gst::debug!(CAT, - obj: stream.sinkpad, + gst::debug!( + CAT, + obj = stream.sinkpad, "Switching to next chunk: {} < {} and {} < {}", gst::format::Bytes::from_u64(stream.queued_chunk_bytes), - settings.interleave_bytes.map(gst::format::Bytes::from_u64).display(), - stream.queued_chunk_time, settings.interleave_time.display(), + settings + .interleave_bytes + .map(gst::format::Bytes::from_u64) + .display(), + stream.queued_chunk_time, + settings.interleave_time.display(), ); } Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: stream.sinkpad, "Stream is EOS, switching to next stream"); + gst::debug!( + CAT, + obj = stream.sinkpad, + "Stream is EOS, switching to next stream" + ); state.current_stream_idx = None; } Err(err) => { @@ -734,10 +759,7 @@ impl MP4Mux { let timestamp = stream.pending_buffer.as_ref().unwrap().timestamp; - gst::trace!(CAT, - obj: stream.sinkpad, - "Stream at timestamp {timestamp}", - ); + gst::trace!(CAT, obj = stream.sinkpad, "Stream at timestamp {timestamp}",); all_eos = false; @@ -765,21 +787,21 @@ impl MP4Mux { } if !all_have_data_or_eos { - gst::trace!(CAT, imp: self, "Not all streams have a buffer or are EOS"); + gst::trace!(CAT, imp = self, "Not all streams have a buffer or are EOS"); Err(gst_base::AGGREGATOR_FLOW_NEED_DATA) } else if all_eos { - gst::info!(CAT, imp: self, "All streams are EOS"); + gst::info!(CAT, imp = self, "All streams are EOS"); Err(gst::FlowError::Eos) } else if let Some((idx, stream, earliest_timestamp)) = earliest_stream { gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Stream is earliest stream with timestamp {earliest_timestamp}", ); gst::debug!( CAT, - obj: stream.sinkpad, + obj = stream.sinkpad, "Starting new chunk at offset {}", state.current_offset, ); @@ -813,7 +835,7 @@ impl MP4Mux { && buffer.buffer.flags().contains(gst::BufferFlags::DROPPABLE) && buffer.buffer.size() == 0 { - gst::trace!(CAT, obj: stream.sinkpad, "Skipping gap buffer {buffer:?}"); + gst::trace!(CAT, obj = stream.sinkpad, "Skipping gap buffer {buffer:?}"); // If a new chunk was just started for the gap buffer, don't bother and get rid // of this chunk again for now and search for the next stream. @@ -831,10 +853,19 @@ impl MP4Mux { if let Some(previous_sample) = stream.chunks.last_mut().and_then(|c| c.samples.last_mut()) { - gst::trace!(CAT, obj: stream.sinkpad, "Adding gap duration {} to previous sample", buffer.duration.unwrap()); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Adding gap duration {} to previous sample", + buffer.duration.unwrap() + ); previous_sample.duration += buffer.duration.unwrap(); } else { - gst::trace!(CAT, obj: stream.sinkpad, "Resetting stream start time because it started with a gap"); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Resetting stream start time because it started with a gap" + ); // If there was no previous sample yet then the next sample needs to start // earlier or alternatively we change the start PTS. We do the latter here // as otherwise the first sample would be displayed too early. @@ -846,7 +877,12 @@ impl MP4Mux { continue; } - gst::trace!(CAT, obj: stream.sinkpad, "Handling buffer {buffer:?} at offset {}", state.current_offset); + gst::trace!( + CAT, + obj = stream.sinkpad, + "Handling buffer {buffer:?} at offset {}", + state.current_offset + ); let duration = buffer.duration.unwrap(); let composition_time_offset = buffer.composition_time_offset; @@ -884,7 +920,7 @@ impl MP4Mux { } fn create_streams(&self, state: &mut State) -> Result<(), gst::FlowError> { - gst::info!(CAT, imp: self, "Creating streams"); + gst::info!(CAT, imp = self, "Creating streams"); for pad in self .obj() @@ -895,12 +931,12 @@ impl MP4Mux { let caps = match pad.current_caps() { Some(caps) => caps, None => { - gst::warning!(CAT, obj: pad, "Skipping pad without caps"); + gst::warning!(CAT, obj = pad, "Skipping pad without caps"); continue; } }; - gst::info!(CAT, obj: pad, "Configuring caps {caps:?}"); + gst::info!(CAT, obj = pad, "Configuring caps {caps:?}"); let s = caps.structure(0).unwrap(); @@ -909,7 +945,7 @@ impl MP4Mux { match s.name().as_str() { "video/x-h264" | "video/x-h265" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without codec_data"); + gst::error!(CAT, obj = pad, "Received caps without codec_data"); return Err(gst::FlowError::NotNegotiated); } delta_frames = super::DeltaFrames::Bidirectional; @@ -919,7 +955,7 @@ impl MP4Mux { } "video/x-vp9" => { if !s.has_field_with_type("colorimetry", str::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without colorimetry"); + gst::error!(CAT, obj = pad, "Received caps without colorimetry"); return Err(gst::FlowError::NotNegotiated); } delta_frames = super::DeltaFrames::PredictiveOnly; @@ -930,7 +966,7 @@ impl MP4Mux { "image/jpeg" => (), "audio/mpeg" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { - gst::error!(CAT, obj: pad, "Received caps without codec_data"); + gst::error!(CAT, obj = pad, "Received caps without codec_data"); return Err(gst::FlowError::NotNegotiated); } } @@ -941,18 +977,23 @@ impl MP4Mux { .and_then(|a| a.first().and_then(|v| v.get::().ok())) { if gst_pbutils::codec_utils_opus_parse_header(&header, None).is_err() { - gst::error!(CAT, obj: pad, "Received invalid Opus header"); + gst::error!(CAT, obj = pad, "Received invalid Opus header"); return Err(gst::FlowError::NotNegotiated); } } else if gst_pbutils::codec_utils_opus_parse_caps(&caps, None).is_err() { - gst::error!(CAT, obj: pad, "Received invalid Opus caps"); + gst::error!(CAT, obj = pad, "Received invalid Opus caps"); return Err(gst::FlowError::NotNegotiated); } } "audio/x-flac" => { discard_header_buffers = true; if let Err(e) = s.get::("streamheader") { - gst::error!(CAT, obj: pad, "Muxing FLAC into MP4 needs streamheader: {}", e); + gst::error!( + CAT, + obj = pad, + "Muxing FLAC into MP4 needs streamheader: {}", + e + ); return Err(gst::FlowError::NotNegotiated); }; } @@ -981,7 +1022,7 @@ impl MP4Mux { } if state.streams.is_empty() { - gst::error!(CAT, imp: self, "No streams available"); + gst::error!(CAT, imp = self, "No streams available"); return Err(gst::FlowError::Error); } @@ -1116,7 +1157,7 @@ impl ElementImpl for MP4Mux { if !state.streams.is_empty() { gst::error!( CAT, - imp: self, + imp = self, "Can't request new pads after stream was started" ); return None; @@ -1138,7 +1179,7 @@ impl AggregatorImpl for MP4Mux { ) -> bool { use gst::QueryViewMut; - gst::trace!(CAT, obj: aggregator_pad, "Handling query {query:?}"); + gst::trace!(CAT, obj = aggregator_pad, "Handling query {query:?}"); match query.view_mut() { QueryViewMut::Caps(q) => { @@ -1172,14 +1213,14 @@ impl AggregatorImpl for MP4Mux { ) -> Result { use gst::EventView; - gst::trace!(CAT, obj: aggregator_pad, "Handling event {event:?}"); + gst::trace!(CAT, obj = aggregator_pad, "Handling event {event:?}"); match event.view() { EventView::Segment(ev) => { if ev.segment().format() != gst::Format::Time { gst::warning!( CAT, - obj: aggregator_pad, + obj = aggregator_pad, "Received non-TIME segment, replacing with default TIME segment" ); let segment = gst::FormattedSegment::::new(); @@ -1192,7 +1233,12 @@ impl AggregatorImpl for MP4Mux { EventView::Tag(ev) => { if let Some(tag_value) = ev.tag().get::() { let lang = tag_value.get(); - gst::trace!(CAT, imp: self, "Received language code from tags: {:?}", lang); + gst::trace!( + CAT, + imp = self, + "Received language code from tags: {:?}", + lang + ); // Language as ISO-639-2/T if lang.len() == 3 && lang.chars().all(|c| c.is_ascii_lowercase()) { @@ -1215,7 +1261,7 @@ impl AggregatorImpl for MP4Mux { fn sink_event(&self, aggregator_pad: &gst_base::AggregatorPad, event: gst::Event) -> bool { use gst::EventView; - gst::trace!(CAT, obj: aggregator_pad, "Handling event {event:?}"); + gst::trace!(CAT, obj = aggregator_pad, "Handling event {event:?}"); match event.view() { EventView::Tag(_ev) => { @@ -1230,7 +1276,7 @@ impl AggregatorImpl for MP4Mux { fn src_query(&self, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::trace!(CAT, imp: self, "Handling query {query:?}"); + gst::trace!(CAT, imp = self, "Handling query {query:?}"); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -1245,7 +1291,7 @@ impl AggregatorImpl for MP4Mux { fn src_event(&self, event: gst::Event) -> bool { use gst::EventView; - gst::trace!(CAT, imp: self, "Handling event {event:?}"); + gst::trace!(CAT, imp = self, "Handling event {event:?}"); match event.view() { EventView::Seek(_ev) => false, @@ -1254,7 +1300,7 @@ impl AggregatorImpl for MP4Mux { } fn flush(&self) -> Result { - gst::info!(CAT, imp: self, "Flushing"); + gst::info!(CAT, imp = self, "Flushing"); let mut state = self.state.lock().unwrap(); for stream in &mut state.streams { @@ -1268,7 +1314,7 @@ impl AggregatorImpl for MP4Mux { } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::trace!(CAT, imp: self, "Stopping"); + gst::trace!(CAT, imp = self, "Stopping"); let _ = self.parent_stop(); @@ -1278,7 +1324,7 @@ impl AggregatorImpl for MP4Mux { } fn start(&self) -> Result<(), gst::ErrorMessage> { - gst::trace!(CAT, imp: self, "Starting"); + gst::trace!(CAT, imp = self, "Starting"); self.parent_start()?; @@ -1319,7 +1365,7 @@ impl AggregatorImpl for MP4Mux { } } else { // Can't query downstream, have to assume downstream is seekable - gst::warning!(CAT, imp: self, "Can't query downstream for seekability"); + gst::warning!(CAT, imp = self, "Can't query downstream for seekability"); } state = self.state.lock().unwrap(); @@ -1334,7 +1380,7 @@ impl AggregatorImpl for MP4Mux { gst::info!( CAT, - imp: self, + imp = self, "Creating ftyp box at offset {}", state.current_offset ); @@ -1350,7 +1396,7 @@ impl AggregatorImpl for MP4Mux { .collect::>(), ) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to create ftyp box: {err}"); + gst::error!(CAT, imp = self, "Failed to create ftyp box: {err}"); gst::FlowError::Error })?; state.current_offset += ftyp.size() as u64; @@ -1358,13 +1404,13 @@ impl AggregatorImpl for MP4Mux { gst::info!( CAT, - imp: self, + imp = self, "Creating mdat box header at offset {}", state.current_offset ); state.mdat_offset = Some(state.current_offset); let mdat = boxes::create_mdat_header(None).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to create mdat box header: {err}"); + gst::error!(CAT, imp = self, "Failed to create mdat box header: {err}"); gst::FlowError::Error })?; state.current_offset += mdat.size() as u64; @@ -1385,7 +1431,7 @@ impl AggregatorImpl for MP4Mux { gst::info!( CAT, - imp: self, + imp = self, "Creating moov box now, mdat ends at offset {} with size {}", state.current_offset, state.mdat_size @@ -1419,7 +1465,7 @@ impl AggregatorImpl for MP4Mux { language_code: state.language_code, }) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to create moov box: {err}"); + gst::error!(CAT, imp = self, "Failed to create moov box: {err}"); gst::FlowError::Error })?; state.current_offset += moov.size() as u64; @@ -1434,7 +1480,7 @@ impl AggregatorImpl for MP4Mux { if !buffers.is_empty() { if let Err(err) = self.obj().finish_buffer_list(buffers) { - gst::error!(CAT, imp: self, "Failed pushing buffers: {err:?}"); + gst::error!(CAT, imp = self, "Failed pushing buffers: {err:?}"); return Err(err); } } @@ -1445,7 +1491,7 @@ impl AggregatorImpl for MP4Mux { if let Some(mdat_offset) = state.mdat_offset { gst::info!( CAT, - imp: self, + imp = self, "Rewriting mdat box header at offset {mdat_offset} with size {} now", state.mdat_size, ); @@ -1453,7 +1499,7 @@ impl AggregatorImpl for MP4Mux { segment.set_start(gst::format::Bytes::from_u64(mdat_offset)); state.current_offset = mdat_offset; let mdat = boxes::create_mdat_header(Some(state.mdat_size)).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to create mdat box header: {err}"); + gst::error!(CAT, imp = self, "Failed to create mdat box header: {err}"); gst::FlowError::Error })?; drop(state); @@ -1462,7 +1508,7 @@ impl AggregatorImpl for MP4Mux { if let Err(err) = self.obj().finish_buffer(mdat) { gst::error!( CAT, - imp: self, + imp = self, "Failed pushing updated mdat box header buffer downstream: {err:?}", ); } @@ -1788,7 +1834,7 @@ impl AggregatorPadImpl for MP4MuxPad { let mux = aggregator.downcast_ref::().unwrap(); let mut mux_state = mux.imp().state.lock().unwrap(); - gst::info!(CAT, imp: self, "Flushing"); + gst::info!(CAT, imp = self, "Flushing"); for stream in &mut mux_state.streams { if stream.sinkpad == *self.obj() { diff --git a/net/aws/src/s3hlssink/imp.rs b/net/aws/src/s3hlssink/imp.rs index bc7f7578..b09a12c3 100644 --- a/net/aws/src/s3hlssink/imp.rs +++ b/net/aws/src/s3hlssink/imp.rs @@ -237,10 +237,10 @@ impl S3HlsSink { match rxc.try_recv() { Ok(S3RequestControl::Continue) => (), Ok(S3RequestControl::Pause) => { - gst::debug!(CAT, imp: self, "Pausing S3 request thread."); + gst::debug!(CAT, imp = self, "Pausing S3 request thread."); match rxc.recv() { Ok(S3RequestControl::Continue) => { - gst::debug!(CAT, imp: self, "Continuing S3 request thread.") + gst::debug!(CAT, imp = self, "Continuing S3 request thread.") } // We do not expect another pause request here. Ok(S3RequestControl::Pause) => unreachable!(), @@ -262,7 +262,7 @@ impl S3HlsSink { let s3_acl = data.s3_acl; let s3_data_len = data.s3_data.len(); - gst::debug!(CAT, imp: self, "Uploading key {}", s3_key); + gst::debug!(CAT, imp = self, "Uploading key {}", s3_key); let put_object_req = s3_client .put_object() @@ -277,7 +277,7 @@ impl S3HlsSink { Err(err) => { gst::error!( CAT, - imp: self, + imp = self, "Put object request for S3 key {} of data length {} failed with error {err}", s3_key, s3_data_len, @@ -308,7 +308,7 @@ impl S3HlsSink { let s3_bucket = data.s3_bucket.clone(); let s3_key = data.s3_key.clone(); - gst::debug!(CAT, imp: self, "Deleting key {}", s3_key); + gst::debug!(CAT, imp = self, "Deleting key {}", s3_key); let delete_object_req = s3_client .delete_object() @@ -320,7 +320,7 @@ impl S3HlsSink { if let Err(err) = result { gst::error!( CAT, - imp: self, + imp = self, "Delete object request for S3 key {} failed with error {err}", s3_key, ); @@ -334,14 +334,14 @@ impl S3HlsSink { } Ok(S3Request::Stop) => break, Err(err) => { - gst::error!(CAT, imp: self, "S3 channel error: {}", err); + gst::error!(CAT, imp = self, "S3 channel error: {}", err); element_imp_error!(self, gst::ResourceError::Write, ["S3 channel error"]); break; } } } - gst::info!(CAT, imp: self, "Exiting S3 request thread",); + gst::info!(CAT, imp = self, "Exiting S3 request thread",); } fn s3client_from_settings(&self) -> Client { @@ -397,17 +397,22 @@ impl S3HlsSink { let s3_tx = settings.s3_tx.clone(); if let (Some(handle), Some(tx)) = (s3_handle, s3_tx) { - gst::info!(CAT, imp: self, "Stopping S3 request thread"); + gst::info!(CAT, imp = self, "Stopping S3 request thread"); match tx.send(S3Request::Stop) { Ok(_) => { - gst::info!(CAT, imp: self, "Joining S3 request thread"); + gst::info!(CAT, imp = self, "Joining S3 request thread"); if let Err(err) = handle.join() { - gst::error!(CAT, imp: self, "S3 upload thread failed to exit: {:?}", err); + gst::error!( + CAT, + imp = self, + "S3 upload thread failed to exit: {:?}", + err + ); } drop(tx); } Err(err) => { - gst::error!(CAT, imp: self, "Failed to stop S3 request thread: {}", err) + gst::error!(CAT, imp = self, "Failed to stop S3 request thread: {}", err) } }; }; @@ -552,7 +557,7 @@ impl ObjectImpl for S3HlsSink { gst::debug!( CAT, - imp: self, + imp = self, "Setting property '{}' to '{:?}'", pspec.name(), value @@ -651,7 +656,7 @@ impl ObjectImpl for S3HlsSink { settings.s3_txc = Some(txc); drop(settings); - gst::info!(CAT, imp: self, "Constructed"); + gst::info!(CAT, imp = self, "Constructed"); self.hlssink.connect("get-playlist-stream", false, { let self_weak = self.downgrade(); @@ -674,7 +679,7 @@ impl ObjectImpl for S3HlsSink { playlist_tx.clone(), ); - gst::debug!(CAT, imp: self_, "New upload for {}", s3_location); + gst::debug!(CAT, imp = self_, "New upload for {}", s3_location); Some( gio::WriteOutputStream::new(upload) @@ -705,7 +710,7 @@ impl ObjectImpl for S3HlsSink { fragment_tx.clone(), ); - gst::debug!(CAT, imp: self_, "New upload for {}", s3_location); + gst::debug!(CAT, imp = self_, "New upload for {}", s3_location); Some( gio::WriteOutputStream::new(upload) @@ -732,7 +737,7 @@ impl ObjectImpl for S3HlsSink { s3_location.to_string() }; - gst::debug!(CAT, imp: self_, "Deleting {}", s3_location); + gst::debug!(CAT, imp = self_, "Deleting {}", s3_location); let delete = S3DeleteReq { s3_client, @@ -752,7 +757,7 @@ impl ObjectImpl for S3HlsSink { if res.is_ok() { Some(true.to_value()) } else { - gst::error!(CAT, imp: self_, "Failed deleting {}", s3_location); + gst::error!(CAT, imp = self_, "Failed deleting {}", s3_location); element_imp_error!( self_, gst::ResourceError::Write, @@ -839,11 +844,11 @@ impl ElementImpl for S3HlsSink { if let Some(tx) = s3_txc { gst::debug!( CAT, - imp: self, + imp = self, "Sending continue request to S3 request thread." ); if tx.send(S3RequestControl::Continue).is_err() { - gst::error!(CAT, imp: self, "Could not send continue request."); + gst::error!(CAT, imp = self, "Could not send continue request."); } } } @@ -853,13 +858,13 @@ impl ElementImpl for S3HlsSink { if let Some(tx) = s3_txc { gst::debug!( CAT, - imp: self, + imp = self, "Sending pause request to S3 request thread." ); if settings.s3_upload_handle.is_some() && tx.send(S3RequestControl::Pause).is_err() { - gst::error!(CAT, imp: self, "Could not send pause request."); + gst::error!(CAT, imp = self, "Could not send pause request."); } } } @@ -890,7 +895,7 @@ impl ElementImpl for S3HlsSink { if settings.audio_sink { gst::debug!( CAT, - imp: self, + imp = self, "requested_new_pad: audio pad is already set" ); return None; @@ -908,7 +913,7 @@ impl ElementImpl for S3HlsSink { if settings.video_sink { gst::debug!( CAT, - imp: self, + imp = self, "requested_new_pad: video pad is already set" ); return None; @@ -923,7 +928,7 @@ impl ElementImpl for S3HlsSink { Some(sink_pad.upcast()) } _ => { - gst::debug!(CAT, imp: self, "requested_new_pad is not audio or video"); + gst::debug!(CAT, imp = self, "requested_new_pad is not audio or video"); None } } @@ -945,7 +950,7 @@ impl BinImpl for S3HlsSink { * unblock the S3 request thread from waiting for a Continue request * on the control channel. */ - gst::debug!(CAT, imp: self, "Got EOS, dropping control channel"); + gst::debug!(CAT, imp = self, "Got EOS, dropping control channel"); drop(txc); } drop(settings); diff --git a/net/aws/src/s3sink/multipartsink.rs b/net/aws/src/s3sink/multipartsink.rs index 24bca9f3..0ff7113d 100644 --- a/net/aws/src/s3sink/multipartsink.rs +++ b/net/aws/src/s3sink/multipartsink.rs @@ -136,12 +136,12 @@ impl Settings { for (key, value) in structure.iter() { if let Ok(Ok(value_str)) = value.transform::().map(|v| v.get()) { - gst::log!(CAT, imp: imp, "metadata '{}' -> '{}'", key, value_str); + gst::log!(CAT, imp = imp, "metadata '{}' -> '{}'", key, value_str); hash.insert(key.to_string(), value_str); } else { gst::warning!( CAT, - imp: imp, + imp = imp, "Failed to convert metadata '{}' to string ('{:?}')", key, value @@ -203,7 +203,7 @@ impl S3Sink { OnError::Abort => { gst::log!( CAT, - imp: self, + imp = self, "Aborting multipart upload request with id: {}", state.upload_id ); @@ -211,13 +211,13 @@ impl S3Sink { Ok(()) => { gst::log!( CAT, - imp: self, + imp = self, "Aborting multipart upload request succeeded." ); } Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Aborting multipart upload failed: {}", err.to_string() ), @@ -226,7 +226,7 @@ impl S3Sink { OnError::Complete => { gst::log!( CAT, - imp: self, + imp = self, "Completing multipart upload request with id: {}", state.upload_id ); @@ -234,13 +234,13 @@ impl S3Sink { Ok(()) => { gst::log!( CAT, - imp: self, + imp = self, "Complete multipart upload request succeeded." ); } Err(err) => gst::error!( CAT, - imp: self, + imp = self, "Completing multipart upload failed: {}", err.to_string() ), @@ -285,7 +285,7 @@ impl S3Sink { .build(); state.completed_parts.push(completed_part); - gst::info!(CAT, imp: self, "Uploaded part {}", part_number); + gst::info!(CAT, imp = self, "Uploaded part {}", part_number); Ok(()) } @@ -633,7 +633,7 @@ impl S3Sink { return Ok(()); } - gst::debug!(CAT, imp: self, "Setting uri to {:?}", url_str); + gst::debug!(CAT, imp = self, "Setting uri to {:?}", url_str); let url_str = url_str.unwrap(); match parse_s3_url(url_str) { @@ -804,7 +804,7 @@ impl ObjectImpl for S3Sink { gst::debug!( CAT, - imp: self, + imp = self, "Setting property '{}' to '{:?}'", pspec.name(), value @@ -1030,7 +1030,7 @@ impl BaseSinkImpl for S3Sink { fn start(&self) -> Result<(), gst::ErrorMessage> { let res = self.start(); if let Err(ref err) = res { - gst::error!(CAT, imp: self, "Failed to start: {err}"); + gst::error!(CAT, imp = self, "Failed to start: {err}"); } res @@ -1040,7 +1040,7 @@ impl BaseSinkImpl for S3Sink { let mut state = self.state.lock().unwrap(); if let State::Started(ref mut state) = *state { - gst::warning!(CAT, imp: self, "Stopped without EOS"); + gst::warning!(CAT, imp = self, "Stopped without EOS"); // We're stopping without an EOS -- treat this as an error and deal with the open // multipart upload accordingly _if_ we managed to upload any parts @@ -1050,7 +1050,7 @@ impl BaseSinkImpl for S3Sink { } *state = State::Stopped; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -1070,7 +1070,7 @@ impl BaseSinkImpl for S3Sink { return Err(gst::FlowError::Error); } - gst::trace!(CAT, imp: self, "Rendering {:?}", buffer); + gst::trace!(CAT, imp = self, "Rendering {:?}", buffer); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to map buffer"]); gst::FlowError::Error @@ -1080,12 +1080,17 @@ impl BaseSinkImpl for S3Sink { Ok(_) => Ok(gst::FlowSuccess::Ok), Err(err) => match err { Some(error_message) => { - gst::error!(CAT, imp: self, "Multipart upload failed: {}", error_message); + gst::error!( + CAT, + imp = self, + "Multipart upload failed: {}", + error_message + ); self.post_error_message(error_message); Err(gst::FlowError::Error) } _ => { - gst::info!(CAT, imp: self, "Upload interrupted. Flushing..."); + gst::info!(CAT, imp = self, "Upload interrupted. Flushing..."); Err(gst::FlowError::Flushing) } }, @@ -1113,7 +1118,7 @@ impl BaseSinkImpl for S3Sink { if let Err(error_message) = self.finalize_upload() { gst::error!( CAT, - imp: self, + imp = self, "Failed to finalize the upload: {}", error_message ); diff --git a/net/aws/src/s3sink/putobjectsink.rs b/net/aws/src/s3sink/putobjectsink.rs index 934e8180..9633b539 100644 --- a/net/aws/src/s3sink/putobjectsink.rs +++ b/net/aws/src/s3sink/putobjectsink.rs @@ -106,12 +106,12 @@ impl Settings { for (key, value) in structure.iter() { if let Ok(Ok(value_str)) = value.transform::().map(|v| v.get()) { - gst::log!(CAT, imp: imp, "metadata '{}' -> '{}'", key, value_str); + gst::log!(CAT, imp = imp, "metadata '{}' -> '{}'", key, value_str); hash.insert(key.to_string(), value_str); } else { gst::warning!( CAT, - imp: imp, + imp = imp, "Failed to convert metadata '{}' to string ('{:?}')", key, value @@ -215,7 +215,7 @@ impl S3PutObjectSink { WaitError::Cancelled => None, })?; - gst::debug!(CAT, imp: self, "Upload complete"); + gst::debug!(CAT, imp = self, "Upload complete"); Ok(()) } @@ -343,7 +343,7 @@ impl S3PutObjectSink { return Ok(()); } - gst::debug!(CAT, imp: self, "Setting uri to {:?}", url_str); + gst::debug!(CAT, imp = self, "Setting uri to {:?}", url_str); let url_str = url_str.unwrap(); match parse_s3_url(url_str) { @@ -484,7 +484,7 @@ impl ObjectImpl for S3PutObjectSink { gst::debug!( CAT, - imp: self, + imp = self, "Setting property '{}' to '{:?}'", pspec.name(), value @@ -677,11 +677,11 @@ impl BaseSinkImpl for S3PutObjectSink { drop(settings); drop(state); - gst::warning!(CAT, imp: self, "Stopped without EOS, but flushing"); + gst::warning!(CAT, imp = self, "Stopped without EOS, but flushing"); if let Err(error_message) = self.flush_buffer() { gst::error!( CAT, - imp: self, + imp = self, "Failed to finalize the upload: {:?}", error_message ); @@ -692,7 +692,7 @@ impl BaseSinkImpl for S3PutObjectSink { } *state = State::Stopped; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -715,7 +715,7 @@ impl BaseSinkImpl for S3PutObjectSink { started_state.num_buffers += 1; started_state.need_flush = true; - gst::trace!(CAT, imp: self, "Rendering {:?}", buffer); + gst::trace!(CAT, imp = self, "Rendering {:?}", buffer); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to map buffer"]); gst::FlowError::Error @@ -733,12 +733,12 @@ impl BaseSinkImpl for S3PutObjectSink { Ok(_) => Ok(gst::FlowSuccess::Ok), Err(err) => match err { Some(error_message) => { - gst::error!(CAT, imp: self, "Upload failed: {}", error_message); + gst::error!(CAT, imp = self, "Upload failed: {}", error_message); self.post_error_message(error_message); Err(gst::FlowError::Error) } _ => { - gst::info!(CAT, imp: self, "Upload interrupted. Flushing..."); + gst::info!(CAT, imp = self, "Upload interrupted. Flushing..."); Err(gst::FlowError::Flushing) } }, @@ -770,7 +770,7 @@ impl BaseSinkImpl for S3PutObjectSink { if let Err(error_message) = self.flush_buffer() { gst::error!( CAT, - imp: self, + imp = self, "Failed to finalize the upload: {:?}", error_message ); diff --git a/net/aws/src/s3src/imp.rs b/net/aws/src/s3src/imp.rs index 811f4dd2..e34ceeac 100644 --- a/net/aws/src/s3src/imp.rs +++ b/net/aws/src/s3src/imp.rs @@ -191,7 +191,7 @@ impl S3Src { gst::info!( CAT, - imp: self, + imp = self, "HEAD success, content length = {:?}", output.content_length ); @@ -226,7 +226,7 @@ impl S3Src { gst::debug!( CAT, - imp: self, + imp = self, "Requesting range: {}-{}", offset, offset + length - 1 @@ -243,7 +243,7 @@ impl S3Src { WaitError::Cancelled => None, })?; - gst::debug!(CAT, imp: self, "Read {:?} bytes", output.content_length); + gst::debug!(CAT, imp = self, "Read {:?} bytes", output.content_length); s3utils::wait_stream(&self.canceller, &mut output.body).map_err(|err| match err { WaitError::FutureError(err) => Some(gst::error_msg!( @@ -562,7 +562,7 @@ impl BaseSrcImpl for S3Src { Err(None) => Err(gst::FlowError::Flushing), /* Actual Error */ Err(Some(err)) => { - gst::error!(CAT, imp: self, "Could not GET: {}", err); + gst::error!(CAT, imp = self, "Could not GET: {}", err); Err(gst::FlowError::Error) } } diff --git a/net/aws/src/transcribe_parse/imp.rs b/net/aws/src/transcribe_parse/imp.rs index 4a3a4865..42ea99e2 100644 --- a/net/aws/src/transcribe_parse/imp.rs +++ b/net/aws/src/transcribe_parse/imp.rs @@ -83,7 +83,7 @@ impl TranscribeParse { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.lock().unwrap(); @@ -218,7 +218,7 @@ impl TranscribeParse { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::FlushStop(..) => { let mut state = self.state.lock().unwrap(); @@ -228,7 +228,7 @@ impl TranscribeParse { EventView::Eos(..) => match self.drain() { Ok(()) => gst::Pad::event_default(pad, Some(&*self.obj()), event), Err(err) => { - gst::error!(CAT, imp: self, "failed to drain on EOS: {}", err); + gst::error!(CAT, imp = self, "failed to drain on EOS: {}", err); element_imp_error!( self, gst::StreamError::Failed, @@ -338,7 +338,7 @@ impl ElementImpl for TranscribeParse { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/net/aws/src/transcriber/imp.rs b/net/aws/src/transcriber/imp.rs index 61962d8a..12c72733 100644 --- a/net/aws/src/transcriber/imp.rs +++ b/net/aws/src/transcriber/imp.rs @@ -184,7 +184,7 @@ pub struct Transcriber { impl Transcriber { fn start_srcpad_tasks(&self, state: &State) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Starting tasks"); + gst::debug!(CAT, imp = self, "Starting tasks"); if self.static_srcpad.is_linked() { self.static_srcpad.imp().start_task()?; @@ -194,13 +194,13 @@ impl Transcriber { pad.imp().start_task()?; } - gst::debug!(CAT, imp: self, "Tasks Started"); + gst::debug!(CAT, imp = self, "Tasks Started"); Ok(()) } fn stop_tasks(&self, state: &mut State) { - gst::debug!(CAT, imp: self, "Stopping tasks"); + gst::debug!(CAT, imp = self, "Stopping tasks"); if self.static_srcpad.is_linked() { self.static_srcpad.imp().stop_task(); @@ -219,11 +219,11 @@ impl Transcriber { state.start_time = None; - gst::debug!(CAT, imp: self, "Tasks Stopped"); + gst::debug!(CAT, imp = self, "Tasks Stopped"); } fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {event:?}"); + gst::log!(CAT, obj = pad, "Handling event {event:?}"); use gst::EventView::*; match event.view() { @@ -234,20 +234,20 @@ impl Transcriber { true } FlushStart(_) => { - gst::info!(CAT, imp: self, "Received flush start, disconnecting"); + gst::info!(CAT, imp = self, "Received flush start, disconnecting"); let ret = gst::Pad::event_default(pad, Some(&*self.obj()), event); self.stop_tasks(&mut self.state.lock().unwrap()); ret } FlushStop(_) => { - gst::info!(CAT, imp: self, "Received flush stop, restarting task"); + gst::info!(CAT, imp = self, "Received flush stop, restarting task"); if gst::Pad::event_default(pad, Some(&*self.obj()), event) { let state = self.state.lock().unwrap(); match self.start_srcpad_tasks(&state) { Err(err) => { - gst::error!(CAT, imp: self, "Failed to start srcpad tasks: {err}"); + gst::error!(CAT, imp = self, "Failed to start srcpad tasks: {err}"); false } Ok(_) => true, @@ -290,7 +290,7 @@ impl Transcriber { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling {buffer:?}"); + gst::log!(CAT, obj = pad, "Handling {buffer:?}"); if buffer.pts().is_none() { gst::element_imp_error!( @@ -322,7 +322,7 @@ impl Transcriber { }; let Some(mut buffer_tx) = self.state.lock().unwrap().buffer_tx.take() else { - gst::log!(CAT, obj: pad, "Flushing"); + gst::log!(CAT, obj = pad, "Flushing"); return Err(gst::FlowError::Flushing); }; @@ -474,7 +474,7 @@ impl Transcriber { } } Some(Eos) => { - gst::debug!(CAT, imp: imp, "Transcriber loop sending EOS"); + gst::debug!(CAT, imp = imp, "Transcriber loop sending EOS"); if imp.transcript_event_tx.receiver_count() > 0 { let _ = imp.transcript_event_tx.send(Eos); @@ -509,7 +509,7 @@ impl Transcriber { { gst::debug!( CAT, - imp: imp, + imp = imp, "Forcing to translation (threshold {threshold}): {items_to_translate:?}" ); let _ = imp @@ -520,7 +520,7 @@ impl Transcriber { } } - gst::debug!(CAT, imp: imp, "Exiting transcriber loop"); + gst::debug!(CAT, imp = imp, "Exiting transcriber loop"); Ok(()) }); @@ -532,7 +532,7 @@ impl Transcriber { } fn prepare(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Preparing"); + gst::debug!(CAT, imp = self, "Preparing"); let (access_key, secret_access_key, session_token) = { let settings = self.settings.lock().unwrap(); @@ -543,12 +543,12 @@ impl Transcriber { ) }; - gst::info!(CAT, imp: self, "Loading aws config..."); + gst::info!(CAT, imp = self, "Loading aws config..."); let _enter_guard = RUNTIME.enter(); let config_loader = match (access_key, secret_access_key) { (Some(key), Some(secret_key)) => { - gst::debug!(CAT, imp: self, "Using settings credentials"); + gst::debug!(CAT, imp = self, "Using settings credentials"); aws_config::defaults(AWS_BEHAVIOR_VERSION.clone()).credentials_provider( aws_transcribe::config::Credentials::new( key, @@ -560,7 +560,7 @@ impl Transcriber { ) } _ => { - gst::debug!(CAT, imp: self, "Attempting to get credentials from env..."); + gst::debug!(CAT, imp = self, "Attempting to get credentials from env..."); aws_config::defaults(AWS_BEHAVIOR_VERSION.clone()) } }; @@ -571,17 +571,17 @@ impl Transcriber { ); let config = futures::executor::block_on(config_loader.load()); - gst::debug!(CAT, imp: self, "Using region {}", config.region().unwrap()); + gst::debug!(CAT, imp = self, "Using region {}", config.region().unwrap()); *self.aws_config.lock().unwrap() = Some(config); - gst::debug!(CAT, imp: self, "Prepared"); + gst::debug!(CAT, imp = self, "Prepared"); Ok(()) } fn disconnect(&self) { - gst::info!(CAT, imp: self, "Unpreparing"); + gst::info!(CAT, imp = self, "Unpreparing"); let mut state = self.state.lock().unwrap(); self.stop_tasks(&mut state); @@ -589,7 +589,7 @@ impl Transcriber { for pad in state.srcpads.iter() { pad.imp().set_discont(); } - gst::info!(CAT, imp: self, "Unprepared"); + gst::info!(CAT, imp = self, "Unprepared"); } fn get_start_time_and_now(&self) -> Option<(gst::ClockTime, gst::ClockTime)> { @@ -975,7 +975,7 @@ impl ElementImpl for Transcriber { &self, transition: gst::StateChange, ) -> Result { - gst::info!(CAT, imp: self, "Changing state {transition:?}"); + gst::info!(CAT, imp = self, "Changing state {transition:?}"); if let gst::StateChange::NullToReady = transition { self.prepare().map_err(|err| { @@ -1131,7 +1131,7 @@ impl TranslationPadTask { "total latency + lateness must be greater than {}", 2 * GRANULARITY ); - gst::error!(CAT, imp: pad, "{err}"); + gst::error!(CAT, imp = pad, "{err}"); return Err(gst::error_msg!(gst::LibraryError::Settings, ["{err}"])); } @@ -1205,7 +1205,7 @@ impl TranslationPadTask { } if !self.dequeue().await { - gst::info!(CAT, imp: self.pad, "Failed to dequeue buffer, pausing"); + gst::info!(CAT, imp = self.pad, "Failed to dequeue buffer, pausing"); let _ = self.pad.obj().pause_task(); } @@ -1231,14 +1231,14 @@ impl TranslationPadTask { self.output_items.extend(transcript_items.iter().map(Into::into)); } Ok(Eos) => { - gst::debug!(CAT, imp: self.pad, "Got eos"); + gst::debug!(CAT, imp = self.pad, "Got eos"); self.send_eos = true; } Err(RecvError::Lagged(nb_msg)) => { - gst::warning!(CAT, imp: self.pad, "Missed {nb_msg} transcript sets"); + gst::warning!(CAT, imp = self.pad, "Missed {nb_msg} transcript sets"); } Err(RecvError::Closed) => { - gst::debug!(CAT, imp: self.pad, "Transcript chan terminated: setting eos"); + gst::debug!(CAT, imp = self.pad, "Transcript chan terminated: setting eos"); self.send_eos = true; } } @@ -1256,7 +1256,7 @@ impl TranslationPadTask { .map_or(true, task::JoinHandle::is_finished) { const ERR: &str = "Translate loop is not running"; - gst::error!(CAT, imp: self.pad, "{ERR}"); + gst::error!(CAT, imp = self.pad, "{ERR}"); return Err(gst::error_msg!(gst::StreamError::Failed, ["{ERR}"])); } @@ -1277,16 +1277,16 @@ impl TranslationPadTask { match items_res { Ok(Items(items_to_translate)) => Some(items_to_translate), Ok(Eos) => { - gst::debug!(CAT, imp: self.pad, "Got eos"); + gst::debug!(CAT, imp = self.pad, "Got eos"); self.send_eos = true; None } Err(RecvError::Lagged(nb_msg)) => { - gst::warning!(CAT, imp: self.pad, "Missed {nb_msg} transcript sets"); + gst::warning!(CAT, imp = self.pad, "Missed {nb_msg} transcript sets"); None } Err(RecvError::Closed) => { - gst::debug!(CAT, imp: self.pad, "Transcript chan terminated: setting eos"); + gst::debug!(CAT, imp = self.pad, "Transcript chan terminated: setting eos"); self.send_eos = true; None } @@ -1307,7 +1307,7 @@ impl TranslationPadTask { if res.is_err() { const ERR: &str = "to_translation chan terminated"; - gst::debug!(CAT, imp: self.pad, "{ERR}"); + gst::debug!(CAT, imp = self.pad, "{ERR}"); return Err(gst::error_msg!(gst::StreamError::Failed, ["{ERR}"])); } @@ -1324,7 +1324,7 @@ impl TranslationPadTask { while let Ok(translated_items) = from_translate_rx.try_next() { let Some(translated_items) = translated_items else { const ERR: &str = "translation chan terminated"; - gst::debug!(CAT, imp: self.pad, "{ERR}"); + gst::debug!(CAT, imp = self.pad, "{ERR}"); return Err(gst::error_msg!(gst::StreamError::Failed, ["{ERR}"])); }; @@ -1360,7 +1360,7 @@ impl TranslationPadTask { // Note: items pts start from 0 + lateness gst::trace!( CAT, - imp: self.pad, + imp = self.pad, "Checking now {now} if item is ready for dequeuing, PTS {}, threshold {} vs {}", item.pts, item.pts + self.our_latency.saturating_sub(3 * GRANULARITY), @@ -1402,7 +1402,11 @@ impl TranslationPadTask { .duration(pts - last_position) .seqnum(self.seqnum) .build(); - gst::log!(CAT, imp: self.pad, "Pushing gap: {last_position} -> {pts}"); + gst::log!( + CAT, + imp = self.pad, + "Pushing gap: {last_position} -> {pts}" + ); if !self.pad.obj().push_event(gap_event) { return false; } @@ -1415,7 +1419,7 @@ impl TranslationPadTask { gst::warning!( CAT, - imp: self.pad, + imp = self.pad, "Updating item PTS ({pts} < {last_position}), consider increasing latency", ); @@ -1435,7 +1439,12 @@ impl TranslationPadTask { last_position = pts + duration; - gst::debug!(CAT, imp: self.pad, "Pushing buffer with content {content}: {pts} -> {}", pts + duration); + gst::debug!( + CAT, + imp = self.pad, + "Pushing buffer with content {content}: {pts} -> {}", + pts + duration + ); if self.pad.obj().push(buf).is_err() { return false; @@ -1450,7 +1459,7 @@ impl TranslationPadTask { /* We're EOS, we can pause and exit early */ let _ = self.pad.obj().pause_task(); - gst::info!(CAT, imp: self.pad, "Sending eos"); + gst::info!(CAT, imp = self.pad, "Sending eos"); return self .pad .obj() @@ -1460,7 +1469,7 @@ impl TranslationPadTask { /* next, push a gap if we're lagging behind the target position */ gst::trace!( CAT, - imp: self.pad, + imp = self.pad, "Checking now: {now} if we need to push a gap, last_position: {last_position}, threshold: {}", last_position + self.our_latency.saturating_sub(GRANULARITY) ); @@ -1478,7 +1487,7 @@ impl TranslationPadTask { gst::log!( CAT, - imp: self.pad, + imp = self.pad, "Pushing gap: {last_position} -> {}", last_position + duration ); @@ -1533,10 +1542,10 @@ impl TranslationPadTask { } for event in events.drain(..) { - gst::info!(CAT, imp: self.pad, "Sending {event:?}"); + gst::info!(CAT, imp = self.pad, "Sending {event:?}"); if !self.pad.obj().push_event(event) { const ERR: &str = "Failed to send initial"; - gst::error!(CAT, imp: self.pad, "{ERR}"); + gst::error!(CAT, imp = self.pad, "{ERR}"); return Err(gst::error_msg!(gst::StreamError::Failed, ["{ERR}"])); } } @@ -1580,7 +1589,7 @@ pub struct TranslateSrcPad { impl TranslateSrcPad { fn start_task(&self) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Starting task"); + gst::debug!(CAT, imp = self, "Starting task"); let elem = self.parent(); let _enter = RUNTIME.enter(); @@ -1598,10 +1607,10 @@ impl TranslateSrcPad { Ok(Err(err)) => { // Don't bring down the whole element if this Pad fails // FIXME is there a way to mark the Pad in error though? - gst::info!(CAT, imp: imp, "Pausing task due to: {err}"); + gst::info!(CAT, imp = imp, "Pausing task due to: {err}"); let _ = imp.obj().pause_task(); } - Err(_) => gst::debug!(CAT, imp: imp, "task iter aborted"), + Err(_) => gst::debug!(CAT, imp = imp, "task iter aborted"), } }); @@ -1609,13 +1618,13 @@ impl TranslateSrcPad { return Err(gst::loggable_error!(CAT, "Failed to start pad task")); } - gst::debug!(CAT, imp: self, "Task started"); + gst::debug!(CAT, imp = self, "Task started"); Ok(()) } fn stop_task(&self) { - gst::debug!(CAT, imp: self, "Stopping task"); + gst::debug!(CAT, imp = self, "Stopping task"); // See also the note in `start_task()`: // 1. Mark the task as stopped so no further iteration is executed. @@ -1626,7 +1635,7 @@ impl TranslateSrcPad { task_abort_handle.abort(); } - gst::debug!(CAT, imp: self, "Task stopped"); + gst::debug!(CAT, imp = self, "Task stopped"); } fn set_discont(&self) { @@ -1688,7 +1697,7 @@ impl TranslateSrcPad { pad: &super::TranslateSrcPad, query: &mut gst::QueryRef, ) -> bool { - gst::log!(CAT, obj: pad, "Handling query {query:?}"); + gst::log!(CAT, obj = pad, "Handling query {query:?}"); use gst::QueryViewMut::*; match query.view_mut() { @@ -1707,7 +1716,7 @@ impl TranslateSrcPad { Self::our_latency(&elem_settings, &pad_settings) }; - gst::info!(CAT, obj: pad, "Our latency {our_latency}"); + gst::info!(CAT, obj = pad, "Our latency {our_latency}"); q.set(true, our_latency + min, gst::ClockTime::NONE); } ret diff --git a/net/aws/src/transcriber/transcribe.rs b/net/aws/src/transcriber/transcribe.rs index cff88f15..02c983da 100644 --- a/net/aws/src/transcriber/transcribe.rs +++ b/net/aws/src/transcriber/transcribe.rs @@ -167,7 +167,7 @@ impl TranscriberStream { .await .map_err(|err| { let err = format!("Transcribe ws init error: {err}: {}", err.meta()); - gst::error!(CAT, imp: imp, "{err}"); + gst::error!(CAT, imp = imp, "{err}"); gst::error_msg!(gst::LibraryError::Init, ["{err}"]) })?; @@ -189,12 +189,12 @@ impl TranscriberStream { .await .map_err(|err| { let err = format!("Transcribe ws stream error: {err}: {}", err.meta()); - gst::error!(CAT, imp: self.imp, "{err}"); + gst::error!(CAT, imp = self.imp, "{err}"); gst::error_msg!(gst::LibraryError::Failed, ["{err}"]) })?; let Some(event) = event else { - gst::debug!(CAT, imp: self.imp, "Transcriber loop sending EOS"); + gst::debug!(CAT, imp = self.imp, "Transcriber loop sending EOS"); return Ok(TranscriptEvent::Eos); }; @@ -206,7 +206,7 @@ impl TranscriberStream { .and_then(|transcript| transcript.results) .and_then(|mut results| results.drain(..).next()) { - gst::trace!(CAT, imp: self.imp, "Received: {result:?}"); + gst::trace!(CAT, imp = self.imp, "Received: {result:?}"); if let Some(alternative) = result .alternatives @@ -224,7 +224,7 @@ impl TranscriberStream { } else { gst::warning!( CAT, - imp: self.imp, + imp = self.imp, "Transcribe ws returned unknown event: consider upgrading the SDK" ) } @@ -240,7 +240,7 @@ impl TranscriberStream { if items.len() <= self.partial_index { gst::error!( CAT, - imp: self.imp, + imp = self.imp, "sanity check failed, alternative length {} < partial_index {}", items.len(), self.partial_index @@ -267,7 +267,7 @@ impl TranscriberStream { }; gst::debug!( CAT, - imp: self.imp, + imp = self.imp, "Item is ready for queuing: {}, PTS {}", item.content, item.pts, diff --git a/net/aws/src/transcriber/translate.rs b/net/aws/src/transcriber/translate.rs index 0b37422b..bcb2b08c 100644 --- a/net/aws/src/transcriber/translate.rs +++ b/net/aws/src/transcriber/translate.rs @@ -83,7 +83,7 @@ impl TranslateLoop { "Failed to call list_languages service: {err}: {}", err.meta() ); - gst::info!(CAT, imp: self.pad, "{err}"); + gst::info!(CAT, imp = self.pad, "{err}"); gst::error_msg!(gst::LibraryError::Failed, ["{err}"]) })?; @@ -94,7 +94,7 @@ impl TranslateLoop { if !found_output_lang { let err = format!("Unknown output languages: {}", self.output_lang); - gst::info!(CAT, imp: self.pad, "{err}"); + gst::info!(CAT, imp = self.pad, "{err}"); return Err(gst::error_msg!(gst::LibraryError::Failed, ["{err}"])); } @@ -136,7 +136,11 @@ impl TranslateLoop { let content: String = content.join(""); - gst::debug!(CAT, imp: self.pad, "Translating {content} with {ts_duration_list:?}"); + gst::debug!( + CAT, + imp = self.pad, + "Translating {content} with {ts_duration_list:?}" + ); let translated_text = self .client @@ -148,12 +152,12 @@ impl TranslateLoop { .await .map_err(|err| { let err = format!("Failed to call translation service: {err}: {}", err.meta()); - gst::info!(CAT, imp: self.pad, "{err}"); + gst::info!(CAT, imp = self.pad, "{err}"); gst::error_msg!(gst::LibraryError::Failed, ["{err}"]) })? .translated_text; - gst::debug!(CAT, imp: self.pad, "Got translation {translated_text}"); + gst::debug!(CAT, imp = self.pad, "Got translation {translated_text}"); let translated_items = match self.tokenization_method { Tokenization::None => { @@ -173,12 +177,12 @@ impl TranslateLoop { Tokenization::SpanBased => span_tokenize_items(&translated_text, ts_duration_list), }; - gst::trace!(CAT, imp: self.pad, "Sending {translated_items:?}"); + gst::trace!(CAT, imp = self.pad, "Sending {translated_items:?}"); if self.translate_tx.send(translated_items).await.is_err() { gst::info!( CAT, - imp: self.pad, + imp = self.pad, "translation chan terminated, exiting translation loop" ); break; diff --git a/net/hlssink3/src/hlsbasesink.rs b/net/hlssink3/src/hlsbasesink.rs index 343dc3ee..58ca16a4 100644 --- a/net/hlssink3/src/hlsbasesink.rs +++ b/net/hlssink3/src/hlsbasesink.rs @@ -324,11 +324,7 @@ impl HlsBaseSink { let context = match state.context.as_mut() { Some(context) => context, None => { - gst::error!( - CAT, - imp: self, - "Playlist is not configured", - ); + gst::error!(CAT, imp = self, "Playlist is not configured",); return None; } @@ -337,22 +333,13 @@ impl HlsBaseSink { let location = match sprintf::sprintf!(&context.segment_template, fragment_id) { Ok(file_name) => file_name, Err(err) => { - gst::error!( - CAT, - imp: self, - "Couldn't build file name, err: {:?}", err, - ); + gst::error!(CAT, imp = self, "Couldn't build file name, err: {:?}", err,); return None; } }; - gst::trace!( - CAT, - imp: self, - "Segment location formatted: {}", - location - ); + gst::trace!(CAT, imp = self, "Segment location formatted: {}", location); let stream = match self .obj() @@ -390,11 +377,7 @@ impl HlsBaseSink { let context = match state.context.as_mut() { Some(context) => context, None => { - gst::error!( - CAT, - imp: self, - "Playlist is not configured", - ); + gst::error!(CAT, imp = self, "Playlist is not configured",); return Err(gst::FlowError::Error); } @@ -459,7 +442,12 @@ impl HlsBaseSink { &self, context: &mut PlaylistContext, ) -> Result { - gst::info!(CAT, imp: self, "Preparing to write new playlist, COUNT {}", context.playlist.len()); + gst::info!( + CAT, + imp = self, + "Preparing to write new playlist, COUNT {}", + context.playlist.len() + ); context .playlist @@ -476,7 +464,7 @@ impl HlsBaseSink { .ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Could not get stream to write playlist content", ); gst::FlowError::Error @@ -489,7 +477,7 @@ impl HlsBaseSink { .map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Could not write new playlist: {}", err.to_string() ); @@ -498,7 +486,7 @@ impl HlsBaseSink { playlist_stream.flush().map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Could not flush playlist: {}", err.to_string() ); @@ -513,12 +501,12 @@ impl HlsBaseSink { .obj() .emit_by_name::(SIGNAL_DELETE_FRAGMENT, &[&old_segment_location]) { - gst::error!(CAT, imp: self, "Could not delete fragment"); + gst::error!(CAT, imp = self, "Could not delete fragment"); } } } - gst::debug!(CAT, imp: self, "Wrote new playlist file!"); + gst::debug!(CAT, imp = self, "Wrote new playlist file!"); Ok(gst::FlowSuccess::Ok) } @@ -548,7 +536,7 @@ impl HlsBaseSink { let _ = fs::remove_file(location).map_err(|err| { gst::warning!( CAT, - imp: self, + imp = self, "Could not delete segment file: {}", err.to_string() ); diff --git a/net/hlssink3/src/hlscmafsink/imp.rs b/net/hlssink3/src/hlscmafsink/imp.rs index 400535c3..8de2a777 100644 --- a/net/hlssink3/src/hlscmafsink/imp.rs +++ b/net/hlssink3/src/hlscmafsink/imp.rs @@ -341,7 +341,7 @@ impl HlsBaseSinkImpl for HlsCmafSink {} impl HlsCmafSink { fn start(&self, target_duration: u32, playlist_type: Option) -> Playlist { - gst::info!(CAT, imp: self, "Starting"); + gst::info!(CAT, imp = self, "Starting"); let mut state = self.state.lock().unwrap(); *state = HlsCmafSinkState::default(); @@ -369,11 +369,7 @@ impl HlsCmafSink { let location = match sprintf::sprintf!(&settings.init_location, state.init_idx) { Ok(location) => location, Err(err) => { - gst::error!( - CAT, - imp: self, - "Couldn't build file name, err: {:?}", err, - ); + gst::error!(CAT, imp = self, "Couldn't build file name, err: {:?}", err,); return Err(String::from("Invalid init segment file pattern")); } }; @@ -448,7 +444,7 @@ impl HlsCmafSink { let mut stream = self.on_init_segment().map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Couldn't get output stream for init segment, {err}", ); gst::FlowError::Error @@ -458,18 +454,14 @@ impl HlsCmafSink { stream.write(&map).map_err(|_| { gst::error!( CAT, - imp: self, + imp = self, "Couldn't write init segment to output stream", ); gst::FlowError::Error })?; stream.flush().map_err(|_| { - gst::error!( - CAT, - imp: self, - "Couldn't flush output stream", - ); + gst::error!(CAT, imp = self, "Couldn't flush output stream",); gst::FlowError::Error })?; @@ -494,7 +486,7 @@ impl HlsCmafSink { let (mut stream, location) = self.on_new_fragment().map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Couldn't get output stream for segment, {err}", ); gst::FlowError::Error @@ -504,21 +496,13 @@ impl HlsCmafSink { let map = buffer.map_readable().unwrap(); stream.write(&map).map_err(|_| { - gst::error!( - CAT, - imp: self, - "Couldn't write segment to output stream", - ); + gst::error!(CAT, imp = self, "Couldn't write segment to output stream",); gst::FlowError::Error })?; } stream.flush().map_err(|_| { - gst::error!( - CAT, - imp: self, - "Couldn't flush output stream", - ); + gst::error!(CAT, imp = self, "Couldn't flush output stream",); gst::FlowError::Error })?; diff --git a/net/hlssink3/src/hlssink3/imp.rs b/net/hlssink3/src/hlssink3/imp.rs index d76325db..792e0e12 100644 --- a/net/hlssink3/src/hlssink3/imp.rs +++ b/net/hlssink3/src/hlssink3/imp.rs @@ -251,7 +251,7 @@ impl ObjectImpl for HlsSink3 { return Some(None::.to_value()); }; let fragment_id = args[1].get::().unwrap(); - gst::info!(CAT, imp: imp, "Got fragment-id: {}", fragment_id); + gst::info!(CAT, imp = imp, "Got fragment-id: {}", fragment_id); let sample = args[2].get::().unwrap(); let buffer = sample.buffer(); @@ -265,7 +265,7 @@ impl ObjectImpl for HlsSink3 { } else { gst::warning!( CAT, - imp: imp, + imp = imp, "buffer null for fragment-id: {}", fragment_id ); @@ -275,7 +275,7 @@ impl ObjectImpl for HlsSink3 { match imp.on_format_location(fragment_id, running_time) { Ok(segment_location) => Some(segment_location.to_value()), Err(err) => { - gst::error!(CAT, imp: imp, "on format-location handler: {}", err); + gst::error!(CAT, imp = imp, "on format-location handler: {}", err); Some("unknown_segment".to_value()) } } @@ -362,7 +362,7 @@ impl ElementImpl for HlsSink3 { if settings.audio_sink { gst::debug!( CAT, - imp: self, + imp = self, "requested_new_pad: audio pad is already set" ); return None; @@ -389,7 +389,7 @@ impl ElementImpl for HlsSink3 { if settings.video_sink { gst::debug!( CAT, - imp: self, + imp = self, "requested_new_pad: video pad is already set" ); return None; @@ -406,7 +406,7 @@ impl ElementImpl for HlsSink3 { other_name => { gst::debug!( CAT, - imp: self, + imp = self, "requested_new_pad: name \"{}\" is not audio or video", other_name ); @@ -486,7 +486,7 @@ impl HlsSink3 { playlist_type: Option, i_frames_only: bool, ) -> Playlist { - gst::info!(CAT, imp: self, "Starting"); + gst::info!(CAT, imp = self, "Starting"); let mut state = self.state.lock().unwrap(); *state = HlsSink3State::default(); @@ -515,7 +515,7 @@ impl HlsSink3 { ) -> Result { gst::info!( CAT, - imp: self, + imp = self, "Starting the formatting of the fragment-id: {}", fragment_id ); @@ -535,7 +535,7 @@ impl HlsSink3 { gst::info!( CAT, - imp: self, + imp = self, "New segment location: {:?}", state.current_segment_location.as_ref() ); @@ -548,7 +548,7 @@ impl HlsSink3 { let location = match state.current_segment_location.take() { Some(location) => location, None => { - gst::error!(CAT, imp: self, "Unknown segment location"); + gst::error!(CAT, imp = self, "Unknown segment location"); return; } }; @@ -556,7 +556,7 @@ impl HlsSink3 { let opened_at = match state.fragment_opened_at.take() { Some(opened_at) => opened_at, None => { - gst::error!(CAT, imp: self, "Unknown segment duration"); + gst::error!(CAT, imp = self, "Unknown segment duration"); return; } }; diff --git a/net/mpegtslive/src/mpegtslive/imp.rs b/net/mpegtslive/src/mpegtslive/imp.rs index b9063e14..504d39fc 100644 --- a/net/mpegtslive/src/mpegtslive/imp.rs +++ b/net/mpegtslive/src/mpegtslive/imp.rs @@ -259,7 +259,7 @@ fn find_pcr(slice: &[u8], imp: &MpegTsLiveSource) -> Result> { reader.skip(6)?; let pcr_ext = reader.read::(9).context("PCR_ext")?; let pcr = pcr_base * 300 + pcr_ext; - gst::debug!(CAT, imp:imp, "PID {pid} PCR {pcr}"); + gst::debug!(CAT, imp = imp, "PID {pid} PCR {pcr}"); buffer_pcr = Some(pcr); break; } @@ -277,13 +277,13 @@ fn get_pcr_from_buffer(imp: &MpegTsLiveSource, buffer: &gst::Buffer) -> Option pcr, Err(err) => { - gst::error!(CAT, imp:imp, "Failed parsing MPEG-TS packets: {err}"); + gst::error!(CAT, imp = imp, "Failed parsing MPEG-TS packets: {err}"); return None; } }; let Some(raw_pcr) = buffer_pcr else { - gst::debug!(CAT, imp:imp, "No PCR observed in {:?}", buffer); + gst::debug!(CAT, imp = imp, "No PCR observed in {:?}", buffer); return None; }; Some(raw_pcr) @@ -466,20 +466,20 @@ impl ObjectImpl for MpegTsLiveSource { .expect("type checked upstream") { if self.obj().add(&source).is_err() { - gst::warning!(CAT, imp:self, "Failed to add source"); + gst::warning!(CAT, imp = self, "Failed to add source"); return; }; if source.set_clock(Some(&self.internal_clock)).is_err() { - gst::warning!(CAT, imp:self, "Failed to set clock on source"); + gst::warning!(CAT, imp = self, "Failed to set clock on source"); return; }; let Some(target_pad) = source.static_pad("src") else { - gst::warning!(CAT, imp:self, "Source element has no 'src' pad"); + gst::warning!(CAT, imp = self, "Source element has no 'src' pad"); return; }; if self.srcpad.set_target(Some(&target_pad)).is_err() { - gst::warning!(CAT, imp:self, "Failed to set ghost pad target"); + gst::warning!(CAT, imp = self, "Failed to set ghost pad target"); return; } state.source = Some(source); diff --git a/net/ndi/src/device_provider/imp.rs b/net/ndi/src/device_provider/imp.rs index a6f56d80..f499321e 100644 --- a/net/ndi/src/device_provider/imp.rs +++ b/net/ndi/src/device_provider/imp.rs @@ -76,7 +76,7 @@ impl DeviceProviderImpl for DeviceProvider { let mut thread_guard = self.thread.lock().unwrap(); if thread_guard.is_some() { - gst::log!(CAT, imp: self, "Device provider already started"); + gst::log!(CAT, imp = self, "Device provider already started"); return Ok(()); } @@ -92,13 +92,13 @@ impl DeviceProviderImpl for DeviceProvider { let mut find_guard = imp.find.lock().unwrap(); if find_guard.is_some() { - gst::log!(CAT, imp: imp, "Already started"); + gst::log!(CAT, imp = imp, "Already started"); return; } let find = match ndi::FindInstance::builder().build() { None => { - gst::error!(CAT, imp: imp, "Failed to create Find instance"); + gst::error!(CAT, imp = imp, "Failed to create Find instance"); return; } Some(find) => find, @@ -140,7 +140,7 @@ impl DeviceProvider { }; if !find.wait_for_sources(if first { 1000 } else { 5000 }) { - gst::trace!(CAT, imp: self, "No new sources found"); + gst::trace!(CAT, imp = self, "No new sources found"); return; } @@ -157,7 +157,7 @@ impl DeviceProvider { let old_source = old_device_imp.source.get().unwrap(); if !sources.contains(old_source) { - gst::log!(CAT, imp: self, "Source {:?} disappeared", old_source); + gst::log!(CAT, imp = self, "Source {:?} disappeared", old_source); expired_devices.push(old_device.clone()); } else { // Otherwise remember that we had it before already and don't have to announce it @@ -179,7 +179,7 @@ impl DeviceProvider { // Now go through all new devices and announce them for source in sources { - gst::log!(CAT, imp: self, "Source {:?} appeared", source); + gst::log!(CAT, imp = self, "Source {:?} appeared", source); let device = super::Device::new(&source); self.obj().device_add(&device); current_devices_guard.push(device); diff --git a/net/ndi/src/ndisink/imp.rs b/net/ndi/src/ndisink/imp.rs index fb221457..b3a7a7e5 100644 --- a/net/ndi/src/ndisink/imp.rs +++ b/net/ndi/src/ndisink/imp.rs @@ -209,7 +209,7 @@ impl BaseSinkImpl for NdiSink { audio_info: None, }; *state_storage = Some(state); - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -218,7 +218,7 @@ impl BaseSinkImpl for NdiSink { let mut state_storage = self.state.lock().unwrap(); *state_storage = None; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -232,7 +232,7 @@ impl BaseSinkImpl for NdiSink { } fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Setting caps {}", caps); + gst::debug!(CAT, imp = self, "Setting caps {}", caps); let mut state_storage = self.state.lock().unwrap(); let state = match &mut *state_storage { @@ -272,13 +272,13 @@ impl BaseSinkImpl for NdiSink { for (buffer, info, timecode) in audio_meta.buffers() { let frame = crate::ndi::AudioFrame::try_from_buffer(info, buffer, *timecode) .map_err(|_| { - gst::error!(CAT, imp: self, "Unsupported audio frame"); + gst::error!(CAT, imp = self, "Unsupported audio frame"); gst::FlowError::NotNegotiated })?; gst::trace!( CAT, - imp: self, + imp = self, "Sending audio buffer {:?} with timecode {} and format {:?}", buffer, if *timecode < 0 { @@ -317,19 +317,19 @@ impl BaseSinkImpl for NdiSink { let frame = gst_video::VideoFrame::from_buffer_readable(buffer.clone(), info) .map_err(|_| { - gst::error!(CAT, imp: self, "Failed to map buffer"); + gst::error!(CAT, imp = self, "Failed to map buffer"); gst::FlowError::Error })?; let frame = crate::ndi::VideoFrame::try_from_video_frame(frame, ndi_meta, timecode) .map_err(|_| { - gst::error!(CAT, imp: self, "Unsupported video frame"); + gst::error!(CAT, imp = self, "Unsupported video frame"); gst::FlowError::NotNegotiated })?; gst::trace!( CAT, - imp: self, + imp = self, "Sending video buffer {:?} with timecode {} and format {:?}", buffer, if timecode < 0 { @@ -358,13 +358,13 @@ impl BaseSinkImpl for NdiSink { let frame = crate::ndi::AudioFrame::try_from_buffer(info, buffer, timecode).map_err(|_| { - gst::error!(CAT, imp: self, "Unsupported audio frame"); + gst::error!(CAT, imp = self, "Unsupported audio frame"); gst::FlowError::NotNegotiated })?; gst::trace!( CAT, - imp: self, + imp = self, "Sending audio buffer {:?} with timecode {} and format {:?}", buffer, if timecode < 0 { diff --git a/net/ndi/src/ndisinkcombiner/imp.rs b/net/ndi/src/ndisinkcombiner/imp.rs index 289a0d42..d49fb6f3 100644 --- a/net/ndi/src/ndisinkcombiner/imp.rs +++ b/net/ndi/src/ndisinkcombiner/imp.rs @@ -147,7 +147,7 @@ impl ElementImpl for NdiSinkCombiner { let mut audio_pad_storage = self.audio_pad.lock().unwrap(); if audio_pad_storage.as_ref().map(|p| p.upcast_ref()) == Some(pad) { - gst::debug!(CAT, obj: pad, "Release audio pad"); + gst::debug!(CAT, obj = pad, "Release audio pad"); self.parent_release_pad(pad); *audio_pad_storage = None; } @@ -164,20 +164,20 @@ impl AggregatorImpl for NdiSinkCombiner { let mut audio_pad_storage = self.audio_pad.lock().unwrap(); if audio_pad_storage.is_some() { - gst::error!(CAT, imp: self, "Audio pad already requested"); + gst::error!(CAT, imp = self, "Audio pad already requested"); return None; } let sink_templ = self.obj().pad_template("audio").unwrap(); if templ != &sink_templ { - gst::error!(CAT, imp: self, "Wrong pad template"); + gst::error!(CAT, imp = self, "Wrong pad template"); return None; } let pad = gst::PadBuilder::::from_template(templ).build(); *audio_pad_storage = Some(pad.clone()); - gst::debug!(CAT, imp: self, "Requested audio pad"); + gst::debug!(CAT, imp = self, "Requested audio pad"); Some(pad) } @@ -193,7 +193,7 @@ impl AggregatorImpl for NdiSinkCombiner { current_audio_buffers: Vec::new(), }); - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } @@ -202,7 +202,7 @@ impl AggregatorImpl for NdiSinkCombiner { // Drop our state now let _ = self.state.lock().unwrap().take(); - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); Ok(()) } @@ -220,14 +220,14 @@ impl AggregatorImpl for NdiSinkCombiner { let segment = match agg_pad.segment().downcast::() { Ok(segment) => segment, Err(_) => { - gst::error!(CAT, obj: agg_pad, "Only TIME segments supported"); + gst::error!(CAT, obj = agg_pad, "Only TIME segments supported"); return Some(buffer); } }; let pts = buffer.pts(); if pts.is_none() { - gst::error!(CAT, obj: agg_pad, "Only buffers with PTS supported"); + gst::error!(CAT, obj = agg_pad, "Only buffers with PTS supported"); return Some(buffer); } @@ -235,7 +235,7 @@ impl AggregatorImpl for NdiSinkCombiner { gst::trace!( CAT, - obj: agg_pad, + obj = agg_pad, "Clipping buffer {:?} with PTS {} and duration {}", buffer, pts.display(), @@ -270,7 +270,7 @@ impl AggregatorImpl for NdiSinkCombiner { gst::debug!( CAT, - obj: agg_pad, + obj = agg_pad, "Clipping buffer {:?} with PTS {} and duration {}", buffer, pts.display(), @@ -322,7 +322,7 @@ impl AggregatorImpl for NdiSinkCombiner { Err(video_segment) => { gst::error!( CAT, - imp: self, + imp = self, "Video segment of wrong format {:?}", video_segment.format() ); @@ -333,7 +333,7 @@ impl AggregatorImpl for NdiSinkCombiner { Some((video_buffer, video_segment)) } None if !self.video_pad.is_eos() => { - gst::trace!(CAT, imp: self, "Waiting for video buffer"); + gst::trace!(CAT, imp = self, "Waiting for video buffer"); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } None => None, @@ -345,7 +345,7 @@ impl AggregatorImpl for NdiSinkCombiner { Some(audio_buffer) if audio_buffer.size() == 0 => { // Skip empty/gap audio buffer audio_pad.drop_buffer(); - gst::trace!(CAT, imp: self, "Empty audio buffer, waiting for next"); + gst::trace!(CAT, imp = self, "Empty audio buffer, waiting for next"); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } Some(audio_buffer) => { @@ -355,7 +355,7 @@ impl AggregatorImpl for NdiSinkCombiner { Err(audio_segment) => { gst::error!( CAT, - imp: self, + imp = self, "Audio segment of wrong format {:?}", audio_segment.format() ); @@ -366,7 +366,7 @@ impl AggregatorImpl for NdiSinkCombiner { Some((audio_buffer, audio_segment, audio_pad)) } None if !audio_pad.is_eos() => { - gst::trace!(CAT, imp: self, "Waiting for audio buffer"); + gst::trace!(CAT, imp = self, "Waiting for audio buffer"); return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA); } None => None, @@ -395,7 +395,7 @@ impl AggregatorImpl for NdiSinkCombiner { match &state.current_video_buffer { None => { - gst::trace!(CAT, imp: self, "First video buffer, waiting for second"); + gst::trace!(CAT, imp = self, "First video buffer, waiting for second"); state.current_video_buffer = Some(( video_buffer, video_running_time, @@ -419,7 +419,7 @@ impl AggregatorImpl for NdiSinkCombiner { (None, None) => { gst::trace!( CAT, - imp: self, + imp = self, "All pads are EOS and no buffers are queued, finishing" ); return Err(gst::FlowError::Eos); @@ -436,7 +436,7 @@ impl AggregatorImpl for NdiSinkCombiner { Err(video_segment) => { gst::error!( CAT, - imp: self, + imp = self, "Video segment of wrong format {:?}", video_segment.format() ); @@ -445,7 +445,7 @@ impl AggregatorImpl for NdiSinkCombiner { }; let video_pts = video_segment.position_from_running_time(audio_running_time); if video_pts.is_none() { - gst::warning!(CAT, imp: self, "Can't output more audio after video EOS"); + gst::warning!(CAT, imp = self, "Can't output more audio after video EOS"); return Err(gst::FlowError::Eos); } @@ -467,7 +467,7 @@ impl AggregatorImpl for NdiSinkCombiner { let audio_info = match state.audio_info { Some(ref audio_info) => audio_info, None => { - gst::error!(CAT, imp: self, "Have no audio caps"); + gst::error!(CAT, imp = self, "Have no audio caps"); return Err(gst::FlowError::NotNegotiated); } }; @@ -497,7 +497,7 @@ impl AggregatorImpl for NdiSinkCombiner { gst::trace!( CAT, - imp: self, + imp = self, "Including audio buffer {:?} with timecode {}: {} <= {}", audio_buffer, timecode, @@ -538,7 +538,7 @@ impl AggregatorImpl for NdiSinkCombiner { gst::trace!( CAT, - imp: self, + imp = self, "Finishing video buffer {:?}", current_video_buffer ); @@ -570,7 +570,7 @@ impl AggregatorImpl for NdiSinkCombiner { let info = match gst_video::VideoInfo::from_caps(&caps) { Ok(info) => info, Err(_) => { - gst::error!(CAT, obj: pad, "Failed to parse caps {:?}", caps); + gst::error!(CAT, obj = pad, "Failed to parse caps {:?}", caps); return false; } }; @@ -606,7 +606,7 @@ impl AggregatorImpl for NdiSinkCombiner { let info = match gst_audio::AudioInfo::from_caps(&caps) { Ok(info) => info, Err(_) => { - gst::error!(CAT, obj: pad, "Failed to parse caps {:?}", caps); + gst::error!(CAT, obj = pad, "Failed to parse caps {:?}", caps); return false; } }; @@ -617,7 +617,7 @@ impl AggregatorImpl for NdiSinkCombiner { // The video segment is passed through as-is and the video timestamps are preserved EventView::Segment(segment) if pad == &self.video_pad => { let segment = segment.segment(); - gst::debug!(CAT, obj: pad, "Updating segment {:?}", segment); + gst::debug!(CAT, obj = pad, "Updating segment {:?}", segment); let mut state_storage = self.state.lock().unwrap(); let state = match &mut *state_storage { Some(ref mut state) => state, diff --git a/net/ndi/src/ndisrc/imp.rs b/net/ndi/src/ndisrc/imp.rs index 727ab764..14ef8015 100644 --- a/net/ndi/src/ndisrc/imp.rs +++ b/net/ndi/src/ndisrc/imp.rs @@ -169,7 +169,7 @@ impl ObjectImpl for NdiSrc { let ndi_name = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing ndi-name from {:?} to {:?}", settings.ndi_name, ndi_name, @@ -181,7 +181,7 @@ impl ObjectImpl for NdiSrc { let url_address = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing url-address from {:?} to {:?}", settings.url_address, url_address, @@ -193,7 +193,7 @@ impl ObjectImpl for NdiSrc { let receiver_ndi_name = value.get::>().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing receiver-ndi-name from {:?} to {:?}", settings.receiver_ndi_name, receiver_ndi_name, @@ -206,7 +206,7 @@ impl ObjectImpl for NdiSrc { let connect_timeout = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing connect-timeout from {} to {}", settings.connect_timeout, connect_timeout, @@ -218,7 +218,7 @@ impl ObjectImpl for NdiSrc { let timeout = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing timeout from {} to {}", settings.timeout, timeout, @@ -230,7 +230,7 @@ impl ObjectImpl for NdiSrc { let max_queue_length = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing max-queue-length from {} to {}", settings.max_queue_length, max_queue_length, @@ -242,7 +242,7 @@ impl ObjectImpl for NdiSrc { let bandwidth = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing bandwidth from {} to {}", settings.bandwidth, bandwidth, @@ -254,7 +254,7 @@ impl ObjectImpl for NdiSrc { let color_format = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing color format from {:?} to {:?}", settings.color_format, color_format, @@ -266,7 +266,7 @@ impl ObjectImpl for NdiSrc { let timestamp_mode = value.get().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Changing timestamp mode from {:?} to {:?}", settings.timestamp_mode, timestamp_mode @@ -398,7 +398,7 @@ impl BaseSrcImpl for NdiSrc { } fn unlock(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Unlocking",); + gst::debug!(CAT, imp = self, "Unlocking",); if let Some(ref controller) = *self.receiver_controller.lock().unwrap() { controller.set_flushing(true); } @@ -406,7 +406,7 @@ impl BaseSrcImpl for NdiSrc { } fn unlock_stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stop unlocking",); + gst::debug!(CAT, imp = self, "Stop unlocking",); if let Some(ref controller) = *self.receiver_controller.lock().unwrap() { controller.set_flushing(false); } @@ -488,7 +488,7 @@ impl BaseSrcImpl for NdiSrc { let max = settings.max_queue_length as u64 * latency; - gst::debug!(CAT, imp: self, "Returning latency min {} max {}", min, max); + gst::debug!(CAT, imp = self, "Returning latency min {} max {}", min, max); q.set(true, min, max); true } else { @@ -510,7 +510,7 @@ impl BaseSrcImpl for NdiSrc { match state.receiver.take() { Some(recv) => recv, None => { - gst::error!(CAT, imp: self, "Have no receiver"); + gst::error!(CAT, imp = self, "Have no receiver"); return Err(gst::FlowError::Error); } } diff --git a/net/ndi/src/ndisrc/receiver.rs b/net/ndi/src/ndisrc/receiver.rs index eb9452e0..73216ca5 100644 --- a/net/ndi/src/ndisrc/receiver.rs +++ b/net/ndi/src/ndisrc/receiver.rs @@ -101,7 +101,7 @@ impl Drop for ReceiverInner { let element = self.element.upgrade(); if let Some(ref element) = element { - gst::debug!(CAT, obj: element, "Closed NDI connection"); + gst::debug!(CAT, obj = element, "Closed NDI connection"); } } } @@ -220,13 +220,13 @@ impl Receiver { timeout: u32, max_queue_length: usize, ) -> Option { - gst::debug!(CAT, obj: element, "Starting NDI connection..."); + gst::debug!(CAT, obj = element, "Starting NDI connection..."); assert!(ndi_name.is_some() || url_address.is_some()); gst::debug!( CAT, - obj: element, + obj = element, "Connecting to NDI source with NDI name '{:?}' and URL/Address {:?}", ndi_name, url_address, @@ -281,13 +281,13 @@ impl Receiver { let flushing = { let queue = (receiver.0.queue.0).0.lock().unwrap(); if queue.shutdown { - gst::debug!(CAT, obj: element, "Shutting down"); + gst::debug!(CAT, obj = element, "Shutting down"); break; } // If an error happened in the meantime, just go out of here if queue.error.is_some() { - gst::error!(CAT, obj: element, "Error while waiting for connection"); + gst::error!(CAT, obj = element, "Error while waiting for connection"); return; } @@ -302,7 +302,7 @@ impl Receiver { let res = match recv.capture(50) { _ if flushing => { - gst::debug!(CAT, obj: element, "Flushing"); + gst::debug!(CAT, obj = element, "Flushing"); Err(gst::FlowError::Flushing) } Err(_) => { @@ -314,11 +314,11 @@ impl Receiver { Err(gst::FlowError::Error) } Ok(None) if timeout > 0 && timer.elapsed().as_millis() >= timeout as u128 => { - gst::debug!(CAT, obj: element, "Timed out -- assuming EOS",); + gst::debug!(CAT, obj = element, "Timed out -- assuming EOS",); Err(gst::FlowError::Eos) } Ok(None) => { - gst::debug!(CAT, obj: element, "No frame received yet, retry"); + gst::debug!(CAT, obj = element, "No frame received yet, retry"); continue; } Ok(Some(Frame::Video(frame))) => { @@ -331,7 +331,7 @@ impl Receiver { gst::debug!( CAT, - obj: element, + obj = element, "Received video frame at timecode {}: {:?}", (frame.timecode() as u64 * 100).nseconds(), frame, @@ -356,7 +356,7 @@ impl Receiver { gst::debug!( CAT, - obj: element, + obj = element, "Received audio frame at timecode {}: {:?}", (frame.timecode() as u64 * 100).nseconds(), frame, @@ -377,7 +377,7 @@ impl Receiver { let receive_time_real = (glib::real_time() as u64 * 1000).nseconds(); gst::debug!( CAT, - obj: element, + obj = element, "Received metadata frame at timecode {}: {:?}", (frame.timecode() as u64 * 100).nseconds(), frame, @@ -399,7 +399,7 @@ impl Receiver { while queue.buffer_queue.len() > receiver.0.max_queue_length { gst::warning!( CAT, - obj: element, + obj = element, "Dropping old buffer -- queue has {} items", queue.buffer_queue.len() ); @@ -410,7 +410,7 @@ impl Receiver { timer = time::Instant::now(); } Err(gst::FlowError::Eos) => { - gst::debug!(CAT, obj: element, "Signalling EOS"); + gst::debug!(CAT, obj = element, "Signalling EOS"); let mut queue = (receiver.0.queue.0).0.lock().unwrap(); queue.timeout = true; (receiver.0.queue.0).1.notify_one(); @@ -427,7 +427,7 @@ impl Receiver { first_video_frame = true; } Err(err) => { - gst::error!(CAT, obj: element, "Signalling error"); + gst::error!(CAT, obj = element, "Signalling error"); let mut queue = (receiver.0.queue.0).0.lock().unwrap(); if queue.error.is_none() { queue.error = Some(err); diff --git a/net/ndi/src/ndisrcdemux/imp.rs b/net/ndi/src/ndisrcdemux/imp.rs index abfe7adf..b629b3ca 100644 --- a/net/ndi/src/ndisrcdemux/imp.rs +++ b/net/ndi/src/ndisrcdemux/imp.rs @@ -210,13 +210,13 @@ impl NdiSrcDemux { _pad: &gst::Pad, mut buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, imp: self, "Handling buffer {:?}", buffer); + gst::log!(CAT, imp = self, "Handling buffer {:?}", buffer); let mut meta = buffer .make_mut() .meta_mut::() .ok_or_else(|| { - gst::error!(CAT, imp: self, "Buffer without NDI source meta"); + gst::error!(CAT, imp = self, "Buffer without NDI source meta"); gst::FlowError::Error })?; @@ -225,7 +225,7 @@ impl NdiSrcDemux { match ndi_buffer { Buffer::Audio { ref frame, .. } => { - gst::debug!(CAT, imp: self, "Received audio frame {:?}", frame); + gst::debug!(CAT, imp = self, "Received audio frame {:?}", frame); let mut reconfigure = false; let info = self.create_audio_info(frame)?; @@ -239,7 +239,7 @@ impl NdiSrcDemux { gst::FlowError::NotNegotiated })?; - gst::debug!(CAT, imp: self, "Audio caps changed to {}", caps); + gst::debug!(CAT, imp = self, "Audio caps changed to {}", caps); #[allow(irrefutable_let_patterns)] if let AudioInfo::Audio(ref info) = info { @@ -274,7 +274,7 @@ impl NdiSrcDemux { srcpad = pad.clone(); reconfigure |= pad.check_reconfigure(); } else { - gst::debug!(CAT, imp: self, "Adding audio pad"); + gst::debug!(CAT, imp = self, "Adding audio pad"); let templ = self.obj().element_class().pad_template("audio").unwrap(); let pad = gst::Pad::builder_from_template(&templ) @@ -297,7 +297,7 @@ impl NdiSrcDemux { .flags(ev.stream_flags()) .group_id(ev.group_id().unwrap_or_else(|| { // This can't really happen as ndisrc would provide one! - gst::error!(CAT, imp: self, "Upstream provided no group id"); + gst::error!(CAT, imp = self, "Upstream provided no group id"); gst::GroupId::next() })) .build(); @@ -351,16 +351,20 @@ impl NdiSrcDemux { let allowed_caps = srcpad.peer().map(|peer| peer.query_caps(Some(&caps))); state = self.state.lock().unwrap(); - gst::info!(CAT, imp: self, "Allowed audio caps {allowed_caps:?}"); + gst::info!(CAT, imp = self, "Allowed audio caps {allowed_caps:?}"); state.audio_non_interleaved = allowed_caps .is_some_and(|allowed_caps| allowed_caps.can_intersect(&caps)); gst::info!( CAT, - imp: self, + imp = self, "Non-interleaved caps{} supported", - if state.audio_non_interleaved { "" } else { "not" }, + if state.audio_non_interleaved { + "" + } else { + "not" + }, ); } @@ -375,7 +379,7 @@ impl NdiSrcDemux { } } Buffer::Video { ref frame, .. } => { - gst::debug!(CAT, imp: self, "Received video frame {:?}", frame); + gst::debug!(CAT, imp = self, "Received video frame {:?}", frame); let mut reconfigure = false; let info = self.create_video_info(frame)?; @@ -393,7 +397,7 @@ impl NdiSrcDemux { state.ndi_cc_decoder = Some(NDICCMetaDecoder::new(info.width())); } - gst::debug!(CAT, imp: self, "Video caps changed to {}", caps); + gst::debug!(CAT, imp = self, "Video caps changed to {}", caps); state.video_info = Some(info); state.video_caps = Some(caps); state.video_buffer_pool = None; @@ -405,7 +409,7 @@ impl NdiSrcDemux { srcpad = pad.clone(); reconfigure |= pad.check_reconfigure(); } else { - gst::debug!(CAT, imp: self, "Adding video pad"); + gst::debug!(CAT, imp = self, "Adding video pad"); let templ = self.obj().element_class().pad_template("video").unwrap(); let pad = gst::Pad::builder_from_template(&templ) @@ -428,7 +432,7 @@ impl NdiSrcDemux { .flags(ev.stream_flags()) .group_id(ev.group_id().unwrap_or_else(|| { // This can't really happen as ndisrc would provide one! - gst::error!(CAT, imp: self, "Upstream provided no group id"); + gst::error!(CAT, imp = self, "Upstream provided no group id"); gst::GroupId::next() })) .build(); @@ -501,13 +505,13 @@ impl NdiSrcDemux { &frame, ) .ok_or_else(|| { - gst::debug!(CAT, imp: self, "Flushing, dropping buffer"); + gst::debug!(CAT, imp = self, "Flushing, dropping buffer"); gst::FlowError::Flushing })?; buffer = self.create_audio_buffer(&state, pts, duration, discont, resync, frame)?; - gst::log!(CAT, imp: self, "Produced audio buffer {:?}", buffer); + gst::log!(CAT, imp = self, "Produced audio buffer {:?}", buffer); } Buffer::Video { frame, @@ -524,14 +528,14 @@ impl NdiSrcDemux { &frame, ) .ok_or_else(|| { - gst::debug!(CAT, imp: self, "Flushing, dropping buffer"); + gst::debug!(CAT, imp = self, "Flushing, dropping buffer"); gst::FlowError::Flushing })?; buffer = self.create_video_buffer(&mut state, pts, duration, discont, resync, frame)?; - gst::log!(CAT, imp: self, "Produced video buffer {:?}", buffer); + gst::log!(CAT, imp = self, "Produced video buffer {:?}", buffer); } Buffer::Metadata { frame, .. } => { // Only closed caption meta are supported, @@ -553,7 +557,7 @@ impl NdiSrcDemux { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, imp: self, "Handling event {:?}", event); + gst::log!(CAT, imp = self, "Handling event {:?}", event); match event.view() { EventView::StreamStart(ev) => { let state = self.state.lock().unwrap(); @@ -576,7 +580,7 @@ impl NdiSrcDemux { .flags(ev.stream_flags()) .group_id(ev.group_id().unwrap_or_else(|| { // This can't really happen as ndisrc would provide one! - gst::error!(CAT, imp: self, "Upstream provided no group id"); + gst::error!(CAT, imp = self, "Upstream provided no group id"); gst::GroupId::next() })) .build(); @@ -626,7 +630,7 @@ impl NdiSrcDemux { gst::log!( CAT, - imp: self, + imp = self, "Received frame with timecode {}, timestamp {}, duration {}, receive time {}, local time now {}", timecode, timestamp.display(), @@ -653,7 +657,7 @@ impl NdiSrcDemux { TimestampMode::ReceiveTimeTimecode => match res_timecode { Some((pts, duration, discont)) => (pts, duration, discont), None => { - gst::warning!(CAT, imp: self, "Can't calculate timestamp"); + gst::warning!(CAT, imp = self, "Can't calculate timestamp"); (receive_time_gst, duration, false) } }, @@ -661,7 +665,7 @@ impl NdiSrcDemux { Some((pts, duration, discont)) => (pts, duration, discont), None => { if timestamp.is_some() { - gst::warning!(CAT, imp: self, "Can't calculate timestamp"); + gst::warning!(CAT, imp = self, "Can't calculate timestamp"); } (receive_time_gst, duration, false) @@ -694,7 +698,7 @@ impl NdiSrcDemux { gst::log!( CAT, - imp: self, + imp = self, "Calculated PTS {}, duration {}", pts.display(), duration.display(), @@ -879,7 +883,7 @@ impl NdiSrcDemux { let compressed_packet = video_frame.compressed_packet().ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Video packet doesn't have compressed packet start" ); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid video packet"]); @@ -888,7 +892,7 @@ impl NdiSrcDemux { })?; if compressed_packet.fourcc != ndisys::NDIlib_compressed_FourCC_type_H264 { - gst::error!(CAT, imp: self, "Non-H264 video packet"); + gst::error!(CAT, imp = self, "Non-H264 video packet"); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid video packet"]); return Err(gst::FlowError::Error); @@ -917,7 +921,7 @@ impl NdiSrcDemux { let compressed_packet = video_frame.compressed_packet().ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Video packet doesn't have compressed packet start" ); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid video packet"]); @@ -926,7 +930,7 @@ impl NdiSrcDemux { })?; if compressed_packet.fourcc != ndisys::NDIlib_compressed_FourCC_type_HEVC { - gst::error!(CAT, imp: self, "Non-H265 video packet"); + gst::error!(CAT, imp = self, "Non-H265 video packet"); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid video packet"]); return Err(gst::FlowError::Error); @@ -975,7 +979,7 @@ impl NdiSrcDemux { if let Some(meta) = metadata.metadata() { let res = ndi_cc_decoder.decode(meta); if let Err(err) = res { - gst::debug!(CAT, imp: self, "Failed to parse NDI metadata: {err}"); + gst::debug!(CAT, imp = self, "Failed to parse NDI metadata: {err}"); } } } @@ -987,7 +991,11 @@ impl NdiSrcDemux { captions.extend_from_slice(&c); } Err(err) => { - gst::debug!(CAT, imp: self, "Failed to parse NDI video frame metadata: {err}"); + gst::debug!( + CAT, + imp = self, + "Failed to parse NDI video frame metadata: {err}" + ); } } } @@ -1093,7 +1101,11 @@ impl NdiSrcDemux { if src_stride == info.stride()[0] as usize { Ok(gst::Buffer::from_slice(WrappedVideoFrame(video_frame))) } else { - gst::debug!(gst::CAT_PERFORMANCE, imp: self, "Copying raw video frame"); + gst::debug!( + gst::CAT_PERFORMANCE, + imp = self, + "Copying raw video frame" + ); let src = video_frame.data().ok_or(gst::FlowError::Error)?; @@ -1117,7 +1129,11 @@ impl NdiSrcDemux { let plane_size = video_frame.yres() as usize * src_stride; if src.len() < plane_size || src_stride < line_bytes { - gst::error!(CAT, imp: self, "Video packet has wrong stride or size"); + gst::error!( + CAT, + imp = self, + "Video packet has wrong stride or size" + ); gst::element_imp_error!( self, gst::StreamError::Format, @@ -1142,7 +1158,11 @@ impl NdiSrcDemux { if src_stride == info.stride()[0] as usize { Ok(gst::Buffer::from_slice(WrappedVideoFrame(video_frame))) } else { - gst::debug!(gst::CAT_PERFORMANCE, imp: self, "Copying raw video frame"); + gst::debug!( + gst::CAT_PERFORMANCE, + imp = self, + "Copying raw video frame" + ); let src = video_frame.data().ok_or(gst::FlowError::Error)?; @@ -1159,7 +1179,11 @@ impl NdiSrcDemux { let plane_size = video_frame.yres() as usize * src_stride; if src.len() < 2 * plane_size || src_stride < line_bytes { - gst::error!(CAT, imp: self, "Video packet has wrong stride or size"); + gst::error!( + CAT, + imp = self, + "Video packet has wrong stride or size" + ); gst::element_imp_error!( self, gst::StreamError::Format, @@ -1208,7 +1232,11 @@ impl NdiSrcDemux { { Ok(gst::Buffer::from_slice(WrappedVideoFrame(video_frame))) } else { - gst::debug!(gst::CAT_PERFORMANCE, imp: self, "Copying raw video frame"); + gst::debug!( + gst::CAT_PERFORMANCE, + imp = self, + "Copying raw video frame" + ); let src = video_frame.data().ok_or(gst::FlowError::Error)?; @@ -1228,7 +1256,11 @@ impl NdiSrcDemux { let plane_size1 = ((video_frame.yres() as usize + 1) / 2) * src_stride1; if src.len() < plane_size + 2 * plane_size1 || src_stride < line_bytes { - gst::error!(CAT, imp: self, "Video packet has wrong stride or size"); + gst::error!( + CAT, + imp = self, + "Video packet has wrong stride or size" + ); gst::element_imp_error!( self, gst::StreamError::Format, @@ -1294,7 +1326,7 @@ impl NdiSrcDemux { let compressed_packet = video_frame.compressed_packet().ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Video packet doesn't have compressed packet start" ); gst::element_imp_error!( @@ -1388,7 +1420,7 @@ impl NdiSrcDemux { let compressed_packet = audio_frame.compressed_packet().ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Audio packet doesn't have compressed packet start" ); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid audio packet"]); @@ -1397,7 +1429,7 @@ impl NdiSrcDemux { })?; if compressed_packet.fourcc != ndisys::NDIlib_compressed_FourCC_type_AAC { - gst::error!(CAT, imp: self, "Non-AAC audio packet"); + gst::error!(CAT, imp = self, "Non-AAC audio packet"); gst::element_imp_error!(self, gst::StreamError::Format, ["Invalid audio packet"]); return Err(gst::FlowError::Error); @@ -1462,7 +1494,7 @@ impl NdiSrcDemux { buffer } else { - gst::debug!(gst::CAT_PERFORMANCE, imp: self, "Copying raw audio frame"); + gst::debug!(gst::CAT_PERFORMANCE, imp = self, "Copying raw audio frame"); let src = audio_frame.data().ok_or(gst::FlowError::Error)?; let mut buffer = gst::Buffer::with_size(buff_size).unwrap(); @@ -1536,7 +1568,7 @@ impl NdiSrcDemux { #[cfg(feature = "advanced-sdk")] AudioInfo::Opus { .. } => { let data = audio_frame.data().ok_or_else(|| { - gst::error!(CAT, imp: self, "Audio packet has no data"); + gst::error!(CAT, imp = self, "Audio packet has no data"); gst::element_imp_error!( self, gst::StreamError::Format, @@ -1553,7 +1585,7 @@ impl NdiSrcDemux { let compressed_packet = audio_frame.compressed_packet().ok_or_else(|| { gst::error!( CAT, - imp: self, + imp = self, "Audio packet doesn't have compressed packet start" ); gst::element_imp_error!( @@ -1798,7 +1830,7 @@ impl Observations { gst::trace!( CAT, - obj: element, + obj = element, "Local time {}, remote time {}, slope correct {}/{}", local_time.nseconds(), remote_time.nseconds(), @@ -1832,7 +1864,7 @@ impl Observations { _ => { gst::debug!( CAT, - obj: element, + obj = element, "Initializing base time: local {}, remote {}", local_time.nseconds(), remote_time.nseconds(), @@ -1880,7 +1912,7 @@ impl Observations { if !(0.5..1.5).contains(&scaled_slope) { gst::warning!( CAT, - obj: element, + obj = element, "Too small/big slope {}, resetting", scaled_slope ); @@ -1921,7 +1953,7 @@ impl Observations { .mul_div_round(inner.slope_correction.0, inner.slope_correction.1)?; gst::debug!( CAT, - obj: element, + obj = element, "Initializing base time: local {}, remote {}, slope correction {}/{}", local_time.nseconds(), remote_time.nseconds(), @@ -1942,7 +1974,7 @@ impl Observations { gst::trace!( CAT, - obj: element, + obj = element, "Local diff {}, remote diff {}, delta {}", local_diff.nseconds(), remote_diff.nseconds(), @@ -1954,7 +1986,7 @@ impl Observations { { gst::warning!( CAT, - obj: element, + obj = element, "Delta {} too far from skew {}, resetting", delta, inner.skew @@ -1964,7 +1996,7 @@ impl Observations { gst::debug!( CAT, - obj: element, + obj = element, "Initializing base time: local {}, remote {}", local_time.nseconds(), remote_time.nseconds(), @@ -2018,12 +2050,12 @@ impl Observations { gst::trace!( CAT, - obj: element, + obj = element, "Skew {}, min delta {}", inner.skew, inner.min_delta ); - gst::trace!(CAT, obj: element, "Outputting {}", out_time.nseconds()); + gst::trace!(CAT, obj = element, "Outputting {}", out_time.nseconds()); Some((out_time.nseconds(), duration, false)) } diff --git a/net/onvif/src/onvifmetadatacombiner/imp.rs b/net/onvif/src/onvifmetadatacombiner/imp.rs index 9cd56f53..2c6a3256 100644 --- a/net/onvif/src/onvifmetadatacombiner/imp.rs +++ b/net/onvif/src/onvifmetadatacombiner/imp.rs @@ -133,7 +133,7 @@ impl ElementImpl for OnvifMetadataCombiner { ) -> Option { gst::error!( CAT, - imp: self, + imp = self, "onvifmetadatacombiner doesn't expose request pads" ); @@ -143,7 +143,7 @@ impl ElementImpl for OnvifMetadataCombiner { fn release_pad(&self, _pad: &gst::Pad) { gst::error!( CAT, - imp: self, + imp = self, "onvifmetadatacombiner doesn't expose request pads" ); } @@ -172,7 +172,7 @@ impl OnvifMetadataCombiner { if meta_ts <= end { gst::trace!( CAT, - imp: self, + imp = self, "Consuming meta buffer at {} before the media end timestamp {}", meta_ts, end @@ -182,7 +182,7 @@ impl OnvifMetadataCombiner { } else { gst::trace!( CAT, - imp: self, + imp = self, "Consumed all meta buffers before the media end timestamp {}", end ); @@ -192,9 +192,9 @@ impl OnvifMetadataCombiner { let is_eos = self.meta_sink_pad.is_eos(); if is_eos { - gst::debug!(CAT, imp: self, "Meta pad is EOS"); + gst::debug!(CAT, imp = self, "Meta pad is EOS"); } else { - gst::trace!(CAT, imp: self, "Need more meta until time {}", end); + gst::trace!(CAT, imp = self, "Need more meta until time {}", end); } Ok(is_eos) @@ -209,7 +209,7 @@ impl OnvifMetadataCombiner { Some(duration) => { gst::trace!( CAT, - imp: self, + imp = self, "Current media buffer has a duration, using it: {}", duration ); @@ -223,7 +223,7 @@ impl OnvifMetadataCombiner { gst::trace!( CAT, - imp: self, + imp = self, "calculated duration for current media buffer from next buffer: {}", duration ); @@ -233,7 +233,7 @@ impl OnvifMetadataCombiner { None => { gst::trace!( CAT, - imp: self, + imp = self, "could not calculate duration for current media buffer" ); Some(gst::ClockTime::ZERO) @@ -242,14 +242,14 @@ impl OnvifMetadataCombiner { } else if timeout { gst::trace!( CAT, - imp: self, + imp = self, "could not calculate duration for current media buffer" ); Some(gst::ClockTime::ZERO) } else { gst::trace!( CAT, - imp: self, + imp = self, "No next buffer to peek at yet to calculate duration" ); None @@ -273,7 +273,7 @@ impl OnvifMetadataCombiner { { gst::trace!( CAT, - imp: self, + imp = self, "Handling media buffer with reference timestamp {}", current_media_start ); @@ -284,7 +284,7 @@ impl OnvifMetadataCombiner { gst::trace!( CAT, - imp: self, + imp = self, "Consuming meta for media buffer from {}-{}", current_media_start, end @@ -293,7 +293,7 @@ impl OnvifMetadataCombiner { if self.consume_meta(state, end)? { gst::trace!( CAT, - imp: self, + imp = self, "Consumed all meta for media buffer from {}-{}", current_media_start, end @@ -302,7 +302,7 @@ impl OnvifMetadataCombiner { } else if timeout { gst::warning!( CAT, - imp: self, + imp = self, "Timed out but did not receive all meta for media buffer from {}-{} yet", current_media_start, end @@ -311,7 +311,7 @@ impl OnvifMetadataCombiner { } else { gst::trace!( CAT, - imp: self, + imp = self, "Waiting for more meta for media buffer from {}-{}", current_media_start, end @@ -323,7 +323,7 @@ impl OnvifMetadataCombiner { None => { gst::trace!( CAT, - imp: self, + imp = self, "Can't calculate media buffer duration yet, waiting for next" ); @@ -334,14 +334,14 @@ impl OnvifMetadataCombiner { } else { gst::trace!( CAT, - imp: self, + imp = self, "Returning media buffer without reference timestamp" ); Ok(Some(current_media_buffer)) } } else { - gst::trace!(CAT, imp: self, "No media buffer queued currently"); + gst::trace!(CAT, imp = self, "No media buffer queued currently"); Ok(None) } } @@ -349,7 +349,7 @@ impl OnvifMetadataCombiner { impl AggregatorImpl for OnvifMetadataCombiner { fn aggregate(&self, timeout: bool) -> Result { - gst::trace!(CAT, imp: self, "aggregate, timeout: {}", timeout); + gst::trace!(CAT, imp = self, "aggregate, timeout: {}", timeout); let mut state = self.state.lock().unwrap(); @@ -378,16 +378,16 @@ impl AggregatorImpl for OnvifMetadataCombiner { .pts() .opt_add(buffer.duration().unwrap_or(gst::ClockTime::ZERO)); - gst::log!(CAT, imp: self, "Updating position: {:?}", position); + gst::log!(CAT, imp = self, "Updating position: {:?}", position); self.obj().set_position(position); self.finish_buffer(buffer) } else if self.media_sink_pad.is_eos() { - gst::debug!(CAT, imp: self, "EOS"); + gst::debug!(CAT, imp = self, "EOS"); Err(gst::FlowError::Eos) } else { - gst::trace!(CAT, imp: self, "Need more data"); + gst::trace!(CAT, imp = self, "Need more data"); Err(AGGREGATOR_FLOW_NEED_DATA) } } @@ -422,7 +422,7 @@ impl AggregatorImpl for OnvifMetadataCombiner { match event.view() { EventView::Caps(e) => { if aggregator_pad.upcast_ref::() == &self.media_sink_pad { - gst::info!(CAT, imp: self, "Pushing caps {}", e.caps()); + gst::info!(CAT, imp = self, "Pushing caps {}", e.caps()); self.obj().set_src_caps(&e.caps_owned()); } diff --git a/net/onvif/src/onvifmetadatadepay/imp.rs b/net/onvif/src/onvifmetadatadepay/imp.rs index 05fcc2c3..58542d49 100644 --- a/net/onvif/src/onvifmetadatadepay/imp.rs +++ b/net/onvif/src/onvifmetadatadepay/imp.rs @@ -116,7 +116,7 @@ impl RTPBaseDepayloadImpl for OnvifMetadataDepay { .flags() .contains(gst::BufferFlags::DISCONT) { - gst::debug!(CAT, imp: self, "processing discont RTP buffer"); + gst::debug!(CAT, imp = self, "processing discont RTP buffer"); state.adapter.clear(); } @@ -148,7 +148,12 @@ impl RTPBaseDepayloadImpl for OnvifMetadataDepay { let utf8 = match std::str::from_utf8(map.as_ref()) { Ok(s) => s, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to decode payload as UTF-8: {}", err); + gst::warning!( + CAT, + imp = self, + "Failed to decode payload as UTF-8: {}", + err + ); return None; } @@ -178,7 +183,7 @@ impl RTPBaseDepayloadImpl for OnvifMetadataDepay { } }, Err(err) => { - gst::warning!(CAT, imp: self, "Invalid XML in payload: {}", err); + gst::warning!(CAT, imp = self, "Invalid XML in payload: {}", err); return None; } @@ -192,7 +197,7 @@ impl RTPBaseDepayloadImpl for OnvifMetadataDepay { if !forward { gst::warning!( CAT, - imp: self, + imp = self, "document must start with tt:MetadataStream element", ); diff --git a/net/onvif/src/onvifmetadataoverlay/imp.rs b/net/onvif/src/onvifmetadataoverlay/imp.rs index 6003ff3a..b9514230 100644 --- a/net/onvif/src/onvifmetadataoverlay/imp.rs +++ b/net/onvif/src/onvifmetadataoverlay/imp.rs @@ -110,7 +110,7 @@ impl OnvifMetadataOverlay { gst::debug!( CAT, - imp: self, + imp = self, "upstream has meta: {}, downstream accepts meta: {}", upstream_has_meta, downstream_accepts_meta @@ -133,7 +133,7 @@ impl OnvifMetadataOverlay { .find_allocation_meta::() .is_some(); - gst::debug!(CAT, imp: self, "attach meta: {}", attach); + gst::debug!(CAT, imp = self, "attach meta: {}", attach); self.state.lock().unwrap().attach = attach; @@ -316,7 +316,7 @@ impl OnvifMetadataOverlay { gst::debug!( CAT, - imp: self, + imp = self, "Rendering shape with tag {:?} x {} y {} width {} height {}", shape.tag, shape.x, @@ -334,7 +334,7 @@ impl OnvifMetadataOverlay { ) { Some(ret) => ret, None => { - gst::error!(CAT, imp: self, "Failed to render buffer"); + gst::error!(CAT, imp = self, "Failed to render buffer"); state.composition = None; return; } @@ -360,7 +360,7 @@ impl OnvifMetadataOverlay { pad: &gst::Pad, mut buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::trace!(CAT, obj = pad, "Handling buffer {:?}", buffer); if self.srcpad.check_reconfigure() { if let Err(err) = self.negotiate() { @@ -384,7 +384,7 @@ impl OnvifMetadataOverlay { let mut shapes: Vec = Vec::new(); if let Ok(frames) = s.get::("frames") { - gst::log!(CAT, imp: self, "Overlaying {} frames", frames.len()); + gst::log!(CAT, imp = self, "Overlaying {} frames", frames.len()); // Metadata for multiple frames may be attached to this frame, either because: // @@ -451,14 +451,14 @@ impl OnvifMetadataOverlay { == Some(crate::ONVIF_METADATA_SCHEMA) }) { - gst::trace!(CAT, imp: self, "Handling object {:?}", object); + gst::trace!(CAT, imp = self, "Handling object {:?}", object); let object_id = match object.attributes.get("ObjectId") { Some(id) => id.to_string(), None => { gst::warning!( CAT, - imp: self, + imp = self, "XML Object with no ObjectId" ); continue; @@ -503,7 +503,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "XML Shape with no BoundingBox" ); continue; @@ -519,7 +519,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "BoundingBox with no left attribute" ); continue; @@ -535,7 +535,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "BoundingBox with no right attribute" ); continue; @@ -551,7 +551,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "BoundingBox with no top attribute" ); continue; @@ -567,7 +567,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "BoundingBox with no bottom attribute" ); continue; @@ -603,7 +603,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "Point with no x attribute" ); continue; @@ -619,7 +619,7 @@ impl OnvifMetadataOverlay { None => { gst::warning!( CAT, - imp: self, + imp = self, "Point with no y attribute" ); continue; @@ -669,7 +669,7 @@ impl OnvifMetadataOverlay { .unwrap(); if composition.blend(&mut frame).is_err() { - gst::error!(CAT, obj: pad, "Failed to blend composition"); + gst::error!(CAT, obj = pad, "Failed to blend composition"); } } } @@ -681,7 +681,7 @@ impl OnvifMetadataOverlay { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(c) => { @@ -840,7 +840,7 @@ impl ElementImpl for OnvifMetadataOverlay { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/net/onvif/src/onvifmetadataparse/imp.rs b/net/onvif/src/onvifmetadataparse/imp.rs index 92e770ae..fb91940f 100644 --- a/net/onvif/src/onvifmetadataparse/imp.rs +++ b/net/onvif/src/onvifmetadataparse/imp.rs @@ -177,7 +177,7 @@ impl OnvifMetadataParse { ) -> Result { gst::log!( CAT, - obj: pad, + obj = pad, "Handling buffer {:?} with UTC time {}", buffer, crate::lookup_reference_timestamp(&buffer).display() @@ -188,7 +188,7 @@ impl OnvifMetadataParse { let pts = match buffer.pts() { Some(pts) => pts, None => { - gst::error!(CAT, obj: pad, "Need buffers with PTS"); + gst::error!(CAT, obj = pad, "Need buffers with PTS"); return Err(gst::FlowError::Error); } }; @@ -200,7 +200,7 @@ impl OnvifMetadataParse { .position() .map_or(true, |position| position < pts) { - gst::trace!(CAT, imp: self, "Input position updated to {}", pts); + gst::trace!(CAT, imp = self, "Input position updated to {}", pts); state.in_segment.set_position(pts); } @@ -228,7 +228,7 @@ impl OnvifMetadataParse { None => { gst::error!( CAT, - obj: pad, + obj = pad, "Too big running time difference between initial running time {:?} and current running time {:?}", initial_running_time, running_time, @@ -243,7 +243,7 @@ impl OnvifMetadataParse { Some(Negative(initial_utc_time)) => { gst::warning!( CAT, - obj: pad, + obj = pad, "Initial UTC time is negative: -{}, dropping buffer", initial_utc_time ); @@ -254,7 +254,7 @@ impl OnvifMetadataParse { None => { gst::warning!( CAT, - obj: pad, + obj = pad, "Can't calculate initial UTC time, dropping buffer" ); state.pre_queued_buffers.remove(idx.unwrap()); @@ -267,7 +267,7 @@ impl OnvifMetadataParse { gst::info!( CAT, - obj: pad, + obj = pad, "Calculated initial UTC/running time mapping: {}/{:?}", initial_utc_time, initial_running_time @@ -294,7 +294,7 @@ impl OnvifMetadataParse { if running_time.saturating_sub(front_running_time) >= state.configured_latency { gst::warning!( CAT, - obj: pad, + obj = pad, "Received no UTC time in the first {}", state.configured_latency ); @@ -310,7 +310,7 @@ impl OnvifMetadataParse { self.queue(&mut state, buffer, running_time)?; let res = self.wake_up_output(state); - gst::trace!(CAT, obj: pad, "Returning {:?}", res); + gst::trace!(CAT, obj = pad, "Returning {:?}", res); res } @@ -373,8 +373,9 @@ impl OnvifMetadataParse { .and_then(|ns| ns.nseconds().checked_add(crate::PRIME_EPOCH_OFFSET)); let Some(dt_unix_ns) = dt_unix_ns else { - gst::warning!(CAT, - imp: self, + gst::warning!( + CAT, + imp = self, "Frame with unrepresentable UTC time {}", dt, ); @@ -383,7 +384,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Queueing frame with UTC time {}", dt_unix_ns ); @@ -435,7 +436,7 @@ impl OnvifMetadataParse { if state.upstream_latency.is_none() { drop(state); - gst::debug!(CAT, imp: self, "Have no upstream latency yet, querying"); + gst::debug!(CAT, imp = self, "Have no upstream latency yet, querying"); let mut q = gst::query::Latency::new(); let res = self.sinkpad.peer_query(&mut q); @@ -446,7 +447,7 @@ impl OnvifMetadataParse { gst::debug!( CAT, - imp: self, + imp = self, "Latency query response: live {} min {} max {}", live, min, @@ -457,7 +458,7 @@ impl OnvifMetadataParse { } else { gst::warning!( CAT, - imp: self, + imp = self, "Can't query upstream latency -- assuming non-live upstream for now" ); } @@ -465,7 +466,7 @@ impl OnvifMetadataParse { // Consider waking up the source element thread if self.sinkpad.pad_flags().contains(gst::PadFlags::EOS) { - gst::trace!(CAT, imp: self, "Scheduling immediate wakeup at EOS",); + gst::trace!(CAT, imp = self, "Scheduling immediate wakeup at EOS",); if let Some(clock_wait) = state.clock_wait.take() { clock_wait.unschedule(); @@ -483,7 +484,7 @@ impl OnvifMetadataParse { if queued_time.is_some_and(|queued_time| queued_time >= state.configured_latency) { gst::trace!( CAT, - imp: self, + imp = self, "Scheduling immediate wakeup -- queued time {}", queued_time.display() ); @@ -520,7 +521,12 @@ impl OnvifMetadataParse { .and_then(|queued_time| queued_time.positive()) .unwrap_or(gst::ClockTime::ZERO); - gst::trace!(CAT, imp: self, "Currently queued {}", queued_time.display()); + gst::trace!( + CAT, + imp = self, + "Currently queued {}", + queued_time.display() + ); Some(queued_time) } @@ -546,7 +552,7 @@ impl OnvifMetadataParse { _ => { gst::warning!( CAT, - imp: self, + imp = self, "Upstream is live but have no clock -- assuming non-live for now" ); return false; @@ -572,7 +578,7 @@ impl OnvifMetadataParse { } gst::trace!( CAT, - imp: self, + imp = self, "Scheduling timer for {} / running time {}, now {}", earliest_clock_time, earliest_running_time.unwrap().display(), @@ -585,7 +591,7 @@ impl OnvifMetadataParse { if let Some(clock_wait) = state.clock_wait.take() { clock_wait.unschedule(); } - gst::trace!(CAT, imp: self, "Scheduling immediate wakeup"); + gst::trace!(CAT, imp = self, "Scheduling immediate wakeup"); } true @@ -610,7 +616,7 @@ impl OnvifMetadataParse { gst::log!( CAT, - imp: self, + imp = self, "Draining up to UTC time {} / running time {} from current position {} / running time {}", drain_utc_time.display(), drain_utc_time @@ -658,7 +664,7 @@ impl OnvifMetadataParse { }); segment.set_position(current_position); - gst::debug!(CAT, imp: self, "Configuring output segment {:?}", segment); + gst::debug!(CAT, imp = self, "Configuring output segment {:?}", segment); *out_segment = segment; @@ -680,7 +686,7 @@ impl OnvifMetadataParse { { gst::trace!( CAT, - imp: self, + imp = self, "Output position updated to {}", current_position ); @@ -703,7 +709,7 @@ impl OnvifMetadataParse { match utc_time_to_pts(out_segment, utc_time_running_time_mapping, utc_time) { Some(frame_pts) => frame_pts, None => { - gst::warning!(CAT, imp: self, "UTC time {} outside segment", utc_time); + gst::warning!(CAT, imp = self, "UTC time {} outside segment", utc_time); gst::ClockTime::ZERO } }; @@ -732,7 +738,7 @@ impl OnvifMetadataParse { { gst::warning!( CAT, - imp: self, + imp = self, "Dropping frame with UTC time {} / PTS {} that is too late by {} at current position {}", utc_time, frame_pts, @@ -748,7 +754,7 @@ impl OnvifMetadataParse { } else if diff > gst::ClockTime::ZERO { gst::warning!( CAT, - imp: self, + imp = self, "Frame in the past by {} with UTC time {} / PTS {} at current position {}", diff, utc_time, @@ -764,7 +770,7 @@ impl OnvifMetadataParse { .position() .map_or(true, |position| position < frame_pts) { - gst::trace!(CAT, imp: self, "Output position updated to {}", frame_pts); + gst::trace!(CAT, imp = self, "Output position updated to {}", frame_pts); out_segment.set_position(frame_pts); } @@ -776,7 +782,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Producing frame with UTC time {} / PTS {}", utc_time, frame_pts @@ -806,7 +812,7 @@ impl OnvifMetadataParse { ..xmltree::EmitterConfig::default() }, ) { - gst::error!(CAT, imp: self, "Can't serialize XML element: {}", err); + gst::error!(CAT, imp = self, "Can't serialize XML element: {}", err); for event in eos_events { data.push(BufferOrEvent::Event(event)); } @@ -833,7 +839,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Position after draining {} / running time {} -- queued now {} / {} items", out_segment.position().display(), out_segment @@ -847,7 +853,7 @@ impl OnvifMetadataParse { } fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { gst::EventView::FlushStart(_) => { @@ -902,14 +908,14 @@ impl OnvifMetadataParse { gst::debug!( CAT, - obj: pad, + obj = pad, "Configuring input segment {:?}", segment ); state.in_segment = segment; } None => { - gst::error!(CAT, obj: pad, "Non-TIME segment"); + gst::error!(CAT, obj = pad, "Non-TIME segment"); return false; } } @@ -934,7 +940,7 @@ impl OnvifMetadataParse { state.configured_latency = latency; drop(state); - gst::debug!(CAT, obj: pad, "Configuring latency of {}", latency); + gst::debug!(CAT, obj = pad, "Configuring latency of {}", latency); if previous_latency != latency { let element = self.obj(); let _ = element.post_message( @@ -957,7 +963,7 @@ impl OnvifMetadataParse { { gst::trace!( CAT, - imp: self, + imp = self, "Input position updated to {}", current_position ); @@ -983,7 +989,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Queueing EOS event with UTC time {} / running time {}", eos_utc_time, utc_time_to_running_time(*utc_time_running_time_mapping, eos_utc_time) @@ -1003,7 +1009,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Queueing event with UTC time {} / running time {}", current_utc_time, current_running_time.display(), @@ -1021,7 +1027,7 @@ impl OnvifMetadataParse { if matches!(ev, gst::EventView::Eos(_)) { gst::error!( CAT, - imp: self, + imp = self, "Got EOS event before creating UTC/running time mapping" ); gst::element_imp_error!( @@ -1038,7 +1044,7 @@ impl OnvifMetadataParse { gst::trace!( CAT, - imp: self, + imp = self, "Pre-queueing event with running time {}", current_running_time.display() ); @@ -1052,7 +1058,7 @@ impl OnvifMetadataParse { } fn sink_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { gst::QueryViewMut::Caps(q) => { @@ -1075,7 +1081,7 @@ impl OnvifMetadataParse { true } gst::QueryViewMut::Allocation(_) => { - gst::fixme!(CAT, obj: pad, "Dropping allocation query"); + gst::fixme!(CAT, obj = pad, "Dropping allocation query"); false } _ => gst::Pad::query_default(pad, Some(&*self.obj()), query), @@ -1083,7 +1089,7 @@ impl OnvifMetadataParse { } fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { gst::EventView::FlushStart(_) => { @@ -1120,7 +1126,7 @@ impl OnvifMetadataParse { } fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { gst::QueryViewMut::Caps(q) => { @@ -1158,7 +1164,7 @@ impl OnvifMetadataParse { gst::debug!( CAT, - obj: pad, + obj = pad, "Latency query response: live {} min {} max {}", live, min, @@ -1181,17 +1187,17 @@ impl OnvifMetadataParse { if let Err(err) = self_.src_loop() { match err { gst::FlowError::Flushing => { - gst::debug!(CAT, imp: self_, "Pausing after flow {:?}", err); + gst::debug!(CAT, imp = self_, "Pausing after flow {:?}", err); } gst::FlowError::Eos => { let _ = self_.srcpad.push_event(gst::event::Eos::builder().build()); - gst::debug!(CAT, imp: self_, "Pausing after flow {:?}", err); + gst::debug!(CAT, imp = self_, "Pausing after flow {:?}", err); } _ => { let _ = self_.srcpad.push_event(gst::event::Eos::builder().build()); - gst::error!(CAT, imp: self_, "Pausing after flow {:?}", err); + gst::error!(CAT, imp = self_, "Pausing after flow {:?}", err); gst::element_imp_error!( self_, @@ -1269,7 +1275,7 @@ impl OnvifMetadataParse { let mut drain_running_time = None; if self.sinkpad.pad_flags().contains(gst::PadFlags::EOS) { // Drain completely - gst::debug!(CAT, imp: self, "Sink pad is EOS, draining"); + gst::debug!(CAT, imp = self, "Sink pad is EOS, draining"); } else if let Some((true, min_latency)) = state.upstream_latency { // Drain until the current clock running time minus the configured latency when // live @@ -1279,7 +1285,7 @@ impl OnvifMetadataParse { ) { gst::trace!( CAT, - imp: self, + imp = self, "Clock time now {}, last timer was at {} and current timer at {}", now, last_clock_wait_time.display(), @@ -1333,13 +1339,13 @@ impl OnvifMetadataParse { if data.is_empty() { if self.sinkpad.pad_flags().contains(gst::PadFlags::EOS) { state.last_flow_ret = Err(gst::FlowError::Eos); - gst::debug!(CAT, imp: self, "EOS, waiting on cond"); + gst::debug!(CAT, imp = self, "EOS, waiting on cond"); state = self.cond.wait(state).unwrap(); - gst::trace!(CAT, imp: self, "Woke up"); + gst::trace!(CAT, imp = self, "Woke up"); } else if let Some(clock_wait) = state.clock_wait.clone() { gst::trace!( CAT, - imp: self, + imp = self, "Waiting on timer with time {}, now {}", clock_wait.time(), clock_wait.clock().and_then(|clock| clock.time()).display(), @@ -1358,13 +1364,13 @@ impl OnvifMetadataParse { match res { (Ok(_), jitter) => { - gst::trace!(CAT, imp: self, "Woke up after waiting for {}", jitter); + gst::trace!(CAT, imp = self, "Woke up after waiting for {}", jitter); last_clock_wait_time = Some(clock_wait.time()); } (Err(err), jitter) => { gst::trace!( CAT, - imp: self, + imp = self, "Woke up with error {:?} and jitter {}", err, jitter @@ -1372,9 +1378,9 @@ impl OnvifMetadataParse { } } } else { - gst::debug!(CAT, imp: self, "Waiting on cond"); + gst::debug!(CAT, imp = self, "Waiting on cond"); state = self.cond.wait(state).unwrap(); - gst::trace!(CAT, imp: self, "Woke up"); + gst::trace!(CAT, imp = self, "Woke up"); } // And retry if there's anything to drain now. @@ -1385,15 +1391,15 @@ impl OnvifMetadataParse { let mut res = Ok(()); - gst::trace!(CAT, imp: self, "Pushing {} items downstream", data.len()); + gst::trace!(CAT, imp = self, "Pushing {} items downstream", data.len()); for data in data { match data { BufferOrEvent::Event(event) => { - gst::trace!(CAT, imp: self, "Pushing event {:?}", event); + gst::trace!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } BufferOrEvent::Buffer(buffer) => { - gst::trace!(CAT, imp: self, "Pushing buffer {:?}", buffer); + gst::trace!(CAT, imp = self, "Pushing buffer {:?}", buffer); if let Err(err) = self.srcpad.push(buffer) { res = Err(err); break; @@ -1401,7 +1407,7 @@ impl OnvifMetadataParse { } } } - gst::trace!(CAT, imp: self, "Pushing returned {:?}", res); + gst::trace!(CAT, imp = self, "Pushing returned {:?}", res); state = self.state.lock().unwrap(); // If flushing or any other error then just return here @@ -1601,7 +1607,7 @@ impl ElementImpl for OnvifMetadataParse { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if matches!(transition, gst::StateChange::ReadyToPaused) { let mut state = self.state.lock().unwrap(); diff --git a/net/quinn/src/quinnquicsink/imp.rs b/net/quinn/src/quinnquicsink/imp.rs index 216dd6bb..052f1a70 100644 --- a/net/quinn/src/quinnquicsink/imp.rs +++ b/net/quinn/src/quinnquicsink/imp.rs @@ -147,7 +147,7 @@ impl ElementImpl for QuinnQuicSink { { gst::error!( CAT, - imp: self, + imp = self, "Certificate or private key file not provided for secure connection" ); return Err(gst::StateChangeError); @@ -456,17 +456,17 @@ impl BaseSinkImpl for QuinnQuicSink { stream: s, }); - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } Ok(Err(e)) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Connection aborted"); + gst::warning!(CAT, imp = self, "Connection aborted"); Ok(()) } WaitError::FutureError(err) => { - gst::error!(CAT, imp: self, "Connection request failed: {}", err); + gst::error!(CAT, imp = self, "Connection request failed: {}", err); Err(gst::error_msg!( gst::ResourceError::Failed, ["Connection request failed: {}", err] @@ -474,7 +474,7 @@ impl BaseSinkImpl for QuinnQuicSink { } }, Err(e) => { - gst::error!(CAT, imp: self, "Failed to establish a connection: {:?}", e); + gst::error!(CAT, imp = self, "Failed to establish a connection: {:?}", e); Err(gst::error_msg!( gst::ResourceError::Failed, ["Failed to establish a connection: {:?}", e] @@ -505,17 +505,17 @@ impl BaseSinkImpl for QuinnQuicSink { Ok(r) => { if let Err(e) = r { close_msg = format!("Stream finish request error: {}", e); - gst::error!(CAT, imp: self, "{}", close_msg); + gst::error!(CAT, imp = self, "{}", close_msg); } } Err(e) => match e { WaitError::FutureAborted => { close_msg = "Stream finish request aborted".to_string(); - gst::warning!(CAT, imp: self, "{}", close_msg); + gst::warning!(CAT, imp = self, "{}", close_msg); } WaitError::FutureError(e) => { close_msg = format!("Stream finish request future error: {}", e); - gst::error!(CAT, imp: self, "{}", close_msg); + gst::error!(CAT, imp = self, "{}", close_msg); } }, }; @@ -526,7 +526,7 @@ impl BaseSinkImpl for QuinnQuicSink { *state = State::Stopped; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -537,7 +537,7 @@ impl BaseSinkImpl for QuinnQuicSink { return Err(gst::FlowError::Error); } - gst::trace!(CAT, imp: self, "Rendering {:?}", buffer); + gst::trace!(CAT, imp = self, "Rendering {:?}", buffer); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to map buffer"]); @@ -548,12 +548,12 @@ impl BaseSinkImpl for QuinnQuicSink { Ok(_) => Ok(gst::FlowSuccess::Ok), Err(err) => match err { Some(error_message) => { - gst::error!(CAT, imp: self, "Data sending failed: {}", error_message); + gst::error!(CAT, imp = self, "Data sending failed: {}", error_message); self.post_error_message(error_message); Err(gst::FlowError::Error) } _ => { - gst::info!(CAT, imp: self, "Send interrupted. Flushing..."); + gst::info!(CAT, imp = self, "Send interrupted. Flushing..."); Err(gst::FlowError::Flushing) } }, @@ -603,7 +603,7 @@ impl QuinnQuicSink { Some(size) => { if src.len() > size { if drop_buffer_for_datagram { - gst::warning!(CAT, imp: self, "Buffer dropped, current max datagram size: {size} > buffer size: {}", src.len()); + gst::warning!(CAT, imp = self, "Buffer dropped, current max datagram size: {size} > buffer size: {}", src.len()); return Ok(()); } else { return Err(Some(gst::error_msg!( @@ -638,7 +638,7 @@ impl QuinnQuicSink { ))), Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Sending aborted"); + gst::warning!(CAT, imp = self, "Sending aborted"); Ok(()) } WaitError::FutureError(e) => Err(Some(gst::error_msg!( @@ -738,7 +738,11 @@ impl QuinnQuicSink { } else { match connection.max_datagram_size() { Some(datagram_size) => { - gst::info!(CAT, imp: self, "Datagram size reported by peer: {datagram_size}"); + gst::info!( + CAT, + imp = self, + "Datagram size reported by peer: {datagram_size}" + ); } None => { return Err(WaitError::FutureError(gst::error_msg!( diff --git a/net/quinn/src/quinnquicsrc/imp.rs b/net/quinn/src/quinnquicsrc/imp.rs index d754cde8..a677c440 100644 --- a/net/quinn/src/quinnquicsrc/imp.rs +++ b/net/quinn/src/quinnquicsrc/imp.rs @@ -149,7 +149,7 @@ impl ElementImpl for QuinnQuicSrc { { gst::error!( CAT, - imp: self, + imp = self, "Certificate or private key file not provided for secure connection" ); return Err(gst::StateChangeError); @@ -468,17 +468,17 @@ impl BaseSrcImpl for QuinnQuicSrc { stream: s, }); - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } Ok(Err(e)) | Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Connection aborted"); + gst::warning!(CAT, imp = self, "Connection aborted"); Ok(()) } WaitError::FutureError(err) => { - gst::error!(CAT, imp: self, "Connection request failed: {}", err); + gst::error!(CAT, imp = self, "Connection request failed: {}", err); Err(gst::error_msg!( gst::ResourceError::Failed, ["Connection request failed: {}", err] @@ -531,7 +531,7 @@ impl BaseSrcImpl for QuinnQuicSrc { match data { Ok(bytes) => { if bytes.is_empty() { - gst::debug!(CAT, imp: self, "End of stream"); + gst::debug!(CAT, imp = self, "End of stream"); return Err(gst::FlowError::Eos); } @@ -546,7 +546,7 @@ impl BaseSrcImpl for QuinnQuicSrc { } Err(None) => Err(gst::FlowError::Flushing), Err(Some(err)) => { - gst::error!(CAT, imp: self, "Could not GET: {}", err); + gst::error!(CAT, imp = self, "Could not GET: {}", err); Err(gst::FlowError::Error) } } @@ -571,12 +571,12 @@ impl BaseSrcImpl for QuinnQuicSrc { let mut tmp_caps = settings.caps.clone(); - gst::debug!(CAT, imp: self, "Advertising our own caps: {:?}", &tmp_caps); + gst::debug!(CAT, imp = self, "Advertising our own caps: {:?}", &tmp_caps); if let Some(filter_caps) = filter { gst::debug!( CAT, - imp: self, + imp = self, "Intersecting with filter caps: {:?}", &filter_caps ); @@ -584,7 +584,7 @@ impl BaseSrcImpl for QuinnQuicSrc { tmp_caps = filter_caps.intersect_with_mode(&tmp_caps, gst::CapsIntersectMode::First); }; - gst::debug!(CAT, imp: self, "Returning caps: {:?}", &tmp_caps); + gst::debug!(CAT, imp = self, "Returning caps: {:?}", &tmp_caps); Some(tmp_caps) } @@ -618,11 +618,11 @@ impl QuinnQuicSrc { Ok(bytes) => Ok(bytes), Err(err) => match err { ConnectionError::ApplicationClosed(ac) => { - gst::info!(CAT, imp: self, "Application closed connection, {}", ac); + gst::info!(CAT, imp = self, "Application closed connection, {}", ac); Ok(Bytes::new()) } ConnectionError::ConnectionClosed(cc) => { - gst::info!(CAT, imp: self, "Transport closed connection, {}", cc); + gst::info!(CAT, imp = self, "Transport closed connection, {}", cc); Ok(Bytes::new()) } _ => Err(WaitError::FutureError(gst::error_msg!( @@ -640,11 +640,16 @@ impl QuinnQuicSrc { Err(err) => match err { ReadError::ConnectionLost(conn_err) => match conn_err { ConnectionError::ConnectionClosed(cc) => { - gst::info!(CAT, imp: self, "Transport closed connection, {}", cc); + gst::info!(CAT, imp = self, "Transport closed connection, {}", cc); Ok(Bytes::new()) } ConnectionError::ApplicationClosed(ac) => { - gst::info!(CAT, imp: self, "Application closed connection, {}", ac); + gst::info!( + CAT, + imp = self, + "Application closed connection, {}", + ac + ); Ok(Bytes::new()) } _ => Err(WaitError::FutureError(gst::error_msg!( @@ -653,7 +658,7 @@ impl QuinnQuicSrc { ))), }, ReadError::ClosedStream => { - gst::info!(CAT, imp: self, "Stream closed"); + gst::info!(CAT, imp = self, "Stream closed"); Ok(Bytes::new()) } _ => Err(WaitError::FutureError(gst::error_msg!( @@ -669,11 +674,11 @@ impl QuinnQuicSrc { Ok(Ok(bytes)) => Ok(bytes), Ok(Err(e)) | Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Read from stream request aborted"); + gst::warning!(CAT, imp = self, "Read from stream request aborted"); Err(None) } WaitError::FutureError(e) => { - gst::error!(CAT, imp: self, "Failed to read from stream: {}", e); + gst::error!(CAT, imp = self, "Failed to read from stream: {}", e); Err(Some(e)) } }, @@ -768,7 +773,11 @@ impl QuinnQuicSrc { } else { match connection.max_datagram_size() { Some(datagram_size) => { - gst::info!(CAT, imp: self, "Datagram size reported by peer: {datagram_size}"); + gst::info!( + CAT, + imp = self, + "Datagram size reported by peer: {datagram_size}" + ); } None => { return Err(WaitError::FutureError(gst::error_msg!( @@ -783,7 +792,7 @@ impl QuinnQuicSrc { gst::info!( CAT, - imp: self, + imp = self, "Remote connection accepted: {}", connection.remote_address() ); diff --git a/net/raptorq/src/raptorqdec/imp.rs b/net/raptorq/src/raptorqdec/imp.rs index 9d5ce2da..a6ff2544 100644 --- a/net/raptorq/src/raptorqdec/imp.rs +++ b/net/raptorq/src/raptorqdec/imp.rs @@ -165,7 +165,7 @@ impl RaptorqDec { if data_packets_num == n { gst::trace!( CAT, - imp: self, + imp = self, "All packets ({}) received, dropping Source Block ({})", data_packets_num, seq_lo @@ -300,7 +300,7 @@ impl RaptorqDec { gst::debug!( CAT, - imp: self, + imp = self, "Successfully recovered packet: seqnum: {}, len: {}, ts: {}", rtpbuf.seq(), rtpbuf.payload_size(), @@ -324,13 +324,13 @@ impl RaptorqDec { ) -> Result { let this_seq = { let rtpbuf = RTPBuffer::from_buffer_readable(buffer).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to map rtp buffer : {}", err); + gst::error!(CAT, imp = self, "Failed to map rtp buffer : {}", err); gst::FlowError::Error })?; gst::trace!( CAT, - imp: self, + imp = self, "New data packet, seq {}, ts {}", rtpbuf.seq(), rtpbuf.timestamp() @@ -388,7 +388,7 @@ impl RaptorqDec { for seq in expired { gst::trace!( CAT, - imp: self, + imp = self, "Source Block ({}) dropped, because max wait time has been exceeded", seq as u16 ); @@ -399,7 +399,7 @@ impl RaptorqDec { if thresh > 0 && state.media_packets.len() >= thresh { gst::warning!( CAT, - imp: self, + imp = self, "Too many buffered media packets, resetting decoder. This might \ be because we haven't received a repair packet for too long, or \ repair packets have no valid timestamps.", @@ -420,13 +420,13 @@ impl RaptorqDec { buffer: gst::Buffer, ) -> Result { let rtpbuf = RTPBuffer::from_buffer_readable(&buffer).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to map rtp buffer : {}", err); + gst::error!(CAT, imp = self, "Failed to map rtp buffer : {}", err); gst::FlowError::Error })?; let payload = rtpbuf.payload().unwrap(); let payload_id = payload[0..7].try_into().map_err(|err| { - gst::error!(CAT, imp: self, "Unexpected rtp fec payload : {}", err); + gst::error!(CAT, imp = self, "Unexpected rtp fec payload : {}", err); gst::FlowError::Error })?; @@ -440,7 +440,7 @@ impl RaptorqDec { gst::trace!( CAT, - imp: self, + imp = self, "New repair packet, I: {}, LP: {}, LB: {}", i, lp, @@ -553,7 +553,7 @@ impl RaptorqDec { let media_packets_reset_threshold = settings.media_packets_reset_threshold as usize; - gst::debug!(CAT, imp: self, "Configured for caps {}", incaps); + gst::debug!(CAT, imp = self, "Configured for caps {}", incaps); let mut state = self.state.lock().unwrap(); @@ -788,7 +788,7 @@ impl ElementImpl for RaptorqDec { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/net/raptorq/src/raptorqenc/imp.rs b/net/raptorq/src/raptorqenc/imp.rs index 50c5b269..42092adc 100644 --- a/net/raptorq/src/raptorqenc/imp.rs +++ b/net/raptorq/src/raptorqenc/imp.rs @@ -132,7 +132,13 @@ impl RaptorqEnc { // placed in each repair packet. let si = state.symbols_per_packet; - gst::trace!(CAT, imp: self, "Source Block add ADU: si {}, li {}", si, li); + gst::trace!( + CAT, + imp = self, + "Source Block add ADU: si {}, li {}", + si, + li + ); let mut data = vec![0; si * state.symbol_size]; @@ -397,21 +403,21 @@ impl RaptorqEnc { let state = state_guard.as_mut().ok_or(gst::FlowError::NotNegotiated)?; if buffer.size() > state.mtu { - gst::error!(CAT, imp: self, "Packet length exceeds configured MTU"); + gst::error!(CAT, imp = self, "Packet length exceeds configured MTU"); return Err(gst::FlowError::NotSupported); } let (curr_seq, now_rtpts) = match RTPBuffer::from_buffer_readable(&buffer) { Ok(rtpbuf) => (rtpbuf.seq(), rtpbuf.timestamp()), Err(_) => { - gst::error!(CAT, imp: self, "Mapping to RTP packet failed"); + gst::error!(CAT, imp = self, "Mapping to RTP packet failed"); return Err(gst::FlowError::NotSupported); } }; if let Some(last_seq) = state.seqnums.last() { if last_seq.overflowing_add(1).0 != curr_seq { - gst::error!(CAT, imp: self, "Got out of sequence packets"); + gst::error!(CAT, imp = self, "Got out of sequence packets"); return Err(gst::FlowError::NotSupported); } } @@ -464,7 +470,7 @@ impl RaptorqEnc { } EventView::Caps(ev) => { let caps = ev.caps(); - gst::info!(CAT, obj: pad, "Got caps {:?}", caps); + gst::info!(CAT, obj = pad, "Got caps {:?}", caps); let mut state_guard = self.state.lock().unwrap(); @@ -605,7 +611,7 @@ impl RaptorqEnc { gst::info!( CAT, - imp: self, + imp = self, "Starting RaptorQ Encoder, Symbols per Block: {}, Symbol Size: {}", symbols_per_block, symbol_size @@ -909,7 +915,7 @@ impl ElementImpl for RaptorqEnc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index 77b5439f..ffab4482 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -264,7 +264,7 @@ impl ReqwestHttpSrc { ) -> Result { let mut client_guard = self.client.lock().unwrap(); if let Some(ref client) = *client_guard { - gst::debug!(CAT, imp: self, "Using already configured client"); + gst::debug!(CAT, imp = self, "Using already configured client"); return Ok(client.clone()); } @@ -286,7 +286,7 @@ impl ReqwestHttpSrc { // Hopefully now, self.set_context will have been synchronously called if let Some(client) = self.external_client.lock().unwrap().clone() { - gst::debug!(CAT, imp: self, "Using shared client"); + gst::debug!(CAT, imp = self, "Using shared client"); *client_guard = Some(client.clone()); return Ok(client); @@ -307,7 +307,7 @@ impl ReqwestHttpSrc { builder = builder.proxy(p); } - gst::debug!(CAT, imp: self, "Creating new client"); + gst::debug!(CAT, imp = self, "Creating new client"); let client = ClientContext(Arc::new(ClientContextInner { client: builder.build().map_err(|err| { gst::error_msg!( @@ -321,7 +321,7 @@ impl ReqwestHttpSrc { // The alternative would be different contexts for different proxy settings, or one context with a // map from proxy settings to client, but then, how and when to discard those, retaining reuse benefits? if proxy.is_none() { - gst::debug!(CAT, imp: self, "Sharing new client with other elements"); + gst::debug!(CAT, imp = self, "Sharing new client with other elements"); let mut context = gst::Context::new(REQWEST_CLIENT_CONTEXT, true); { let context = context.get_mut().unwrap(); @@ -350,7 +350,7 @@ impl ReqwestHttpSrc { use headers::{Connection, ContentLength, ContentRange, HeaderMapExt, Range, UserAgent}; use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue}; - gst::debug!(CAT, imp: self, "Creating new request for {}", uri); + gst::debug!(CAT, imp = self, "Creating new request for {}", uri); let settings = self.settings.lock().unwrap().clone(); @@ -395,7 +395,7 @@ impl ReqwestHttpSrc { Err(err) => { gst::warning!( CAT, - imp: self, + imp = self, "Failed to transform extra-header field name '{}' to header name: {}", field, err, @@ -411,7 +411,7 @@ impl ReqwestHttpSrc { Err(_) => { gst::warning!( CAT, - imp: self, + imp = self, "Failed to transform extra-header '{}' value to string", field ); @@ -426,7 +426,7 @@ impl ReqwestHttpSrc { Err(_) => { gst::warning!( CAT, - imp: self, + imp = self, "Failed to transform extra-header '{}' value to header value", field ); @@ -472,7 +472,7 @@ impl ReqwestHttpSrc { req }; - gst::debug!(CAT, imp: self, "Sending new request: {:?}", req); + gst::debug!(CAT, imp = self, "Sending new request: {:?}", req); let future = async { req.send().await.map_err(|err| { @@ -487,21 +487,21 @@ impl ReqwestHttpSrc { let res = match res { Ok(res) => res, Err(Some(err)) => { - gst::debug!(CAT, imp: self, "Error {:?}", err); + gst::debug!(CAT, imp = self, "Error {:?}", err); return Err(Some(err)); } Err(None) => { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(None); } }; - gst::debug!(CAT, imp: self, "Received response: {:?}", res); + gst::debug!(CAT, imp = self, "Received response: {:?}", res); if !res.status().is_success() { match res.status() { StatusCode::NOT_FOUND => { - gst::error!(CAT, imp: self, "Resource not found"); + gst::error!(CAT, imp = self, "Resource not found"); return Err(Some(gst::error_msg!( gst::ResourceError::NotFound, ["Resource '{}' not found", uri] @@ -511,14 +511,14 @@ impl ReqwestHttpSrc { | StatusCode::PAYMENT_REQUIRED | StatusCode::FORBIDDEN | StatusCode::PROXY_AUTHENTICATION_REQUIRED => { - gst::error!(CAT, imp: self, "Not authorized: {}", res.status()); + gst::error!(CAT, imp = self, "Not authorized: {}", res.status()); return Err(Some(gst::error_msg!( gst::ResourceError::NotAuthorized, ["Not Authorized for resource '{}': {}", uri, res.status()] ))); } _ => { - gst::error!(CAT, imp: self, "Request failed: {}", res.status()); + gst::error!(CAT, imp = self, "Request failed: {}", res.status()); return Err(Some(gst::error_msg!( gst::ResourceError::OpenRead, ["Request for '{}' failed: {}", uri, res.status()] @@ -571,7 +571,7 @@ impl ReqwestHttpSrc { .and_then(|content_type| content_type.to_str().ok()) .and_then(|content_type| content_type.parse::().ok()) { - gst::debug!(CAT, imp: self, "Got content type {}", content_type); + gst::debug!(CAT, imp = self, "Got content type {}", content_type); if let Some(ref mut caps) = caps { let caps = caps.get_mut().unwrap(); let s = caps.structure_mut(0).unwrap(); @@ -614,7 +614,7 @@ impl ReqwestHttpSrc { } } - gst::debug!(CAT, imp: self, "Request successful"); + gst::debug!(CAT, imp = self, "Request successful"); Ok(State::Started { uri, @@ -897,7 +897,7 @@ impl ObjectImpl for ReqwestHttpSrc { if let Err(err) = res { gst::error!( CAT, - imp: self, + imp = self, "Failed to set property `{}`: {:?}", pspec.name(), err @@ -1077,7 +1077,7 @@ impl BaseSrcImpl for ReqwestHttpSrc { }) .cloned()?; - gst::debug!(CAT, imp: self, "Starting for URI {}", uri); + gst::debug!(CAT, imp = self, "Starting for URI {}", uri); *state = self.do_request(uri, 0, None).map_err(|err| { err.unwrap_or_else(|| { @@ -1089,7 +1089,7 @@ impl BaseSrcImpl for ReqwestHttpSrc { } fn stop(&self) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); *self.state.lock().unwrap() = State::Stopped; Ok(()) @@ -1135,10 +1135,10 @@ impl BaseSrcImpl for ReqwestHttpSrc { let start = *segment.start().expect("No start position given"); let stop = segment.stop().map(|stop| *stop); - gst::debug!(CAT, imp: self, "Seeking to {}-{:?}", start, stop); + gst::debug!(CAT, imp = self, "Seeking to {}-{:?}", start, stop); if position == start && old_stop == stop { - gst::debug!(CAT, imp: self, "No change to current request"); + gst::debug!(CAT, imp = self, "No change to current request"); return true; } @@ -1184,7 +1184,7 @@ impl PushSrcImpl for ReqwestHttpSrc { let mut current_response = match response.take() { Some(response) => response, None => { - gst::error!(CAT, imp: self, "Don't have a response"); + gst::error!(CAT, imp = self, "Don't have a response"); gst::element_imp_error!(self, gst::ResourceError::Read, ["Don't have a response"]); return Err(gst::FlowError::Error); @@ -1196,14 +1196,14 @@ impl PushSrcImpl for ReqwestHttpSrc { drop(state); if let Some(caps) = caps { - gst::debug!(CAT, imp: self, "Setting caps {:?}", caps); + gst::debug!(CAT, imp = self, "Setting caps {:?}", caps); self.obj() .set_caps(&caps) .map_err(|_| gst::FlowError::NotNegotiated)?; } if let Some(tags) = tags { - gst::debug!(CAT, imp: self, "Sending iradio tags {:?}", tags); + gst::debug!(CAT, imp = self, "Sending iradio tags {:?}", tags); self.obj().src_pad().push_event(gst::event::Tag::new(tags)); } @@ -1220,12 +1220,12 @@ impl PushSrcImpl for ReqwestHttpSrc { let res = match res { Ok(res) => res, Err(Some(err)) => { - gst::debug!(CAT, imp: self, "Error {:?}", err); + gst::debug!(CAT, imp = self, "Error {:?}", err); self.post_error_message(err); return Err(gst::FlowError::Error); } Err(None) => { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } }; @@ -1250,7 +1250,7 @@ impl PushSrcImpl for ReqwestHttpSrc { gst::trace!( CAT, - imp: self, + imp = self, "Chunk of {} bytes received at offset {}", chunk.len(), offset @@ -1274,7 +1274,7 @@ impl PushSrcImpl for ReqwestHttpSrc { } None => { /* No further data, end of stream */ - gst::debug!(CAT, imp: self, "End of stream"); + gst::debug!(CAT, imp = self, "End of stream"); *response = Some(current_response); Err(gst::FlowError::Eos) } diff --git a/net/rtp/src/ac3/depay/imp.rs b/net/rtp/src/ac3/depay/imp.rs index 1ba496fa..eabf98cd 100644 --- a/net/rtp/src/ac3/depay/imp.rs +++ b/net/rtp/src/ac3/depay/imp.rs @@ -162,7 +162,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { if payload.len() < 2 + 6 { gst::warning!( CAT, - imp: self, + imp = self, "Payload too small: {} bytes, but need at least 8 bytes", payload.len(), ); @@ -173,7 +173,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { gst::log!( CAT, - imp: self, + imp = self, "Have payload of {} bytes, header {:02x?} {:02x?}", payload.len(), payload[0], @@ -201,7 +201,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { if frag_type == FragType::Start || frag_type == FragType::NotFragmented { if let Some(partial_frame) = state.partial_frame.as_ref() { - gst::warning!(CAT, imp: self, "Dropping unfinished partial frame"); + gst::warning!(CAT, imp = self, "Dropping unfinished partial frame"); self.obj() .drop_packets(partial_frame.ext_seqnum..=packet.ext_seqnum() - 1); @@ -225,7 +225,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { ext_timestamp: packet.ext_timestamp(), }); - gst::trace!(CAT, imp: self, "Partial frame {:?}", state.partial_frame); + gst::trace!(CAT, imp = self, "Partial frame {:?}", state.partial_frame); return Ok(gst::FlowSuccess::Ok); } @@ -234,7 +234,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { let Some(partial_frame) = state.partial_frame.as_mut() else { gst::debug!( CAT, - imp: self, + imp = self, "{frag_type:?} packet but no partial frame (most likely indicates packet loss)", ); self.obj().drop_packet(packet); @@ -245,7 +245,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { if partial_frame.ext_timestamp != packet.ext_timestamp() { gst::warning!( CAT, - imp: self, + imp = self, "{frag_type:?} packet timestamp {} doesn't match existing partial fragment timestamp {}", packet.ext_timestamp(), partial_frame.ext_timestamp, @@ -259,7 +259,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { gst::log!( CAT, - imp: self, + imp = self, "Added {frag_type:?} packet payload, assembled {} bytes now", partial_frame.data.len() ); @@ -268,18 +268,22 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { let partial_frame = state.partial_frame.take().unwrap(); let Ok(hdr) = ac3_audio_utils::peek_frame_header(&partial_frame.data) else { - gst::warning!(CAT, imp: self, "Could not parse frame header, dropping frame"); + gst::warning!( + CAT, + imp = self, + "Could not parse frame header, dropping frame" + ); self.obj() .drop_packets(partial_frame.ext_seqnum..=packet.ext_seqnum()); return Ok(gst::FlowSuccess::Ok); }; - gst::trace!(CAT, imp: self, "{hdr:?}"); + gst::trace!(CAT, imp = self, "{hdr:?}"); if partial_frame.data.len() != hdr.frame_len { gst::warning!( CAT, - imp: self, + imp = self, "Partial frame finished, but have {} bytes, and expected {} bytes!", partial_frame.data.len(), hdr.frame_len, @@ -294,7 +298,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { outbuf_ref.set_duration(gst::ClockTime::from_nseconds(hdr.duration())); - gst::trace!(CAT, imp: self, "Finishing buffer {outbuf:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {outbuf:?}"); return self.obj().queue_buffer( PacketToBufferRelation::Seqnums( @@ -314,18 +318,22 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { while offset < payload.len() { let Ok(hdr) = ac3_audio_utils::peek_frame_header(&payload[offset..]) else { - gst::warning!(CAT, imp: self, "Could not parse frame header at offset {offset}"); + gst::warning!( + CAT, + imp = self, + "Could not parse frame header at offset {offset}" + ); break; }; - gst::trace!(CAT, imp: self, "{hdr:?} at offset {offset}"); + gst::trace!(CAT, imp = self, "{hdr:?} at offset {offset}"); let frame_len = if offset + hdr.frame_len <= payload.len() { hdr.frame_len } else { gst::warning!( CAT, - imp: self, + imp = self, "Frame at offset {offset} is {} bytes, but we have only {} bytes left!", hdr.frame_len, payload.len() - offset, @@ -336,7 +344,7 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { self.ensure_output_caps(&mut state, &hdr); - gst::trace!(CAT, imp: self, "Getting frame @ {offset}+{frame_len}"); + gst::trace!(CAT, imp = self, "Getting frame @ {offset}+{frame_len}"); let mut outbuf = packet.payload_subbuffer_from_offset_with_length(offset, frame_len); @@ -345,7 +353,11 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { outbuf_ref.set_duration(gst::ClockTime::from_nseconds(hdr.duration())); - gst::trace!(CAT, imp: self, "Finishing frame @ {offset}, buffer {outbuf:?}"); + gst::trace!( + CAT, + imp = self, + "Finishing frame @ {offset}, buffer {outbuf:?}" + ); self.obj().queue_buffer( PacketToBufferRelation::SeqnumsWithOffset { @@ -381,7 +393,7 @@ impl RtpAc3Depay { if state.clock_rate != Some(frame_header.sample_rate as i32) { gst::warning!( CAT, - imp: self, + imp = self, "clock-rate {} does not match sample rate {}!", state.clock_rate.unwrap(), frame_header.sample_rate, @@ -395,7 +407,7 @@ impl RtpAc3Depay { .field("alignment", "frame") .build(); - gst::info!(CAT, imp: self, "Setting output caps {src_caps}.."); + gst::info!(CAT, imp = self, "Setting output caps {src_caps}.."); // Ignore failure here and let the next buffer push yield an appropriate flow return self.obj().set_src_caps(&src_caps); diff --git a/net/rtp/src/ac3/pay/imp.rs b/net/rtp/src/ac3/pay/imp.rs index d8888916..3528f036 100644 --- a/net/rtp/src/ac3/pay/imp.rs +++ b/net/rtp/src/ac3/pay/imp.rs @@ -326,12 +326,16 @@ impl RtpBasePay2Impl for RtpAc3Pay { let mut settings = self.settings.lock().unwrap(); if buffer.flags().contains(gst::BufferFlags::DISCONT) { - gst::debug!(CAT, imp: self, "Discont on {buffer:?}, pushing out any pending frames"); + gst::debug!( + CAT, + imp = self, + "Discont on {buffer:?}, pushing out any pending frames" + ); self.send_packets(&settings, &mut state, SendPacketMode::ForcePending)?; } let map = buffer.clone().into_mapped_buffer_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -350,7 +354,7 @@ impl RtpBasePay2Impl for RtpAc3Pay { let Ok(frame_hdr) = ac3_audio_utils::peek_frame_header(&data[map_offset..]) else { gst::warning!( CAT, - imp: self, + imp = self, "Failed to parse AC-3 audio frame header for {buffer:?} at offset {map_offset}", ); @@ -376,7 +380,11 @@ impl RtpBasePay2Impl for RtpAc3Pay { let frame_dur = queued_frame.duration(); if map_offset + frame_len > data.len() { - gst::warning!(CAT, imp: self, "Short audio frame for {buffer:?} at offset {map_offset}"); + gst::warning!( + CAT, + imp = self, + "Short audio frame for {buffer:?} at offset {map_offset}" + ); } pts_offset += frame_dur; @@ -426,7 +434,7 @@ impl RtpBasePay2Impl for RtpAc3Pay { let mut live_guard = self.is_live.lock().unwrap(); if Some(is_live) != *live_guard { - gst::info!(CAT, imp: self, "Upstream is live: {is_live}"); + gst::info!(CAT, imp = self, "Upstream is live: {is_live}"); *live_guard = Some(is_live); } } @@ -438,7 +446,7 @@ impl RtpBasePay2Impl for RtpAc3Pay { } else if is_live { gst::warning!( CAT, - imp: self, + imp = self, "Aggregating packets in live mode, but no max_ptime configured. \ Configured latency may be too low!", ); @@ -565,19 +573,20 @@ impl RtpAc3Pay { gst::log!( CAT, - imp: self, + imp = self, "Queued: size {queue_size}, duration ~{}ms, mode: {:?} + {:?} => ready: {}", queue_duration / 1_000_000, agg_mode, send_mode, - is_ready); + is_ready + ); if !is_ready { - gst::log!(CAT, imp: self, "Not ready yet, waiting for more data"); + gst::log!(CAT, imp = self, "Not ready yet, waiting for more data"); break; } - gst::trace!(CAT, imp: self, "Creating packet.."); + gst::trace!(CAT, imp = self, "Creating packet.."); let pts_offset = gst::ClockTime::from_nseconds(first.pts_offset); @@ -593,9 +602,10 @@ impl RtpAc3Pay { for frame in &state.queued_frames { gst::trace!( CAT, - imp: self, + imp = self, "{frame:?}, accumulated size {acc_size} duration ~{}ms", - acc_duration / 1_000_000); + acc_duration / 1_000_000 + ); // If this frame would overflow the packet, bail out and send out what we have. // @@ -651,7 +661,12 @@ impl RtpAc3Pay { } } - gst::log!(CAT, imp: self, "All done for now, {} frames queued", state.queued_frames.len()); + gst::log!( + CAT, + imp = self, + "All done for now, {} frames queued", + state.queued_frames.len() + ); if send_mode == SendPacketMode::ForcePending { self.obj().finish_pending_packets()?; @@ -691,7 +706,7 @@ impl RtpAc3Pay { *self.is_live.lock().unwrap() = Some(is_live); - gst::info!(CAT, imp: self, "Upstream is live: {is_live}"); + gst::info!(CAT, imp = self, "Upstream is live: {is_live}"); } // We can get max ptime or ptime recommendations/restrictions from multiple places, e.g. the diff --git a/net/rtp/src/av1/common/error.rs b/net/rtp/src/av1/common/error.rs index 54c5193f..7a28169e 100644 --- a/net/rtp/src/av1/common/error.rs +++ b/net/rtp/src/av1/common/error.rs @@ -10,14 +10,14 @@ macro_rules! err_flow { ($imp:ident, read, $msg:literal) => { |err| { - gst::warning!(CAT, imp: $imp, $msg, err); + gst::warning!(CAT, imp = $imp, $msg, err); gst::element_imp_warning!($imp, gst::ResourceError::Read, [$msg, err]); gst::FlowError::Error } }; ($imp:ident, write, $msg:literal) => { |err| { - gst::warning!(CAT, imp: $imp, $msg, err); + gst::warning!(CAT, imp = $imp, $msg, err); gst::element_imp_warning!($imp, gst::ResourceError::Write, [$msg, err]); gst::FlowError::Error } diff --git a/net/rtp/src/av1/depay/imp.rs b/net/rtp/src/av1/depay/imp.rs index 4976aea3..11da141b 100644 --- a/net/rtp/src/av1/depay/imp.rs +++ b/net/rtp/src/av1/depay/imp.rs @@ -74,7 +74,7 @@ static TEMPORAL_DELIMITER: [u8; 2] = [0b0001_0010, 0]; impl RTPAv1Depay { fn reset(&self, state: &mut State) { - gst::debug!(CAT, imp: self, "resetting state"); + gst::debug!(CAT, imp = self, "resetting state"); *state = State::default() } @@ -177,7 +177,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RTPAv1Depay { .queue_buffer(PacketToBufferRelation::Seqnums(seqnums), buffer), Ok(None) => Ok(gst::FlowSuccess::Ok), Err(err) => { - gst::warning!(CAT, imp: self, "Failed to handle RTP packet: {err:?}"); + gst::warning!(CAT, imp = self, "Failed to handle RTP packet: {err:?}"); self.reset(&mut self.state.borrow_mut()); self.obj().drop_packets(..=packet.ext_seqnum()); Ok(gst::FlowSuccess::Ok) @@ -191,11 +191,7 @@ impl RTPAv1Depay { &self, packet: &crate::basedepay::Packet, ) -> Result, gst::Buffer)>, gst::FlowError> { - gst::trace!( - CAT, - imp: self, - "Processing RTP packet {packet:?}", - ); + gst::trace!(CAT, imp = self, "Processing RTP packet {packet:?}",); let mut state = self.state.borrow_mut(); @@ -210,14 +206,14 @@ impl RTPAv1Depay { AggregationHeader::from(&byte) }; - gst::trace!(CAT, imp: self, "Aggregation header {aggr_header:?}"); + gst::trace!(CAT, imp = self, "Aggregation header {aggr_header:?}"); // handle new temporal units if state.marked_packet || state.last_timestamp != Some(packet.ext_timestamp()) { if state.last_timestamp.is_some() && state.obu_fragment.is_some() { gst::error!( CAT, - imp: self, + imp = self, concat!( "invalid packet: packet is part of a new TU but ", "the previous TU still has an incomplete OBU", @@ -243,7 +239,7 @@ impl RTPAv1Depay { if state.obu_fragment.is_some() && !aggr_header.leading_fragment { gst::error!( CAT, - imp: self, + imp = self, "invalid packet: dropping unclosed OBU fragment" ); self.reset(&mut state); @@ -294,7 +290,7 @@ impl RTPAv1Depay { if state.found_valid_obu { gst::error!( CAT, - imp: self, + imp = self, "invalid packet: unexpected leading OBU fragment" ); } @@ -327,7 +323,7 @@ impl RTPAv1Depay { if remaining_slice.len() < element_size as usize { gst::error!( CAT, - imp: self, + imp = self, "invalid packet: not enough data left for OBU {idx} (needed {element_size}, have {})", remaining_slice.len(), ); @@ -355,7 +351,7 @@ impl RTPAv1Depay { let buffer = if !ready_obus.is_empty() && ready_obus != TEMPORAL_DELIMITER { gst::log!( CAT, - imp: self, + imp = self, "Creating buffer containing {} bytes of data (marker {}, discont {})...", ready_obus.len(), state.marked_packet, @@ -384,7 +380,7 @@ impl RTPAv1Depay { if state.marked_packet && state.obu_fragment.is_some() { gst::error!( CAT, - imp: self, + imp = self, concat!( "invalid packet: has marker bit set, but ", "last OBU is not yet complete. Dropping incomplete OBU." @@ -437,7 +433,7 @@ impl RTPAv1Depay { Ordering::Less => { gst::error!( CAT, - imp: self, + imp = self, "invalid packet: size field gives impossibly large OBU size" ); return Err(gst::FlowError::Error); @@ -516,7 +512,7 @@ impl RTPAv1Depay { if first { return Err(err); } else { - gst::warning!(CAT, imp: self, "Trailing payload unit is not a valid OBU"); + gst::warning!(CAT, imp = self, "Trailing payload unit is not a valid OBU"); return Ok(()); } } @@ -526,23 +522,31 @@ impl RTPAv1Depay { .seek(SeekFrom::Start(header_pos)) .map_err(err_flow!(self, buf_read))?; - gst::trace!(CAT, imp: self, "Handling OBU {obu:?}"); + gst::trace!(CAT, imp = self, "Handling OBU {obu:?}"); let remaining_slice = &reader.get_ref()[reader.position() as usize..]; let element_size = if let Some((size, leb_size)) = obu.size { let size = (size + leb_size + obu.header_len) as usize; if size > remaining_slice.len() { if first { - gst::warning!(CAT, imp: self, "Payload unit starts with an incomplete OBU"); + gst::warning!( + CAT, + imp = self, + "Payload unit starts with an incomplete OBU" + ); return Err(gst::FlowError::Error); } else { - gst::warning!(CAT, imp: self, "Trailing payload unit is an incomplete OBU"); + gst::warning!( + CAT, + imp = self, + "Trailing payload unit is an incomplete OBU" + ); return Ok(()); } } if !first { - gst::debug!(CAT, imp: self, "Multiple OBUs in a single payload unit"); + gst::debug!(CAT, imp = self, "Multiple OBUs in a single payload unit"); } size } else { @@ -557,7 +561,12 @@ impl RTPAv1Depay { obu.obu_type, ObuType::TemporalDelimiter | ObuType::TileList | ObuType::Padding ) { - gst::trace!(CAT, imp: self, "Dropping {:?} of size {element_size}", obu.obu_type); + gst::trace!( + CAT, + imp = self, + "Dropping {:?} of size {element_size}", + obu.obu_type + ); reader .seek(SeekFrom::Current(element_size as i64)) .map_err(err_flow!(self, buf_read))?; diff --git a/net/rtp/src/av1/pay/imp.rs b/net/rtp/src/av1/pay/imp.rs index f784079a..797e3252 100644 --- a/net/rtp/src/av1/pay/imp.rs +++ b/net/rtp/src/av1/pay/imp.rs @@ -84,7 +84,7 @@ pub struct RTPAv1Pay { impl RTPAv1Pay { fn reset(&self, state: &mut State, full: bool) { - gst::debug!(CAT, imp: self, "resetting state"); + gst::debug!(CAT, imp = self, "resetting state"); if full { *state = State::default(); @@ -118,7 +118,7 @@ impl RTPAv1Pay { match obu.obu_type { // completely ignore tile lists and padding ObuType::TileList | ObuType::Padding => { - gst::log!(CAT, imp: self, "ignoring {:?} OBU", obu.obu_type); + gst::log!(CAT, imp = self, "ignoring {:?} OBU", obu.obu_type); reader .seek(SeekFrom::Current(obu.size as i64)) .map_err(err_flow!(self, buf_read))?; @@ -200,7 +200,7 @@ impl RTPAv1Pay { ) -> Option { gst::trace!( CAT, - imp: self, + imp = self, "{} new packet, currently storing {} OBUs (marker {})", if force { "forcing" } else { "considering" }, state.obus.len(), @@ -239,13 +239,13 @@ impl RTPAv1Pay { if current.obu_type == ObuType::TemporalDelimiter { // ignore the temporal delimiter, it is not supposed to be transmitted, // it will be skipped later when building the packet - gst::log!(CAT, imp: self, "ignoring temporal delimiter OBU"); + gst::log!(CAT, imp = self, "ignoring temporal delimiter OBU"); if packet.obu_count > 0 { if marker { gst::warning!( CAT, - imp: self, + imp = self, "Temporal delimited in the middle of a frame" ); } @@ -356,7 +356,7 @@ impl RTPAv1Pay { ) -> Result { gst::log!( CAT, - imp: self, + imp = self, "constructing new RTP packet with {} OBUs", packet.obu_count ); @@ -475,7 +475,7 @@ impl RTPAv1Pay { gst::log!( CAT, - imp: self, + imp = self, "generated RTP packet of size {}", payload.len() ); @@ -567,7 +567,7 @@ impl crate::basepay::RtpBasePay2Impl for RTPAv1Pay { } fn set_sink_caps(&self, caps: &gst::Caps) -> bool { - gst::debug!(CAT, imp: self, "received caps {caps:?}"); + gst::debug!(CAT, imp = self, "received caps {caps:?}"); self.obj().set_src_caps( &gst::Caps::builder("application/x-rtp") @@ -596,7 +596,7 @@ impl crate::basepay::RtpBasePay2Impl for RTPAv1Pay { buffer: &gst::Buffer, id: u64, ) -> Result { - gst::trace!(CAT, imp: self, "received buffer of size {}", buffer.size()); + gst::trace!(CAT, imp = self, "received buffer of size {}", buffer.size()); let mut state = self.state.borrow_mut(); let map = buffer.map_readable().map_err(|_| { diff --git a/net/rtp/src/baseaudiopay/imp.rs b/net/rtp/src/baseaudiopay/imp.rs index ba386c1f..9af5c751 100644 --- a/net/rtp/src/baseaudiopay/imp.rs +++ b/net/rtp/src/baseaudiopay/imp.rs @@ -271,7 +271,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpBaseAudioPay2 { id: u64, ) -> Result { let buffer = buffer.clone().into_mapped_buffer_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; let pts = buffer.buffer().pts().unwrap(); @@ -297,7 +297,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpBaseAudioPay2 { if discont { if state.audio_discont.base_pts().is_some() { - gst::debug!(CAT, imp: self, "Draining because of discontinuity"); + gst::debug!(CAT, imp = self, "Draining because of discontinuity"); self.drain_packets(&settings, &mut state, true)?; } @@ -373,7 +373,7 @@ impl RtpBaseAudioPay2 { gst::trace!( CAT, - imp: self, + imp = self, "min ptime {} (frames: {}), max ptime {} (frames: {}), ptime multiple {} (frames {})", settings.min_ptime, min_pframes, @@ -426,7 +426,7 @@ impl RtpBaseAudioPay2 { gst::trace!( CAT, - imp: self, + imp = self, "Currently {} bytes queued, min packet size {min_packet_size}, max packet size {max_packet_size}, force {force}", state.queued_bytes, ); @@ -440,7 +440,7 @@ impl RtpBaseAudioPay2 { gst::trace!( CAT, - imp: self, + imp = self, "Creating packet of size {packet_size} ({} frames), marker {}", packet_size / bpf, state.audio_discont.next_output_offset().is_none(), @@ -502,7 +502,13 @@ impl RtpBaseAudioPay2 { state.audio_discont.process_output(packet_size / bpf); } - gst::trace!(CAT, imp: self, "Currently {} bytes / {} frames queued", state.queued_bytes, state.queued_bytes / bpf); + gst::trace!( + CAT, + imp = self, + "Currently {} bytes / {} frames queued", + state.queued_bytes, + state.queued_bytes / bpf + ); Ok(gst::FlowSuccess::Ok) } diff --git a/net/rtp/src/basedepay/imp.rs b/net/rtp/src/basedepay/imp.rs index 3bca6469..ff941ad5 100644 --- a/net/rtp/src/basedepay/imp.rs +++ b/net/rtp/src/basedepay/imp.rs @@ -224,11 +224,11 @@ impl Ord for CapsOrd { #[allow(dead_code)] impl RtpBaseDepay2 { pub(super) fn set_src_caps(&self, src_caps: &gst::Caps) { - gst::debug!(CAT, imp: self, "Setting caps {src_caps:?}"); + gst::debug!(CAT, imp = self, "Setting caps {src_caps:?}"); let mut state = self.state.borrow_mut(); if Some(src_caps) == state.src_caps.as_ref() { - gst::debug!(CAT, imp: self, "Setting same caps {src_caps:?} again"); + gst::debug!(CAT, imp = self, "Setting same caps {src_caps:?} again"); return; } @@ -254,7 +254,12 @@ impl RtpBaseDepay2 { } pub(super) fn drop_packets(&self, ext_seqnum: impl RangeBounds) { - gst::trace!(CAT, imp: self, "Dropping packets up to ext seqnum {:?}", ext_seqnum.end_bound()); + gst::trace!( + CAT, + imp = self, + "Dropping packets up to ext seqnum {:?}", + ext_seqnum.end_bound() + ); let mut state = self.state.borrow_mut(); state.discont_pending = true; @@ -378,7 +383,11 @@ impl RtpBaseDepay2 { 0xBEDE => gst_rtp::RTPHeaderExtensionFlags::ONE_BYTE, x if x >> 4 == 0x100 => gst_rtp::RTPHeaderExtensionFlags::TWO_BYTE, _ => { - gst::trace!(CAT, imp: self, "Unknown extension pattern {extension_pattern:04X}"); + gst::trace!( + CAT, + imp = self, + "Unknown extension pattern {extension_pattern:04X}" + ); continue; } }; @@ -425,7 +434,11 @@ impl RtpBaseDepay2 { break; } - gst::trace!(CAT, imp: self, "Handling RTP header extension with id {id} and length {len}"); + gst::trace!( + CAT, + imp = self, + "Handling RTP header extension with id {id} and length {len}" + ); let (extension_data, remainder) = extensions_data.split_at(len); extensions_data = remainder; @@ -435,7 +448,11 @@ impl RtpBaseDepay2 { }; if !extension.read(extension_flags, extension_data, buffer) { - gst::warning!(CAT, imp: self, "Failed reading RTP header extension with id {id} and length {len}"); + gst::warning!( + CAT, + imp = self, + "Failed reading RTP header extension with id {id} and length {len}" + ); continue; } @@ -478,16 +495,24 @@ impl RtpBaseDepay2 { buffer_ref.set_dts(None); } - gst::trace!(CAT, imp: self, "Queueing buffer {buffer:?} for seqnum range {packet_to_buffer_relation:?}"); + gst::trace!( + CAT, + imp = self, + "Queueing buffer {buffer:?} for seqnum range {packet_to_buffer_relation:?}" + ); let mut state = self.state.borrow_mut(); if state.src_caps.is_none() { - gst::error!(CAT, imp: self, "No source pad caps negotiated yet"); + gst::error!(CAT, imp = self, "No source pad caps negotiated yet"); return Err(gst::FlowError::NotNegotiated); } if matches!(packet_to_buffer_relation, PacketToBufferRelation::OutOfBand) { - gst::trace!(CAT, imp: self, "Keeping buffer without associated seqnums until next buffer or EOS"); + gst::trace!( + CAT, + imp = self, + "Keeping buffer without associated seqnums until next buffer or EOS" + ); state.pending_buffers.push_back(PendingBuffer { metadata_set: false, @@ -506,7 +531,7 @@ impl RtpBaseDepay2 { }; if seqnums.is_empty() { - gst::error!(CAT, imp: self, "Empty packet ext seqnum range provided"); + gst::error!(CAT, imp = self, "Empty packet ext seqnum range provided"); return Err(gst::FlowError::Error); } @@ -520,16 +545,29 @@ impl RtpBaseDepay2 { .is_some_and(|p| p.ext_seqnum < seqnum_start) { let p = state.pending_packets.pop_front().unwrap(); - gst::trace!(CAT, imp: self, "Dropping packet with extended seqnum {}", p.ext_seqnum); + gst::trace!( + CAT, + imp = self, + "Dropping packet with extended seqnum {}", + p.ext_seqnum + ); } if state.pending_packets.is_empty() { - gst::error!(CAT, imp: self, "Queueing buffers for future ext seqnums not allowed"); + gst::error!( + CAT, + imp = self, + "Queueing buffers for future ext seqnums not allowed" + ); return Err(gst::FlowError::Error); }; if seqnum_end > state.pending_packets.back().unwrap().ext_seqnum { - gst::error!(CAT, imp: self, "Queueing buffers for future ext seqnums not allowed"); + gst::error!( + CAT, + imp = self, + "Queueing buffers for future ext seqnums not allowed" + ); return Err(gst::FlowError::Error); } @@ -551,7 +589,12 @@ impl RtpBaseDepay2 { if let Some(ts) = pts_signed.positive() { pts = Some(ts); } else { - gst::warning!(CAT, imp: self, "Negative PTS {} calculated, not supported", pts_signed); + gst::warning!( + CAT, + imp = self, + "Negative PTS {} calculated, not supported", + pts_signed + ); } } } @@ -561,7 +604,12 @@ impl RtpBaseDepay2 { if let Some(ts) = pts_signed.positive() { pts = Some(ts); } else { - gst::warning!(CAT, imp: self, "Negative PTS {} calculated, not supported", pts_signed); + gst::warning!( + CAT, + imp = self, + "Negative PTS {} calculated, not supported", + pts_signed + ); } } @@ -570,7 +618,12 @@ impl RtpBaseDepay2 { if let Some(ts) = dts_signed.positive() { dts = Some(ts); } else { - gst::warning!(CAT, imp: self, "Negative DTS {} calculated, not supported", dts_signed); + gst::warning!( + CAT, + imp = self, + "Negative DTS {} calculated, not supported", + dts_signed + ); } } } @@ -623,7 +676,12 @@ impl RtpBaseDepay2 { let extensions = self.extensions.lock().unwrap(); for extension in extensions.values() { if !extension.update_non_rtp_src_caps(src_caps) { - gst::error!(CAT, imp: self, "RTP header extension {} could not update caps", extension.name()); + gst::error!( + CAT, + imp = self, + "RTP header extension {} could not update caps", + extension.name() + ); return Err(gst::FlowError::Error); } } @@ -679,7 +737,7 @@ impl RtpBaseDepay2 { assert_ne!(num_buffers, 0); - gst::trace!(CAT, imp: self, "Flushing {num_buffers} buffers"); + gst::trace!(CAT, imp = self, "Flushing {num_buffers} buffers"); let segment_event = self.retrieve_pending_segment_event(&mut state); @@ -690,7 +748,7 @@ impl RtpBaseDepay2 { let buffers = if num_buffers == 1 { let buffer = state.pending_buffers.pop_front().unwrap().buffer; - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); BufferOrList::Buffer(buffer) } else { let mut list = gst::BufferList::new_sized(num_buffers); @@ -700,7 +758,7 @@ impl RtpBaseDepay2 { b.metadata_set && (b.buffer.pts() == pts || b.buffer.pts().is_none()) }) { let buffer = state.pending_buffers.pop_front().unwrap().buffer; - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); list.add(buffer); } } @@ -721,9 +779,9 @@ impl RtpBaseDepay2 { if let Err(err) = res { if ![gst::FlowError::Flushing, gst::FlowError::Eos].contains(&err) { - gst::warning!(CAT, imp: self, "Failed pushing buffers: {err:?}"); + gst::warning!(CAT, imp = self, "Failed pushing buffers: {err:?}"); } else { - gst::debug!(CAT, imp: self, "Failed pushing buffers: {err:?}"); + gst::debug!(CAT, imp = self, "Failed pushing buffers: {err:?}"); } } @@ -782,7 +840,7 @@ impl RtpBaseDepay2 { let state = self.state.borrow(); if state.sink_caps.is_none() { - gst::warning!(CAT, imp: self, "Received segment before caps"); + gst::warning!(CAT, imp = self, "Received segment before caps"); return Err(gst::FlowError::NotNegotiated); } @@ -798,14 +856,14 @@ impl RtpBaseDepay2 { drop(state); if !same_segment { - gst::debug!(CAT, imp: self, "Received segment {segment:?}"); + gst::debug!(CAT, imp = self, "Received segment {segment:?}"); if drain { if let Err(err) = self.drain() { // Just continue here. The depayloader is now flushed and can proceed below, // and if there was a serious error downstream it will happen on the next // buffer pushed downstream - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } } @@ -814,7 +872,11 @@ impl RtpBaseDepay2 { state.segment = Some((event.seqnum(), segment.clone())); state.pending_segment = true; } else { - gst::error!(CAT, imp: self, "Segments in non-TIME format are not supported"); + gst::error!( + CAT, + imp = self, + "Segments in non-TIME format are not supported" + ); state.segment = None; // FIXME: Forget everything here? return Err(gst::FlowError::Error); @@ -825,7 +887,7 @@ impl RtpBaseDepay2 { } gst::EventView::Eos(_) => { if let Err(err) = self.drain() { - gst::debug!(CAT, imp: self, "Draining on EOS failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining on EOS failed: {err:?}"); } } gst::EventView::FlushStop(_) => { @@ -844,7 +906,7 @@ impl RtpBaseDepay2 { _ => (), } - gst::debug!(CAT, imp: self, "Forwarding event: {event:?}"); + gst::debug!(CAT, imp = self, "Forwarding event: {event:?}"); if self.src_pad.push_event(event) { Ok(gst::FlowSuccess::Ok) } else if self.src_pad.pad_flags().contains(gst::PadFlags::FLUSHING) { @@ -883,7 +945,7 @@ impl RtpBaseDepay2 { if tags.len() > 1 { gst::trace!( CAT, - imp: self, + imp = self, "Not copying meta {}: has multiple tags {tags:?}", meta.api(), ); @@ -897,7 +959,7 @@ impl RtpBaseDepay2 { if !allowed_tags.iter().copied().any(|tag| tag == *meta_tag) { gst::trace!( CAT, - imp: self, + imp = self, "Not copying meta {}: tag '{meta_tag}' not allowed", meta.api(), ); @@ -905,10 +967,10 @@ impl RtpBaseDepay2 { } } - gst::trace!(CAT, imp: self, "Copying meta {}", meta.api()); + gst::trace!(CAT, imp = self, "Copying meta {}", meta.api()); if let Err(err) = meta.transform(out_buf, &gst::meta::MetaTransformCopy::new(false, ..)) { - gst::trace!(CAT, imp: self, "Could not copy meta {}: {err}", meta.api()); + gst::trace!(CAT, imp = self, "Could not copy meta {}: {err}", meta.api()); } } @@ -942,7 +1004,7 @@ impl RtpBaseDepay2 { let Some(ext) = gst_rtp::RTPHeaderExtension::create_from_uri(uri) else { gst::debug!( CAT, - imp: self, + imp = self, "Didn't find any extension implementing URI {uri}", ); return None; @@ -950,7 +1012,7 @@ impl RtpBaseDepay2 { gst::debug!( CAT, - imp: self, + imp = self, "Automatically enabling extension {} for URI {uri}", ext.name(), ); @@ -968,7 +1030,7 @@ impl RtpBaseDepay2 { _pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, imp: self, "Received buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Received buffer {buffer:?}"); let settings = self.settings.lock().unwrap().clone(); self.handle_buffer(&settings, buffer) @@ -979,7 +1041,7 @@ impl RtpBaseDepay2 { _pad: &gst::Pad, list: gst::BufferList, ) -> Result { - gst::trace!(CAT, imp: self, "Received buffer list {list:?}"); + gst::trace!(CAT, imp = self, "Received buffer list {list:?}"); let settings = self.settings.lock().unwrap().clone(); for buffer in list.iter_owned() { @@ -994,7 +1056,7 @@ impl RtpBaseDepay2 { pad: &gst::Pad, event: gst::Event, ) -> Result { - gst::debug!(CAT, obj: pad, "Received event: {event:?}"); + gst::debug!(CAT, obj = pad, "Received event: {event:?}"); let obj = self.obj(); (obj.class().as_ref().sink_event)(&obj, event) @@ -1005,21 +1067,21 @@ impl RtpBaseDepay2 { pad: &gst::Pad, event: gst::Event, ) -> Result { - gst::debug!(CAT, obj: pad, "Received event: {event:?}"); + gst::debug!(CAT, obj = pad, "Received event: {event:?}"); let obj = self.obj(); (obj.class().as_ref().src_event)(&obj, event) } fn sink_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::trace!(CAT, obj: pad, "Received query: {query:?}"); + gst::trace!(CAT, obj = pad, "Received query: {query:?}"); let obj = self.obj(); (obj.class().as_ref().sink_query)(&obj, query) } fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::trace!(CAT, obj: pad, "Received query: {query:?}"); + gst::trace!(CAT, obj = pad, "Received query: {query:?}"); let obj = self.obj(); (obj.class().as_ref().src_query)(&obj, query) @@ -1056,7 +1118,7 @@ impl RtpBaseDepay2 { if pts > gap { gst::debug!( CAT, - imp: self, + imp = self, "Found gap of {}, adjusting start: {} = {} - {}", gap.display(), (pts - gap).display(), @@ -1095,7 +1157,7 @@ impl RtpBaseDepay2 { state.pending_segment = false; gst::debug!( CAT, - imp: self, + imp = self, "Created segment event {segment:?} with seqnum {seqnum:?}", ); @@ -1110,7 +1172,7 @@ impl RtpBaseDepay2 { let mut state = self.state.borrow_mut(); if state.sink_caps.is_none() { - gst::error!(CAT, imp: self, "No sink pad caps"); + gst::error!(CAT, imp = self, "No sink pad caps"); gst::element_imp_error!( self, gst::CoreError::Negotiation, @@ -1142,13 +1204,21 @@ impl RtpBaseDepay2 { if let Some(rtp_diff) = rtp_diff { if rtp_diff > gst::ClockTime::SECOND { - gst::warning!(CAT, imp: self, "More than {rtp_diff} of RTP time queued, probably a bug in the subclass"); + gst::warning!( + CAT, + imp = self, + "More than {rtp_diff} of RTP time queued, probably a bug in the subclass" + ); } } if let Some(pts_diff) = pts_diff { if pts_diff > gst::ClockTime::SECOND { - gst::warning!(CAT, imp: self, "More than {pts_diff} of PTS time queued, probably a bug in the subclass"); + gst::warning!( + CAT, + imp = self, + "More than {pts_diff} of PTS time queued, probably a bug in the subclass" + ); } } } @@ -1156,7 +1226,7 @@ impl RtpBaseDepay2 { let buffer = match buffer.into_mapped_buffer_readable() { Ok(buffer) => buffer, Err(_) => { - gst::error!(CAT, imp: self, "Failed to map buffer"); + gst::error!(CAT, imp = self, "Failed to map buffer"); gst::element_imp_error!(self, gst::StreamError::Failed, ["Failed to map buffer"]); return Err(gst::FlowError::Error); } @@ -1166,7 +1236,7 @@ impl RtpBaseDepay2 { let packet = match rtp_types::RtpPacket::parse(&buffer) { Ok(packet) => packet, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to parse RTP packet: {err:?}"); + gst::warning!(CAT, imp = self, "Failed to parse RTP packet: {err:?}"); return Ok(gst::FlowSuccess::Ok); } }; @@ -1198,7 +1268,7 @@ impl RtpBaseDepay2 { // FIXME: Allow subclasses to decide not to flush on DISCONTs and handle the situation // themselves, e.g. to be able to continue reconstructing frames despite missing data. if buffer.buffer().flags().contains(gst::BufferFlags::DISCONT) { - gst::info!(CAT, imp: self, "Discont received"); + gst::info!(CAT, imp = self, "Discont received"); state.current_stream = None; } @@ -1206,15 +1276,31 @@ impl RtpBaseDepay2 { // having a gap compared to the previous packet. if let Some(ref mut current_stream) = state.current_stream { if current_stream.ssrc != ssrc { - gst::info!(CAT, imp: self, "Stream SSRC changed from {:08x} to {:08x}", current_stream.ssrc, ssrc); + gst::info!( + CAT, + imp = self, + "Stream SSRC changed from {:08x} to {:08x}", + current_stream.ssrc, + ssrc + ); state.current_stream = None; } else if current_stream.pt != pt { - gst::info!(CAT, imp: self, "Stream payload type changed from {} to {}", current_stream.pt, pt); + gst::info!( + CAT, + imp = self, + "Stream payload type changed from {} to {}", + current_stream.pt, + pt + ); state.current_stream = None; } else { let expected_seqnum = (current_stream.ext_seqnum + 1) & 0xffff; if expected_seqnum != seqnum as u64 { - gst::info!(CAT, imp: self, "Got seqnum {seqnum} but expected {expected_seqnum}"); + gst::info!( + CAT, + imp = self, + "Got seqnum {seqnum} but expected {expected_seqnum}" + ); let mut ext_seqnum = seqnum as u64 + (current_stream.ext_seqnum & !0xffff); @@ -1236,13 +1322,13 @@ impl RtpBaseDepay2 { }; if diff > 0 { - gst::info!(CAT, imp: self, "{diff} missing packets or sender restart"); + gst::info!(CAT, imp = self, "{diff} missing packets or sender restart"); state.current_stream = None; } else if diff >= -(settings.max_reorder as i32) { - gst::info!(CAT, imp: self, "Got old packet, dropping"); + gst::info!(CAT, imp = self, "Got old packet, dropping"); return Ok(gst::FlowSuccess::Ok); } else { - gst::info!(CAT, imp: self, "Sender restart"); + gst::info!(CAT, imp = self, "Sender restart"); state.current_stream = None; } } else { @@ -1271,7 +1357,7 @@ impl RtpBaseDepay2 { current_stream.ext_rtptime = ext_rtptime; gst::trace!( CAT, - imp: self, + imp = self, "Handling packet with extended seqnum {} and extended RTP time {}", current_stream.ext_seqnum, current_stream.ext_rtptime, @@ -1284,13 +1370,13 @@ impl RtpBaseDepay2 { let discont = state.current_stream.is_none(); if discont && !state.pending_packets.is_empty() { drop(state); - gst::info!(CAT, imp: self, "Got discontinuity, draining"); + gst::info!(CAT, imp = self, "Got discontinuity, draining"); if let Err(err) = self.drain() { if ![gst::FlowError::Flushing, gst::FlowError::Eos].contains(&err) { - gst::warning!(CAT, imp: self, "Error while draining: {err:?}"); + gst::warning!(CAT, imp = self, "Error while draining: {err:?}"); } else { - gst::debug!(CAT, imp: self, "Error while draining: {err:?}"); + gst::debug!(CAT, imp = self, "Error while draining: {err:?}"); } return Err(err); } @@ -1309,7 +1395,7 @@ impl RtpBaseDepay2 { gst::info!( CAT, - imp: self, + imp = self, "Starting stream with SSRC {ssrc:08x} at extended seqnum {ext_seqnum} with extended RTP time {ext_rtptime}", ); @@ -1383,12 +1469,12 @@ impl RtpBaseDepay2 { }, ); if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed handling packet: {err:?}"); + gst::error!(CAT, imp = self, "Failed handling packet: {err:?}"); } else { res = self.finish_pending_buffers(); if let Err(err) = res { - gst::debug!(CAT, imp: self, "Failed finishing pending buffers: {err:?}"); + gst::debug!(CAT, imp = self, "Failed finishing pending buffers: {err:?}"); } } @@ -1424,7 +1510,11 @@ impl RtpBaseDepay2 { continue; }; let Ok(ext_id) = ext_id.parse::() else { - gst::error!(CAT, imp: self, "Can't parse RTP header extension id from caps {sink_caps:?}"); + gst::error!( + CAT, + imp = self, + "Can't parse RTP header extension id from caps {sink_caps:?}" + ); return Err(gst::FlowError::NotNegotiated); }; @@ -1434,11 +1524,15 @@ impl RtpBaseDepay2 { if let Some(uri) = arr.get(1).and_then(|v| v.get::().ok()) { uri } else { - gst::error!(CAT, imp: self, "Couldn't get URI for RTP header extension id {ext_id} from caps {sink_caps:?}"); + gst::error!(CAT, imp = self, "Couldn't get URI for RTP header extension id {ext_id} from caps {sink_caps:?}"); return Err(gst::FlowError::NotNegotiated); } } else { - gst::error!(CAT, imp: self, "Couldn't get URI for RTP header extension id {ext_id} from caps {sink_caps:?}"); + gst::error!( + CAT, + imp = self, + "Couldn't get URI for RTP header extension id {ext_id} from caps {sink_caps:?}" + ); return Err(gst::FlowError::NotNegotiated); }; @@ -1456,13 +1550,17 @@ impl RtpBaseDepay2 { } // Try to get a new one for this extension ID instead - gst::warning!(CAT, imp: self, "Failed to configure extension {ext_id} from caps {sink_caps}"); + gst::warning!( + CAT, + imp = self, + "Failed to configure extension {ext_id} from caps {sink_caps}" + ); extensions_changed |= true; extensions.remove(ext_id); } else { gst::debug!( CAT, - imp: self, + imp = self, "Extension ID {ext_id} changed from {:?} to {uri}", extension.uri(), ); @@ -1471,7 +1569,11 @@ impl RtpBaseDepay2 { } } - gst::debug!(CAT, imp: self, "Requesting extension {uri} for ID {ext_id}"); + gst::debug!( + CAT, + imp = self, + "Requesting extension {uri} for ID {ext_id}" + ); let ext = self .obj() .emit_by_name::>( @@ -1480,17 +1582,25 @@ impl RtpBaseDepay2 { ); let Some(ext) = ext else { - gst::warning!(CAT, imp: self, "Couldn't create extension for {uri} with ID {ext_id}"); + gst::warning!( + CAT, + imp = self, + "Couldn't create extension for {uri} with ID {ext_id}" + ); continue; }; if ext.id() != *ext_id as u32 { - gst::warning!(CAT, imp: self, "Created extension has wrong ID"); + gst::warning!(CAT, imp = self, "Created extension has wrong ID"); continue; } if !ext.set_attributes_from_caps(sink_caps) { - gst::warning!(CAT, imp: self, "Failed to configure extension {ext_id} from caps {sink_caps}"); + gst::warning!( + CAT, + imp = self, + "Failed to configure extension {ext_id} from caps {sink_caps}" + ); continue; } @@ -1517,19 +1627,23 @@ impl RtpBaseDepay2 { } fn set_sink_caps(&self, sink_caps: gst::Caps) -> Result { - gst::debug!(CAT, imp: self, "Received caps {sink_caps:?}"); + gst::debug!(CAT, imp = self, "Received caps {sink_caps:?}"); let s = sink_caps.structure(0).unwrap(); if !s.has_name("application/x-rtp") { - gst::error!(CAT, imp: self, "Non-RTP caps {sink_caps:?} not supported"); + gst::error!(CAT, imp = self, "Non-RTP caps {sink_caps:?} not supported"); return Err(gst::FlowError::NotNegotiated); } let clock_rate = match s.get::("clock-rate") { Ok(clock_rate) if clock_rate > 0 => clock_rate, _ => { - gst::error!(CAT, imp: self, "RTP caps {sink_caps:?} without 'clock-rate'"); + gst::error!( + CAT, + imp = self, + "RTP caps {sink_caps:?} without 'clock-rate'" + ); return Err(gst::FlowError::NotNegotiated); } }; @@ -1558,14 +1672,14 @@ impl RtpBaseDepay2 { // Just continue here. The depayloader is now flushed and can proceed below, // and if there was a serious error downstream it will happen on the next // buffer pushed downstream - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } let set_sink_caps_res = if (obj.class().as_ref().set_sink_caps)(&obj, &sink_caps) { - gst::debug!(CAT, imp: self, "Caps {sink_caps:?} accepted"); + gst::debug!(CAT, imp = self, "Caps {sink_caps:?} accepted"); Ok(gst::FlowSuccess::Ok) } else { - gst::warning!(CAT, imp: self, "Caps {sink_caps:?} not accepted"); + gst::warning!(CAT, imp = self, "Caps {sink_caps:?} not accepted"); Err(gst::FlowError::NotNegotiated) }; @@ -1613,9 +1727,9 @@ impl RtpBaseDepay2 { let obj = self.obj(); if let Err(err) = (obj.class().as_ref().drain)(&obj) { if ![gst::FlowError::Flushing, gst::FlowError::Eos].contains(&err) { - gst::warning!(CAT, imp: self, "Draining failed: {err:?}"); + gst::warning!(CAT, imp = self, "Draining failed: {err:?}"); } else { - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } self.flush(); return Err(err); @@ -1912,7 +2026,7 @@ impl ElementImpl for RtpBaseDepay2 { &self, transition: gst::StateChange, ) -> Result { - gst::debug!(CAT, imp: self, "Changing state: {transition}"); + gst::debug!(CAT, imp = self, "Changing state: {transition}"); if transition == gst::StateChange::ReadyToPaused { *self.state.borrow_mut() = State::default(); diff --git a/net/rtp/src/basepay/imp.rs b/net/rtp/src/basepay/imp.rs index 7534291a..716d6d38 100644 --- a/net/rtp/src/basepay/imp.rs +++ b/net/rtp/src/basepay/imp.rs @@ -211,7 +211,7 @@ impl RtpBasePay2 { } pub(super) fn set_src_caps(&self, src_caps: &gst::Caps) { - gst::debug!(CAT, imp: self, "Setting src caps {src_caps:?}"); + gst::debug!(CAT, imp = self, "Setting src caps {src_caps:?}"); let s = src_caps.structure(0).unwrap(); assert!( @@ -229,22 +229,22 @@ impl RtpBasePay2 { fn negotiate(&self) { let state = self.state.borrow_mut(); let Some(ref src_caps) = state.src_caps else { - gst::debug!(CAT, imp: self, "No src caps set yet, can't negotiate"); + gst::debug!(CAT, imp = self, "No src caps set yet, can't negotiate"); return; }; let mut src_caps = src_caps.clone(); drop(state); - gst::debug!(CAT, imp: self, "Configured src caps: {src_caps:?}"); + gst::debug!(CAT, imp = self, "Configured src caps: {src_caps:?}"); let peer_caps = self.src_pad.peer_query_caps(Some(&src_caps)); if !peer_caps.is_empty() { - gst::debug!(CAT, imp: self, "Peer caps: {peer_caps:?}"); + gst::debug!(CAT, imp = self, "Peer caps: {peer_caps:?}"); src_caps = peer_caps; } else { - gst::debug!(CAT, imp: self, "Empty peer caps"); + gst::debug!(CAT, imp = self, "Empty peer caps"); } - gst::debug!(CAT, imp: self, "Negotiating with caps {src_caps:?}"); + gst::debug!(CAT, imp = self, "Negotiating with caps {src_caps:?}"); src_caps.make_mut(); let obj = self.obj(); @@ -252,7 +252,12 @@ impl RtpBasePay2 { } pub(super) fn drop_buffers(&self, ids: impl RangeBounds) { - gst::trace!(CAT, imp: self, "Dropping buffers up to {:?}", ids.end_bound()); + gst::trace!( + CAT, + imp = self, + "Dropping buffers up to {:?}", + ids.end_bound() + ); let mut state = self.state.borrow_mut(); let end = match ids.end_bound() { @@ -286,7 +291,7 @@ impl RtpBasePay2 { ) -> Result { gst::trace!( CAT, - imp: self, + imp = self, "Queueing packet for {packet_to_buffer_relation:?}", ); @@ -294,14 +299,14 @@ impl RtpBasePay2 { let mut state = self.state.borrow_mut(); if state.negotiated_src_caps.is_none() { - gst::error!(CAT, imp: self, "No source pad caps negotiated yet"); + gst::error!(CAT, imp = self, "No source pad caps negotiated yet"); return Err(gst::FlowError::NotNegotiated); } state.last_seqnum += 1; let stream = state.stream.as_ref().unwrap(); let seqnum = state.last_seqnum.0; - gst::trace!(CAT, imp: self, "Using seqnum {seqnum}"); + gst::trace!(CAT, imp = self, "Using seqnum {seqnum}"); packet = packet .payload_type(stream.pt) .ssrc(stream.ssrc) @@ -311,23 +316,32 @@ impl RtpBasePay2 { // Queue up packet for later if it doesn't have any associated buffers that could be used // for figuring out the timestamp. if matches!(packet_to_buffer_relation, PacketToBufferRelation::OutOfBand) { - gst::trace!(CAT, imp: self, "Keeping packet without associated buffer until next packet or EOS"); + gst::trace!( + CAT, + imp = self, + "Keeping packet without associated buffer until next packet or EOS" + ); // FIXME: Use more optimal packet writing API once available // https://github.com/ystreet/rtp-types/issues/4 // https://github.com/ystreet/rtp-types/issues/5 // TODO: Maybe use an MTU-sized buffer pool? let packet_buffer = packet.write_vec().map_err(|err| { - gst::error!(CAT, imp: self, "Can't write packet: {err}"); + gst::error!(CAT, imp = self, "Can't write packet: {err}"); gst::FlowError::Error })?; let packet_len = packet_buffer.len(); if (settings.mtu as usize) < packet_len { - gst::warning!(CAT, imp: self, "Generated packet has bigger size {packet_len} than MTU {}", settings.mtu); + gst::warning!( + CAT, + imp = self, + "Generated packet has bigger size {packet_len} than MTU {}", + settings.mtu + ); } - gst::trace!(CAT, imp: self, "Queueing packet of size {packet_len}"); + gst::trace!(CAT, imp = self, "Queueing packet of size {packet_len}"); let marker = { let packet = rtp_types::RtpPacket::parse(&packet_buffer).unwrap(); @@ -363,7 +377,7 @@ impl RtpBasePay2 { }; if ids.is_empty() { - gst::error!(CAT, imp: self, "Empty buffer id range provided"); + gst::error!(CAT, imp = self, "Empty buffer id range provided"); return Err(gst::FlowError::Error); } @@ -377,16 +391,24 @@ impl RtpBasePay2 { .is_some_and(|b| b.id < id_start) { let b = state.pending_buffers.pop_front().unwrap(); - gst::trace!(CAT, imp: self, "Dropping buffer with id {}", b.id); + gst::trace!(CAT, imp = self, "Dropping buffer with id {}", b.id); } let Some(front) = state.pending_buffers.front() else { - gst::error!(CAT, imp: self, "Queueing packet for future buffer ids not allowed"); + gst::error!( + CAT, + imp = self, + "Queueing packet for future buffer ids not allowed" + ); return Err(gst::FlowError::Error); }; if id_end > state.pending_buffers.back().unwrap().id { - gst::error!(CAT, imp: self, "Queueing packet for future buffer ids not allowed"); + gst::error!( + CAT, + imp = self, + "Queueing packet for future buffer ids not allowed" + ); return Err(gst::FlowError::Error); } @@ -449,7 +471,7 @@ impl RtpBasePay2 { } crate::basepay::TimestampOffset::Rtp(rtp_diff) => { let Some((base_pts, base_rtptime)) = state.last_pts_rtp_mapping else { - gst::error!(CAT, imp: self, "Have no base PTS / RTP time mapping"); + gst::error!(CAT, imp = self, "Have no base PTS / RTP time mapping"); return Err(gst::FlowError::Error); }; @@ -624,7 +646,7 @@ impl RtpBasePay2 { // https://github.com/ystreet/rtp-types/issues/5 // TODO: Maybe use an MTU-sized buffer pool? let packet_buffer = packet.write_vec().map_err(|err| { - gst::error!(CAT, imp: self, "Can't write packet: {err}"); + gst::error!(CAT, imp = self, "Can't write packet: {err}"); gst::FlowError::Error })?; let packet_len = packet_buffer.len(); @@ -632,12 +654,17 @@ impl RtpBasePay2 { // FIXME: See comment in `max_payload_size()`. We currently don't provide a way to the // subclass to know how much space will be used up by extensions. if (settings.mtu as usize) < packet_len - extension_size { - gst::warning!(CAT, imp: self, "Generated packet has bigger size {packet_len} than MTU {}", settings.mtu); + gst::warning!( + CAT, + imp = self, + "Generated packet has bigger size {packet_len} than MTU {}", + settings.mtu + ); } gst::trace!( CAT, - imp: self, + imp = self, "Queueing packet of size {packet_len} with RTP timestamp {packet_rtptime} and PTS {packet_pts}", ); @@ -701,7 +728,11 @@ impl RtpBasePay2 { }; if extension_data.len() < offset { - gst::error!(CAT, imp: self, "No space left for writing RTP header extension {ext_id}"); + gst::error!( + CAT, + imp = self, + "No space left for writing RTP header extension {ext_id}" + ); break; } @@ -727,7 +758,11 @@ impl RtpBasePay2 { extension_data = &mut extension_data[offset + written..]; } else { - gst::error!(CAT, imp: self, "Writing RTP header extension {ext_id} failed"); + gst::error!( + CAT, + imp = self, + "Writing RTP header extension {ext_id} failed" + ); } } } @@ -773,7 +808,7 @@ impl RtpBasePay2 { assert_ne!(num_buffers, 0); - gst::trace!(CAT, imp: self, "Flushing {num_buffers} packets"); + gst::trace!(CAT, imp = self, "Flushing {num_buffers} packets"); let segment_event = self.retrieve_pending_segment_event(&mut state); @@ -784,7 +819,7 @@ impl RtpBasePay2 { let packets = if num_buffers == 1 { let buffer = state.pending_packets.pop_front().unwrap().buffer; - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); BufferOrList::Buffer(buffer) } else { let mut list = gst::BufferList::new_sized(num_buffers); @@ -796,7 +831,7 @@ impl RtpBasePay2 { .is_some_and(|p| p.buffer.pts() == Some(pts)) { let buffer = state.pending_packets.pop_front().unwrap().buffer; - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); list.add(buffer); } } @@ -817,9 +852,9 @@ impl RtpBasePay2 { if let Err(err) = res { if ![gst::FlowError::Flushing, gst::FlowError::Eos].contains(&err) { - gst::warning!(CAT, imp: self, "Failed pushing packets: {err:?}"); + gst::warning!(CAT, imp = self, "Failed pushing packets: {err:?}"); } else { - gst::debug!(CAT, imp: self, "Failed pushing packets: {err:?}"); + gst::debug!(CAT, imp = self, "Failed pushing packets: {err:?}"); } return Err(err); } @@ -874,7 +909,11 @@ impl RtpBasePay2 { continue; }; let Ok(ext_id) = ext_id.parse::() else { - gst::error!(CAT, imp: self, "Can't parse RTP header extension id from caps {src_caps:?}"); + gst::error!( + CAT, + imp = self, + "Can't parse RTP header extension id from caps {src_caps:?}" + ); return Err(gst::FlowError::NotNegotiated); }; @@ -884,11 +923,15 @@ impl RtpBasePay2 { if let Some(uri) = arr.get(1).and_then(|v| v.get::().ok()) { uri } else { - gst::error!(CAT, imp: self, "Couldn't get URI for RTP header extension id {ext_id} from caps {src_caps:?}"); + gst::error!(CAT, imp = self, "Couldn't get URI for RTP header extension id {ext_id} from caps {src_caps:?}"); return Err(gst::FlowError::NotNegotiated); } } else { - gst::error!(CAT, imp: self, "Couldn't get URI for RTP header extension id {ext_id} from caps {src_caps:?}"); + gst::error!( + CAT, + imp = self, + "Couldn't get URI for RTP header extension id {ext_id} from caps {src_caps:?}" + ); return Err(gst::FlowError::NotNegotiated); }; @@ -906,13 +949,17 @@ impl RtpBasePay2 { } // Try to get a new one for this extension ID instead - gst::warning!(CAT, imp: self, "Failed to configure extension {ext_id} from caps {src_caps}"); + gst::warning!( + CAT, + imp = self, + "Failed to configure extension {ext_id} from caps {src_caps}" + ); extensions_changed |= true; extensions.remove(ext_id); } else { gst::debug!( CAT, - imp: self, + imp = self, "Extension ID {ext_id} changed from {:?} to {uri}", extension.uri(), ); @@ -921,7 +968,11 @@ impl RtpBasePay2 { } } - gst::debug!(CAT, imp: self, "Requesting extension {uri} for ID {ext_id}"); + gst::debug!( + CAT, + imp = self, + "Requesting extension {uri} for ID {ext_id}" + ); let ext = self .obj() .emit_by_name::>( @@ -930,17 +981,25 @@ impl RtpBasePay2 { ); let Some(ext) = ext else { - gst::warning!(CAT, imp: self, "Couldn't create extension for {uri} with ID {ext_id}"); + gst::warning!( + CAT, + imp = self, + "Couldn't create extension for {uri} with ID {ext_id}" + ); continue; }; if ext.id() != *ext_id as u32 { - gst::warning!(CAT, imp: self, "Created extension has wrong ID"); + gst::warning!(CAT, imp = self, "Created extension has wrong ID"); continue; } if !ext.set_attributes_from_caps(src_caps) { - gst::warning!(CAT, imp: self, "Failed to configure extension {ext_id} from caps {src_caps}"); + gst::warning!( + CAT, + imp = self, + "Failed to configure extension {ext_id} from caps {src_caps}" + ); continue; } @@ -952,7 +1011,11 @@ impl RtpBasePay2 { let mut to_remove = vec![]; for (ext_id, ext) in extensions.iter() { if !ext.set_non_rtp_sink_caps(sink_caps) { - gst::warning!(CAT, imp: self, "Failed to configure extension {ext_id} from sink caps {sink_caps}"); + gst::warning!( + CAT, + imp = self, + "Failed to configure extension {ext_id} from sink caps {sink_caps}" + ); to_remove.push(*ext_id); } } @@ -982,7 +1045,7 @@ impl RtpBasePay2 { } fn negotiate_default(&self, mut src_caps: gst::Caps) { - gst::debug!(CAT, imp: self, "Negotiating caps {src_caps:?}"); + gst::debug!(CAT, imp = self, "Negotiating caps {src_caps:?}"); // Fixate what is left to fixate. src_caps.fixate(); @@ -1021,7 +1084,7 @@ impl RtpBasePay2 { } if Some(&src_caps) == state.negotiated_src_caps.as_ref() { - gst::debug!(CAT, imp: self, "Setting same caps {src_caps:?} again"); + gst::debug!(CAT, imp = self, "Setting same caps {src_caps:?} again"); return; } @@ -1052,7 +1115,7 @@ impl RtpBasePay2 { // Just continue here. The payloader is now flushed and can proceed below, // and if there was a serious error downstream it will happen on the next // buffer pushed downstream - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } } @@ -1095,7 +1158,7 @@ impl RtpBasePay2 { let state = self.state.borrow(); if state.sink_caps.is_none() { - gst::warning!(CAT, imp: self, "Received segment before caps"); + gst::warning!(CAT, imp = self, "Received segment before caps"); return Err(gst::FlowError::NotNegotiated); } @@ -1111,14 +1174,14 @@ impl RtpBasePay2 { drop(state); if !same_segment { - gst::debug!(CAT, imp: self, "Received segment {segment:?}"); + gst::debug!(CAT, imp = self, "Received segment {segment:?}"); if drain { if let Err(err) = self.drain() { // Just continue here. The payloader is now flushed and can proceed below, // and if there was a serious error downstream it will happen on the next // buffer pushed downstream - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } } @@ -1126,7 +1189,11 @@ impl RtpBasePay2 { if let Some(segment) = segment.downcast_ref::() { state.segment = Some((event.seqnum(), segment.clone())); } else { - gst::error!(CAT, imp: self, "Segments in non-TIME format are not supported"); + gst::error!( + CAT, + imp = self, + "Segments in non-TIME format are not supported" + ); state.segment = None; // FIXME: Forget everything here? return Err(gst::FlowError::Error); @@ -1134,7 +1201,11 @@ impl RtpBasePay2 { if state.negotiated_src_caps.is_none() { state.pending_segment = true; - gst::debug!(CAT, imp: self, "Received segment before knowing src caps, delaying"); + gst::debug!( + CAT, + imp = self, + "Received segment before knowing src caps, delaying" + ); return Ok(gst::FlowSuccess::Ok); } @@ -1143,7 +1214,7 @@ impl RtpBasePay2 { } gst::EventView::Eos(_) => { if let Err(err) = self.drain() { - gst::debug!(CAT, imp: self, "Draining on EOS failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining on EOS failed: {err:?}"); } } gst::EventView::FlushStop(_) => { @@ -1163,7 +1234,7 @@ impl RtpBasePay2 { _ => (), } - gst::debug!(CAT, imp: self, "Forwarding event: {event:?}"); + gst::debug!(CAT, imp = self, "Forwarding event: {event:?}"); if self.src_pad.push_event(event) { Ok(gst::FlowSuccess::Ok) } else if self.src_pad.pad_flags().contains(gst::PadFlags::FLUSHING) { @@ -1244,7 +1315,7 @@ impl RtpBasePay2 { if tags.len() > 1 { gst::trace!( CAT, - imp: self, + imp = self, "Not copying meta {}: has multiple tags {tags:?}", meta.api(), ); @@ -1258,7 +1329,7 @@ impl RtpBasePay2 { if !allowed_tags.iter().copied().any(|tag| tag == *meta_tag) { gst::trace!( CAT, - imp: self, + imp = self, "Not copying meta {}: tag '{meta_tag}' not allowed", meta.api(), ); @@ -1266,10 +1337,10 @@ impl RtpBasePay2 { } } - gst::trace!(CAT, imp: self, "Copying meta {}", meta.api()); + gst::trace!(CAT, imp = self, "Copying meta {}", meta.api()); if let Err(err) = meta.transform(out_buf, &gst::meta::MetaTransformCopy::new(false, ..)) { - gst::trace!(CAT, imp: self, "Could not copy meta {}: {err}", meta.api()); + gst::trace!(CAT, imp = self, "Could not copy meta {}: {err}", meta.api()); } } @@ -1303,7 +1374,7 @@ impl RtpBasePay2 { let Some(ext) = gst_rtp::RTPHeaderExtension::create_from_uri(uri) else { gst::debug!( CAT, - imp: self, + imp = self, "Didn't find any extension implementing URI {uri}", ); return None; @@ -1311,7 +1382,7 @@ impl RtpBasePay2 { gst::debug!( CAT, - imp: self, + imp = self, "Automatically enabling extension {} for URI {uri}", ext.name(), ); @@ -1329,7 +1400,7 @@ impl RtpBasePay2 { _pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, imp: self, "Received buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Received buffer {buffer:?}"); let settings = self.settings.lock().unwrap().clone(); self.handle_buffer(&settings, buffer) @@ -1340,7 +1411,7 @@ impl RtpBasePay2 { _pad: &gst::Pad, list: gst::BufferList, ) -> Result { - gst::trace!(CAT, imp: self, "Received buffer list {list:?}"); + gst::trace!(CAT, imp = self, "Received buffer list {list:?}"); let settings = self.settings.lock().unwrap().clone(); for buffer in list.iter_owned() { @@ -1355,7 +1426,7 @@ impl RtpBasePay2 { pad: &gst::Pad, event: gst::Event, ) -> Result { - gst::debug!(CAT, obj: pad, "Received event: {event:?}"); + gst::debug!(CAT, obj = pad, "Received event: {event:?}"); let obj = self.obj(); (obj.class().as_ref().sink_event)(&obj, event) @@ -1366,21 +1437,21 @@ impl RtpBasePay2 { pad: &gst::Pad, event: gst::Event, ) -> Result { - gst::debug!(CAT, obj: pad, "Received event: {event:?}"); + gst::debug!(CAT, obj = pad, "Received event: {event:?}"); let obj = self.obj(); (obj.class().as_ref().src_event)(&obj, event) } fn sink_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::trace!(CAT, obj: pad, "Received query: {query:?}"); + gst::trace!(CAT, obj = pad, "Received query: {query:?}"); let obj = self.obj(); (obj.class().as_ref().sink_query)(&obj, query) } fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::trace!(CAT, obj: pad, "Received query: {query:?}"); + gst::trace!(CAT, obj = pad, "Received query: {query:?}"); let obj = self.obj(); (obj.class().as_ref().src_query)(&obj, query) @@ -1400,7 +1471,11 @@ impl RtpBasePay2 { .build(); state.pending_segment = false; - gst::debug!(CAT, imp: self, "Created segment event {segment:?} with seqnum {seqnum:?}"); + gst::debug!( + CAT, + imp = self, + "Created segment event {segment:?} with seqnum {seqnum:?}" + ); Some(segment_event) } @@ -1418,7 +1493,7 @@ impl RtpBasePay2 { let mut state = self.state.borrow_mut(); if state.sink_caps.is_none() { - gst::error!(CAT, imp: self, "No sink pad caps"); + gst::error!(CAT, imp = self, "No sink pad caps"); gst::element_imp_error!( self, gst::CoreError::Negotiation, @@ -1433,12 +1508,12 @@ impl RtpBasePay2 { if buffer.flags().contains(gst::BufferFlags::HEADER) && self.obj().class().as_ref().drop_header_buffers { - gst::trace!(CAT, imp: self, "Dropping buffer with HEADER flag"); + gst::trace!(CAT, imp = self, "Dropping buffer with HEADER flag"); return Ok(gst::FlowSuccess::Ok); } if buffer.pts().is_none() { - gst::error!(CAT, imp: self, "Buffers without PTS"); + gst::error!(CAT, imp = self, "Buffers without PTS"); return Err(gst::FlowError::Error); }; @@ -1452,7 +1527,11 @@ impl RtpBasePay2 { if let Some(pts_diff) = pts_diff { if pts_diff > gst::ClockTime::SECOND { - gst::warning!(CAT, imp: self, "More than {pts_diff} of PTS time queued, probably a bug in the subclass"); + gst::warning!( + CAT, + imp = self, + "More than {pts_diff} of PTS time queued, probably a bug in the subclass" + ); } } } @@ -1462,7 +1541,7 @@ impl RtpBasePay2 { let stream = state.stream.as_mut().unwrap(); gst::debug!( CAT, - imp: self, + imp = self, "Switching from SSRC {} to {} because of SSRC collision", stream.ssrc, new_ssrc, @@ -1501,7 +1580,7 @@ impl RtpBasePay2 { let id = state.current_buffer_id; state.current_buffer_id += 1; - gst::trace!(CAT, imp: self, "Handling buffer {buffer:?} with id {id}"); + gst::trace!(CAT, imp = self, "Handling buffer {buffer:?} with id {id}"); state.pending_buffers.push_back(PendingBuffer { id, buffer: buffer.clone(), @@ -1511,12 +1590,12 @@ impl RtpBasePay2 { let obj = self.obj(); let mut res = (obj.class().as_ref().handle_buffer)(&obj, &buffer, id); if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed handling buffer: {err:?}"); + gst::error!(CAT, imp = self, "Failed handling buffer: {err:?}"); } else { res = self.finish_pending_packets(); if let Err(err) = res { - gst::debug!(CAT, imp: self, "Failed finishing pending packets: {err:?}"); + gst::debug!(CAT, imp = self, "Failed finishing pending packets: {err:?}"); } } @@ -1538,7 +1617,7 @@ impl RtpBasePay2 { /// Other methods. impl RtpBasePay2 { fn set_sink_caps(&self, caps: gst::Caps) -> Result { - gst::debug!(CAT, imp: self, "Received caps {caps:?}"); + gst::debug!(CAT, imp = self, "Received caps {caps:?}"); let mut state = self.state.borrow_mut(); let same_caps = state @@ -1552,10 +1631,10 @@ impl RtpBasePay2 { if !same_caps { let obj = self.obj(); let set_sink_caps_res = if (obj.class().as_ref().set_sink_caps)(&obj, &caps) { - gst::debug!(CAT, imp: self, "Caps {caps:?} accepted"); + gst::debug!(CAT, imp = self, "Caps {caps:?} accepted"); Ok(gst::FlowSuccess::Ok) } else { - gst::warning!(CAT, imp: self, "Caps {caps:?} not accepted"); + gst::warning!(CAT, imp = self, "Caps {caps:?} not accepted"); Err(gst::FlowError::NotNegotiated) }; @@ -1575,9 +1654,9 @@ impl RtpBasePay2 { let obj = self.obj(); if let Err(err) = (obj.class().as_ref().drain)(&obj) { if ![gst::FlowError::Flushing, gst::FlowError::Eos].contains(&err) { - gst::warning!(CAT, imp: self, "Draining failed: {err:?}"); + gst::warning!(CAT, imp = self, "Draining failed: {err:?}"); } else { - gst::debug!(CAT, imp: self, "Draining failed: {err:?}"); + gst::debug!(CAT, imp = self, "Draining failed: {err:?}"); } self.flush(); return Err(err); @@ -1587,7 +1666,7 @@ impl RtpBasePay2 { state.pending_buffers.clear(); if !state.pending_packets.is_empty() { - gst::debug!(CAT, imp: self, "Pushing all pending packets"); + gst::debug!(CAT, imp = self, "Pushing all pending packets"); } // Update PTS and RTP timestamp of all pending packets that have none yet @@ -2021,7 +2100,7 @@ impl ElementImpl for RtpBasePay2 { &self, transition: gst::StateChange, ) -> Result { - gst::debug!(CAT, imp: self, "Changing state: {transition}"); + gst::debug!(CAT, imp = self, "Changing state: {transition}"); if transition == gst::StateChange::ReadyToPaused { { @@ -2044,7 +2123,7 @@ impl ElementImpl for RtpBasePay2 { use_stream_time: settings.onvif_no_rate_control || !settings.scale_rtptime, }; - gst::info!(CAT, imp: self, "Configuring {stream:?}"); + gst::info!(CAT, imp = self, "Configuring {stream:?}"); *self.state.borrow_mut() = State { stream: Some(stream), diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index eeacd17c..5023cd1c 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -795,7 +795,7 @@ impl State { gst::trace!( CAT, - obj: bwe, + obj = bwe, "{} bitrate: {}ps budget: {}/{} sending: {} Remaining: {}/{}", elapsed, human_kbits(self.estimated_bitrate), @@ -882,7 +882,7 @@ impl State { if rate > received_max && received_max > self.target_bitrate_on_delay as f64 { gst::log!( CAT, - obj: bwe, + obj = bwe, "Increasing == received_max rate: {}ps - effective bitrate: {}ps", human_kbits(received_max), human_kbits(effective_bitrate), @@ -896,7 +896,7 @@ impl State { } else if rate < self.target_bitrate_on_delay as f64 { gst::log!( CAT, - obj: bwe, + obj = bwe, "Rate < target, returning {}ps - effective bitrate: {}ps", human_kbits(self.target_bitrate_on_delay), human_kbits(effective_bitrate), @@ -906,7 +906,7 @@ impl State { } else { gst::log!( CAT, - obj: bwe, + obj = bwe, "Increase mult {eta}x{}ps={}ps - effective bitrate: {}ps", human_kbits(self.target_bitrate_on_delay), human_kbits(rate), @@ -948,7 +948,7 @@ impl State { gst::info!( CAT, - obj: bwe, + obj = bwe, "{controller_type:?}: {}ps => {}ps ({:?}) - effective bitrate: {}ps", human_kbits(prev_bitrate), human_kbits(target_bitrate), @@ -1110,7 +1110,7 @@ impl BandwidthEstimator { if !list.is_empty() { if let Err(err) = bwe.imp().push_list(list) { if err != gst::FlowError::Flushing { - gst::error!(CAT, obj: bwe, "pause task, reason: {err:?}"); + gst::error!(CAT, obj = bwe, "pause task, reason: {err:?}"); } pause() } @@ -1218,7 +1218,7 @@ impl ObjectSubclass for BandwidthEstimator { if let Some(bitrates) = logged_bitrates { gst::log!( CAT, - obj: bwe, + obj = bwe, "target bitrate on delay: {}ps - target bitrate on loss: {}ps", human_kbits(bitrates.0), human_kbits(bitrates.1), diff --git a/net/rtp/src/jpeg/depay/imp.rs b/net/rtp/src/jpeg/depay/imp.rs index 02dc1833..65261685 100644 --- a/net/rtp/src/jpeg/depay/imp.rs +++ b/net/rtp/src/jpeg/depay/imp.rs @@ -180,10 +180,14 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { }); if let Some((width, height)) = dimensions { - gst::debug!(CAT, imp: self, "Parsed SDP dimensions {width}x{height}"); + gst::debug!(CAT, imp = self, "Parsed SDP dimensions {width}x{height}"); state.sdp_dimensions = dimensions; } else { - gst::warning!(CAT, imp: self, "Failed to parse 'x-dimensions' attribute: {dimensions_str}"); + gst::warning!( + CAT, + imp = self, + "Failed to parse 'x-dimensions' attribute: {dimensions_str}" + ); } } @@ -200,10 +204,14 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { .ok() .and_then(gst::Fraction::approximate_f64) { - gst::debug!(CAT, imp: self, "Parsed SDP framerate {framerate}"); + gst::debug!(CAT, imp = self, "Parsed SDP framerate {framerate}"); state.sdp_framerate = Some(framerate); } else { - gst::warning!(CAT, imp: self, "Failed to parse 'a-framerate' attribute: {framerate_str}"); + gst::warning!( + CAT, + imp = self, + "Failed to parse 'a-framerate' attribute: {framerate_str}" + ); } } @@ -234,17 +242,17 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { let main_header = match r.parse::() { Ok(main_header) => main_header, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to parse main header: {err}"); + gst::warning!(CAT, imp = self, "Failed to parse main header: {err}"); state.pending_frame = None; self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } }; - gst::trace!(CAT, imp: self, "Parsed main header {main_header:?}"); + gst::trace!(CAT, imp = self, "Parsed main header {main_header:?}"); if state.pending_frame.is_none() && main_header.fragment_offset > 0 { - gst::trace!(CAT, imp: self, "Waiting for start of frame"); + gst::trace!(CAT, imp = self, "Waiting for start of frame"); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } @@ -253,7 +261,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { match r.parse::() { Ok(restart_header) => Some(restart_header), Err(err) => { - gst::warning!(CAT, imp: self, "Failed to parse restart header: {err}"); + gst::warning!(CAT, imp = self, "Failed to parse restart header: {err}"); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } @@ -265,7 +273,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { // Handle initial setup for a frame if main_header.fragment_offset == 0 { if state.pending_frame.is_some() { - gst::warning!(CAT, imp: self, "Dropping incomplete pending frame"); + gst::warning!(CAT, imp = self, "Dropping incomplete pending frame"); state.pending_frame = None; } @@ -289,13 +297,22 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { Ok(_) => match state.quant_tables.get(&main_header.q) { Some(quant) => quant.clone(), None => { - gst::warning!(CAT, imp: self, "Have no quantization table for Q {} yet", main_header.q); + gst::warning!( + CAT, + imp = self, + "Have no quantization table for Q {} yet", + main_header.q + ); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } }, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to parse quantization table header: {err}"); + gst::warning!( + CAT, + imp = self, + "Failed to parse quantization table header: {err}" + ); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } @@ -319,7 +336,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { } else if let Some((width, _)) = state.sdp_dimensions { width as i32 } else { - gst::warning!(CAT, imp: self, "Can't determine valid width for frame"); + gst::warning!(CAT, imp = self, "Can't determine valid width for frame"); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); }; @@ -329,7 +346,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { } else if let Some((height, _)) = state.sdp_dimensions { height as i32 } else { - gst::warning!(CAT, imp: self, "Can't determine valid height for frame"); + gst::warning!(CAT, imp = self, "Can't determine valid height for frame"); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); }; @@ -357,7 +374,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { } let caps = caps_builder.build(); - gst::debug!(CAT, imp: self, "Setting caps {caps:?}"); + gst::debug!(CAT, imp = self, "Setting caps {caps:?}"); self.obj().set_src_caps(&caps); state.dimensions = Some((width, height)); state.framerate = state.sdp_framerate; @@ -376,7 +393,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { ) { Ok(jpeg_header) => jpeg_header, Err(err) => { - gst::warning!(CAT, imp: self, "Can't create JPEG header for frame: {err}"); + gst::warning!(CAT, imp = self, "Can't create JPEG header for frame: {err}"); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } @@ -384,7 +401,11 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { let mut w = ByteWriter::endian(&mut data, BigEndian); if let Err(err) = w.build::(&jpeg_header) { - gst::warning!(CAT, imp: self, "Failed to write JPEG header for frame: {err}"); + gst::warning!( + CAT, + imp = self, + "Failed to write JPEG header for frame: {err}" + ); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); } @@ -399,7 +420,10 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { let pending_frame = state.pending_frame.as_mut().expect("no pending frame"); if pending_frame.expected_fragment_offset != main_header.fragment_offset { - gst::warning!(CAT, imp: self, "Expected fragment offset {} but got {}", + gst::warning!( + CAT, + imp = self, + "Expected fragment offset {} but got {}", pending_frame.expected_fragment_offset, main_header.fragment_offset, ); @@ -416,7 +440,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { { gst::warning!( CAT, - imp: self, + imp = self, "Main header changed in incompatible ways from {:?} to {:?} during a frame", pending_frame.main_header, main_header, diff --git a/net/rtp/src/jpeg/pay/imp.rs b/net/rtp/src/jpeg/pay/imp.rs index 6d34cfef..c6871b7c 100644 --- a/net/rtp/src/jpeg/pay/imp.rs +++ b/net/rtp/src/jpeg/pay/imp.rs @@ -154,7 +154,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { } fn set_sink_caps(&self, caps: &gst::Caps) -> bool { - gst::debug!(CAT, imp: self, "received caps {caps:?}"); + gst::debug!(CAT, imp = self, "received caps {caps:?}"); let s = caps.structure(0).unwrap(); @@ -210,7 +210,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { let max_payload_size = self.obj().max_payload_size(); - gst::trace!(CAT, imp: self, "received buffer of size {}", buffer.size()); + gst::trace!(CAT, imp = self, "received buffer of size {}", buffer.size()); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!( @@ -231,12 +231,16 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { let jpeg_header = match r.parse::() { Ok(header) => header, Err(err) => { - gst::error!(CAT, imp: self, "Failed parsing JPEG header: {err}"); + gst::error!(CAT, imp = self, "Failed parsing JPEG header: {err}"); return Err(gst::FlowError::Error); } }; let data_offset = cursor.position() as usize; - gst::trace!(CAT, imp: self, "Parsed JPEG header {jpeg_header:?}, data starts at offset {data_offset}"); + gst::trace!( + CAT, + imp = self, + "Parsed JPEG header {jpeg_header:?}, data starts at offset {data_offset}" + ); // Try detecting static quantization headers let luma_quant = &jpeg_header.quant.luma_quant[..jpeg_header.quant.luma_len as usize]; @@ -251,7 +255,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { 255 }; - gst::trace!(CAT, imp: self, "Using Q {q}"); + gst::trace!(CAT, imp = self, "Using Q {q}"); let mut data = &map[data_offset..]; let mut fragment_offset = 0; @@ -265,7 +269,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { height, }; let main_header_size = main_header.size().map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write main header: {err:?}"); + gst::error!(CAT, imp = self, "Failed to write main header: {err:?}"); gst::FlowError::Error })?; @@ -281,7 +285,11 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { .map(|q| q.size(&main_header)) .unwrap_or(Ok(0)) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write quantization table header: {err:?}"); + gst::error!( + CAT, + imp = self, + "Failed to write quantization table header: {err:?}" + ); gst::FlowError::Error })?; @@ -289,7 +297,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { let payload_size = (max_payload_size as usize) .checked_sub(overhead + 1) .ok_or_else(|| { - gst::error!(CAT, imp: self, "Too small MTU configured for stream"); + gst::error!(CAT, imp = self, "Too small MTU configured for stream"); gst::element_imp_error!( self, gst::LibraryError::Settings, @@ -302,7 +310,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { gst::trace!( CAT, - imp: self, + imp = self, "Writing packet with main header {main_header:?}, quantization table header {quant_table_header:?} and payload size {payload_size}", ); @@ -314,15 +322,19 @@ impl crate::basepay::RtpBasePay2Impl for RtpJpegPay { let mut w = ByteWriter::endian(&mut headers_buffer, BigEndian); w.build::(&main_header).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write main header: {err:?}"); + gst::error!(CAT, imp = self, "Failed to write main header: {err:?}"); gst::FlowError::Error })?; if let Some(quant_table_header) = quant_table_header { w.build_with::(&quant_table_header, &main_header) - .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write quantization table header: {err:?}"); - gst::FlowError::Error - })?; + .map_err(|err| { + gst::error!( + CAT, + imp = self, + "Failed to write quantization table header: {err:?}" + ); + gst::FlowError::Error + })?; } assert_eq!( headers_buffer.len(), diff --git a/net/rtp/src/klv/depay/imp.rs b/net/rtp/src/klv/depay/imp.rs index 60ccbaa5..3fded00e 100644 --- a/net/rtp/src/klv/depay/imp.rs +++ b/net/rtp/src/klv/depay/imp.rs @@ -163,7 +163,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { { gst::debug!( CAT, - imp: self, + imp = self, "Discontinuity, discarding {} bytes in accumulator", state.accumulator.len(), ); @@ -189,7 +189,11 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { let end = packet.marker_bit() || looks_like == LooksLike::SelfContained; - gst::trace!(CAT, imp: self, "start: {start}, end: {end}, looks like: {looks_like:?}"); + gst::trace!( + CAT, + imp = self, + "start: {start}, end: {end}, looks like: {looks_like:?}" + ); if end { state.prev_marker_seqnum = Some(packet.ext_seqnum()); @@ -198,7 +202,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { if start && looks_like == LooksLike::Undetermined { gst::warning!( CAT, - imp: self, + imp = self, "New start, but data doesn't look like the start of a KLV unit?! Discarding", ); state.clear_accumulator(); @@ -210,7 +214,12 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { if looks_like == LooksLike::SelfContained { state.clear_accumulator(); - gst::debug!(CAT, imp: self, "Finished KLV unit, pushing out {} bytes", payload.len()); + gst::debug!( + CAT, + imp = self, + "Finished KLV unit, pushing out {} bytes", + payload.len() + ); return self .obj() .queue_buffer(packet.into(), packet.payload_buffer()); @@ -222,7 +231,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { if !state.accumulator.is_empty() { gst::debug!( CAT, - imp: self, + imp = self, "New start, but still {} bytes in accumulator, discarding", state.accumulator.len(), ); @@ -236,7 +245,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { // if it looks like a start we know we don't have enough bytes yet gst::debug!( CAT, - imp: self, + imp = self, "Start. Have {} bytes, but want {} bytes, waiting for more data", state.accumulator.len(), klv_utils::peek_klv(payload).unwrap(), @@ -252,7 +261,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { if state.accumulator.is_empty() { gst::debug!( CAT, - imp: self, + imp = self, "Continuation fragment, but no data in accumulator. Need to wait for start of next unit, discarding.", ); self.obj().drop_packet(packet); @@ -264,7 +273,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { let Ok(klv_unit_size) = klv_utils::peek_klv(&state.accumulator) else { gst::warning!( CAT, - imp: self, + imp = self, "Accumulator does not contain KLV unit start?! Clearing.", ); @@ -275,7 +284,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { gst::log!( CAT, - imp: self, + imp = self, "Continuation. Have {} bytes, want {} bytes", state.accumulator.len(), klv_unit_size, @@ -285,12 +294,12 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { if state.accumulator.len() >= klv_unit_size || end { if state.accumulator.len() != klv_unit_size { if state.accumulator.len() > klv_unit_size { - gst::warning!(CAT, imp: self, "More bytes than expected in accumulator!"); + gst::warning!(CAT, imp = self, "More bytes than expected in accumulator!"); } else { // For now we'll honour the marker bit unconditionally and don't second-guess it gst::warning!( CAT, - imp: self, + imp = self, "Fewer bytes than expected in accumulator, but marker bit set!", ); } @@ -303,7 +312,7 @@ impl RtpBaseDepay2Impl for RtpKlvDepay { gst::debug!( CAT, - imp: self, + imp = self, "Finished KLV unit, pushing out {} bytes", accumulator.len(), ); diff --git a/net/rtp/src/klv/pay/imp.rs b/net/rtp/src/klv/pay/imp.rs index e6f9ddbf..a9b23698 100644 --- a/net/rtp/src/klv/pay/imp.rs +++ b/net/rtp/src/klv/pay/imp.rs @@ -132,12 +132,12 @@ impl RtpBasePay2Impl for RtpKlvPay { id: u64, ) -> Result { let map = buffer.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; if map.size() == 0 { - gst::log!(CAT, imp: self, "Empty buffer, skipping"); + gst::log!(CAT, imp = self, "Empty buffer, skipping"); self.obj().drop_buffers(id..=id); return Ok(gst::FlowSuccess::Ok); } @@ -154,7 +154,7 @@ impl RtpBasePay2Impl for RtpKlvPay { // Also post warning message? gst::warning!( CAT, - imp: self, + imp = self, "Input doesn't look like a KLV unit, ignoring. {err:?}", ); return Ok(gst::FlowSuccess::Ok); @@ -164,7 +164,7 @@ impl RtpBasePay2Impl for RtpKlvPay { if unit_len != data.len() { gst::error!( CAT, - imp: self, + imp = self, "Input is not properly framed: KLV unit of size {unit_len} but buffer is {} bytes", data.len(), ); diff --git a/net/rtp/src/mp2t/depay/imp.rs b/net/rtp/src/mp2t/depay/imp.rs index a75a8578..d7924429 100644 --- a/net/rtp/src/mp2t/depay/imp.rs +++ b/net/rtp/src/mp2t/depay/imp.rs @@ -210,9 +210,12 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMP2TDepay { let payload = packet.payload(); if payload.len() < 188 + bytes_to_skip { - gst::warning!(CAT, imp: self, + gst::warning!( + CAT, + imp = self, "Payload too small: {} bytes, but need at least {} bytes", - payload.len(), 188 + bytes_to_skip + payload.len(), + 188 + bytes_to_skip ); self.obj().drop_packet(packet); @@ -236,7 +239,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMP2TDepay { } let Some(packet_size) = state.packet_size else { - gst::debug!(CAT, imp: self, "Could not determine packet size, dropping packet {packet:?}"); + gst::debug!( + CAT, + imp = self, + "Could not determine packet size, dropping packet {packet:?}" + ); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); }; @@ -248,14 +255,21 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMP2TDepay { let n_packets = payload.len() / packet_size; if payload.len() % packet_size != 0 { - gst::warning!(CAT, imp: self, + gst::warning!( + CAT, + imp = self, "Payload does not contain an integral number of MPEG-TS packets! ({} left over)", - payload.len() % packet_size); + payload.len() % packet_size + ); } let output_size = n_packets * packet_size; - gst::trace!(CAT, imp: self, "Packet with {n_packets} MPEG-TS packets of size {packet_size}"); + gst::trace!( + CAT, + imp = self, + "Packet with {n_packets} MPEG-TS packets of size {packet_size}" + ); let mut buffer = packet.payload_subbuffer_from_offset_with_length(bytes_to_skip, output_size); @@ -266,7 +280,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMP2TDepay { buffer_ref.set_flags(gst::BufferFlags::RESYNC); } - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); self.obj().queue_buffer(packet.into(), buffer) } @@ -277,7 +291,11 @@ impl RtpMP2TDepay { const PACKET_SIZES: [(usize, usize); 4] = [(188, 0), (192, 4), (204, 0), (208, 0)]; for (size, offset) in PACKET_SIZES { - gst::debug!(CAT, imp: self, "Trying MPEG-TS packet size of {size} bytes.."); + gst::debug!( + CAT, + imp = self, + "Trying MPEG-TS packet size of {size} bytes.." + ); // Try exact size match for the payload first if payload.len() >= size @@ -286,16 +304,29 @@ impl RtpMP2TDepay { .chunks_exact(size) .all(|packet| packet[offset] == TS_PACKET_SYNC) { - gst::info!(CAT, imp: self, "Detected MPEG-TS packet size of {size} bytes, {} packets", payload.len() / size); + gst::info!( + CAT, + imp = self, + "Detected MPEG-TS packet size of {size} bytes, {} packets", + payload.len() / size + ); return NonZeroUsize::new(size); } } - gst::warning!(CAT, imp: self, "Could not detect MPEG-TS packet size using full payload"); + gst::warning!( + CAT, + imp = self, + "Could not detect MPEG-TS packet size using full payload" + ); // No match? Try if we find a size if we ignore any leftover bytes for (size, offset) in PACKET_SIZES { - gst::debug!(CAT, imp: self, "Trying MPEG-TS packet size of {size} bytes with remainder.."); + gst::debug!( + CAT, + imp = self, + "Trying MPEG-TS packet size of {size} bytes with remainder.." + ); if payload.len() >= size && payload.len() % size != 0 @@ -303,13 +334,18 @@ impl RtpMP2TDepay { .chunks_exact(size) .all(|packet| packet[offset] == TS_PACKET_SYNC) { - gst::info!(CAT, imp: self, "Detected MPEG-TS packet size of {size} bytes, {} packets, {} bytes leftover", - payload.len() / size, payload.len() % size); + gst::info!( + CAT, + imp = self, + "Detected MPEG-TS packet size of {size} bytes, {} packets, {} bytes leftover", + payload.len() / size, + payload.len() % size + ); return NonZeroUsize::new(size); } } - gst::warning!(CAT, imp: self, "Could not detect MPEG-TS packet size"); + gst::warning!(CAT, imp = self, "Could not detect MPEG-TS packet size"); None } diff --git a/net/rtp/src/mp2t/pay/imp.rs b/net/rtp/src/mp2t/pay/imp.rs index 3624bc90..dd2826b5 100644 --- a/net/rtp/src/mp2t/pay/imp.rs +++ b/net/rtp/src/mp2t/pay/imp.rs @@ -248,14 +248,14 @@ impl crate::basepay::RtpBasePay2Impl for RtpMP2TPay { // // Set marker flag whenever the timestamp is discontinuous. if buffer.flags().contains(gst::BufferFlags::DISCONT) { - gst::debug!(CAT, imp: self, "discont, pushing out pending packets"); + gst::debug!(CAT, imp = self, "discont, pushing out pending packets"); self.send_pending_data(&mut state)?; self.obj().finish_pending_packets()?; state.discont_pending = true; } let map = buffer.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -292,7 +292,9 @@ impl crate::basepay::RtpBasePay2Impl for RtpMP2TPay { let n_bytes_from_new_data_in_first_packet = target_payload_size - state.pending_data.len(); - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "Using {} bytes ({} packets) of old data and {} bytes ({} packets) from new buffer", state.pending_data.len(), state.pending_data.len() / packet_size, @@ -321,7 +323,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpMP2TPay { let remainder = iter.remainder(); - gst::log!(CAT, imp: self, + gst::log!(CAT, imp = self, "Sending {} bytes ({} packets) in {} RTP packets with max payload size {}, {} bytes ({} packets) remaining for next time", data.len() - remainder.len(), (data.len() - remainder.len()) / packet_size, data.len() / target_payload_size, @@ -364,11 +366,16 @@ impl crate::basepay::RtpBasePay2Impl for RtpMP2TPay { impl RtpMP2TPay { fn send_pending_data(&self, state: &mut State) -> Result { if state.pending_data.is_empty() { - gst::log!(CAT, imp: self, "No pending data, nothing to do"); + gst::log!(CAT, imp = self, "No pending data, nothing to do"); return Ok(gst::FlowSuccess::Ok); } - gst::log!(CAT, imp: self, "Sending {} bytes of old data", state.pending_data.len()); + gst::log!( + CAT, + imp = self, + "Sending {} bytes of old data", + state.pending_data.len() + ); let pending_id = state.pending_data.id(); diff --git a/net/rtp/src/mp4a/depay/imp.rs b/net/rtp/src/mp4a/depay/imp.rs index d123afce..6a6938b7 100644 --- a/net/rtp/src/mp4a/depay/imp.rs +++ b/net/rtp/src/mp4a/depay/imp.rs @@ -218,7 +218,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { let mut config = match ConfigWithCodecData::from_caps_structure(s) { Ok(Some(c)) => { - gst::log!(CAT, imp: self, "{:?}", c.config); + gst::log!(CAT, imp = self, "{:?}", c.config); caps_builder = caps_builder .field("channels", c.config.prog.channel_conf as i32) @@ -229,11 +229,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { } Ok(None) => { // In-band StreamMuxConfig not supported yet - gst::log!(CAT, imp: self, "config field not found"); + gst::log!(CAT, imp = self, "config field not found"); return false; } Err(err) => { - gst::error!(CAT, imp: self, "Error parsing StreamMuxConfig: {err}"); + gst::error!(CAT, imp = self, "Error parsing StreamMuxConfig: {err}"); return false; } }; @@ -249,7 +249,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { { // FIXME this is a workaround for forward compatibility with AAC SBR & HE // see also comment in the parsers module. - gst::warning!(CAT, imp: self, concat!( + gst::warning!(CAT, imp = self, concat!( "Found audio object type {}, which uses a specific extension for samplingFrequency. ", "This extension is not supported yet. ", "Will use 'clock-rate' {} as a workaround.", @@ -258,7 +258,10 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { clock_rate, ); } else { - gst::error!(CAT, imp: self, concat!( + gst::error!( + CAT, + imp = self, + concat!( "Caps 'clock-rate' {} and 'codec-data' sample rate {} mismatch. ", "Will use 'clock-rate'", ), @@ -283,7 +286,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { // Can't push incomplete frames, so draining is the same as flushing. fn flush(&self) { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); self.state.borrow_mut().flush(); } @@ -323,7 +326,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { // See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1173 let Some(config) = state.config.as_ref() else { - gst::error!(CAT, imp: self, "In-band StreamMuxConfig not supported"); + gst::error!(CAT, imp = self, "In-band StreamMuxConfig not supported"); return Err(gst::FlowError::NotSupported); }; @@ -334,7 +337,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { for (idx, subframe) in frame.take_subframes(config).enumerate() { match subframe { Ok(subframe) => { - gst::log!(CAT, imp: self, "subframe {idx}: len {}", subframe.size()); + gst::log!(CAT, imp = self, "subframe {idx}: len {}", subframe.size()); // The duration is always set by the subframes iterator let duration = subframe.duration().expect("no duration set"); @@ -351,11 +354,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4AudioDepay { accumulated_duration.opt_add_assign(duration); } Err(err) if err.is_zero_length_subframe() => { - gst::warning!(CAT, imp: self, "{err}"); + gst::warning!(CAT, imp = self, "{err}"); continue; } Err(err) => { - gst::warning!(CAT, imp: self, "{err}"); + gst::warning!(CAT, imp = self, "{err}"); self.obj().drop_packets(..=packet.ext_seqnum()); break; } @@ -379,8 +382,11 @@ impl RtpMpeg4AudioDepay { let delta = crate::utils::seqnum_distance(seqnum, seqnum_base); if delta == 0 { - gst::debug!(CAT, imp: self, - "Got initial packet {seqnum_base} @ ext seqnum {}", packet.ext_seqnum(), + gst::debug!( + CAT, + imp = self, + "Got initial packet {seqnum_base} @ ext seqnum {}", + packet.ext_seqnum(), ); state.can_parse = true; @@ -388,7 +394,9 @@ impl RtpMpeg4AudioDepay { } if delta < 0 { - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "Waiting for initial packet {seqnum_base}, got {seqnum} (ext seqnum {})", packet.ext_seqnum(), ); @@ -396,7 +404,7 @@ impl RtpMpeg4AudioDepay { return ControlFlow::Break(()); } - gst::debug!(CAT, imp: self, + gst::debug!(CAT, imp = self, "Packet {seqnum} (ext seqnum {}) passed expected initial packet {seqnum_base}, will sync on next marker", packet.ext_seqnum(), ); @@ -407,7 +415,7 @@ impl RtpMpeg4AudioDepay { // AudioMuxElement doesn't come with a frame start marker // so wait until a marked packet is found and start parsing from the next packet if packet.marker_bit() { - gst::debug!(CAT, imp: self, + gst::debug!(CAT, imp = self, "Found first marked packet {seqnum} (ext seqnum {}). Will start parsing from next packet", packet.ext_seqnum(), ); @@ -415,7 +423,9 @@ impl RtpMpeg4AudioDepay { assert!(state.frame_acc.is_none()); state.can_parse = true; } else { - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "First marked packet not found yet, skipping packet {seqnum} (ext seqnum {})", packet.ext_seqnum(), ); diff --git a/net/rtp/src/mp4a/pay/imp.rs b/net/rtp/src/mp4a/pay/imp.rs index 645c9941..9cf8b6b6 100644 --- a/net/rtp/src/mp4a/pay/imp.rs +++ b/net/rtp/src/mp4a/pay/imp.rs @@ -175,7 +175,7 @@ impl RtpBasePay2Impl for RtpMpeg4AudioPay { let (config, config_data) = match ConfigWithCodecData::from_codec_data(s) { Ok(c) => (c.audio_config, c.config_data), Err(err) => { - gst::error!(CAT, imp: self, "Unusable codec_data: {err:#}"); + gst::error!(CAT, imp = self, "Unusable codec_data: {err:#}"); return false; } }; @@ -212,14 +212,14 @@ impl RtpBasePay2Impl for RtpMpeg4AudioPay { id: u64, ) -> Result { if buffer.size() == 0 { - gst::info!(CAT, imp: self, "Dropping empty buffer {id}"); + gst::info!(CAT, imp = self, "Dropping empty buffer {id}"); self.obj().drop_buffers(..=id); return Ok(gst::FlowSuccess::Ok); } let Ok(buffer_ref) = buffer.map_readable() else { - gst::error!(CAT, imp: self, "Failed to map buffer {id} readable"); + gst::error!(CAT, imp = self, "Failed to map buffer {id} readable"); return Err(gst::FlowError::Error); }; @@ -237,7 +237,7 @@ impl RtpBasePay2Impl for RtpMpeg4AudioPay { if max_payload_size < size_prefix.len() { gst::error!( CAT, - imp: self, + imp = self, "Insufficient max-payload-size {} for buffer {id} at least {} bytes needed", self.obj().max_payload_size(), size_prefix.len() + 1, @@ -268,10 +268,17 @@ impl RtpBasePay2Impl for RtpMpeg4AudioPay { // audioMuxElement or the last fragment of an audioMuxElement. let marker = rem_data.is_empty(); - gst::log!(CAT, imp: self, "Queuing {}packet with size {} for {}buffer {id}", + gst::log!( + CAT, + imp = self, + "Queuing {}packet with size {} for {}buffer {id}", if marker { "marked " } else { "" }, payload.len(), - if !marker || !is_first { "fragmented " } else { "" }, + if !marker || !is_first { + "fragmented " + } else { + "" + }, ); self.obj() diff --git a/net/rtp/src/mp4g/depay/imp.rs b/net/rtp/src/mp4g/depay/imp.rs index 2d1da783..510528ad 100644 --- a/net/rtp/src/mp4g/depay/imp.rs +++ b/net/rtp/src/mp4g/depay/imp.rs @@ -274,7 +274,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { } fn flush(&self) { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); self.state.borrow_mut().flush(); } @@ -283,7 +283,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { let mode = s.get::<&str>("mode").expect("Required by Caps"); if mode.starts_with("CELP") { - gst::error!(CAT, imp: self, "{mode} not supported yet"); + gst::error!(CAT, imp = self, "{mode} not supported yet"); return false; } @@ -301,7 +301,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { let mode_config = match ModeConfig::from_caps(s) { Ok(h) => h, Err(err) => { - gst::error!(CAT, imp: self, "Error parsing Header in Caps: {err:#}"); + gst::error!(CAT, imp = self, "Error parsing Header in Caps: {err:#}"); return false; } }; @@ -311,7 +311,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { caps_builder = caps_builder.field("codec_data", codec_data); } Err(err) => { - gst::error!(CAT, imp: self, "Error parsing Caps: {err:#}"); + gst::error!(CAT, imp = self, "Error parsing Caps: {err:#}"); return false; } } @@ -324,7 +324,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { let mut state = self.state.borrow_mut(); state.seqnum_base = s.get_optional::("seqnum-base").unwrap(); if let Some(seqnum_base) = state.seqnum_base { - gst::info!(CAT, imp: self, "Got seqnum_base {seqnum_base}"); + gst::info!(CAT, imp = self, "Got seqnum_base {seqnum_base}"); } state.clock_rate = clock_rate; @@ -364,7 +364,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { let au_iter = match parser.parse(payload, ext_seqnum, packet_ts) { Ok(au_iter) => au_iter, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to parse payload for packet {ext_seqnum}: {err:#}"); + gst::warning!( + CAT, + imp = self, + "Failed to parse payload for packet {ext_seqnum}: {err:#}" + ); *au_acc = None; self.obj().drop_packets(..=packet.ext_seqnum()); @@ -377,8 +381,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { let au = match au { Ok(au) => au, Err(err) => { - gst::warning!(CAT, imp: self, - "Failed to parse AU from packet {}: {err:#}", packet.ext_seqnum(), + gst::warning!( + CAT, + imp = self, + "Failed to parse AU from packet {}: {err:#}", + packet.ext_seqnum(), ); continue; @@ -390,13 +397,17 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { // > a fragmented Access Unit or one or more complete Access Units if !packet.marker_bit() { if !au.is_fragment { - gst::warning!(CAT, imp: self, "Dropping non fragmented AU {au} in un-marked packet"); + gst::warning!( + CAT, + imp = self, + "Dropping non fragmented AU {au} in un-marked packet" + ); continue; } if let Some(ref mut acc) = au_acc { if let Err(err) = acc.try_append(au) { - gst::warning!(CAT, imp: self, "Discarding pending fragmented AU: {err}"); + gst::warning!(CAT, imp = self, "Discarding pending fragmented AU: {err}"); *au_acc = None; parser.reset(); self.obj().drop_packets(..=packet.ext_seqnum()); @@ -407,7 +418,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { *au_acc = Some(AuAccumulator::new(au)); } - gst::trace!(CAT, imp: self, "Non-final fragment"); + gst::trace!(CAT, imp = self, "Non-final fragment"); return Ok(gst::FlowSuccess::Ok); } @@ -418,7 +429,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { Some(mut acc) => { if au.is_fragment { if let Err(err) = acc.try_append(au) { - gst::warning!(CAT, imp: self, "Discarding pending fragmented AU: {err}"); + gst::warning!( + CAT, + imp = self, + "Discarding pending fragmented AU: {err}" + ); parser.reset(); self.obj().drop_packets(..=packet.ext_seqnum()); @@ -428,7 +443,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { match acc.try_into_au() { Ok(au) => au, Err(err) => { - gst::warning!(CAT, imp: self, "Discarding pending fragmented AU: {err}"); + gst::warning!( + CAT, + imp = self, + "Discarding pending fragmented AU: {err}" + ); let Mpeg4GenericDepayError::FragmentedAuSizeMismatch { .. } = err else { unreachable!(); @@ -440,7 +459,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { } } } else { - gst::warning!(CAT, imp: self, + gst::warning!(CAT, imp = self, "Discarding pending fragmented AU {} due to incoming non fragmented AU {au}", acc.0, ); @@ -454,7 +473,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { if let Some(ref mut deint_buf) = deint_buf { if let Err(err) = deint_buf.push_and_pop(au, &mut aus) { - gst::warning!(CAT, imp: self, "Failed to push AU to deinterleave buffer: {err}"); + gst::warning!( + CAT, + imp = self, + "Failed to push AU to deinterleave buffer: {err}" + ); // The AU has been dropped, just keep going // Packet will be dropped eventually } @@ -467,7 +490,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpMpeg4GenericDepay { // > some broken non-interleaved streams have AU-index jumping around // > all over the place, apparently assuming receiver disregards - gst::warning!(CAT, imp: self, "Interleaved AU, but no `max_displacement` was defined"); + gst::warning!( + CAT, + imp = self, + "Interleaved AU, but no `max_displacement` was defined" + ); } aus.push(au); @@ -498,8 +525,11 @@ impl RtpMpeg4GenericDepay { let delta = crate::utils::seqnum_distance(seqnum, seqnum_base); if delta == 0 { - gst::debug!(CAT, imp: self, - "Got initial packet {seqnum_base} @ ext seqnum {}", packet.ext_seqnum(), + gst::debug!( + CAT, + imp = self, + "Got initial packet {seqnum_base} @ ext seqnum {}", + packet.ext_seqnum(), ); state.can_parse = true; @@ -507,7 +537,9 @@ impl RtpMpeg4GenericDepay { } if delta < 0 { - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "Waiting for initial packet {seqnum_base}, got {seqnum} (ext seqnum {})", packet.ext_seqnum(), ); @@ -515,7 +547,7 @@ impl RtpMpeg4GenericDepay { return ControlFlow::Break(()); } - gst::debug!(CAT, imp: self, + gst::debug!(CAT, imp = self, "Packet {seqnum} (ext seqnum {}) passed expected initial packet {seqnum_base}, will sync on next marker", packet.ext_seqnum(), ); @@ -525,7 +557,7 @@ impl RtpMpeg4GenericDepay { // Wait until a marked packet is found and start parsing from the next packet if packet.marker_bit() { - gst::debug!(CAT, imp: self, + gst::debug!(CAT, imp = self, "Found first marked packet {seqnum} (ext seqnum {}). Will start parsing from next packet", packet.ext_seqnum(), ); @@ -533,7 +565,9 @@ impl RtpMpeg4GenericDepay { assert!(state.au_acc.is_none()); state.can_parse = true; } else { - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "First marked packet not found yet, skipping packet {seqnum} (ext seqnum {})", packet.ext_seqnum(), ); @@ -590,7 +624,11 @@ impl RtpMpeg4GenericDepay { let packet_to_buffer_relation = get_packet_to_buffer_relation(&au, state.clock_rate, range); - gst::trace!(CAT, imp: self, "Finishing AU buffer {packet_to_buffer_relation:?}"); + gst::trace!( + CAT, + imp = self, + "Finishing AU buffer {packet_to_buffer_relation:?}" + ); let buffer = Self::new_buffer(au, state); @@ -607,7 +645,11 @@ impl RtpMpeg4GenericDepay { let packet_to_buffer_relation = get_packet_to_buffer_relation(&au, state.clock_rate, range); - gst::trace!(CAT, imp: self, "Finishing AU buffer {packet_to_buffer_relation:?}"); + gst::trace!( + CAT, + imp = self, + "Finishing AU buffer {packet_to_buffer_relation:?}" + ); let buffer = Self::new_buffer(au, state); diff --git a/net/rtp/src/mp4g/pay/imp.rs b/net/rtp/src/mp4g/pay/imp.rs index 78f27457..719e4f15 100644 --- a/net/rtp/src/mp4g/pay/imp.rs +++ b/net/rtp/src/mp4g/pay/imp.rs @@ -334,13 +334,13 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { let codec_data = match s.get::<&gst::BufferRef>("codec_data") { Ok(codec_data) => codec_data, Err(err) => { - gst::error!(CAT, imp: self, "Error getting codec_data from Caps: {err}"); + gst::error!(CAT, imp = self, "Error getting codec_data from Caps: {err}"); return false; } }; let Ok(codec_data) = codec_data.map_readable() else { - gst::error!(CAT, imp: self, "Failed to map codec_data as readable"); + gst::error!(CAT, imp = self, "Failed to map codec_data as readable"); return false; }; @@ -358,25 +358,34 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { let config = match r.parse::() { Ok(config) => config, Err(err) => { - gst::error!(CAT, imp: self, "Error parsing audio codec_data: {err:#}"); + gst::error!(CAT, imp = self, "Error parsing audio codec_data: {err:#}"); return false; } }; if config.audio_object_type == 0 || config.audio_object_type > 6 { - gst::error!(CAT, imp: self, "Unsupported Audio Object Type {}", config.audio_object_type); + gst::error!( + CAT, + imp = self, + "Unsupported Audio Object Type {}", + config.audio_object_type + ); return false; } let profile_level = match ProfileLevel::from_caps(s) { Ok(profile_level) => profile_level, Err(err) => { - gst::error!(CAT, imp: self, "Error getting profile level from Caps: {err:#}"); + gst::error!( + CAT, + imp = self, + "Error getting profile level from Caps: {err:#}" + ); return false; } }; - gst::log!(CAT, imp: self, "Using audio codec_data {config:?}"); + gst::log!(CAT, imp = self, "Using audio codec_data {config:?}"); // AAC-hbr: also used by rtpmp4gpay // RFC 3640 also defines AAC-lbr, with a maximum encoded buffer @@ -411,18 +420,22 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { } "video/mpeg" => { if codec_data.len() < 5 { - gst::error!(CAT, imp: self, "Error parsing video codec_data: too short"); + gst::error!(CAT, imp = self, "Error parsing video codec_data: too short"); return false; } let code = u32::from_be_bytes(codec_data[..4].try_into().unwrap()); let profile = if code == VOS_STARTCODE { let profile = codec_data[4]; - gst::log!(CAT, imp: self, "Using video codec_data profile {profile}"); + gst::log!(CAT, imp = self, "Using video codec_data profile {profile}"); profile } else { - gst::warning!(CAT, imp: self, "Unexpected VOS startcode in video codec_data. Assuming profile '1'"); + gst::warning!( + CAT, + imp = self, + "Unexpected VOS startcode in video codec_data. Assuming profile '1'" + ); 1 }; @@ -510,8 +523,14 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { let mut state = self.state.borrow_mut(); let mut settings = self.settings.lock().unwrap(); - gst::trace!(CAT, imp: self, "Handling buffer {id} duration {} pts {} dts {}, len {}", - buffer.duration().display(), buffer.pts().display(), buffer.dts().display(), buffer.size(), + gst::trace!( + CAT, + imp = self, + "Handling buffer {id} duration {} pts {} dts {}, len {}", + buffer.duration().display(), + buffer.pts().display(), + buffer.dts().display(), + buffer.size(), ); let maybe_random_access = if state.mode.random_access_indication { @@ -520,17 +539,23 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { None }; - let dts_delta = ct_delta_to_rtp(buffer.dts(), buffer.pts(), state.clock_rate).and_then(|dts_delta_res| { - if dts_delta_res.is_none() { - gst::warning!(CAT, imp: self, "Overflow computing DTS-delta between pts {} & dts {}", - buffer.dts().display(), buffer.pts().display(), - ); - } + let dts_delta = ct_delta_to_rtp(buffer.dts(), buffer.pts(), state.clock_rate).and_then( + |dts_delta_res| { + if dts_delta_res.is_none() { + gst::warning!( + CAT, + imp = self, + "Overflow computing DTS-delta between pts {} & dts {}", + buffer.dts().display(), + buffer.pts().display(), + ); + } - dts_delta_res - }); + dts_delta_res + }, + ); - gst::trace!(CAT, imp: self, + gst::trace!(CAT, imp = self, "Pushing AU from buffer {id} dts_delta {dts_delta:?} random access {maybe_random_access:?}", ); @@ -540,7 +565,7 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { pts: buffer.pts(), dts_delta, buffer: buffer.clone().into_mapped_buffer_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map incoming buffer readable"); + gst::error!(CAT, imp = self, "Can't map incoming buffer readable"); gst::FlowError::Error })?, maybe_random_access, @@ -585,7 +610,7 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { let mut live_guard = self.is_live.lock().unwrap(); if Some(is_live) != *live_guard { - gst::info!(CAT, imp: self, "Upstream is live: {is_live}"); + gst::info!(CAT, imp = self, "Upstream is live: {is_live}"); *live_guard = Some(is_live); } } @@ -597,7 +622,9 @@ impl RtpBasePay2Impl for RtpMpeg4GenericPay { min += max_ptime; max.opt_add_assign(max_ptime); } else if is_live { - gst::warning!(CAT, imp: self, + gst::warning!( + CAT, + imp = self, "Aggregating packets in live mode, but no max_ptime configured. \ Configured latency may be too low!" ); @@ -642,7 +669,13 @@ impl RtpMpeg4GenericPay { let agg_mode = self.effective_aggregate_mode(settings); if (self.obj().mtu() as usize) < state.min_mtu { - gst::error!(CAT, imp: self, "Insufficient mtu {} at least {} bytes needed", self.obj().mtu(), state.min_mtu); + gst::error!( + CAT, + imp = self, + "Insufficient mtu {} at least {} bytes needed", + self.obj().mtu(), + state.min_mtu + ); return Err(gst::FlowError::Error); } @@ -693,7 +726,13 @@ impl RtpMpeg4GenericPay { res = w.write(7, 0).map_err(Into::into); } if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to write header for AU {} in buffer {}: {err:#}", header.index, au.id); + gst::error!( + CAT, + imp = self, + "Failed to write header for AU {} in buffer {}: {err:#}", + header.index, + au.id + ); return Err(gst::FlowError::Error); } @@ -748,18 +787,24 @@ impl RtpMpeg4GenericPay { .opt_gt(max_ptime) .unwrap_or(false); - gst::log!(CAT, imp: self, + gst::log!( + CAT, + imp = self, "Pending: size {}, duration ~{:.3}, mode: {agg_mode:?} + {send_mode:?} => {}", state.pending_size, state.pending_duration.display(), - if is_ready { "ready" } else { "not ready, waiting for more data" }, + if is_ready { + "ready" + } else { + "not ready, waiting for more data" + }, ); if !is_ready { break; } - gst::trace!(CAT, imp: self, "Creating packet.."); + gst::trace!(CAT, imp = self, "Creating packet.."); let id = front.id; let mut end_id = front.id; @@ -776,7 +821,11 @@ impl RtpMpeg4GenericPay { au_data_list.clear(); while let Some(front) = state.pending_aus.front() { - gst::trace!(CAT, imp: self, "{front:?}, accumulated size {acc_size} duration ~{acc_duration:.3}"); + gst::trace!( + CAT, + imp = self, + "{front:?}, accumulated size {acc_size} duration ~{acc_duration:.3}" + ); // If this AU would overflow the packet, bail out and send out what we have. // @@ -790,15 +839,21 @@ impl RtpMpeg4GenericPay { // No CTS-delta for the first AU in the packet None } else { - ct_delta_to_rtp(front.pts, previous_pts, state.clock_rate).and_then(|dts_delta_res| { - if dts_delta_res.is_none() { - gst::warning!(CAT, imp: self, "Overflow computing CTS-delta between pts {} & previous pts {}", - front.pts.display(), previous_pts.display(), - ); - } + ct_delta_to_rtp(front.pts, previous_pts, state.clock_rate).and_then( + |dts_delta_res| { + if dts_delta_res.is_none() { + gst::warning!( + CAT, + imp = self, + "Overflow computing CTS-delta between pts {} & previous pts {}", + front.pts.display(), + previous_pts.display(), + ); + } - dts_delta_res - }) + dts_delta_res + }, + ) }; previous_pts = front.pts; @@ -813,8 +868,12 @@ impl RtpMpeg4GenericPay { }; w.build_with(&header, &ctx).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write header for AU {} in buffer {}: {err:#}", - header.index, front.id, + gst::error!( + CAT, + imp = self, + "Failed to write header for AU {} in buffer {}: {err:#}", + header.index, + front.id, ); gst::FlowError::Error })?; @@ -852,7 +911,10 @@ impl RtpMpeg4GenericPay { // add final padding if let Err(err) = w.write(7, 0) { - gst::error!(CAT, imp: self, "Failed to write padding for final AU {} in buffer {end_id}: {err}", + gst::error!( + CAT, + imp = self, + "Failed to write padding for final AU {} in buffer {end_id}: {err}", ctx.prev_index.expect("at least one AU"), ); return Err(gst::FlowError::Error); @@ -874,7 +936,12 @@ impl RtpMpeg4GenericPay { .queue_packet(PacketToBufferRelation::Ids(id..=end_id), packet)?; } - gst::log!(CAT, imp: self, "All done for now, {} pending AUs", state.pending_aus.len()); + gst::log!( + CAT, + imp = self, + "All done for now, {} pending AUs", + state.pending_aus.len() + ); if send_mode == SendPacketMode::ForcePending { self.obj().finish_pending_packets()?; @@ -916,6 +983,6 @@ impl RtpMpeg4GenericPay { *self.is_live.lock().unwrap() = Some(is_live); - gst::info!(CAT, imp: self, "Upstream is live: {is_live}"); + gst::info!(CAT, imp = self, "Upstream is live: {is_live}"); } } diff --git a/net/rtp/src/opus/depay/imp.rs b/net/rtp/src/opus/depay/imp.rs index 929d3a64..74500b38 100644 --- a/net/rtp/src/opus/depay/imp.rs +++ b/net/rtp/src/opus/depay/imp.rs @@ -118,9 +118,12 @@ impl RtpBaseDepay2Impl for RtpOpusDepay { }; let Ok(src_caps) = res else { - gst::warning!(CAT, imp: self, + gst::warning!( + CAT, + imp = self, "Failed to parse {encoding_name} RTP input caps {s}: {}", - res.unwrap_err()); + res.unwrap_err() + ); return false; }; @@ -150,7 +153,7 @@ impl RtpBaseDepay2Impl for RtpOpusDepay { outbuf_ref.set_flags(gst::BufferFlags::RESYNC); } - gst::trace!(CAT, imp: self, "Finishing buffer {outbuf:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {outbuf:?}"); self.obj().queue_buffer(packet.into(), outbuf) } @@ -175,7 +178,11 @@ impl RtpOpusDepay { 0 => 1, // mono 1 => 2, // stereo _ => { - gst::warning!(CAT, imp: self, "Unexpected sprop-stereo value {v} in input caps {s}"); + gst::warning!( + CAT, + imp = self, + "Unexpected sprop-stereo value {v} in input caps {s}" + ); DEFAULT_CHANNELS } }) @@ -293,7 +300,11 @@ impl RtpOpusDepay { let duration = frame_duration * n_frames; if duration > gst::ClockTime::from_mseconds(120) { - gst::warning!(CAT, imp: self, "Opus packet with frame duration {duration:?} > 120ms"); + gst::warning!( + CAT, + imp = self, + "Opus packet with frame duration {duration:?} > 120ms" + ); return gst::ClockTime::NONE; } diff --git a/net/rtp/src/opus/pay/imp.rs b/net/rtp/src/opus/pay/imp.rs index 58685f77..48e91a0f 100644 --- a/net/rtp/src/opus/pay/imp.rs +++ b/net/rtp/src/opus/pay/imp.rs @@ -246,7 +246,11 @@ impl RtpBasePay2Impl for RtpOpusPay { // Can't use .collect().map_err()? because it doesn't work for funcs with bool returns match res { Err(_) => { - gst::error!(CAT, imp: self, "Invalid 'channel-mapping' field types"); + gst::error!( + CAT, + imp = self, + "Invalid 'channel-mapping' field types" + ); return false; } Ok(num_strings) => num_strings.join(","), @@ -289,7 +293,7 @@ impl RtpBasePay2Impl for RtpOpusPay { let mut state = self.state.borrow_mut(); let map = buffer.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -303,7 +307,12 @@ impl RtpBasePay2Impl for RtpOpusPay { // // Even in DTX mode there will still be a non-DTX packet going through every 400ms. if dtx && data.len() <= 2 { - gst::log!(CAT, imp: self, "Not sending out empty DTX packet {:?}", buffer); + gst::log!( + CAT, + imp = self, + "Not sending out empty DTX packet {:?}", + buffer + ); // The first non-DTX packet will be the start of a talkspurt state.marker_pending = true; self.obj().drop_buffers(..=id); @@ -370,22 +379,27 @@ impl RtpBasePay2Impl for RtpOpusPay { if s.get::("channel-mapping-family") == Ok(0) { let peer_s = peer_caps.structure(0).unwrap(); - gst::trace!(CAT, imp: self, "Peer preference structure: {peer_s}"); + gst::trace!(CAT, imp = self, "Peer preference structure: {peer_s}"); - let pref_chans = peer_s.get::<&str>("stereo") + let pref_chans = peer_s + .get::<&str>("stereo") .ok() .and_then(|params| params.trim().parse::().ok()) .map(|v| match v { 0 => 1, // mono 1 => 2, // stereo _ => { - gst::warning!(CAT, imp: self, "Unexpected stereo value {v} in peer caps {s}"); + gst::warning!( + CAT, + imp = self, + "Unexpected stereo value {v} in peer caps {s}" + ); 2 // default is stereo } }); if let Some(pref_chans) = pref_chans { - gst::trace!(CAT, imp: self, "Peer preference: channels={pref_chans}"); + gst::trace!(CAT, imp = self, "Peer preference: channels={pref_chans}"); let mut pref_caps = gst::Caps::builder("audio/x-opus") .field("channel-mapping-family", 0i32) diff --git a/net/rtp/src/pcmau/depay/imp.rs b/net/rtp/src/pcmau/depay/imp.rs index 243a4d32..71e4c6ca 100644 --- a/net/rtp/src/pcmau/depay/imp.rs +++ b/net/rtp/src/pcmau/depay/imp.rs @@ -93,7 +93,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpPcmauDepay { buffer_ref.set_flags(gst::BufferFlags::RESYNC); } - gst::trace!(CAT, imp: self, "Finishing buffer {buffer:?}"); + gst::trace!(CAT, imp = self, "Finishing buffer {buffer:?}"); self.obj().queue_buffer(packet.into(), buffer) } diff --git a/net/rtp/src/rtpbin2/rtprecv.rs b/net/rtp/src/rtpbin2/rtprecv.rs index 75fd1f03..f2dbc01a 100644 --- a/net/rtp/src/rtpbin2/rtprecv.rs +++ b/net/rtp/src/rtpbin2/rtprecv.rs @@ -318,7 +318,7 @@ impl RecvSession { } fn start_rtp_task(&mut self, pad: &gst::Pad) -> Result<(), glib::BoolError> { - gst::debug!(CAT, obj: pad, "Starting rtp recv src task"); + gst::debug!(CAT, obj = pad, "Starting rtp recv src task"); let recv_pad = self .rtp_recv_srcpads @@ -354,21 +354,21 @@ impl RecvSession { match item { JitterBufferItem::PacketList(list) => { let flow = pad.push_list(list); - gst::trace!(CAT, obj: pad, "Pushed buffer list, flow ret {:?}", flow); + gst::trace!(CAT, obj = pad, "Pushed buffer list, flow ret {:?}", flow); let mut recv_flow_combiner = recv_flow_combiner.lock().unwrap(); let _combined_flow = recv_flow_combiner.update_pad_flow(&pad, flow); // TODO: store flow, return only on session pads? } JitterBufferItem::Packet(buffer) => { let flow = pad.push(buffer); - gst::trace!(CAT, obj: pad, "Pushed buffer, flow ret {:?}", flow); + gst::trace!(CAT, obj = pad, "Pushed buffer, flow ret {:?}", flow); let mut recv_flow_combiner = recv_flow_combiner.lock().unwrap(); let _combined_flow = recv_flow_combiner.update_pad_flow(&pad, flow); // TODO: store flow, return only on session pads? } JitterBufferItem::Event(event) => { let res = pad.push_event(event); - gst::trace!(CAT, obj: pad, "Pushed serialized event, result: {}", res); + gst::trace!(CAT, obj = pad, "Pushed serialized event, result: {}", res); } JitterBufferItem::Query(mut query, tx) => { // This is safe because the thread holding the original reference is waiting @@ -381,13 +381,13 @@ impl RecvSession { }) })?; - gst::debug!(CAT, obj: pad, "Task started"); + gst::debug!(CAT, obj = pad, "Task started"); Ok(()) } fn stop_rtp_task(&mut self, pad: &gst::Pad) -> Result<(), glib::BoolError> { - gst::debug!(CAT, obj: pad, "Stopping rtp recv src task"); + gst::debug!(CAT, obj = pad, "Stopping rtp recv src task"); let recv_pad = self .rtp_recv_srcpads .iter_mut() @@ -561,7 +561,7 @@ impl RtpRecv { } else { session.stop_rtp_task(pad)?; - gst::debug!(CAT, obj: pad, "Stopping task"); + gst::debug!(CAT, obj = pad, "Stopping task"); let _ = pad.stop_task(); } @@ -576,7 +576,7 @@ impl RtpRecv { } pub fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {query:?}"); + gst::log!(CAT, obj = pad, "Handling query {query:?}"); use gst::QueryViewMut::*; match query.view_mut() { @@ -594,7 +594,11 @@ impl RtpRecv { our_latency }; - gst::info!(CAT, obj: pad, "Handled latency query, our latency {our_latency}, minimum latency: {min}"); + gst::info!( + CAT, + obj = pad, + "Handled latency query, our latency {our_latency}, minimum latency: {min}" + ); q.set(true, min, gst::ClockTime::NONE); ret @@ -649,7 +653,7 @@ impl RtpRecv { match segment.to_running_time(dts) { Some(time) => time, None => { - gst::error!(CAT, obj: pad, "out of segment DTS are not supported"); + gst::error!(CAT, obj = pad, "out of segment DTS are not supported"); return Err(gst::FlowError::Error); } } @@ -657,7 +661,7 @@ impl RtpRecv { None => match self.obj().current_running_time() { Some(time) => time, None => { - gst::error!(CAT, obj: pad, "Failed to get current time"); + gst::error!(CAT, obj = pad, "Failed to get current time"); return Err(gst::FlowError::Error); } }, @@ -674,7 +678,7 @@ impl RtpRecv { .ok() }); let mapped = buffer.map_readable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map input buffer {e:?}"); + gst::error!(CAT, imp = self, "Failed to map input buffer {e:?}"); gst::FlowError::Error })?; @@ -690,12 +694,16 @@ impl RtpRecv { return Ok(RecvRtpBuffer::IsRtcp(buffer)); } - gst::error!(CAT, imp: self, "Failed to parse input as valid rtp packet: {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse input as valid rtp packet: {e:?}" + ); return Ok(RecvRtpBuffer::Drop); } }; - gst::trace!(CAT, obj: pad, "using arrival time {}", arrival_time); + gst::trace!(CAT, obj = pad, "using arrival time {}", arrival_time); let internal_session = session.internal_session.clone(); let mut session_inner = internal_session.inner.lock().unwrap(); @@ -721,11 +729,11 @@ impl RtpRecv { let pts = segment .position_from_running_time(gst::ClockTime::from_nseconds(pts)) .unwrap(); - gst::debug!(CAT, obj: pad, "Calculated PTS: {}", pts); + gst::debug!(CAT, obj = pad, "Calculated PTS: {}", pts); loop { let recv_ret = session_inner.session.handle_recv(&rtp, addr, now); - gst::trace!(CAT, obj: pad, "session handle_recv ret: {recv_ret:?}"); + gst::trace!(CAT, obj = pad, "session handle_recv ret: {recv_ret:?}"); match recv_ret { RecvReply::SsrcCollision(ssrc) => return Ok(RecvRtpBuffer::SsrcCollision(ssrc)), RecvReply::NewSsrc(ssrc, _pt) => { @@ -849,13 +857,17 @@ impl RtpRecv { } HeldRecvItem::Buffer(buffer) => { let mapped = buffer.buffer.map_readable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map input buffer {e:?}"); + gst::error!(CAT, imp = self, "Failed to map input buffer {e:?}"); gst::FlowError::Error })?; let rtp = match rtp_types::RtpPacket::parse(&mapped) { Ok(rtp) => rtp, Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse input as valid rtp packet: {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse input as valid rtp packet: {e:?}" + ); return Ok(state); } }; @@ -899,13 +911,17 @@ impl RtpRecv { for buffer in list.list.iter_owned() { let mapped = buffer.map_readable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map input buffer {e:?}"); + gst::error!(CAT, imp = self, "Failed to map input buffer {e:?}"); gst::FlowError::Error })?; let rtp = match rtp_types::RtpPacket::parse(&mapped) { Ok(rtp) => rtp, Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse input as valid rtp packet: {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse input as valid rtp packet: {e:?}" + ); return Ok(state); } }; @@ -1131,13 +1147,17 @@ impl RtpRecv { .ok() }); let mapped = buffer.map_readable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map input buffer {e:?}"); + gst::error!(CAT, imp = self, "Failed to map input buffer {e:?}"); gst::FlowError::Error })?; let rtcp = match rtcp_types::Compound::parse(&mapped) { Ok(rtcp) => rtcp, Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse input as valid rtcp packet: {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse input as valid rtcp packet: {e:?}" + ); return Ok(gst::FlowSuccess::Ok); } }; @@ -1187,7 +1207,11 @@ impl RtpRecv { } RtcpRecvReply::RequestKeyUnit { ssrcs, fir } => { if let Some(ref rtp_send_sinkpad) = rtp_send_sinkpad { - gst::debug!(CAT, imp: self, "Sending force-keyunit event for ssrcs {ssrcs:?} (all headers: {fir})"); + gst::debug!( + CAT, + imp = self, + "Sending force-keyunit event for ssrcs {ssrcs:?} (all headers: {fir})" + ); // TODO what to do with the ssrc? let event = gst_video::UpstreamForceKeyUnitEvent::builder() .all_headers(fir) @@ -1196,7 +1220,11 @@ impl RtpRecv { let _ = rtp_send_sinkpad.push_event(event); } else { - gst::debug!(CAT, imp: self, "Can't send force-keyunit event because of missing sinkpad"); + gst::debug!( + CAT, + imp = self, + "Can't send force-keyunit event because of missing sinkpad" + ); } } RtcpRecvReply::NewCName((cname, ssrc)) => { @@ -1223,7 +1251,7 @@ impl RtpRecv { } pub fn rtp_sink_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef, id: usize) -> bool { - gst::log!(CAT, obj: pad, "Handling query {query:?}"); + gst::log!(CAT, obj = pad, "Handling query {query:?}"); if query.is_serialized() { let state = self.state.lock().unwrap(); @@ -1352,7 +1380,11 @@ impl RtpRecv { session_inner.add_caps(caps); } } else { - gst::warning!(CAT, obj: pad, "input caps are missing payload or clock-rate fields"); + gst::warning!( + CAT, + obj = pad, + "input caps are missing payload or clock-rate fields" + ); } true } @@ -1364,7 +1396,7 @@ impl RtpRecv { let segment = match segment.downcast_ref::() { Some(segment) => segment.clone(), None => { - gst::warning!(CAT, obj: pad, "Only TIME segments are supported"); + gst::warning!(CAT, obj = pad, "Only TIME segments are supported"); let segment = gst::FormattedSegment::new(); let seqnum = event.seqnum(); diff --git a/net/rtp/src/rtpbin2/rtpsend.rs b/net/rtp/src/rtpbin2/rtpsend.rs index e2db2479..f3c4cd57 100644 --- a/net/rtp/src/rtpbin2/rtpsend.rs +++ b/net/rtp/src/rtpbin2/rtpsend.rs @@ -227,7 +227,11 @@ impl SendSession { RUNTIME.spawn_blocking(move || { let buffer = gst::Buffer::from_mut_slice(data); if let Err(e) = rtcp_srcpad.push(buffer) { - gst::warning!(CAT, obj: rtcp_srcpad, "Failed to send rtcp data: flow return {e:?}"); + gst::warning!( + CAT, + obj = rtcp_srcpad, + "Failed to send rtcp data: flow return {e:?}" + ); } drop(acquired); }); @@ -316,13 +320,17 @@ impl RtpSend { now: Instant, ) -> Result { let mapped = buffer.map_readable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map input buffer {e:?}"); + gst::error!(CAT, imp = self, "Failed to map input buffer {e:?}"); gst::FlowError::Error })?; let rtp = match rtp_types::RtpPacket::parse(&mapped) { Ok(rtp) => rtp, Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse input as valid rtp packet: {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse input as valid rtp packet: {e:?}" + ); return Ok(gst::FlowSuccess::Ok); } }; @@ -422,7 +430,11 @@ impl RtpSend { session.add_caps(caps.caps_owned()); } } else { - gst::warning!(CAT, obj: pad, "input caps are missing payload or clock-rate fields"); + gst::warning!( + CAT, + obj = pad, + "input caps are missing payload or clock-rate fields" + ); } gst::Pad::event_default(pad, Some(&*self.obj()), event) } diff --git a/net/rtp/src/vp8/depay/imp.rs b/net/rtp/src/vp8/depay/imp.rs index 7e07db29..55c3cfc0 100644 --- a/net/rtp/src/vp8/depay/imp.rs +++ b/net/rtp/src/vp8/depay/imp.rs @@ -103,7 +103,7 @@ static CAT: Lazy = Lazy::new(|| { impl RtpVp8Depay { fn reset(&self, state: &mut State) { - gst::debug!(CAT, imp: self, "resetting state"); + gst::debug!(CAT, imp = self, "resetting state"); *state = State::default() } @@ -240,7 +240,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { ) -> Result { let settings = self.settings.lock().unwrap().clone(); - gst::trace!(CAT, imp: self, "Handling RTP packet {packet:?}"); + gst::trace!(CAT, imp = self, "Handling RTP packet {packet:?}"); let mut state = self.state.borrow_mut(); let payload = packet.payload(); @@ -250,7 +250,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { let payload_descriptor = match r.parse::() { Ok(payload_descriptor) => payload_descriptor, Err(err) => { - gst::warning!(CAT, imp: self, "Invalid VP8 RTP packet: {err}"); + gst::warning!(CAT, imp = self, "Invalid VP8 RTP packet: {err}"); self.reset(&mut state); self.obj().drop_packet(packet); return Ok(gst::FlowSuccess::Ok); @@ -258,8 +258,17 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { }; let payload_start_index = cursor.position() as usize; - gst::trace!(CAT, imp: self, "VP8 RTP payload descriptor size: {}", payload_start_index); - gst::trace!(CAT, imp: self, "Received VP8 RTP payload descriptor: {payload_descriptor:?}"); + gst::trace!( + CAT, + imp = self, + "VP8 RTP payload descriptor size: {}", + payload_start_index + ); + gst::trace!( + CAT, + imp = self, + "Received VP8 RTP payload descriptor: {payload_descriptor:?}" + ); // This is the start of a frame if it is the start of a partition and the partition index // is 0. @@ -269,9 +278,9 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { // If this is not the start of a picture then we have to wait for one if state.current_frame_payload_descriptor.is_none() && !is_start_of_frame { if state.last_timestamp.is_some() { - gst::warning!(CAT, imp: self, "Waiting for start of picture"); + gst::warning!(CAT, imp = self, "Waiting for start of picture"); } else { - gst::trace!(CAT, imp: self, "Waiting for start of picture"); + gst::trace!(CAT, imp = self, "Waiting for start of picture"); } self.obj().drop_packet(packet); self.reset(&mut state); @@ -285,7 +294,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { let frame_header = match r.parse::() { Ok(frame_header) => frame_header, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to read frame header: {err}"); + gst::warning!(CAT, imp = self, "Failed to read frame header: {err}"); self.obj().drop_packet(packet); self.reset(&mut state); return Ok(gst::FlowSuccess::Ok); @@ -296,7 +305,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { // from upstream. if !frame_header.is_keyframe && state.last_keyframe_frame_header.is_none() { if settings.request_keyframe { - gst::debug!(CAT, imp: self, "Requesting keyframe from upstream"); + gst::debug!(CAT, imp = self, "Requesting keyframe from upstream"); let event = gst_video::UpstreamForceKeyUnitEvent::builder() .all_headers(true) .build(); @@ -304,7 +313,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { } if settings.wait_for_keyframe { - gst::trace!(CAT, imp: self, "Waiting for keyframe"); + gst::trace!(CAT, imp = self, "Waiting for keyframe"); // TODO: Could potentially drain here? self.reset(&mut state); self.obj().drop_packet(packet); @@ -362,13 +371,13 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp8Depay { if !state.pending_frame_is_keyframe { buffer.set_flags(gst::BufferFlags::DELTA_UNIT); - gst::trace!(CAT, imp: self, "Finishing delta-frame"); + gst::trace!(CAT, imp = self, "Finishing delta-frame"); } else { - gst::trace!(CAT, imp: self, "Finishing keyframe"); + gst::trace!(CAT, imp = self, "Finishing keyframe"); } if state.needs_discont { - gst::trace!(CAT, imp: self, "Setting DISCONT"); + gst::trace!(CAT, imp = self, "Setting DISCONT"); buffer.set_flags(gst::BufferFlags::DISCONT); state.needs_discont = false; } diff --git a/net/rtp/src/vp8/pay/imp.rs b/net/rtp/src/vp8/pay/imp.rs index a104ad1c..3851b815 100644 --- a/net/rtp/src/vp8/pay/imp.rs +++ b/net/rtp/src/vp8/pay/imp.rs @@ -242,7 +242,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { } fn set_sink_caps(&self, caps: &gst::Caps) -> bool { - gst::debug!(CAT, imp: self, "received caps {caps:?}"); + gst::debug!(CAT, imp = self, "received caps {caps:?}"); let caps_builder = gst::Caps::builder("application/x-rtp") .field("media", "video") @@ -280,7 +280,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { let settings = self.settings.lock().unwrap(); let max_payload_size = self.obj().max_payload_size(); - gst::trace!(CAT, imp: self, "received buffer of size {}", buffer.size()); + gst::trace!(CAT, imp = self, "received buffer of size {}", buffer.size()); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!( @@ -306,7 +306,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { if meta.as_ref().map(|meta| meta.layer_id.is_some()) == Some(true) && state.temporal_layer_zero_index.is_none() { - gst::trace!(CAT, imp: self, "Detected stream with temporal scalability"); + gst::trace!(CAT, imp = self, "Detected stream with temporal scalability"); state.temporal_layer_zero_index = Some(0); } @@ -314,12 +314,12 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { let partition_offsets = if state.temporal_layer_zero_index.is_none() { match FrameInfo::parse(&map) { Ok(frame_info) => { - gst::trace!(CAT, imp: self, "Parsed frame info {frame_info:?}"); + gst::trace!(CAT, imp = self, "Parsed frame info {frame_info:?}"); Some(frame_info.partition_offsets) } Err(err) => { - gst::error!(CAT, imp: self, "Failed parsing frame info: {err}"); + gst::error!(CAT, imp = self, "Failed parsing frame info: {err}"); None } } @@ -354,14 +354,18 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { }; let payload_descriptor_size = payload_descriptor.size().map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write payload descriptor: {err:?}"); + gst::error!( + CAT, + imp = self, + "Failed to write payload descriptor: {err:?}" + ); gst::FlowError::Error })?; let overhead = payload_descriptor_size; let payload_size = (max_payload_size as usize) .checked_sub(overhead + 1) .ok_or_else(|| { - gst::error!(CAT, imp: self, "Too small MTU configured for stream"); + gst::error!(CAT, imp = self, "Too small MTU configured for stream"); gst::element_imp_error!( self, gst::LibraryError::Settings, @@ -442,7 +446,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { gst::trace!( CAT, - imp: self, + imp = self, "Writing packet with payload descriptor {payload_descriptor:?} and payload size {payload_size} at offset {current_offset}", ); @@ -453,7 +457,11 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { let mut w = ByteWriter::endian(&mut payload_descriptor_buffer, BigEndian); w.build::(&payload_descriptor) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write payload descriptor: {err:?}"); + gst::error!( + CAT, + imp = self, + "Failed to write payload descriptor: {err:?}" + ); gst::FlowError::Error })?; assert_eq!(payload_descriptor_buffer.len(), payload_descriptor_size); @@ -478,7 +486,11 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp8Pay { if meta.map_or(true, |meta| matches!(meta.layer_id, Some((0, _)))) { if let Some(ref mut temporal_layer_zero_index) = state.temporal_layer_zero_index { *temporal_layer_zero_index = temporal_layer_zero_index.wrapping_add(1); - gst::trace!(CAT, imp: self, "Updated temporal layer zero index to {temporal_layer_zero_index}"); + gst::trace!( + CAT, + imp = self, + "Updated temporal layer zero index to {temporal_layer_zero_index}" + ); } } diff --git a/net/rtp/src/vp9/depay/imp.rs b/net/rtp/src/vp9/depay/imp.rs index 3d3ab676..612fa5a5 100644 --- a/net/rtp/src/vp9/depay/imp.rs +++ b/net/rtp/src/vp9/depay/imp.rs @@ -118,7 +118,7 @@ static CAT: Lazy = Lazy::new(|| { impl RtpVp9Depay { fn reset(&self, state: &mut State) { - gst::debug!(CAT, imp: self, "resetting state"); + gst::debug!(CAT, imp = self, "resetting state"); *state = State::default() } @@ -260,7 +260,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { ) -> Result { let settings = self.settings.lock().unwrap().clone(); - gst::trace!(CAT, imp: self, "Handling RTP packet {packet:?}"); + gst::trace!(CAT, imp = self, "Handling RTP packet {packet:?}"); let mut state = self.state.borrow_mut(); let payload = packet.payload(); @@ -270,7 +270,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { let payload_descriptor = match r.parse::() { Ok(payload_descriptor) => payload_descriptor, Err(err) => { - gst::warning!(CAT, imp: self, "Invalid VP9 RTP packet: {err}"); + gst::warning!(CAT, imp = self, "Invalid VP9 RTP packet: {err}"); // TODO: Could potentially drain here? self.reset(&mut state); self.obj().drop_packet(packet); @@ -280,8 +280,17 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { let payload_start_index = cursor.position() as usize; - gst::trace!(CAT, imp: self, "VP9 RTP payload descriptor size: {}", payload_start_index); - gst::trace!(CAT, imp: self, "Received VP9 RTP payload descriptor: {payload_descriptor:?}"); + gst::trace!( + CAT, + imp = self, + "VP9 RTP payload descriptor size: {}", + payload_start_index + ); + gst::trace!( + CAT, + imp = self, + "Received VP9 RTP payload descriptor: {payload_descriptor:?}" + ); // This is the start of a picture if this is the start of the frame and either there is no // layer information or this is the first spatial layer. @@ -305,7 +314,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { { // Missed the marker packet for the last picture if state.current_picture_payload_descriptor.is_some() { - gst::warning!(CAT, imp: self, "Packet is part of a new picture but didn't receive last packet of previous picture"); + gst::warning!(CAT, imp = self, "Packet is part of a new picture but didn't receive last packet of previous picture"); // TODO: Could potentially drain here? self.reset(&mut state); } @@ -334,7 +343,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { { gst::warning!( CAT, - imp: self, + imp = self, "Scalability structure present and non-flexible scalability mode used but no picture ID present", ); // TODO: Could potentially drain here? @@ -357,7 +366,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { && last_keyframe_payloader_descriptor.flexible_mode != payload_descriptor.flexible_mode { - gst::warning!(CAT, imp: self, "Flexible scalability mode can only change on key pictures"); + gst::warning!( + CAT, + imp = self, + "Flexible scalability mode can only change on key pictures" + ); // TODO: Could potentially drain here? self.reset(&mut state); @@ -376,7 +389,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { .as_ref() .is_some_and(|layer_index| layer_index.temporal_layer_id != 0) { - gst::warning!(CAT, imp: self, "Temporal layer ID of non-inter-predicted frame must be 0"); + gst::warning!( + CAT, + imp = self, + "Temporal layer ID of non-inter-predicted frame must be 0" + ); // TODO: Could potentially drain here? self.reset(&mut state); self.obj().drop_packet(packet); @@ -388,7 +405,11 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { // > This MUST only be set to 1 if the I bit is also set to one; if the I bit is set to // > zero, then this MUST also be set to zero and ignored by receivers. if payload_descriptor.flexible_mode && payload_descriptor.picture_id.is_none() { - gst::warning!(CAT, imp: self, "Flexible scalability mode but no picture ID present"); + gst::warning!( + CAT, + imp = self, + "Flexible scalability mode but no picture ID present" + ); // TODO: Could potentially drain here? self.reset(&mut state); self.obj().drop_packet(packet); @@ -398,9 +419,9 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { // If this is not the start of a picture then we have to wait for one if state.current_picture_payload_descriptor.is_none() && !is_start_of_picture { if state.last_timestamp.is_some() { - gst::warning!(CAT, imp: self, "Waiting for start of picture"); + gst::warning!(CAT, imp = self, "Waiting for start of picture"); } else { - gst::trace!(CAT, imp: self, "Waiting for start of picture"); + gst::trace!(CAT, imp = self, "Waiting for start of picture"); } // TODO: Could potentially drain here? self.obj().drop_packet(packet); @@ -415,7 +436,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { && state.last_key_picture_payload_descriptor.is_none() { if settings.request_keyframe { - gst::debug!(CAT, imp: self, "Requesting keyframe from upstream"); + gst::debug!(CAT, imp = self, "Requesting keyframe from upstream"); let event = gst_video::UpstreamForceKeyUnitEvent::builder() .all_headers(true) .build(); @@ -423,7 +444,7 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { } if settings.wait_for_keyframe { - gst::trace!(CAT, imp: self, "Waiting for keyframe"); + gst::trace!(CAT, imp = self, "Waiting for keyframe"); // TODO: Could potentially drain here? self.reset(&mut state); self.obj().drop_packet(packet); @@ -463,12 +484,12 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { // We assume that the beginning of the frame header fits into the first packet match r.parse::() { Ok(frame_header) => { - gst::trace!(CAT, imp: self, "Parsed frame header: {frame_header:?}"); + gst::trace!(CAT, imp = self, "Parsed frame header: {frame_header:?}"); state.current_keyframe_frame_header = Some(frame_header); } Err(err) => { // Don't consider this a fatal error - gst::warning!(CAT, imp: self, "Failed to read frame header: {err}"); + gst::warning!(CAT, imp = self, "Failed to read frame header: {err}"); } }; } @@ -529,13 +550,13 @@ impl crate::basedepay::RtpBaseDepay2Impl for RtpVp9Depay { if current_picture_payload_descriptor.inter_picture_predicted_frame { buffer.set_flags(gst::BufferFlags::DELTA_UNIT); - gst::trace!(CAT, imp: self, "Finishing delta-frame"); + gst::trace!(CAT, imp = self, "Finishing delta-frame"); } else { - gst::trace!(CAT, imp: self, "Finishing keyframe"); + gst::trace!(CAT, imp = self, "Finishing keyframe"); } if state.needs_discont { - gst::trace!(CAT, imp: self, "Setting DISCONT"); + gst::trace!(CAT, imp = self, "Setting DISCONT"); buffer.set_flags(gst::BufferFlags::DISCONT); state.needs_discont = false; } diff --git a/net/rtp/src/vp9/pay/imp.rs b/net/rtp/src/vp9/pay/imp.rs index 3eed24dd..12d457c1 100644 --- a/net/rtp/src/vp9/pay/imp.rs +++ b/net/rtp/src/vp9/pay/imp.rs @@ -219,7 +219,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { } fn set_sink_caps(&self, caps: &gst::Caps) -> bool { - gst::debug!(CAT, imp: self, "received caps {caps:?}"); + gst::debug!(CAT, imp = self, "received caps {caps:?}"); let caps_builder = gst::Caps::builder("application/x-rtp") .field("media", "video") @@ -254,7 +254,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { ) -> Result { let max_payload_size = self.obj().max_payload_size(); - gst::trace!(CAT, imp: self, "received buffer of size {}", buffer.size()); + gst::trace!(CAT, imp = self, "received buffer of size {}", buffer.size()); let map = buffer.map_readable().map_err(|_| { gst::element_imp_error!( @@ -284,13 +284,13 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { let mut r = BitReader::endian(map.as_slice(), BigEndian); let key_frame = match r.parse::() { Ok(frame_header) => { - gst::trace!(CAT, imp: self, "Parsed frame header: {frame_header:?}"); + gst::trace!(CAT, imp = self, "Parsed frame header: {frame_header:?}"); // show_existing_frame assumes that there is an existing frame to show so this is // clearly not a keyframe frame_header.is_keyframe.unwrap_or(false) } Err(err) => { - gst::trace!(CAT, imp: self, "Failed parsing frame header: {err:?}"); + gst::trace!(CAT, imp = self, "Failed parsing frame header: {err:?}"); !buffer.flags().contains(gst::BufferFlags::DELTA_UNIT) } }; @@ -311,14 +311,18 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { }; let payload_descriptor_size = payload_descriptor.size().map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write payload descriptor: {err:?}"); + gst::error!( + CAT, + imp = self, + "Failed to write payload descriptor: {err:?}" + ); gst::FlowError::Error })?; let overhead = payload_descriptor_size; let payload_size = (max_payload_size as usize) .checked_sub(overhead + 1) .ok_or_else(|| { - gst::error!(CAT, imp: self, "Too small MTU configured for stream"); + gst::error!(CAT, imp = self, "Too small MTU configured for stream"); gst::element_imp_error!( self, gst::LibraryError::Settings, @@ -333,7 +337,7 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { gst::trace!( CAT, - imp: self, + imp = self, "Writing packet with payload descriptor {payload_descriptor:?} and payload size {payload_size}", ); @@ -342,7 +346,11 @@ impl crate::basepay::RtpBasePay2Impl for RtpVp9Pay { let mut w = ByteWriter::endian(&mut payload_descriptor_buffer, BigEndian); w.build::(&payload_descriptor) .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to write payload descriptor: {err:?}"); + gst::error!( + CAT, + imp = self, + "Failed to write payload descriptor: {err:?}" + ); gst::FlowError::Error })?; assert_eq!(payload_descriptor_buffer.len(), payload_descriptor_size); diff --git a/net/rtsp/src/rtspsrc/imp.rs b/net/rtsp/src/rtspsrc/imp.rs index b83e08f2..d3cda200 100644 --- a/net/rtsp/src/rtspsrc/imp.rs +++ b/net/rtsp/src/rtspsrc/imp.rs @@ -354,7 +354,7 @@ impl ObjectImpl for RtspSrc { if let Err(err) = res { gst::error!( CAT, - imp: self, + imp = self, "Failed to set property `{}`: {:?}", pspec.name(), err @@ -537,17 +537,9 @@ impl RtspSrc { )); }; - gst::info!( - CAT, - imp: self, - "Location: {url}", - ); + gst::info!(CAT, imp = self, "Location: {url}",); - gst::info!( - CAT, - imp: self, - "Starting RTSP connection thread.. " - ); + gst::info!(CAT, imp = self, "Starting RTSP connection thread.. "); let task_src = self.ref_counted(); @@ -635,7 +627,7 @@ impl RtspSrc { debug_assert!(task_handle.is_none()); task_handle.replace(join_handle); - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -664,7 +656,7 @@ impl RtspSrc { self.command_queue.lock().unwrap().take(); - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } diff --git a/net/webrtc/src/aws_kvs_signaller/imp.rs b/net/webrtc/src/aws_kvs_signaller/imp.rs index 1c476cf8..f0b6b214 100644 --- a/net/webrtc/src/aws_kvs_signaller/imp.rs +++ b/net/webrtc/src/aws_kvs_signaller/imp.rs @@ -115,7 +115,7 @@ impl Signaller { } else { gst::warning!( CAT, - imp: self, + imp = self, "Failed to parse SDP_OFFER: {payload}" ); } @@ -142,7 +142,7 @@ impl Signaller { } else { gst::warning!( CAT, - imp: self, + imp = self, "Failed to parse ICE_CANDIDATE: {payload}" ); } @@ -150,7 +150,7 @@ impl Signaller { _ => { gst::log!( CAT, - imp: self, + imp = self, "Ignoring unsupported message type {}", msg.message_type ); @@ -160,7 +160,7 @@ impl Signaller { Err(e) => { gst::error!( CAT, - imp: self, + imp = self, "Failed to decode message payload from server: {e}" ); self.obj().emit_by_name::<()>( @@ -173,7 +173,7 @@ impl Signaller { } } } else { - gst::log!(CAT, imp: self, "Unknown message from server: [{msg}]"); + gst::log!(CAT, imp = self, "Unknown message from server: [{msg}]"); } } @@ -203,7 +203,7 @@ impl Signaller { (Some(key), Some(secret_key)) => { gst::debug!( CAT, - imp: self, + imp = self, "Using provided access and secret access key" ); Ok(Credentials::new( @@ -215,7 +215,7 @@ impl Signaller { )) } _ => { - gst::debug!(CAT, imp: self, "Using default AWS credentials"); + gst::debug!(CAT, imp = self, "Using default AWS credentials"); let cred = DefaultCredentialsChain::builder() .region(region.clone()) .build() @@ -387,7 +387,7 @@ impl Signaller { )) .build() .map_err(|err| { - gst::error!(CAT, imp: self, "Failed to build HTTP request URI: {err}"); + gst::error!(CAT, imp = self, "Failed to build HTTP request URI: {err}"); anyhow!("Failed to build HTTP request URI: {err}") })?; @@ -415,7 +415,7 @@ impl Signaller { let (ws, _) = async_tungstenite::tokio::connect_async_with_tls_connector(url, connector).await?; - gst::info!(CAT, imp: self, "connected"); + gst::info!(CAT, imp = self, "connected"); // Channel for asynchronously sending out websocket message let (mut ws_sink, mut ws_stream) = ws.split(); @@ -439,7 +439,7 @@ impl Signaller { if let Some(imp) = imp.upgrade() { gst::trace!( CAT, - imp: imp, + imp = imp, "Sending websocket message {}", serde_json::to_string(&msg).unwrap() ); @@ -458,7 +458,7 @@ impl Signaller { if let Err(ref err) = res { if let Some(imp) = imp.upgrade() { - gst::error!(CAT, imp: imp, "Quitting send loop: {err}"); + gst::error!(CAT, imp = imp, "Quitting send loop: {err}"); } else { gst::error!(CAT, "Quitting send loop: {err}"); } @@ -468,7 +468,7 @@ impl Signaller { } if let Some(imp) = imp.upgrade() { - gst::debug!(CAT, imp: imp, "Done sending"); + gst::debug!(CAT, imp = imp, "Done sending"); } else { gst::debug!(CAT, "Done sending"); } @@ -488,7 +488,7 @@ impl Signaller { imp.handle_message(msg); } Ok(WsMessage::Close(reason)) => { - gst::info!(CAT, imp: imp, "websocket connection closed: {:?}", reason); + gst::info!(CAT, imp = imp, "websocket connection closed: {:?}", reason); imp.obj().emit_by_name::<()>("shutdown", &[]); break; } @@ -507,7 +507,7 @@ impl Signaller { } if let Some(imp) = imp.upgrade() { - gst::info!(CAT, imp: imp, "Stopped websocket receiving"); + gst::info!(CAT, imp = imp, "Stopped websocket receiving"); } }); @@ -603,7 +603,7 @@ impl SignallableImpl for Signaller { } fn stop(&self) { - gst::info!(CAT, imp: self, "Stopping now"); + gst::info!(CAT, imp = self, "Stopping now"); let mut state = self.state.lock().unwrap(); let send_task_handle = state.send_task_handle.take(); @@ -616,7 +616,7 @@ impl SignallableImpl for Signaller { if let Some(handle) = send_task_handle { if let Err(err) = handle.await { if let Some(imp) = imp.upgrade() { - gst::warning!(CAT, imp: imp, "Error while joining send task: {err}"); + gst::warning!(CAT, imp = imp, "Error while joining send task: {err}"); } } } @@ -624,7 +624,11 @@ impl SignallableImpl for Signaller { if let Some(handle) = receive_task_handle { if let Err(err) = handle.await { if let Some(imp) = imp.upgrade() { - gst::warning!(CAT, imp: imp, "Error while joining receive task: {err}"); + gst::warning!( + CAT, + imp = imp, + "Error while joining receive task: {err}" + ); } } } @@ -633,7 +637,7 @@ impl SignallableImpl for Signaller { } fn end_session(&self, session_id: &str) { - gst::info!(CAT, imp: self, "Signalling session {session_id} ended"); + gst::info!(CAT, imp = self, "Signalling session {session_id} ended"); // We can seemingly not do anything beyond that } diff --git a/net/webrtc/src/janusvr_signaller/imp.rs b/net/webrtc/src/janusvr_signaller/imp.rs index 78277539..db0b7e3c 100644 --- a/net/webrtc/src/janusvr_signaller/imp.rs +++ b/net/webrtc/src/janusvr_signaller/imp.rs @@ -373,12 +373,12 @@ impl Signaller { } if let Err(ref err) = res { - gst::error!(CAT, imp: this, "Quitting send task: {err}"); + gst::error!(CAT, imp = this, "Quitting send task: {err}"); break; } } - gst::debug!(CAT, imp: this, "Done sending"); + gst::debug!(CAT, imp = this, "Done sending"); let _ = ws_sink.close().await; @@ -397,7 +397,7 @@ impl Signaller { } let msg = "Stopped websocket receiving"; - gst::info!(CAT, imp: this, "{msg}"); + gst::info!(CAT, imp = this, "{msg}"); } )); @@ -415,15 +415,15 @@ impl Signaller { ) -> ControlFlow<()> { match msg { Ok(WsMessage::Text(msg)) => { - gst::trace!(CAT, imp: self, "Received message {}", msg); + gst::trace!(CAT, imp = self, "Received message {}", msg); if let Ok(reply) = serde_json::from_str::(&msg) { self.handle_reply(reply); } else { - gst::error!(CAT, imp: self, "Unknown message from server: {}", msg); + gst::error!(CAT, imp = self, "Unknown message from server: {}", msg); } } Ok(WsMessage::Close(reason)) => { - gst::info!(CAT, imp: self, "websocket connection closed: {:?}", reason); + gst::info!(CAT, imp = self, "websocket connection closed: {:?}", reason); return ControlFlow::Break(()); } Ok(_) => (), @@ -438,16 +438,26 @@ impl Signaller { fn handle_reply(&self, reply: JsonReply) { match reply { JsonReply::WebRTCUp => { - gst::trace!(CAT, imp: self, "WebRTC streaming is working!"); + gst::trace!(CAT, imp = self, "WebRTC streaming is working!"); } JsonReply::Success(success) => { if let Some(data) = success.data { if success.session_id.is_none() { - gst::trace!(CAT, imp: self, "Janus session {} was created successfully", data.id); + gst::trace!( + CAT, + imp = self, + "Janus session {} was created successfully", + data.id + ); self.set_session_id(data.id); self.attach_plugin(); } else { - gst::trace!(CAT, imp: self, "Attached to Janus Video Room plugin successfully, handle: {}", data.id); + gst::trace!( + CAT, + imp = self, + "Attached to Janus Video Room plugin successfully, handle: {}", + data.id + ); self.set_handle_id(data.id); self.join_room(); } @@ -475,7 +485,12 @@ impl Signaller { self.obj().notify("feed-id"); } - gst::trace!(CAT, imp: self, "Joined room {:?} successfully", joined.room); + gst::trace!( + CAT, + imp = self, + "Joined room {:?} successfully", + joined.room + ); self.session_requested(); } VideoRoomData::Event(room_event) => { @@ -490,13 +505,18 @@ impl Signaller { if let Some(jsep) = event.jsep { if jsep.r#type == "answer" { - gst::trace!(CAT, imp: self, "Session requested successfully"); + gst::trace!(CAT, imp = self, "Session requested successfully"); self.handle_answer(jsep.sdp); } } } VideoRoomData::Destroyed(room_destroyed) => { - gst::trace!(CAT, imp: self, "Room {} has been destroyed", room_destroyed.room); + gst::trace!( + CAT, + imp = self, + "Room {} has been destroyed", + room_destroyed.room + ); self.raise_error(format!( "room {} has been destroyed", @@ -782,7 +802,12 @@ impl SignallableImpl for Signaller { } fn send_sdp(&self, _session_id: &str, offer: &gst_webrtc::WebRTCSessionDescription) { - gst::info!(CAT, imp: self, "sending SDP offer to peer: {:?}", offer.sdp().as_text()); + gst::info!( + CAT, + imp = self, + "sending SDP offer to peer: {:?}", + offer.sdp().as_text() + ); self.publish(offer); } @@ -798,7 +823,7 @@ impl SignallableImpl for Signaller { } fn stop(&self) { - gst::info!(CAT, imp: self, "Stopping now"); + gst::info!(CAT, imp = self, "Stopping now"); let mut state = self.state.lock().unwrap(); let send_task_handle = state.send_task_handle.take(); @@ -810,7 +835,7 @@ impl SignallableImpl for Signaller { if let Some(handle) = send_task_handle { if let Err(err) = handle.await { - gst::warning!(CAT, imp: self, "Error while joining send task: {}", err); + gst::warning!(CAT, imp = self, "Error while joining send task: {}", err); } } diff --git a/net/webrtc/src/livekit_signaller/imp.rs b/net/webrtc/src/livekit_signaller/imp.rs index 9f5f05f2..49797e5c 100644 --- a/net/webrtc/src/livekit_signaller/imp.rs +++ b/net/webrtc/src/livekit_signaller/imp.rs @@ -186,7 +186,7 @@ impl Signaller { while let Some(candidate_str) = early_candidates.pop() { gst::debug!( CAT, - imp: self, + imp = self, "Sending delayed ice candidate {candidate_str:?}" ); self.send_trickle_request(&candidate_str).await; @@ -201,7 +201,7 @@ impl Signaller { self.on_signal_event(*signal).await; } signal_client::SignalEvent::Close(reason) => { - gst::debug!(CAT, imp: self, "Close: {reason}"); + gst::debug!(CAT, imp = self, "Close: {reason}"); self.raise_error("Server disconnected".to_string()); break; } @@ -209,7 +209,7 @@ impl Signaller { Ok(None) => {} Err(err) => match err { WaitError::FutureAborted => { - gst::debug!(CAT, imp: self, "Closing signal_task"); + gst::debug!(CAT, imp = self, "Closing signal_task"); break; } WaitError::FutureError(err) => self.raise_error(err.to_string()), @@ -221,7 +221,7 @@ impl Signaller { async fn on_signal_event(&self, event: proto::signal_response::Message) { match event { proto::signal_response::Message::Answer(answer) => { - gst::debug!(CAT, imp: self, "Received publisher answer: {:?}", answer); + gst::debug!(CAT, imp = self, "Received publisher answer: {:?}", answer); let sdp = match gst_sdp::SDPMessage::parse_buffer(answer.sdp.as_bytes()) { Ok(sdp) => sdp, Err(_) => { @@ -239,10 +239,15 @@ impl Signaller { proto::signal_response::Message::Offer(offer) => { if !self.is_subscriber() { - gst::warning!(CAT, imp: self, "Ignoring subscriber offer in non-subscriber mode: {:?}", offer); + gst::warning!( + CAT, + imp = self, + "Ignoring subscriber offer in non-subscriber mode: {:?}", + offer + ); return; } - gst::debug!(CAT, imp: self, "Received subscriber offer: {:?}", offer); + gst::debug!(CAT, imp = self, "Received subscriber offer: {:?}", offer); let sdp = match gst_sdp::SDPMessage::parse_buffer(offer.sdp.as_bytes()) { Ok(sdp) => sdp, Err(_) => { @@ -259,7 +264,7 @@ impl Signaller { } proto::signal_response::Message::Trickle(trickle) => { - gst::debug!(CAT, imp: self, "Received ice_candidate {:?}", trickle); + gst::debug!(CAT, imp = self, "Received ice_candidate {:?}", trickle); let Some(target) = self.signal_target() else { return; @@ -279,11 +284,11 @@ impl Signaller { } proto::signal_response::Message::ConnectionQuality(quality) => { - gst::debug!(CAT, imp: self, "Connection quality: {:?}", quality); + gst::debug!(CAT, imp = self, "Connection quality: {:?}", quality); } proto::signal_response::Message::TrackPublished(publish_res) => { - gst::debug!(CAT, imp: self, "Track published: {:?}", publish_res); + gst::debug!(CAT, imp = self, "Track published: {:?}", publish_res); if let Some(connection) = &mut *self.connection.lock().unwrap() { if let Some(tx) = connection.pending_tracks.remove(&publish_res.cid) { let _ = tx.send(publish_res.track.unwrap()); @@ -293,17 +298,22 @@ impl Signaller { proto::signal_response::Message::Update(update) => { if !self.is_subscriber() { - gst::trace!(CAT, imp: self, "Ignoring update in non-subscriber mode: {:?}", update); + gst::trace!( + CAT, + imp = self, + "Ignoring update in non-subscriber mode: {:?}", + update + ); return; } - gst::debug!(CAT, imp: self, "Update: {:?}", update); + gst::debug!(CAT, imp = self, "Update: {:?}", update); for participant in update.participants { self.on_participant(&participant, true) } } proto::signal_response::Message::Leave(leave) => { - gst::debug!(CAT, imp: self, "Leave: {:?}", leave); + gst::debug!(CAT, imp = self, "Leave: {:?}", leave); } _ => {} @@ -317,7 +327,7 @@ impl Signaller { RUNTIME.spawn(async move { if let Some(imp) = weak_imp.upgrade() { let sdp = sessdesc.sdp(); - gst::debug!(CAT, imp: imp, "Sending SDP {:?} now", &sdp); + gst::debug!(CAT, imp = imp, "Sending SDP {:?} now", &sdp); let signal_client = imp.require_signal_client(); signal_client .send(proto::signal_request::Message::Answer( @@ -429,7 +439,7 @@ impl Signaller { match err { WaitError::FutureAborted => { - gst::warning!(CAT, imp: imp, "Future aborted") + gst::warning!(CAT, imp = imp, "Future aborted") } WaitError::FutureError(err) => imp.raise_error(err.to_string()), }; @@ -437,7 +447,7 @@ impl Signaller { } } - gst::debug!(CAT, imp: imp, "Sending SDP now"); + gst::debug!(CAT, imp = imp, "Sending SDP now"); signal_client .send(proto::signal_request::Message::Offer( proto::SessionDescription { @@ -455,7 +465,7 @@ impl Signaller { } fn on_participant(&self, participant: &proto::ParticipantInfo, new_connection: bool) { - gst::debug!(CAT, imp: self, "{:?}", participant); + gst::debug!(CAT, imp = self, "{:?}", participant); if !participant.is_publisher { return; } @@ -463,17 +473,17 @@ impl Signaller { let peer_identity = &participant.identity; match self.producer_peer_id() { Some(id) if id == *peer_sid => { - gst::debug!(CAT, imp: self, "matching peer sid {id:?}"); + gst::debug!(CAT, imp = self, "matching peer sid {id:?}"); } Some(id) if id == *peer_identity => { - gst::debug!(CAT, imp: self, "matching peer identity {id:?}"); + gst::debug!(CAT, imp = self, "matching peer identity {id:?}"); } None => { if self.is_peer_excluded(peer_sid) || self.is_peer_excluded(peer_identity) { - gst::debug!(CAT, imp: self, "ignoring excluded peer {participant:?}"); + gst::debug!(CAT, imp = self, "ignoring excluded peer {participant:?}"); return; } - gst::debug!(CAT, imp: self, "catch-all mode, matching {participant:?}"); + gst::debug!(CAT, imp = self, "catch-all mode, matching {participant:?}"); } _ => return, } @@ -531,7 +541,7 @@ impl Signaller { impl SignallableImpl for Signaller { fn start(&self) { - gst::debug!(CAT, imp: self, "Connecting"); + gst::debug!(CAT, imp = self, "Connecting"); let wsurl = if let Some(wsurl) = &self.settings.lock().unwrap().wsurl { wsurl.clone() @@ -585,7 +595,7 @@ impl SignallableImpl for Signaller { } }; - gst::debug!(CAT, imp: self, "We have an authentication token"); + gst::debug!(CAT, imp = self, "We have an authentication token"); let weak_imp = self.downgrade(); RUNTIME.spawn(async move { @@ -597,7 +607,7 @@ impl SignallableImpl for Signaller { auto_subscribe: imp.auto_subscribe(), ..Default::default() }; - gst::debug!(CAT, imp: imp, "Connecting to {}", wsurl); + gst::debug!(CAT, imp = imp, "Connecting to {}", wsurl); let res = signal_client::SignalClient::connect(&wsurl, &auth_token, options).await; let (signal_client, join_response, signal_events) = match res { @@ -612,7 +622,7 @@ impl SignallableImpl for Signaller { gst::debug!( CAT, - imp: imp, + imp = imp, "Connected with JoinResponse: {:?}", join_response ); @@ -700,7 +710,7 @@ impl SignallableImpl for Signaller { } fn send_sdp(&self, session_id: &str, sessdesc: &gst_webrtc::WebRTCSessionDescription) { - gst::debug!(CAT, imp: self, "Created SDP {:?}", sessdesc.sdp()); + gst::debug!(CAT, imp = self, "Created SDP {:?}", sessdesc.sdp()); match sessdesc.type_() { gst_webrtc::WebRTCSDPType::Offer => { @@ -710,7 +720,7 @@ impl SignallableImpl for Signaller { self.send_sdp_answer(session_id, sessdesc); } _ => { - gst::debug!(CAT, imp: self, "Ignoring SDP {:?}", sessdesc.sdp()); + gst::debug!(CAT, imp = self, "Ignoring SDP {:?}", sessdesc.sdp()); } } } @@ -731,14 +741,14 @@ impl SignallableImpl for Signaller { if let Some(connection) = &mut *self.connection.lock().unwrap() { if let Some(early_candidates) = connection.early_candidates.as_mut() { - gst::debug!(CAT, imp: self, "Delaying ice candidate {candidate_str:?}"); + gst::debug!(CAT, imp = self, "Delaying ice candidate {candidate_str:?}"); early_candidates.push(candidate_str); return; } }; - gst::debug!(CAT, imp: self, "Sending ice candidate {candidate_str:?}"); + gst::debug!(CAT, imp = self, "Sending ice candidate {candidate_str:?}"); let imp = self.downgrade(); RUNTIME.spawn(async move { diff --git a/net/webrtc/src/signaller/imp.rs b/net/webrtc/src/signaller/imp.rs index dc45a81d..b898579c 100644 --- a/net/webrtc/src/signaller/imp.rs +++ b/net/webrtc/src/signaller/imp.rs @@ -136,7 +136,7 @@ impl Signaller { if insecure_tls { connector_builder.danger_accept_invalid_certs(true); - gst::warning!(CAT, imp: self, "insecure tls connections are allowed"); + gst::warning!(CAT, imp = self, "insecure tls connections are allowed"); } let connector = Some(tokio_native_tls::TlsConnector::from( @@ -146,7 +146,7 @@ impl Signaller { let mut uri = self.uri(); uri.set_query(None); - gst::info!(CAT, imp: self, "connecting to {}", uri.to_string()); + gst::info!(CAT, imp = self, "connecting to {}", uri.to_string()); let mut req = uri.into_client_request()?; let req_headers = req.headers_mut(); @@ -166,7 +166,7 @@ impl Signaller { ) .await??; - gst::info!(CAT, imp: self, "connected"); + gst::info!(CAT, imp = self, "connected"); // Channel for asynchronously sending out websocket message let (mut ws_sink, mut ws_stream) = ws.split(); @@ -186,12 +186,12 @@ impl Signaller { .await; if let Err(ref err) = res { - gst::error!(CAT, imp: this, "Quitting send loop: {err}"); + gst::error!(CAT, imp = this, "Quitting send loop: {err}"); break; } } - gst::debug!(CAT, imp: this, "Done sending"); + gst::debug!(CAT, imp = this, "Done sending"); let _ = ws_sink.close().await; @@ -218,7 +218,7 @@ impl Signaller { } let msg = "Stopped websocket receiving"; - gst::info!(CAT, imp: this, "{msg}"); + gst::info!(CAT, imp = this, "{msg}"); } )); @@ -274,12 +274,12 @@ impl Signaller { for (key, value) in structure.iter() { if let Ok(Ok(value_str)) = value.transform::().map(|v| v.get()) { - gst::log!(CAT, imp: self, "headers '{}' -> '{}'", key, value_str); + gst::log!(CAT, imp = self, "headers '{}' -> '{}'", key, value_str); hash.insert(key.to_string(), value_str); } else { gst::warning!( CAT, - imp: self, + imp = self, "Failed to convert headers '{}' to string ('{:?}')", key, value @@ -318,7 +318,7 @@ impl Signaller { gst::info!( CAT, - imp: self, + imp = self, "Started session with producer peer id {target_producer}", ); } @@ -331,7 +331,7 @@ impl Signaller { ) -> ControlFlow<()> { match msg { Ok(WsMessage::Text(msg)) => { - gst::trace!(CAT, imp: self, "Received message {}", msg); + gst::trace!(CAT, imp = self, "Received message {}", msg); if let Ok(msg) = serde_json::from_str::(&msg) { match msg { @@ -347,7 +347,7 @@ impl Signaller { let meta = meta.and_then(|m| match m { serde_json::Value::Object(v) => Some(serialize_json_object(&v)), _ => { - gst::error!(CAT, imp: self, "Invalid json value: {m:?}"); + gst::error!(CAT, imp = self, "Invalid json value: {m:?}"); None } }); @@ -398,7 +398,7 @@ impl Signaller { ); } p::OutgoingMessage::EndSession(p::EndSessionMessage { session_id }) => { - gst::info!(CAT, imp: self, "Session {session_id} ended"); + gst::info!(CAT, imp = self, "Session {session_id} ended"); self.obj() .emit_by_name::("session-ended", &[&session_id]); @@ -454,9 +454,15 @@ impl Signaller { drop(state); let meta = producer.meta.and_then(|m| match m { - serde_json::Value::Object(v) => Some(serialize_json_object(&v)), + serde_json::Value::Object(v) => { + Some(serialize_json_object(&v)) + } _ => { - gst::error!(CAT, imp: self, "Invalid json value: {m:?}"); + gst::error!( + CAT, + imp = self, + "Invalid json value: {m:?}" + ); None } }); @@ -476,7 +482,7 @@ impl Signaller { } } } else { - gst::error!(CAT, imp: self, "Unknown message from server: {}", msg); + gst::error!(CAT, imp = self, "Unknown message from server: {}", msg); self.obj().emit_by_name::<()>( "error", @@ -485,7 +491,7 @@ impl Signaller { } } Ok(WsMessage::Close(reason)) => { - gst::info!(CAT, imp: self, "websocket connection closed: {:?}", reason); + gst::info!(CAT, imp = self, "websocket connection closed: {:?}", reason); return ControlFlow::Break(()); } Ok(_) => (), @@ -637,7 +643,7 @@ impl ObjectImpl for Signaller { impl SignallableImpl for Signaller { fn start(&self) { - gst::info!(CAT, imp: self, "Starting"); + gst::info!(CAT, imp = self, "Starting"); let mut state = self.state.lock().unwrap(); let connect_task_handle = RUNTIME.spawn(glib::clone!( @@ -655,7 +661,7 @@ impl SignallableImpl for Signaller { } fn stop(&self) { - gst::info!(CAT, imp: self, "Stopping now"); + gst::info!(CAT, imp = self, "Stopping now"); let mut state = self.state.lock().unwrap(); @@ -677,7 +683,7 @@ impl SignallableImpl for Signaller { if let Some(handle) = send_task_handle { if let Err(err) = handle.await { - gst::warning!(CAT, imp: self, "Error while joining send task: {}", err); + gst::warning!(CAT, imp = self, "Error while joining send task: {}", err); } } @@ -692,7 +698,7 @@ impl SignallableImpl for Signaller { } fn send_sdp(&self, session_id: &str, sdp: &gst_webrtc::WebRTCSessionDescription) { - gst::debug!(CAT, imp: self, "Sending SDP {sdp:#?}"); + gst::debug!(CAT, imp = self, "Sending SDP {sdp:#?}"); let role = self.settings.lock().unwrap().role; let is_consumer = matches!(role, super::WebRTCSignallerRole::Consumer); @@ -722,7 +728,7 @@ impl SignallableImpl for Signaller { ) { gst::debug!( CAT, - imp: self, + imp = self, "Adding ice candidate {candidate:?} for {sdp_m_line_index:?} on session {session_id}" ); @@ -738,7 +744,7 @@ impl SignallableImpl for Signaller { } fn end_session(&self, session_id: &str) { - gst::debug!(CAT, imp: self, "Signalling session done {}", session_id); + gst::debug!(CAT, imp = self, "Signalling session done {}", session_id); let state = self.state.lock().unwrap(); let session_id = session_id.to_string(); diff --git a/net/webrtc/src/webrtcsink/homegrown_cc.rs b/net/webrtc/src/webrtcsink/homegrown_cc.rs index 22b07cd9..34954807 100644 --- a/net/webrtc/src/webrtcsink/homegrown_cc.rs +++ b/net/webrtc/src/webrtcsink/homegrown_cc.rs @@ -131,7 +131,7 @@ impl CongestionController { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: considering stats {}", self.peer_id, twcc_stats @@ -159,7 +159,7 @@ impl CongestionController { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: Old bitrate: {}, ema: {}, stddev: {}", self.peer_id, target_bitrate, @@ -174,7 +174,7 @@ impl CongestionController { if target_bitrate < ema - 7. * bitrate_stdev { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: below last congestion window", self.peer_id ); @@ -183,7 +183,7 @@ impl CongestionController { } else if target_bitrate > ema + 7. * bitrate_stdev { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: above last congestion window", self.peer_id ); @@ -213,7 +213,7 @@ impl CongestionController { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: still in last congestion window", self.peer_id, ); @@ -225,7 +225,7 @@ impl CongestionController { /* Multiplicative increase */ gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: outside congestion window", self.peer_id ); @@ -335,7 +335,7 @@ impl CongestionController { ) { gst::trace!( CAT, - obj: element, + obj = element, "consumer {}: applying congestion control operation {:?}", self.peer_id, control_op diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 20d98ff5..8bccc454 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -372,7 +372,7 @@ impl SessionWrapper { if !cands.is_empty() { gst::trace!( CAT, - obj: element, + obj = element, "handling {} pending ice candidates for session {}", cands.len(), session.id, @@ -401,13 +401,21 @@ impl SessionWrapper { ) { match self { SessionWrapper::InPlace(session) => { - gst::trace!(CAT, obj: element, "adding ice candidate for session {session_id}"); + gst::trace!( + CAT, + obj = element, + "adding ice candidate for session {session_id}" + ); session .webrtcbin .emit_by_name::<()>("add-ice-candidate", &[&sdp_m_line_index, &candidate]); } SessionWrapper::Taken(cands) => { - gst::trace!(CAT, obj: element, "queueing ice candidate for session {session_id}"); + gst::trace!( + CAT, + obj = element, + "queueing ice candidate for session {session_id}" + ); cands.push(IceCandidate { sdp_m_line_index, candidate: candidate.to_string(), @@ -449,7 +457,7 @@ fn create_navigation_event(sink: &super::BaseWebRTCSink, msg: &str) { let event: Result = serde_json::from_str(msg); if let Ok(event) = event { - gst::log!(CAT, obj: sink, "Processing navigation event: {:?}", event); + gst::log!(CAT, obj = sink, "Processing navigation event: {:?}", event); if let Some(mid) = event.mid { let this = sink.imp(); @@ -460,7 +468,7 @@ fn create_navigation_event(sink: &super::BaseWebRTCSink, msg: &str) { let event = gst::event::Navigation::new(event.event.structure()); if !stream.sink_pad.push_event(event.clone()) { - gst::info!(CAT, obj: sink, "Could not send event: {:?}", event); + gst::info!(CAT, obj = sink, "Could not send event: {:?}", event); } } } @@ -473,13 +481,13 @@ fn create_navigation_event(sink: &super::BaseWebRTCSink, msg: &str) { if stream.sink_pad.name().starts_with("video_") { gst::log!(CAT, "Navigating to: {:?}", event); if !stream.sink_pad.push_event(event.clone()) { - gst::info!(CAT, obj: sink, "Could not send event: {:?}", event); + gst::info!(CAT, obj = sink, "Could not send event: {:?}", event); } } }); } } else { - gst::error!(CAT, obj: sink, "Invalid navigation event: {:?}", msg); + gst::error!(CAT, obj = sink, "Invalid navigation event: {:?}", msg); } } @@ -868,7 +876,7 @@ impl PayloadChainBuilder { fn build(self, pipeline: &gst::Pipeline, src: &gst::Element) -> Result { gst::trace!( CAT, - obj: pipeline, + obj = pipeline, "Setting up encoding, input caps: {input_caps}, \ output caps: {output_caps}, codec: {codec:?}", input_caps = self.input_caps, @@ -1097,7 +1105,7 @@ impl VideoEncoder { if !caps.is_strictly_equal(¤t_caps) { gst::log!( CAT, - obj: element, + obj = element, "session {}: setting bitrate {} and caps {} on encoder {:?}", self.session_id, bitrate, @@ -1159,7 +1167,7 @@ impl State { sessions.remove(&session_id); cvar.notify_one(); - gst::debug!(CAT, obj: element, "Session {session_id} ended"); + gst::debug!(CAT, obj = element, "Session {session_id} ended"); }); } @@ -1270,7 +1278,7 @@ impl Session { None => { gst::info!( CAT, - obj: element, + obj = element, "Consumer {} not connecting any input stream for inactive media {}", self.peer_id, webrtc_pad.media_idx @@ -1281,7 +1289,7 @@ impl Session { gst::info!( CAT, - obj: element, + obj = element, "Connecting input stream {} for consumer {} and media {}", stream_name, self.peer_id, @@ -1292,7 +1300,7 @@ impl Session { let codec = match self.codecs { Some(ref codecs) => { - gst::debug!(CAT, obj: element, "Picking codec from remote offer"); + gst::debug!(CAT, obj = element, "Picking codec from remote offer"); codecs .get(&payload) @@ -1300,7 +1308,7 @@ impl Session { .ok_or_else(|| anyhow!("No codec for payload {}", payload))? } None => { - gst::debug!(CAT, obj: element, "Picking codec from local offer"); + gst::debug!(CAT, obj = element, "Picking codec from local offer"); codecs .get(&payload) @@ -1522,7 +1530,7 @@ impl InputStream { impl NavigationEventHandler { fn new(element: &super::BaseWebRTCSink, webrtcbin: &gst::Element) -> Self { - gst::info!(CAT, obj: element, "Creating navigation data channel"); + gst::info!(CAT, obj = element, "Creating navigation data channel"); let channel = webrtcbin.emit_by_name::( "create-data-channel", &[ @@ -1576,7 +1584,11 @@ impl BaseWebRTCSink { if codec.is_video() { if let Some(enc_name) = codec.encoder_name().as_deref() { if !VideoEncoder::is_bitrate_supported(enc_name) { - gst::error!(CAT, imp: self, "Bitrate handling is not supported yet for {enc_name}"); + gst::error!( + CAT, + imp = self, + "Bitrate handling is not supported yet for {enc_name}" + ); return Ok(()); } @@ -1592,7 +1604,12 @@ impl BaseWebRTCSink { return Ok(()); }; - gst::debug!(CAT, obj: payloader, "Mapping TWCC extension to ID {}", twcc_id); + gst::debug!( + CAT, + obj = payloader, + "Mapping TWCC extension to ID {}", + twcc_id + ); /* We only enforce TWCC in the offer caps, once a remote description * has been set it will get automatically negotiated. This is necessary @@ -1635,7 +1652,7 @@ impl BaseWebRTCSink { // GstRTPBasePayload::extensions property is only available since GStreamer 1.24 if !payloader.has_property("extensions", Some(gst::Array::static_type())) { if self.has_connected_payloader_setup_slots() { - gst::warning!(CAT, imp: self, "'extensions' property is not available: TWCC extension ID will default to 1. \ + gst::warning!(CAT, imp = self, "'extensions' property is not available: TWCC extension ID will default to 1. \ Application code must ensure to pick non-conflicting IDs for any additionally configured extensions. \ Please consider updating GStreamer to 1.24."); } @@ -1658,7 +1675,12 @@ impl BaseWebRTCSink { .map(|value| value.get::().unwrap()); if let Some(ext) = twcc { - gst::debug!(CAT, obj: payloader, "TWCC extension is already mapped to id {} by application", ext.id()); + gst::debug!( + CAT, + obj = payloader, + "TWCC extension is already mapped to id {} by application", + ext.id() + ); return None; } @@ -1706,11 +1728,19 @@ impl BaseWebRTCSink { payloader.set_property("ssrc", ssrc); } _ => { - gst::warning!(CAT, imp: self, "Unsupported ssrc type (expected i64 or u32)"); + gst::warning!( + CAT, + imp = self, + "Unsupported ssrc type (expected i64 or u32)" + ); } } } else { - gst::warning!(CAT, imp: self, "Failed to find 'ssrc' property on payloader"); + gst::warning!( + CAT, + imp = self, + "Failed to find 'ssrc' property on payloader" + ); } } @@ -1757,7 +1787,7 @@ impl BaseWebRTCSink { let ret = fastrand::u32(..); if !webrtc_pads.contains_key(&ret) { - gst::trace!(CAT, imp: self, "Selected ssrc {}", ret); + gst::trace!(CAT, imp = self, "Selected ssrc {}", ret); return ret; } } @@ -1773,7 +1803,7 @@ impl BaseWebRTCSink { let media_idx = webrtc_pads.len() as i32; let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{}", media_idx)) else { - gst::error!(CAT, imp: self, "Failed to request pad from webrtcbin"); + gst::error!(CAT, imp = self, "Failed to request pad from webrtcbin"); gst::element_imp_error!( self, gst::StreamError::Failed, @@ -1836,17 +1866,13 @@ impl BaseWebRTCSink { match codec { Some(codec) => { - gst::debug!( - CAT, - imp: self, - "Selected {codec:?} for media {media_idx}" - ); + gst::debug!(CAT, imp = self, "Selected {codec:?} for media {media_idx}"); codecs.insert(codec.payload().unwrap(), codec.clone()); codec.output_filter().unwrap() } None => { - gst::error!(CAT, imp: self, "No codec selected for media {media_idx}"); + gst::error!(CAT, imp = self, "No codec selected for media {media_idx}"); gst::Caps::new_empty() } @@ -1869,7 +1895,7 @@ impl BaseWebRTCSink { .expect("element added and pipeline playing"); let ts_refclk = if clock.is::() { - gst::debug!(CAT, imp: self, "Found NTP clock"); + gst::debug!(CAT, imp = self, "Found NTP clock"); let addr = clock.property::("address"); let port = clock.property::("port"); @@ -1880,7 +1906,7 @@ impl BaseWebRTCSink { format!("ntp={addr}:{port}") }) } else if clock.is::() { - gst::debug!(CAT, imp: self, "Found PTP clock"); + gst::debug!(CAT, imp = self, "Found PTP clock"); let clock_id = clock.property::("grandmaster-clock-id"); let domain = clock.property::("domain"); @@ -1918,13 +1944,13 @@ impl BaseWebRTCSink { gst::info!( CAT, - imp: self, + imp = self, "Requesting WebRTC pad with caps {}", payloader_caps ); let Some(pad) = webrtcbin.request_pad_simple(&format!("sink_{}", media_idx)) else { - gst::error!(CAT, imp: self, "Failed to request pad from webrtcbin"); + gst::error!(CAT, imp = self, "Failed to request pad from webrtcbin"); gst::element_imp_error!( self, gst::StreamError::Failed, @@ -1934,7 +1960,11 @@ impl BaseWebRTCSink { }; if let Some(msid) = stream.msid() { - gst::trace!(CAT, imp: self, "forwarding msid={msid:?} to webrtcbin sinkpad"); + gst::trace!( + CAT, + imp = self, + "forwarding msid={msid:?} to webrtcbin sinkpad" + ); pad.set_property("msid", &msid); } @@ -1972,7 +2002,7 @@ impl BaseWebRTCSink { /// Prepare for accepting consumers, by setting /// up StreamProducers for each of our sink pads fn prepare(&self) -> Result<(), Error> { - gst::debug!(CAT, imp: self, "preparing"); + gst::debug!(CAT, imp = self, "preparing"); self.state .lock() @@ -1987,7 +2017,7 @@ impl BaseWebRTCSink { /// Unprepare by stopping consumers, then the signaller object. /// Might abort codec discovery fn unprepare(&self) -> Result<(), Error> { - gst::info!(CAT, imp: self, "unpreparing"); + gst::info!(CAT, imp = self, "unpreparing"); let settings = self.settings.lock().unwrap(); let signaller = settings.signaller.clone(); @@ -2011,14 +2041,14 @@ impl BaseWebRTCSink { handle.abort(); }); - gst::debug!(CAT, imp: self, "Waiting for codec discoveries to finish"); + gst::debug!(CAT, imp = self, "Waiting for codec discoveries to finish"); let codecs_done_receiver = std::mem::take(&mut state.codecs_done_receivers); codecs_done_receiver.into_iter().for_each(|receiver| { RUNTIME.block_on(async { let _ = receiver.await; }); }); - gst::debug!(CAT, imp: self, "No codec discovery is running anymore"); + gst::debug!(CAT, imp = self, "No codec discovery is running anymore"); state.codec_discovery_done = false; state.codecs = BTreeMap::new(); @@ -2029,16 +2059,16 @@ impl BaseWebRTCSink { } drop(state); - gst::debug!(CAT, imp: self, "Ending sessions"); + gst::debug!(CAT, imp = self, "Ending sessions"); for session in sessions { signaller.end_session(&session.id); } - gst::debug!(CAT, imp: self, "All sessions have started finalizing"); + gst::debug!(CAT, imp = self, "All sessions have started finalizing"); if signaller_state == SignallerState::Started { - gst::info!(CAT, imp: self, "Stopping signaller"); + gst::info!(CAT, imp = self, "Stopping signaller"); signaller.stop(); - gst::info!(CAT, imp: self, "Stopped signaller"); + gst::info!(CAT, imp = self, "Stopped signaller"); } let finalizing_sessions = self.state.lock().unwrap().finalizing_sessions.clone(); @@ -2049,7 +2079,7 @@ impl BaseWebRTCSink { sessions = cvar.wait(sessions).unwrap(); } - gst::debug!(CAT, imp: self, "All sessions are done finalizing"); + gst::debug!(CAT, imp = self, "All sessions are done finalizing"); Ok(()) } @@ -2085,7 +2115,7 @@ impl BaseWebRTCSink { false, glib::closure!(#[watch] instance, move |_signaler: glib::Object, session_id: &str, peer_id: &str, offer: Option<&gst_webrtc::WebRTCSessionDescription>|{ if let Err(err) = instance.imp().start_session(session_id, peer_id, offer) { - gst::warning!(CAT, obj: instance, "{}", err); + gst::warning!(CAT, obj = instance, "{}", err); } }), ), @@ -2101,7 +2131,7 @@ impl BaseWebRTCSink { if session_description.type_() == gst_webrtc::WebRTCSDPType::Answer { instance.imp().handle_sdp_answer(session_id, session_description); } else { - gst::error!(CAT, obj: instance, "Unsupported SDP Type"); + gst::error!(CAT, obj = instance, "Unsupported SDP Type"); } } ), @@ -2127,7 +2157,7 @@ impl BaseWebRTCSink { false, glib::closure!(#[watch] instance, move |_signaler: glib::Object, session_id: &str|{ if let Err(err) = instance.imp().remove_session(session_id, false) { - gst::warning!(CAT, obj: instance, "{}", err); + gst::warning!(CAT, obj = instance, "{}", err); } false }), @@ -2156,7 +2186,7 @@ impl BaseWebRTCSink { /// Called by the signaller when it wants to shut down gracefully fn shutdown(&self) { - gst::info!(CAT, imp: self, "Shutting down"); + gst::info!(CAT, imp = self, "Shutting down"); let _ = self .obj() .post_message(gst::message::Eos::builder().src(&*self.obj()).build()); @@ -2220,7 +2250,7 @@ impl BaseWebRTCSink { if let Some(session_wrapper) = state.sessions.get_mut(&session_id) { session_wrapper.restore(&self.obj(), session); } else { - gst::warning!(CAT, imp: self, "Session {session_id} was removed"); + gst::warning!(CAT, imp = self, "Session {session_id} was removed"); } drop(state); @@ -2246,21 +2276,26 @@ impl BaseWebRTCSink { let state = self.state.lock().unwrap(); if let Some(session) = state.sessions.get(&session_id) { - gst::debug!(CAT, imp: self, "Creating answer for session {}", session_id); + gst::debug!( + CAT, + imp = self, + "Creating answer for session {}", + session_id + ); let promise = gst::Promise::with_change_func(glib::clone!( #[weak(rename_to = this)] self, #[strong] session_id, move |reply| { - gst::debug!(CAT, imp: this, "Created answer for session {}", session_id); + gst::debug!(CAT, imp = this, "Created answer for session {}", session_id); let reply = match reply { Ok(Some(reply)) => reply, Ok(None) => { gst::warning!( CAT, - imp: this, + imp = this, "Promise returned without a reply for {}", session_id ); @@ -2270,7 +2305,7 @@ impl BaseWebRTCSink { Err(err) => { gst::warning!( CAT, - imp: this, + imp = this, "Promise returned with an error for {}: {:?}", session_id, err @@ -2289,7 +2324,7 @@ impl BaseWebRTCSink { } else { gst::warning!( CAT, - imp: this, + imp = this, "Reply without an answer for session {}: {:?}", session_id, reply @@ -2383,7 +2418,7 @@ impl BaseWebRTCSink { } else { gst::warning!( CAT, - imp: self, + imp = self, "Failed to parse twcc index: {idx_str}" ); } @@ -2430,11 +2465,11 @@ impl BaseWebRTCSink { fn negotiate(&self, session_id: &str, offer: Option<&gst_webrtc::WebRTCSessionDescription>) { let state = self.state.lock().unwrap(); - gst::debug!(CAT, imp: self, "Negotiating for session {}", session_id); + gst::debug!(CAT, imp = self, "Negotiating for session {}", session_id); if let Some(session) = state.sessions.get(session_id) { let session = session.unwrap(); - gst::trace!(CAT, imp: self, "WebRTC pads: {:?}", session.webrtc_pads); + gst::trace!(CAT, imp = self, "WebRTC pads: {:?}", session.webrtc_pads); if let Some(offer) = offer { let promise = gst::Promise::with_change_func(glib::clone!( @@ -2443,7 +2478,7 @@ impl BaseWebRTCSink { #[to_owned] session_id, move |reply| { - gst::debug!(CAT, imp: this, "received reply {:?}", reply); + gst::debug!(CAT, imp = this, "received reply {:?}", reply); this.on_remote_description_offer_set(session_id); } )); @@ -2452,21 +2487,21 @@ impl BaseWebRTCSink { .webrtcbin .emit_by_name::<()>("set-remote-description", &[&offer, &promise]); } else { - gst::debug!(CAT, imp: self, "Creating offer for session {}", session_id); + gst::debug!(CAT, imp = self, "Creating offer for session {}", session_id); let promise = gst::Promise::with_change_func(glib::clone!( #[weak(rename_to = this)] self, #[to_owned] session_id, move |reply| { - gst::debug!(CAT, imp: this, "Created offer for session {}", session_id); + gst::debug!(CAT, imp = this, "Created offer for session {}", session_id); let reply = match reply { Ok(Some(reply)) => reply, Ok(None) => { gst::warning!( CAT, - imp: this, + imp = this, "Promise returned without a reply for {}", session_id ); @@ -2476,7 +2511,7 @@ impl BaseWebRTCSink { Err(err) => { gst::warning!( CAT, - imp: this, + imp = this, "Promise returned with an error for {}: {:?}", session_id, err @@ -2509,7 +2544,7 @@ impl BaseWebRTCSink { } else { gst::debug!( CAT, - imp: self, + imp = self, "consumer for session {} no longer exists (sessions: {:?}", session_id, state.sessions.keys() @@ -2550,7 +2585,7 @@ impl BaseWebRTCSink { gst::info!( CAT, - obj: element, + obj = element, "Adding session: {} for peer: {}", session_id, peer_id, @@ -2696,7 +2731,7 @@ impl BaseWebRTCSink { let this = element.imp(); gst::warning!( CAT, - obj: element, + obj = element, "Connection state for in session {} (peer {}) failed", session_id, peer_id @@ -2706,7 +2741,7 @@ impl BaseWebRTCSink { _ => { gst::log!( CAT, - obj: element, + obj = element, "Connection state in session {} (peer {}) changed: {:?}", session_id, peer_id, @@ -2736,7 +2771,7 @@ impl BaseWebRTCSink { gst_webrtc::WebRTCICEConnectionState::Failed => { gst::warning!( CAT, - obj: element, + obj = element, "Ice connection state in session {} (peer {}) failed", session_id, peer_id, @@ -2746,7 +2781,7 @@ impl BaseWebRTCSink { _ => { gst::log!( CAT, - obj: element, + obj = element, "Ice connection state in session {} (peer {}) changed: {:?}", session_id, peer_id, @@ -2789,7 +2824,7 @@ impl BaseWebRTCSink { gst::log!( CAT, - obj: element, + obj = element, "Ice gathering state in session {} (peer {}) changed: {:?}", session_id, peer_id, @@ -2906,7 +2941,7 @@ impl BaseWebRTCSink { } } gst::MessageView::Latency(..) => { - gst::info!(CAT, obj: pipeline, "Recalculating latency"); + gst::info!(CAT, obj = pipeline, "Recalculating latency"); let _ = pipeline.recalculate_latency(); } gst::MessageView::Eos(..) => { @@ -3013,7 +3048,7 @@ impl BaseWebRTCSink { if let Err(err) = pipeline.set_state(gst::State::Ready) { gst::warning!( CAT, - obj: element, + obj = element, "Failed to bring {peer_id} pipeline to READY: {}", err ); @@ -3048,7 +3083,7 @@ impl BaseWebRTCSink { if let Err(err) = pipeline.set_state(gst::State::Playing) { gst::warning!( CAT, - obj: element, + obj = element, "Failed to bring {peer_id} pipeline to PLAYING: {}", err ); @@ -3204,7 +3239,7 @@ impl BaseWebRTCSink { { gst::error!( CAT, - imp: self, + imp = self, "Failed to connect input stream {} for session {}: {}", stream_name, session_id, @@ -3218,7 +3253,7 @@ impl BaseWebRTCSink { } else { gst::error!( CAT, - imp: self, + imp = self, "No producer to connect session {} to", session_id, ); @@ -3261,7 +3296,7 @@ impl BaseWebRTCSink { } else if let Some(session_wrapper) = state.sessions.get_mut(&session_id) { session_wrapper.restore(&self.obj(), session); } else { - gst::warning!(CAT, imp: self, "Session {session_id} was removed"); + gst::warning!(CAT, imp = self, "Session {session_id} was removed"); } } } @@ -3279,7 +3314,7 @@ impl BaseWebRTCSink { let sdp_m_line_index = match sdp_m_line_index { Some(sdp_m_line_index) => sdp_m_line_index, None => { - gst::warning!(CAT, imp: self, "No mandatory SDP m-line index"); + gst::warning!(CAT, imp = self, "No mandatory SDP m-line index"); return; } }; @@ -3287,7 +3322,7 @@ impl BaseWebRTCSink { if let Some(session_wrapper) = state.sessions.get_mut(session_id) { session_wrapper.add_ice_candidate(&self.obj(), session_id, sdp_m_line_index, candidate); } else { - gst::warning!(CAT, imp: self, "No consumer with ID {session_id}"); + gst::warning!(CAT, imp = self, "No consumer with ID {session_id}"); } } @@ -3313,7 +3348,7 @@ impl BaseWebRTCSink { gst::warning!( CAT, - imp: self, + imp = self, "consumer from session {} refused media {}: {:?}", session_id, media_idx, @@ -3329,7 +3364,7 @@ impl BaseWebRTCSink { gst::warning!( CAT, - imp: self, + imp = self, "Consumer refused media {session_id}, {media_idx}" ); return; @@ -3345,7 +3380,7 @@ impl BaseWebRTCSink { } else { gst::warning!( CAT, - imp: self, + imp = self, "consumer from session {} did not provide valid payload for media index {} for session {}", session_id, media_idx, @@ -3360,7 +3395,7 @@ impl BaseWebRTCSink { signaller.end_session(session_id); } - gst::warning!(CAT, imp: self, "Consumer did not provide valid payload for media session: {session_id} media_ix: {media_idx}"); + gst::warning!(CAT, imp = self, "Consumer did not provide valid payload for media session: {session_id} media_ix: {media_idx}"); return; } } @@ -3371,7 +3406,7 @@ impl BaseWebRTCSink { #[to_owned] session_id, move |reply| { - gst::debug!(CAT, imp: this, "received reply {:?}", reply); + gst::debug!(CAT, imp = this, "received reply {:?}", reply); this.on_remote_description_set(session_id); } )); @@ -3380,7 +3415,7 @@ impl BaseWebRTCSink { .webrtcbin .emit_by_name::<()>("set-remote-description", &[desc, &promise]); } else { - gst::warning!(CAT, imp: self, "No consumer with ID {session_id}"); + gst::warning!(CAT, imp = self, "No consumer with ID {session_id}"); } } @@ -3411,11 +3446,11 @@ impl BaseWebRTCSink { gst::debug!( CAT, - imp: self, + imp = self, "Running discovery pipeline for input caps {input_caps} and output caps {output_caps} with codec {codec:?}" ); - gst::debug!(CAT, imp: self, "Running discovery pipeline"); + gst::debug!(CAT, imp = self, "Running discovery pipeline"); let elements_slice = &elements.iter().collect::>(); pipe.0.add_many(elements_slice).unwrap(); gst::Element::link_many(elements_slice) @@ -3498,7 +3533,7 @@ impl BaseWebRTCSink { if let Some(msg) = stream.next().await { match msg.view() { gst::MessageView::Error(err) => { - gst::warning!(CAT, imp: self, "Error in discovery pipeline: {err:#?}"); + gst::warning!(CAT, imp = self, "Error in discovery pipeline: {err:#?}"); pipe.0.debug_to_dot_file_with_ts( gst::DebugGraphDetails::all(), "webrtcsink-discovery-error", @@ -3531,7 +3566,7 @@ impl BaseWebRTCSink { _ => continue, }; - gst::info!(CAT, imp: self, "Discovery pipeline got caps {caps:?}"); + gst::info!(CAT, imp = self, "Discovery pipeline got caps {caps:?}"); pipe.0.debug_to_dot_file_with_ts( gst::DebugGraphDetails::all(), format!("webrtcsink-discovery-{}-done", pipe.0.name()), @@ -3549,7 +3584,7 @@ impl BaseWebRTCSink { s.set("payload", codec.payload().unwrap()); gst::debug!( CAT, - imp: self, + imp = self, "Codec discovery pipeline for caps {input_caps} with codec {codec:?} succeeded: {s}" ); break Ok(s); @@ -3585,7 +3620,7 @@ impl BaseWebRTCSink { gst::info!( CAT, - imp: self, + imp = self, "Stream is already encoded with codec {}, still need to payload it", codec.name ); @@ -3646,12 +3681,7 @@ impl BaseWebRTCSink { /* We don't consider this fatal, as long as we end up with one * potential codec for each input stream */ - gst::warning!( - CAT, - imp: self, - "Codec discovery pipeline failed: {}", - err - ); + gst::warning!(CAT, imp = self, "Codec discovery pipeline failed: {}", err); } } } @@ -3729,7 +3759,7 @@ impl BaseWebRTCSink { if !self.input_caps_change_allowed(&caps, e.caps()) { gst::error!( CAT, - obj: pad, + obj = pad, "Renegotiation is not supported (old: {}, new: {})", caps, e.caps() @@ -3737,7 +3767,7 @@ impl BaseWebRTCSink { return false; } } - gst::info!(CAT, obj: pad, "Received caps event {:?}", e); + gst::info!(CAT, obj = pad, "Received caps event {:?}", e); let mut state = self.state.lock().unwrap(); @@ -3787,7 +3817,7 @@ impl BaseWebRTCSink { for discovery_info in discos.iter() { for src in discovery_info.srcs() { if let Err(err) = src.push_buffer(buffer.clone()) { - gst::log!(CAT, obj: src, "Failed to push buffer: {}", err); + gst::log!(CAT, obj = src, "Failed to push buffer: {}", err); } } } @@ -3854,7 +3884,7 @@ impl BaseWebRTCSink { match fut.await { Ok(Err(err)) => { - gst::error!(CAT, imp: this, "Error running discovery: {err:?}"); + gst::error!(CAT, imp = this, "Error running discovery: {err:?}"); gst::element_error!( this.obj(), gst::StreamError::CodecNotFound, @@ -4253,7 +4283,7 @@ impl ObjectImpl for BaseWebRTCSink { gst::debug!( CAT, - obj: element, + obj = element, "applying default configuration on encoder {:?}", enc ); @@ -4407,7 +4437,11 @@ impl ElementImpl for BaseWebRTCSink { ) -> Option { let element = self.obj(); if element.current_state() > gst::State::Ready { - gst::error!(CAT, imp: self, "element pads can only be requested before starting"); + gst::error!( + CAT, + imp = self, + "element pads can only be requested before starting" + ); return None; } @@ -4491,7 +4525,7 @@ impl ElementImpl for BaseWebRTCSink { Ok(_) => { gst::error!( CAT, - obj: element, + obj = element, "Trying to set state to NULL from an async \ tokio context, working around the panic but \ you should refactor your code to make use of \ @@ -4566,7 +4600,7 @@ impl NavigationImpl for BaseWebRTCSink { gst::log!(CAT, "Navigating to: {:?}", event); // FIXME: Handle multi tracks. if !stream.sink_pad.push_event(event.clone()) { - gst::info!(CAT, imp: self, "Could not send event: {:?}", event); + gst::info!(CAT, imp = self, "Could not send event: {:?}", event); } } }); diff --git a/net/webrtc/src/webrtcsrc/imp.rs b/net/webrtc/src/webrtcsrc/imp.rs index c76c45cb..419b9b77 100644 --- a/net/webrtc/src/webrtcsrc/imp.rs +++ b/net/webrtc/src/webrtcsrc/imp.rs @@ -365,11 +365,21 @@ impl Session { }; match serde_json::to_string(&nav_event).ok() { Some(str) => { - gst::trace!(CAT, obj: element, "Sending navigation event to peer for session {}", self.id); + gst::trace!( + CAT, + obj = element, + "Sending navigation event to peer for session {}", + self.id + ); data_channel.send_string(Some(str.as_str())); } None => { - gst::error!(CAT, obj: element, "Could not serialize navigation event for session {}", self.id); + gst::error!( + CAT, + obj = element, + "Could not serialize navigation event for session {}", + self.id + ); } } } @@ -401,7 +411,12 @@ impl Session { .group_id(stream_start.group_id().unwrap_or_else(gst::GroupId::next)); } - gst::debug!(CAT, obj: element, "Storing id {stream_id} on {webrtcbin_pad:?} for session {}", self.id); + gst::debug!( + CAT, + obj = element, + "Storing id {stream_id} on {webrtcbin_pad:?} for session {}", + self.id + ); webrtcbin_pad.store_sticky_event(&builder.build()).ok(); } @@ -416,7 +431,7 @@ impl Session { let padret = gst::ProxyPad::chain_default(pad, parent, buffer); let state = element.imp().state.lock().unwrap(); let Some(session) = state.sessions.get(&sess_id) else { - gst::error!(CAT, obj: element , "session {sess_id:?} does not exist"); + gst::error!(CAT, obj = element, "session {sess_id:?} does not exist"); return padret; }; let f = session.flow_combiner.lock().unwrap().update_flow(padret); @@ -449,7 +464,7 @@ impl Session { }) .unwrap_or(event) } else { - gst::error!(CAT, obj: element , "session {sess_id:?} does not exist"); + gst::error!(CAT, obj = element, "session {sess_id:?} does not exist"); event } } else { @@ -492,7 +507,7 @@ impl Session { &element, ); } else { - gst::error!(CAT, obj: element , "session {sess_id:?} does not exist"); + gst::error!(CAT, obj = element, "session {sess_id:?} does not exist"); } gst::PadProbeReturn::Ok @@ -544,7 +559,12 @@ impl Session { } )); - gst::debug!(CAT, obj: element, "Decoding for {}", srcpad.imp().stream_id()); + gst::debug!( + CAT, + obj = element, + "Decoding for {}", + srcpad.imp().stream_id() + ); if let Some(encoded_filter) = encoded_filter { let filter_sink_pad = encoded_filter @@ -582,7 +602,7 @@ impl Session { } else { gst::debug!( CAT, - obj: element, + obj = element, "NO decoding for {}", srcpad.imp().stream_id() ); @@ -610,7 +630,7 @@ impl Session { } srcpad.set_target(Some(&ghostpad)).unwrap(); } else { - gst::debug!(CAT, obj: element, "Unused webrtcbin pad {webrtcbin_pad:?}"); + gst::debug!(CAT, obj = element, "Unused webrtcbin pad {webrtcbin_pad:?}"); } ghostpad } @@ -620,7 +640,7 @@ impl Session { offer: &gst_webrtc::WebRTCSessionDescription, element: &super::BaseWebRTCSrc, ) -> (gst::Promise, gst::Bin) { - gst::log!(CAT, obj: element, "Got offer {}", offer.sdp().to_string()); + gst::log!(CAT, obj = element, "Got offer {}", offer.sdp().to_string()); let sdp = offer.sdp(); let direction = gst_webrtc::WebRTCRTPTransceiverDirection::Recvonly; @@ -663,7 +683,7 @@ impl Session { { gst::warning!( CAT, - obj: element, + obj = element, "Failed to retrieve attributes from media!" ); return None; @@ -692,7 +712,7 @@ impl Session { { gst::info!( CAT, - obj: element, + obj = element, "Adding transceiver for {stream_id} with caps: {caps:#?}" ); let transceiver = webrtcbin.emit_by_name::( @@ -706,7 +726,7 @@ impl Session { } else { gst::info!( CAT, - obj: element, + obj = element, "Not using media: {media:#?} as it doesn't match our codec restrictions" ); } @@ -714,7 +734,7 @@ impl Session { webrtcbin.emit_by_name::<()>("set-remote-description", &[&offer, &None::]); - gst::info!(CAT, obj: element, "Set remote description"); + gst::info!(CAT, obj = element, "Set remote description"); let promise = gst::Promise::with_change_func(glib::clone!( #[weak] @@ -723,9 +743,9 @@ impl Session { self.id, move |reply| { let state = element.imp().state.lock().unwrap(); - gst::info!(CAT, obj: element, "got answer for session {session_id:?}"); + gst::info!(CAT, obj = element, "got answer for session {session_id:?}"); let Some(session) = state.sessions.get(&session_id) else { - gst::error!(CAT, obj: element , "no session {session_id:?}"); + gst::error!(CAT, obj = element, "no session {session_id:?}"); return; }; session.on_answer_created(reply, &element); @@ -797,13 +817,18 @@ impl Session { self.webrtcbin .emit_by_name::<()>("set-local-description", &[&answer, &None::]); - gst::log!(CAT, obj: element, "Sending SDP, {}", answer.sdp().to_string()); + gst::log!( + CAT, + obj = element, + "Sending SDP, {}", + answer.sdp().to_string() + ); let signaller = element.imp().signaller(); signaller.send_sdp(&self.id, &answer); } fn on_data_channel(&mut self, data_channel: glib::Object, element: &super::BaseWebRTCSrc) { - gst::info!(CAT, obj: element, "Received data channel {data_channel:?}"); + gst::info!(CAT, obj = element, "Received data channel {data_channel:?}"); self.data_channel = data_channel.dynamic_cast::().ok(); } @@ -828,11 +853,16 @@ impl Session { let sdp_m_line_index = match sdp_m_line_index { Some(m_line) => m_line, None => { - gst::error!(CAT, obj: element, "No mandatory mline"); + gst::error!(CAT, obj = element, "No mandatory mline"); return; } }; - gst::log!(CAT, obj: element, "Got ice candidate for {}: {candidate}", self.id); + gst::log!( + CAT, + obj = element, + "Got ice candidate for {}: {candidate}", + self.id + ); self.webrtcbin() .emit_by_name::<()>("add-ice-candidate", &[&sdp_m_line_index, &candidate]); @@ -845,7 +875,7 @@ impl BaseWebRTCSrc { } fn unprepare(&self) -> Result<(), Error> { - gst::info!(CAT, imp: self, "unpreparing"); + gst::info!(CAT, imp = self, "unpreparing"); let mut state = self.state.lock().unwrap(); let sessions = &state.sessions; @@ -853,7 +883,7 @@ impl BaseWebRTCSrc { let id = s.id.as_str(); let bin = s.webrtcbin().parent().and_downcast::().unwrap(); if let Err(e) = self.end_session(id, &bin) { - gst::error!(CAT, imp: self , "Error ending session : {e}"); + gst::error!(CAT, imp = self, "Error ending session : {e}"); } } state.sessions.clear(); @@ -873,116 +903,153 @@ impl BaseWebRTCSrc { .unwrap() .signaller_signals .insert(SignallerSignals { - error: signaller.connect_closure( - "error", - false, - glib::closure!(#[watch] instance, move | - _signaller: glib::Object, error: String| { - gst::element_error!( + error: signaller.connect_closure( + "error", + false, + glib::closure!( + #[watch] instance, - gst::StreamError::Failed, - ["Signalling error: {}", error] - ); - }), - ), + move |_signaller: glib::Object, error: String| { + gst::element_error!( + instance, + gst::StreamError::Failed, + ["Signalling error: {}", error] + ); + } + ), + ), - session_started: signaller.connect_closure( - "session-started", - false, - glib::closure!(#[watch] instance, move | - _signaller: glib::Object, - session_id: &str, - _peer_id: &str| { - let imp = instance.imp(); - gst::info!(CAT, imp: imp, "Session started: {session_id}"); - let _ = imp.start_session(session_id); - }), - ), + session_started: signaller.connect_closure( + "session-started", + false, + glib::closure!( + #[watch] + instance, + move |_signaller: glib::Object, session_id: &str, _peer_id: &str| { + let imp = instance.imp(); + gst::info!(CAT, imp = imp, "Session started: {session_id}"); + let _ = imp.start_session(session_id); + } + ), + ), - session_ended: signaller.connect_closure( - "session-ended", - false, - glib::closure!(#[watch] instance, move |_signaler: glib::Object, session_id: &str|{ - let this = instance.imp(); - let state = this.state.lock().unwrap(); - let Some(session) = state.sessions.get(session_id) else { - gst::error!(CAT, imp: this , " Failed to find session {session_id}"); - return false; - }; + session_ended: signaller.connect_closure( + "session-ended", + false, + glib::closure!( + #[watch] + instance, + move |_signaler: glib::Object, session_id: &str| { + let this = instance.imp(); + let state = this.state.lock().unwrap(); + let Some(session) = state.sessions.get(session_id) else { + gst::error!( + CAT, + imp = this, + " Failed to find session {session_id}" + ); + return false; + }; - let bin = session.webrtcbin().parent().and_downcast::().unwrap(); - drop(state); + let bin = session + .webrtcbin() + .parent() + .and_downcast::() + .unwrap(); + drop(state); - // FIXME: Needs a safer way to perform end_session. - // We had to release the lock during the session tear down - // to avoid blocking the session bin pad's chain function which could potentially - // block the end_session while removing the bin from webrtcsrc, causing a deadlock - // This looks unsafe to end a session without holding the state lock + // FIXME: Needs a safer way to perform end_session. + // We had to release the lock during the session tear down + // to avoid blocking the session bin pad's chain function which could potentially + // block the end_session while removing the bin from webrtcsrc, causing a deadlock + // This looks unsafe to end a session without holding the state lock - if let Err(e) = this.end_session(session_id, &bin) { - gst::error!(CAT, imp: this , " Failed to end session {session_id}: {e}"); - return false; - } - { - this.state.lock().unwrap().sessions.remove(session_id); - } - true - }), - ), + if let Err(e) = this.end_session(session_id, &bin) { + gst::error!( + CAT, + imp = this, + " Failed to end session {session_id}: {e}" + ); + return false; + } + { + this.state.lock().unwrap().sessions.remove(session_id); + } + true + } + ), + ), - request_meta: signaller.connect_closure( - "request-meta", - false, - glib::closure!(#[watch] instance, move | - _signaller: glib::Object| -> Option { - instance.imp().settings.lock().unwrap().meta.clone() - }), - ), + request_meta: signaller.connect_closure( + "request-meta", + false, + glib::closure!( + #[watch] + instance, + move |_signaller: glib::Object| -> Option { + instance.imp().settings.lock().unwrap().meta.clone() + } + ), + ), - session_description: signaller.connect_closure( - "session-description", - false, - glib::closure!(#[watch] instance, move | - _signaller: glib::Object, - session_id: &str, - desc: &gst_webrtc::WebRTCSessionDescription| { - assert_eq!(desc.type_(), gst_webrtc::WebRTCSDPType::Offer); - let this = instance.imp(); - gst::info!(CAT, imp: this, "got sdp offer"); - let state = this.state.lock().unwrap(); - let Some(session) = state.sessions.get(session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); - return - }; + session_description: signaller.connect_closure( + "session-description", + false, + glib::closure!( + #[watch] + instance, + move |_signaller: glib::Object, + session_id: &str, + desc: &gst_webrtc::WebRTCSessionDescription| { + assert_eq!(desc.type_(), gst_webrtc::WebRTCSDPType::Offer); + let this = instance.imp(); + gst::info!(CAT, imp = this, "got sdp offer"); + let state = this.state.lock().unwrap(); + let Some(session) = state.sessions.get(session_id) else { + gst::error!(CAT, imp = this, "session {session_id:?} not found"); + return; + }; - let (promise, webrtcbin) = session.handle_offer(desc, &this.obj()); - drop(state); - webrtcbin.emit_by_name::<()>("create-answer", &[&None::, &promise]); - }), - ), + let (promise, webrtcbin) = session.handle_offer(desc, &this.obj()); + drop(state); + webrtcbin.emit_by_name::<()>( + "create-answer", + &[&None::, &promise], + ); + } + ), + ), - // sdp_mid is exposed for future proofing, see - // https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1174, - // at the moment sdp_m_line_index must be Some - handle_ice: signaller.connect_closure( - "handle-ice", - false, - glib::closure!(#[watch] instance, move | - _signaller: glib::Object, - session_id: &str, - sdp_m_line_index: u32, - _sdp_mid: Option, - candidate: &str| { - let this = instance.imp(); - let state = this.state.lock().unwrap(); - let Some(session) = state.sessions.get(session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); - return - }; - session.handle_ice(Some(sdp_m_line_index), None, candidate, &this.obj()); - }), - ), - }); + // sdp_mid is exposed for future proofing, see + // https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1174, + // at the moment sdp_m_line_index must be Some + handle_ice: signaller.connect_closure( + "handle-ice", + false, + glib::closure!( + #[watch] + instance, + move |_signaller: glib::Object, + session_id: &str, + sdp_m_line_index: u32, + _sdp_mid: Option, + candidate: &str| { + let this = instance.imp(); + let state = this.state.lock().unwrap(); + let Some(session) = state.sessions.get(session_id) else { + gst::error!(CAT, imp = this, "session {session_id:?} not found"); + return; + }; + session.handle_ice( + Some(sdp_m_line_index), + None, + candidate, + &this.obj(), + ); + } + ), + ), + }); // previous signals are disconnected when dropping the old structure } @@ -1025,7 +1092,11 @@ impl BaseWebRTCSrc { AUDIO_CAPS.to_owned(), ) } else { - gst::info!(CAT, imp: self, "Not an audio or video media {media_type:?}"); + gst::info!( + CAT, + imp = self, + "Not an audio or video media {media_type:?}" + ); return false; }; @@ -1060,7 +1131,7 @@ impl BaseWebRTCSrc { { self.signaller().start(); - gst::info!(CAT, imp: self, "Started signaller"); + gst::info!(CAT, imp = self, "Started signaller"); state.signaller_state = SignallerState::Started; } } @@ -1071,7 +1142,7 @@ impl BaseWebRTCSrc { state.signaller_state = SignallerState::Stopped; drop(state); self.signaller().stop(); - gst::info!(CAT, imp: self, "Stopped signaller"); + gst::info!(CAT, imp = self, "Stopped signaller"); } } @@ -1120,7 +1191,7 @@ impl BaseWebRTCSrc { move |_, pad| { let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::warning!(CAT, imp: this, "session {session_id:?} not found"); + gst::warning!(CAT, imp = this, "session {session_id:?} not found"); return; }; session.flow_combiner.lock().unwrap().remove_pad(pad); @@ -1134,7 +1205,7 @@ impl BaseWebRTCSrc { move |_, pad| { let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::warning!(CAT, imp: this, "session {session_id:?} not found"); + gst::warning!(CAT, imp = this, "session {session_id:?} not found"); return; }; session.flow_combiner.lock().unwrap().add_pad(pad); @@ -1154,7 +1225,7 @@ impl BaseWebRTCSrc { } let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); + gst::error!(CAT, imp = this, "session {session_id:?} not found"); return; }; let bin_ghostpad = session.handle_webrtc_src_pad(&bin, pad, &this.obj()); @@ -1172,7 +1243,7 @@ impl BaseWebRTCSrc { move |_webrtcbin, pad| { let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); + gst::error!(CAT, imp = this, "session {session_id:?} not found"); return; }; session.flow_combiner.lock().unwrap().remove_pad(pad); @@ -1190,7 +1261,7 @@ impl BaseWebRTCSrc { move |_webrtcbin: gst::Bin, sdp_m_line_index: u32, candidate: String| { let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); + gst::error!(CAT, imp = this, "session {session_id:?} not found"); return; }; session.on_ice_candidate(sdp_m_line_index, candidate, &this.obj()); @@ -1210,7 +1281,7 @@ impl BaseWebRTCSrc { let mut state = this.state.lock().unwrap(); let Some(session) = state.sessions.get_mut(&session_id) else { - gst::error!(CAT, imp: this, "session {session_id:?} not found"); + gst::error!(CAT, imp = this, "session {session_id:?} not found"); return; }; session.on_data_channel(data_channel, &this.obj()); @@ -1241,7 +1312,7 @@ impl BaseWebRTCSrc { for pad in obj.src_pads() { if pad.name().contains(id) { if !pad.push_event(gst::event::Eos::new()) { - gst::warning!(CAT, imp: self, "failed to send EOS on {}", pad.name()); + gst::warning!(CAT, imp = self, "failed to send EOS on {}", pad.name()); } obj.remove_pad(&pad) .map_err(|err| anyhow::anyhow!("Couldn't remove pad? {err:?}"))?; @@ -1336,10 +1407,13 @@ impl ElementImpl for BaseWebRTCSrc { let mut state = self.state.lock().unwrap(); if state.sessions.len() != 1 { - gst::warning!(CAT, imp: self, + gst::warning!( + CAT, + imp = self, "Navigation event can only be sent on the element if there is a single \ session. For multiple sessions, send the event on the desired source \ - pad(s)"); + pad(s)" + ); false } else { state @@ -1379,7 +1453,7 @@ impl ChildProxyImpl for BaseWebRTCSrc { fn child_by_name(&self, name: &str) -> Option { match name { "signaller" => { - gst::info!(CAT, imp: self, "Getting signaller"); + gst::info!(CAT, imp = self, "Getting signaller"); Some(self.signaller().upcast()) } _ => None, diff --git a/net/webrtc/src/whip_signaller/imp.rs b/net/webrtc/src/whip_signaller/imp.rs index 5d10dbe3..9888fd4d 100644 --- a/net/webrtc/src/whip_signaller/imp.rs +++ b/net/webrtc/src/whip_signaller/imp.rs @@ -97,7 +97,7 @@ impl WhipClient { fn handle_future_error(&self, err: WaitError) { match err { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Future aborted") + gst::warning!(CAT, imp = self, "Future aborted") } WaitError::FutureError(err) => self.raise_error(err.to_string()), }; @@ -123,7 +123,7 @@ impl WhipClient { gst::debug!( CAT, - imp: self, + imp = self, "Sending offer SDP: {:?}", offer_sdp.sdp().as_text() ); @@ -187,7 +187,7 @@ impl WhipClient { let sdp = offer.sdp(); let body = sdp.as_text().unwrap(); - gst::debug!(CAT, imp: self, "Using endpoint {}", endpoint.as_str()); + gst::debug!(CAT, imp = self, "Using endpoint {}", endpoint.as_str()); let mut headermap = HeaderMap::new(); headermap.insert( reqwest::header::CONTENT_TYPE, @@ -226,7 +226,7 @@ impl WhipClient { redirects: u8, webrtcbin: &gst::Element, ) { - gst::debug!(CAT, imp: self, "Parsing endpoint response"); + gst::debug!(CAT, imp = self, "Parsing endpoint response"); let endpoint; let use_link_headers; @@ -277,7 +277,7 @@ impl WhipClient { let url = reqwest::Url::parse(endpoint.as_str()).unwrap(); - gst::debug!(CAT, imp: self, "WHIP resource: {:?}", location); + gst::debug!(CAT, imp = self, "WHIP resource: {:?}", location); let url = match url.join(location) { Ok(joined_url) => joined_url, @@ -352,7 +352,7 @@ impl WhipClient { gst::debug!( CAT, - imp: self, + imp = self, "Redirecting endpoint to {}", redirect_url.as_str() ); @@ -407,7 +407,7 @@ impl WhipClient { ); } - gst::debug!(CAT, imp: self, "DELETE request on {}", resource_url); + gst::debug!(CAT, imp = self, "DELETE request on {}", resource_url); let client = build_reqwest_client(reqwest::redirect::Policy::default()); let future = async { client @@ -426,14 +426,14 @@ impl WhipClient { let res = wait(&self.canceller, future, timeout); match res { Ok(r) => { - gst::debug!(CAT, imp: self, "Response to DELETE : {}", r.status()); + gst::debug!(CAT, imp = self, "Response to DELETE : {}", r.status()); } Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "DELETE request aborted") + gst::warning!(CAT, imp = self, "DELETE request aborted") } WaitError::FutureError(e) => { - gst::error!(CAT, imp: self, "Error on DELETE request : {}", e) + gst::error!(CAT, imp = self, "Error on DELETE request : {}", e) } }, }; @@ -464,10 +464,10 @@ impl SignallableImpl for WhipClient { match state { WebRTCICEGatheringState::Gathering => { - gst::info!(CAT, obj: signaller, "ICE gathering started"); + gst::info!(CAT, obj = signaller, "ICE gathering started"); } WebRTCICEGatheringState::Complete => { - gst::info!(CAT, obj: signaller, "ICE gathering complete"); + gst::info!(CAT, obj = signaller, "ICE gathering complete"); let webrtcbin = webrtcbin.clone(); @@ -670,10 +670,10 @@ impl WhipServer { match state { WebRTCICEGatheringState::Gathering => { - gst::info!(CAT, obj: signaller, "ICE gathering started"); + gst::info!(CAT, obj = signaller, "ICE gathering started"); } WebRTCICEGatheringState::Complete => { - gst::info!(CAT, obj: signaller, "ICE gathering complete"); + gst::info!(CAT, obj = signaller, "ICE gathering complete"); let ans: Option; let mut settings = signaller.imp().settings.lock().unwrap(); if let Some(answer_desc) = webrtcbin @@ -690,11 +690,19 @@ impl WhipServer { .take() .expect("SDP answer Sender needs to be valid"); - RUNTIME.spawn(glib::clone!(#[strong] signaller, async move { - if let Err(e) = tx.send(ans).await { - gst::error!(CAT, obj: signaller, "Failed to send SDP {e}"); + RUNTIME.spawn(glib::clone!( + #[strong] + signaller, + async move { + if let Err(e) = tx.send(ans).await { + gst::error!( + CAT, + obj = signaller, + "Failed to send SDP {e}" + ); + } } - })); + )); } _ => (), } @@ -719,9 +727,9 @@ impl WhipServer { .obj() .emit_by_name::("session-ended", &[&id.as_str()]) { - gst::info!(CAT, imp:self, "Ended session {id}"); + gst::info!(CAT, imp = self, "Ended session {id}"); } else { - gst::info!(CAT, imp:self, "Failed to End session {id}"); + gst::info!(CAT, imp = self, "Failed to End session {id}"); // FIXME: Do we send a different response } Ok(warp::reply::reply().into_response()) @@ -739,7 +747,7 @@ impl WhipServer { links.append(LINK, HeaderValue::from_str(stun_link.as_str()).unwrap()); } Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse {stun:?} : {e:?}"); + gst::error!(CAT, imp = self, "Failed to parse {stun:?} : {e:?}"); } }, None => {} @@ -748,17 +756,21 @@ impl WhipServer { if !settings.turn_servers.is_empty() { for turn_server in settings.turn_servers.iter() { if let Ok(turn) = turn_server.get::() { - gst::debug!(CAT, imp: self, "turn server: {}",turn.as_str()); + gst::debug!(CAT, imp = self, "turn server: {}", turn.as_str()); match build_link_header(turn.as_str()) { Ok(turn_link) => { links.append(LINK, HeaderValue::from_str(turn_link.as_str()).unwrap()); } Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse {turn_server:?} : {e:?}"); + gst::error!(CAT, imp = self, "Failed to parse {turn_server:?} : {e:?}"); } } } else { - gst::debug!(CAT, imp: self, "Failed to get String value of {turn_server:?}"); + gst::debug!( + CAT, + imp = self, + "Failed to get String value of {turn_server:?}" + ); } } } @@ -801,7 +813,7 @@ impl WhipServer { .emit_by_name::<()>("session-description", &[&session_id, &offer]); } Err(err) => { - gst::error!(CAT, imp: self, "Could not parse offer SDP: {err}"); + gst::error!(CAT, imp = self, "Could not parse offer SDP: {err}"); let reply = warp::reply::reply(); let res = warp::reply::with_status(reply, http::StatusCode::NOT_ACCEPTABLE); return Ok(res.into_response()); @@ -846,7 +858,7 @@ impl WhipServer { links.append(LINK, HeaderValue::from_str(stun_link.as_str()).unwrap()); } Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse {stun:?} : {e:?}"); + gst::error!(CAT, imp = self, "Failed to parse {stun:?} : {e:?}"); } }, None => {} @@ -855,17 +867,25 @@ impl WhipServer { if !settings.turn_servers.is_empty() { for turn_server in settings.turn_servers.iter() { if let Ok(turn) = turn_server.get::() { - gst::debug!(CAT, imp: self, "turn server: {}",turn.as_str()); + gst::debug!(CAT, imp = self, "turn server: {}", turn.as_str()); match build_link_header(turn.as_str()) { Ok(turn_link) => { links.append(LINK, HeaderValue::from_str(turn_link.as_str()).unwrap()); } Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse {turn_server:?} : {e:?}"); + gst::error!( + CAT, + imp = self, + "Failed to parse {turn_server:?} : {e:?}" + ); } } } else { - gst::error!(CAT, imp: self, "Failed to get String value of {turn_server:?}"); + gst::error!( + CAT, + imp = self, + "Failed to get String value of {turn_server:?}" + ); } } } @@ -878,16 +898,16 @@ impl WhipServer { match sdp.as_text() { Ok(text) => { ans_text = Ok(text); - gst::debug!(CAT, imp: self, "{ans_text:?}"); + gst::debug!(CAT, imp = self, "{ans_text:?}"); } Err(e) => { ans_text = Err(format!("Failed to get SDP answer: {e:?}")); - gst::error!(CAT, imp: self, "{e:?}"); + gst::error!(CAT, imp = self, "{e:?}"); } } } else { let e = "SDP Answer is empty!".to_string(); - gst::error!(CAT, imp: self, "{e:?}"); + gst::error!(CAT, imp = self, "{e:?}"); ans_text = Err(e); } @@ -924,10 +944,10 @@ impl WhipServer { Ok(v) => { // pick the first vector item addr = v[0]; - gst::info!(CAT, imp:self, "using {addr:?} as address"); + gst::info!(CAT, imp = self, "using {addr:?} as address"); } Err(e) => { - gst::error!(CAT, imp:self, "error getting addr from uri {e:?}"); + gst::error!(CAT, imp = self, "error getting addr from uri {e:?}"); self.obj() .emit_by_name::<()>("error", &[&format!("Unable to start WHIP Server: {e:?}")]); return None; @@ -1011,7 +1031,7 @@ impl WhipServer { gst::debug!(CAT, "Stopped the server task..."); }); - gst::debug!(CAT, imp: self, "Started the server..."); + gst::debug!(CAT, imp = self, "Started the server..."); Some(jh) } @@ -1024,7 +1044,7 @@ impl WhipServer { impl SignallableImpl for WhipServer { fn start(&self) { - gst::info!(CAT, imp: self, "starting the WHIP server"); + gst::info!(CAT, imp = self, "starting the WHIP server"); let jh = self.serve(); let mut settings = self.settings.lock().unwrap(); settings.server_handle = jh; @@ -1044,21 +1064,25 @@ impl SignallableImpl for WhipServer { .expect("Shutdown signal Sender needs to be valid"); if tx.send(()).is_err() { - gst::error!(CAT, imp: self, "Failed to send shutdown signal. Receiver dropped"); + gst::error!( + CAT, + imp = self, + "Failed to send shutdown signal. Receiver dropped" + ); } - gst::debug!(CAT, imp: self, "Await server handle to join"); + gst::debug!(CAT, imp = self, "Await server handle to join"); RUNTIME.block_on(async { if let Err(e) = handle.await { - gst::error!(CAT, imp:self, "Failed to join server handle: {e:?}"); + gst::error!(CAT, imp = self, "Failed to join server handle: {e:?}"); }; }); - gst::info!(CAT, imp: self, "stopped the WHIP server"); + gst::info!(CAT, imp = self, "stopped the WHIP server"); } fn end_session(&self, session_id: &str) { - gst::info!(CAT, imp: self, "Session {session_id} ended"); + gst::info!(CAT, imp = self, "Session {session_id} ended"); //FIXME: send any events to the client } } diff --git a/net/webrtchttp/src/whepsrc/imp.rs b/net/webrtchttp/src/whepsrc/imp.rs index 1ccc19ce..1a032dd6 100644 --- a/net/webrtchttp/src/whepsrc/imp.rs +++ b/net/webrtchttp/src/whepsrc/imp.rs @@ -171,7 +171,7 @@ impl ElementImpl for WhepSrc { let settings = self.settings.lock().unwrap(); if settings.whep_endpoint.is_none() { - gst::error!(CAT, imp: self, "WHEP endpoint URL must be set"); + gst::error!(CAT, imp = self, "WHEP endpoint URL must be set"); return Err(gst::StateChangeError); } @@ -184,7 +184,7 @@ impl ElementImpl for WhepSrc { { gst::error!( CAT, - imp: self, + imp = self, "WHEP endpoint URL could not be parsed: {}", e ); @@ -217,12 +217,18 @@ impl ElementImpl for WhepSrc { } for pad in self.obj().src_pads() { - gst::debug!(CAT, imp: self, "Removing pad: {}", pad.name()); + gst::debug!(CAT, imp = self, "Removing pad: {}", pad.name()); // No need to deactivate pad here. Parent GstBin will deactivate // the pad. Only remove the pad. if let Err(e) = self.obj().remove_pad(&pad) { - gst::error!(CAT, imp: self, "Failed to remove pad {}: {}", pad.name(), e); + gst::error!( + CAT, + imp = self, + "Failed to remove pad {}: {}", + pad.name(), + e + ); } } } @@ -431,7 +437,7 @@ impl WhepSrc { fn handle_future_error(&self, err: WaitError) { match err { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Future aborted") + gst::warning!(CAT, imp = self, "Future aborted") } WaitError::FutureError(err) => { self.raise_error(gst::ResourceError::Failed, err.to_string()) @@ -455,10 +461,10 @@ impl WhepSrc { match state { WebRTCICEGatheringState::Gathering => { - gst::info!(CAT, imp: self_, "ICE gathering started") + gst::info!(CAT, imp = self_, "ICE gathering started") } WebRTCICEGatheringState::Complete => { - gst::info!(CAT, imp: self_, "ICE gathering completed"); + gst::info!(CAT, imp = self_, "ICE gathering completed"); let self_ref = self_.ref_counted(); @@ -487,13 +493,13 @@ impl WhepSrc { match state { WebRTCICEConnectionState::New => (), WebRTCICEConnectionState::Checking => { - gst::info!(CAT, imp: self_, "ICE connecting...") + gst::info!(CAT, imp = self_, "ICE connecting...") } WebRTCICEConnectionState::Connected => { - gst::info!(CAT, imp: self_, "ICE connected") + gst::info!(CAT, imp = self_, "ICE connected") } WebRTCICEConnectionState::Completed => { - gst::info!(CAT, imp: self_, "ICE completed") + gst::info!(CAT, imp = self_, "ICE completed") } WebRTCICEConnectionState::Failed => { self_.terminate_session(); @@ -517,10 +523,10 @@ impl WhepSrc { match state { WebRTCPeerConnectionState::New => (), WebRTCPeerConnectionState::Connecting => { - gst::info!(CAT, imp: self_, "PeerConnection connecting...") + gst::info!(CAT, imp = self_, "PeerConnection connecting...") } WebRTCPeerConnectionState::Connected => { - gst::info!(CAT, imp: self_, "PeerConnection connected") + gst::info!(CAT, imp = self_, "PeerConnection connected") } WebRTCPeerConnectionState::Disconnected => (), WebRTCPeerConnectionState::Failed => { @@ -544,7 +550,7 @@ impl WhepSrc { gst::debug!( CAT, - imp: self_, + imp = self_, "Pad added with name: {} and caps: {:?}", pad.name(), pad.current_caps() @@ -607,7 +613,7 @@ impl WhepSrc { gst::debug!( CAT, - imp: self, + imp = self, "Setting remote description: {:?}", remote_sdp.sdp().as_text() ); @@ -624,7 +630,7 @@ impl WhepSrc { let m_line_index = 0u32; let c = format!("candidate:{candidate}"); - gst::debug!(CAT, imp: self, "Adding ICE candidate from offer: {:?}", c); + gst::debug!(CAT, imp = self, "Adding ICE candidate from offer: {:?}", c); self.webrtcbin .emit_by_name::<()>("add-ice-candidate", &[&m_line_index, &c]); @@ -651,11 +657,11 @@ impl WhepSrc { match resp.status() { StatusCode::OK | StatusCode::NO_CONTENT => { - gst::info!(CAT, imp: self, "SDP offer successfully send"); + gst::info!(CAT, imp = self, "SDP offer successfully send"); } StatusCode::CREATED => { - gst::debug!(CAT, imp: self, "Response headers: {:?}", resp.headers()); + gst::debug!(CAT, imp = self, "Response headers: {:?}", resp.headers()); if use_link_headers { if let Err(e) = set_ice_servers(&self.webrtcbin, resp.headers()) { @@ -690,7 +696,7 @@ impl WhepSrc { let url = reqwest::Url::parse(endpoint.as_str()).unwrap(); - gst::debug!(CAT, imp: self, "WHEP resource: {:?}", location); + gst::debug!(CAT, imp = self, "WHEP resource: {:?}", location); let url = match url.join(location) { Ok(joined_url) => joined_url, @@ -756,7 +762,7 @@ impl WhepSrc { gst::warning!( CAT, - imp: self, + imp = self, "Redirecting endpoint to {}", redirect_url.as_str() ); @@ -823,7 +829,7 @@ impl WhepSrc { { gst::debug!( CAT, - imp: self_, + imp = self_, "Setting local description: {:?}", offer_sdp.sdp().as_text() ); @@ -851,7 +857,7 @@ impl WhepSrc { gst::debug!( CAT, - imp: self, + imp = self, "Audio caps: {:?} Video caps: {:?}", settings.audio_caps, settings.video_caps @@ -892,7 +898,7 @@ impl WhepSrc { fn initial_post_request(&self, endpoint: reqwest::Url) { let state = self.state.lock().unwrap(); - gst::info!(CAT, imp: self, "WHEP endpoint url: {}", endpoint.as_str()); + gst::info!(CAT, imp = self, "WHEP endpoint url: {}", endpoint.as_str()); match *state { State::Post { .. } => (), @@ -931,7 +937,7 @@ impl WhepSrc { gst::debug!( CAT, - imp: self, + imp = self, "Sending offer SDP: {:?}", sess_desc.sdp().as_text() ); @@ -967,7 +973,7 @@ impl WhepSrc { let sdp = offer.sdp(); let body = sdp.as_text().unwrap(); - gst::info!(CAT, imp: self, "Using endpoint {}", endpoint.as_str()); + gst::info!(CAT, imp = self, "Using endpoint {}", endpoint.as_str()); let mut headermap = HeaderMap::new(); headermap.insert( @@ -986,7 +992,7 @@ impl WhepSrc { gst::debug!( CAT, - imp: self, + imp = self, "Url for HTTP POST request: {}", endpoint.as_str() ); @@ -1058,7 +1064,7 @@ impl WhepSrc { drop(settings); - gst::debug!(CAT, imp: self, "DELETE request on {}", resource_url); + gst::debug!(CAT, imp = self, "DELETE request on {}", resource_url); /* DELETE request goes to the WHEP resource URL. See section 3 of the specification. */ let client = build_reqwest_client(reqwest::redirect::Policy::default()); @@ -1079,14 +1085,14 @@ impl WhepSrc { let res = wait(&self.canceller, future, timeout); match res { Ok(r) => { - gst::debug!(CAT, imp: self, "Response to DELETE : {}", r.status()); + gst::debug!(CAT, imp = self, "Response to DELETE : {}", r.status()); } Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "DELETE request aborted") + gst::warning!(CAT, imp = self, "DELETE request aborted") } WaitError::FutureError(e) => { - gst::error!(CAT, imp: self, "Error on DELETE request : {}", e) + gst::error!(CAT, imp = self, "Error on DELETE request : {}", e) } }, }; diff --git a/net/webrtchttp/src/whipsink/imp.rs b/net/webrtchttp/src/whipsink/imp.rs index 9a55c0dd..36514d1f 100644 --- a/net/webrtchttp/src/whipsink/imp.rs +++ b/net/webrtchttp/src/whipsink/imp.rs @@ -160,7 +160,7 @@ impl ElementImpl for WhipSink { let settings = self.settings.lock().unwrap(); if settings.whip_endpoint.is_none() { - gst::error!(CAT, imp: self, "WHIP endpoint URL must be set"); + gst::error!(CAT, imp = self, "WHIP endpoint URL must be set"); return Err(gst::StateChangeError); } @@ -173,7 +173,7 @@ impl ElementImpl for WhipSink { { gst::error!( CAT, - imp: self, + imp = self, "WHIP endpoint URL could not be parsed: {}", e ); @@ -363,7 +363,7 @@ impl ObjectImpl for WhipSink { gst::warning!( CAT, - imp: self, + imp = self, "whipsink will be deprecated in the future, \ it is recommended that whipclientsink be used instead" ); @@ -383,14 +383,14 @@ impl ObjectImpl for WhipSink { match state { WebRTCICEGatheringState::Gathering => { - gst::info!(CAT, imp: self_, "ICE gathering started") + gst::info!(CAT, imp = self_, "ICE gathering started") } WebRTCICEGatheringState::Complete => { - gst::info!(CAT, imp: self_, "ICE gathering completed"); + gst::info!(CAT, imp = self_, "ICE gathering completed"); let self_ref = self_.ref_counted(); - gst::info!(CAT, imp: self_, "ICE gathering complete"); + gst::info!(CAT, imp = self_, "ICE gathering complete"); // With tokio's spawn one does not have to .await the // returned JoinHandle to make the provided future start @@ -535,7 +535,7 @@ impl WhipSink { fn handle_future_error(&self, err: WaitError) { match err { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "Future aborted") + gst::warning!(CAT, imp = self, "Future aborted") } WaitError::FutureError(err) => { self.raise_error(gst::ResourceError::Failed, err.to_string()) @@ -568,7 +568,7 @@ impl WhipSink { gst::debug!( CAT, - imp: self, + imp = self, "Sending offer SDP: {:?}", offer_sdp.sdp().as_text() ); @@ -627,7 +627,7 @@ impl WhipSink { let sdp = offer.sdp(); let body = sdp.as_text().unwrap(); - gst::debug!(CAT, imp: self, "Using endpoint {}", endpoint.as_str()); + gst::debug!(CAT, imp = self, "Using endpoint {}", endpoint.as_str()); let mut headermap = HeaderMap::new(); headermap.insert( reqwest::header::CONTENT_TYPE, @@ -713,7 +713,7 @@ impl WhipSink { let url = reqwest::Url::parse(endpoint.as_str()).unwrap(); - gst::debug!(CAT, imp: self, "WHIP resource: {:?}", location); + gst::debug!(CAT, imp = self, "WHIP resource: {:?}", location); let url = match url.join(location) { Ok(joined_url) => joined_url, @@ -796,7 +796,7 @@ impl WhipSink { gst::debug!( CAT, - imp: self, + imp = self, "Redirecting endpoint to {}", redirect_url.as_str() ); @@ -861,7 +861,7 @@ impl WhipSink { ); } - gst::debug!(CAT, imp: self, "DELETE request on {}", resource_url); + gst::debug!(CAT, imp = self, "DELETE request on {}", resource_url); let client = build_reqwest_client(reqwest::redirect::Policy::default()); let future = async { client @@ -880,14 +880,14 @@ impl WhipSink { let res = wait(&self.canceller, future, timeout); match res { Ok(r) => { - gst::debug!(CAT, imp: self, "Response to DELETE : {}", r.status()); + gst::debug!(CAT, imp = self, "Response to DELETE : {}", r.status()); } Err(e) => match e { WaitError::FutureAborted => { - gst::warning!(CAT, imp: self, "DELETE request aborted") + gst::warning!(CAT, imp = self, "DELETE request aborted") } WaitError::FutureError(e) => { - gst::error!(CAT, imp: self, "Error on DELETE request : {}", e) + gst::error!(CAT, imp = self, "Error on DELETE request : {}", e) } }, }; diff --git a/text/ahead/src/textahead/imp.rs b/text/ahead/src/textahead/imp.rs index 90c937ea..fc922177 100644 --- a/text/ahead/src/textahead/imp.rs +++ b/text/ahead/src/textahead/imp.rs @@ -298,7 +298,7 @@ impl TextAhead { // queue buffer let mut state = self.state.lock().unwrap(); - gst::log!(CAT, imp: self, "input {:?}: {}", pts, text); + gst::log!(CAT, imp = self, "input {:?}: {}", pts, text); state.pending.push(Input { text, @@ -325,7 +325,7 @@ impl TextAhead { gst::EventView::Eos(_) => { let mut state = self.state.lock().unwrap(); - gst::debug!(CAT, imp: self, "eos"); + gst::debug!(CAT, imp = self, "eos"); while !state.pending.is_empty() { let _ = self.push_pending(&mut state); @@ -456,7 +456,7 @@ impl TextAhead { } } - gst::log!(CAT, imp: self, "output {:?}: {}", pts, text); + gst::log!(CAT, imp = self, "output {:?}: {}", pts, text); let mut output = gst::Buffer::from_mut_slice(text.into_bytes()); { diff --git a/text/json/src/jsongstenc/imp.rs b/text/json/src/jsongstenc/imp.rs index 42e87021..cd57d461 100644 --- a/text/json/src/jsongstenc/imp.rs +++ b/text/json/src/jsongstenc/imp.rs @@ -151,7 +151,7 @@ impl JsonGstEnc { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(e) => { @@ -268,7 +268,7 @@ impl ElementImpl for JsonGstEnc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/text/json/src/jsongstparse/imp.rs b/text/json/src/jsongstparse/imp.rs index 2ad067c4..cb4b902b 100644 --- a/text/json/src/jsongstparse/imp.rs +++ b/text/json/src/jsongstparse/imp.rs @@ -155,7 +155,7 @@ impl State { let caps = caps_builder.build(); events.push(gst::event::Caps::new(&caps)); - gst::info!(CAT, imp: imp, "Caps changed to {:?}", &caps); + gst::info!(CAT, imp = imp, "Caps changed to {:?}", &caps); self.need_caps = false; } @@ -236,7 +236,7 @@ impl JsonGstParse { })) => { gst::debug!( CAT, - imp: self, + imp = self, "Got buffer with timestamp {} and duration {}", pts.display(), duration.display(), @@ -270,13 +270,13 @@ impl JsonGstParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } self.srcpad.push(buffer).map_err(|err| { if err != gst::FlowError::Flushing { - gst::error!(CAT, imp: self, "Pushing buffer returned {:?}", err); + gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err); } err })?; @@ -294,13 +294,13 @@ impl JsonGstParse { if state.format.is_none() { state.format = Some(format); } else { - gst::warning!(CAT, imp: self, "Ignoring format change",); + gst::warning!(CAT, imp = self, "Ignoring format change",); } } Err((line, err)) => { gst::error!( CAT, - imp: self, + imp = self, "Couldn't parse line '{:?}': {:?}", std::str::from_utf8(line), err @@ -316,7 +316,7 @@ impl JsonGstParse { } Ok(None) => { if drain && state.pull.is_some() { - gst::debug!(CAT, imp: self, "Finished draining"); + gst::debug!(CAT, imp = self, "Finished draining"); break Err(gst::FlowError::Eos); } break Ok(gst::FlowSuccess::Ok); @@ -336,7 +336,7 @@ impl JsonGstParse { state.replay_last_line = true; state.need_flush_stop = true; - gst::debug!(CAT, imp: self, "Done seeking"); + gst::debug!(CAT, imp = self, "Done seeking"); } drop(state); @@ -352,18 +352,18 @@ impl JsonGstParse { state.pull = None; if !pad.peer_query(&mut query) { - gst::debug!(CAT, obj: pad, "Scheduling query failed on peer"); + gst::debug!(CAT, obj = pad, "Scheduling query failed on peer"); gst::PadMode::Push } else if query .has_scheduling_mode_with_flags(gst::PadMode::Pull, gst::SchedulingFlags::SEEKABLE) { - gst::debug!(CAT, obj: pad, "Activating in Pull mode"); + gst::debug!(CAT, obj = pad, "Activating in Pull mode"); state.pull = Some(PullState::new(self, &self.srcpad)); gst::PadMode::Pull } else { - gst::debug!(CAT, obj: pad, "Activating in Push mode"); + gst::debug!(CAT, obj = pad, "Activating in Push mode"); gst::PadMode::Push } }; @@ -401,7 +401,7 @@ impl JsonGstParse { } fn scan_duration(&self) -> Result, gst::LoggableError> { - gst::debug!(CAT, imp: self, "Scanning duration"); + gst::debug!(CAT, imp = self, "Scanning duration"); /* First let's query the bytes duration upstream */ let mut q = gst::query::Duration::new(gst::Format::Bytes); @@ -470,7 +470,7 @@ impl JsonGstParse { if last_pts.is_some() || offset == 0 { gst::debug!( CAT, - imp: self, + imp = self, "Duration scan done, last_pts: {:?}", last_pts ); @@ -499,7 +499,7 @@ impl JsonGstParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } } @@ -540,13 +540,22 @@ impl JsonGstParse { Ok(buffer) => Some(buffer), Err(gst::FlowError::Eos) => None, Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.sinkpad, "Pausing after pulling buffer, reason: flushing"); + gst::debug!( + CAT, + obj = self.sinkpad, + "Pausing after pulling buffer, reason: flushing" + ); self.sinkpad.pause_task().unwrap(); return; } Err(flow) => { - gst::error!(CAT, obj: self.sinkpad, "Failed to pull, reason: {:?}", flow); + gst::error!( + CAT, + obj = self.sinkpad, + "Failed to pull, reason: {:?}", + flow + ); gst::element_imp_error!( self, @@ -562,17 +571,17 @@ impl JsonGstParse { if let Err(flow) = self.handle_buffer(buffer) { match flow { gst::FlowError::Flushing => { - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } gst::FlowError::Eos => { self.push_eos(); - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } _ => { self.push_eos(); - gst::error!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::error!(CAT, imp = self, "Pausing after flow {:?}", flow); gst::element_imp_error!( self, @@ -591,7 +600,7 @@ impl JsonGstParse { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); self.handle_buffer(Some(buffer)) } @@ -613,17 +622,17 @@ impl JsonGstParse { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(_) => { // We send a proper caps event from the chain function later - gst::log!(CAT, obj: pad, "Dropping caps event"); + gst::log!(CAT, obj = pad, "Dropping caps event"); true } EventView::Segment(_) => { // We send a gst::Format::Time segment event later when needed - gst::log!(CAT, obj: pad, "Dropping segment event"); + gst::log!(CAT, obj = pad, "Dropping segment event"); true } EventView::FlushStop(_) => { @@ -634,9 +643,9 @@ impl JsonGstParse { gst::Pad::event_default(pad, Some(&*self.obj()), event) } EventView::Eos(_) => { - gst::log!(CAT, obj: pad, "Draining"); + gst::log!(CAT, obj = pad, "Draining"); if let Err(err) = self.handle_buffer(None) { - gst::error!(CAT, obj: pad, "Failed to drain parser: {:?}", err); + gst::error!(CAT, obj = pad, "Failed to drain parser: {:?}", err); } gst::Pad::event_default(pad, Some(&*self.obj()), event) } @@ -645,7 +654,7 @@ impl JsonGstParse { && !self.srcpad.has_current_caps() && event.type_() > gst::EventType::Caps { - gst::log!(CAT, obj: pad, "Deferring sticky event until we have caps"); + gst::log!(CAT, obj = pad, "Deferring sticky event until we have caps"); let mut state = self.state.lock().unwrap(); state.pending_events.push(event); true @@ -658,7 +667,7 @@ impl JsonGstParse { fn perform_seek(&self, event: &gst::event::Seek) -> bool { if self.state.lock().unwrap().pull.is_none() { - gst::error!(CAT, imp: self, "seeking is only supported in pull mode"); + gst::error!(CAT, imp = self, "seeking is only supported in pull mode"); return false; } @@ -667,7 +676,7 @@ impl JsonGstParse { let mut start: Option = match start.try_into() { Ok(start) => start, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; @@ -675,18 +684,18 @@ impl JsonGstParse { let mut stop: Option = match stop.try_into() { Ok(stop) => stop, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; if !flags.contains(gst::SeekFlags::FLUSH) { - gst::error!(CAT, imp: self, "only flushing seeks are supported"); + gst::error!(CAT, imp = self, "only flushing seeks are supported"); return false; } if start_type == gst::SeekType::End || stop_type == gst::SeekType::End { - gst::error!(CAT, imp: self, "Relative seeks are not supported"); + gst::error!(CAT, imp = self, "Relative seeks are not supported"); return false; } @@ -696,14 +705,14 @@ impl JsonGstParse { .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); let event = gst::event::FlushStart::builder() .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); self.sinkpad.pause_task().unwrap(); @@ -731,7 +740,7 @@ impl JsonGstParse { /* Drop our state while we push a serialized event upstream */ drop(state); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); state = self.state.lock().unwrap(); @@ -752,7 +761,7 @@ impl JsonGstParse { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(e) => self.perform_seek(e), _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -762,7 +771,7 @@ impl JsonGstParse { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -940,7 +949,7 @@ impl ElementImpl for JsonGstParse { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/text/regex/src/gstregex/imp.rs b/text/regex/src/gstregex/imp.rs index 10ec9504..afcdad1d 100644 --- a/text/regex/src/gstregex/imp.rs +++ b/text/regex/src/gstregex/imp.rs @@ -52,14 +52,14 @@ impl RegEx { buffer: gst::Buffer, ) -> Result { let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to map buffer"]); gst::FlowError::Error })?; let mut data = std::str::from_utf8(&data) .map_err(|err| { - gst::error!(CAT, imp: self, "Can't decode utf8: {}", err); + gst::error!(CAT, imp = self, "Can't decode utf8: {}", err); gst::element_imp_error!( self, gst::StreamError::Decode, @@ -186,7 +186,7 @@ impl ObjectImpl for RegEx { Ok(None) | Err(_) => { gst::error!( CAT, - imp: self, + imp = self, "All commands require a pattern field as a string" ); continue; @@ -222,7 +222,7 @@ impl ObjectImpl for RegEx { let regex = match builder.build() { Ok(regex) => regex, Err(err) => { - gst::error!(CAT, imp: self, "Failed to compile regex: {:?}", err); + gst::error!(CAT, imp = self, "Failed to compile regex: {:?}", err); continue; } }; @@ -234,7 +234,7 @@ impl ObjectImpl for RegEx { Ok(None) | Err(_) => { gst::error!( CAT, - imp: self, + imp = self, "Replace operations require a replacement field as a string" ); continue; @@ -247,7 +247,7 @@ impl ObjectImpl for RegEx { }); } val => { - gst::error!(CAT, imp: self, "Unknown operation {}", val); + gst::error!(CAT, imp = self, "Unknown operation {}", val); } } } diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs index c42036be..ffe2ebb4 100644 --- a/text/wrap/src/gsttextwrap/imp.rs +++ b/text/wrap/src/gsttextwrap/imp.rs @@ -97,7 +97,7 @@ impl TextWrap { if let Some(dictionary) = &settings.dictionary { let dict_file = match File::open(dictionary) { Err(err) => { - gst::error!(CAT, imp: self, "Failed to open dictionary file: {}", err); + gst::error!(CAT, imp = self, "Failed to open dictionary file: {}", err); return; } Ok(dict_file) => dict_file, @@ -106,7 +106,12 @@ impl TextWrap { let mut reader = io::BufReader::new(dict_file); let standard = match Standard::any_from_reader(&mut reader) { Err(err) => { - gst::error!(CAT, imp: self, "Failed to load standard from file: {}", err); + gst::error!( + CAT, + imp = self, + "Failed to load standard from file: {}", + err + ); return; } Ok(standard) => standard, @@ -128,30 +133,30 @@ impl TextWrap { self.update_wrapper(); let mut pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, imp: self, "Need timestamped buffers"); + gst::error!(CAT, imp = self, "Need timestamped buffers"); gst::FlowError::Error })?; let duration = buffer.duration().ok_or_else(|| { - gst::error!(CAT, imp: self, "Need buffers with duration"); + gst::error!(CAT, imp = self, "Need buffers with duration"); gst::FlowError::Error })?; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, imp: self, "Can't map buffer readable"); + gst::error!(CAT, imp = self, "Can't map buffer readable"); gst::FlowError::Error })?; let data = std::str::from_utf8(&data).map_err(|err| { - gst::error!(CAT, imp: self, "Can't decode utf8: {}", err); + gst::error!(CAT, imp = self, "Can't decode utf8: {}", err); gst::FlowError::Error })?; if data.is_empty() { - gst::trace!(CAT, imp: self, "processing gap {buffer:?}"); + gst::trace!(CAT, imp = self, "processing gap {buffer:?}"); } else { - gst::debug!(CAT, imp: self, "processing {data} in {buffer:?}"); + gst::debug!(CAT, imp = self, "processing {data} in {buffer:?}"); } let accumulate_time = self.settings.lock().unwrap().accumulate_time; @@ -172,7 +177,7 @@ impl TextWrap { let duration = state.end_ts.opt_checked_sub(state.start_ts).ok().flatten(); gst::info!( CAT, - imp: self, + imp = self, "Outputting contents {}, ts: {}, duration: {}", drained, state.start_ts.display(), @@ -233,7 +238,7 @@ impl TextWrap { .join("\n"); gst::info!( CAT, - imp: self, + imp = self, "Outputting contents {}, ts: {}, duration: {}", contents.to_string(), state.start_ts.display(), @@ -279,7 +284,7 @@ impl TextWrap { textwrap::fill(data, options) }; - gst::log!(CAT, imp: self, "fill result: {data}"); + gst::log!(CAT, imp = self, "fill result: {data}"); // If the lines property was set, we want to split the result into buffers // of at most N lines. We compute the duration for each of those based on @@ -329,7 +334,7 @@ impl TextWrap { } fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); use gst::EventView; @@ -399,7 +404,7 @@ impl TextWrap { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Latency(q) => { @@ -412,7 +417,7 @@ impl TextWrap { let our_latency: gst::ClockTime = self.settings.lock().unwrap().accumulate_time; gst::info!( CAT, - imp: self, + imp = self, "Reporting our latency {} + {}", our_latency, min @@ -546,7 +551,7 @@ impl ObjectImpl for TextWrap { if settings.accumulate_time != old_accumulate_time { gst::debug!( CAT, - imp: self, + imp = self, "Accumulate time changed: {}", settings.accumulate_time.display(), ); @@ -630,7 +635,7 @@ impl ElementImpl for TextWrap { &self, transition: gst::StateChange, ) -> Result { - gst::info!(CAT, imp: self, "Changing state {:?}", transition); + gst::info!(CAT, imp = self, "Changing state {:?}", transition); if let gst::StateChange::PausedToReady = transition { let mut state = self.state.lock().unwrap(); diff --git a/tutorial/src/identity/imp.rs b/tutorial/src/identity/imp.rs index 7b26806c..b6bed807 100644 --- a/tutorial/src/identity/imp.rs +++ b/tutorial/src/identity/imp.rs @@ -42,7 +42,7 @@ impl Identity { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); self.srcpad.push(buffer) } @@ -54,7 +54,7 @@ impl Identity { // See the documentation of gst::Event and gst::EventRef to see what can be done with // events, and especially the gst::EventView type for inspecting events. fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); self.srcpad.push_event(event) } @@ -68,7 +68,7 @@ impl Identity { // See the documentation of gst::Query and gst::QueryRef to see what can be done with // queries, and especially the gst::QueryView type for inspecting and modifying queries. fn sink_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); self.srcpad.peer_query(query) } @@ -81,7 +81,7 @@ impl Identity { // See the documentation of gst::Event and gst::EventRef to see what can be done with // events, and especially the gst::EventView type for inspecting events. fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); self.sinkpad.push_event(event) } @@ -95,7 +95,7 @@ impl Identity { // See the documentation of gst::Query and gst::QueryRef to see what can be done with // queries, and especially the gst::QueryView type for inspecting and modifying queries. fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); self.sinkpad.peer_query(query) } } @@ -247,7 +247,7 @@ impl ElementImpl for Identity { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); // Call the parent class' implementation of ::change_state() self.parent_change_state(transition) diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs index eee52691..47727c0d 100644 --- a/tutorial/src/progressbin/imp.rs +++ b/tutorial/src/progressbin/imp.rs @@ -108,7 +108,7 @@ impl ObjectImpl for ProgressBin { .expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing output from {:?} to {:?}", output_type, new_output_type @@ -235,7 +235,7 @@ impl BinImpl for ProgressBin { match output_type { ProgressBinOutput::Println => println!("progress: {percent:5.1}%"), ProgressBinOutput::DebugCategory => { - gst::info!(CAT, imp: self, "progress: {:5.1}%", percent); + gst::info!(CAT, imp = self, "progress: {:5.1}%", percent); } }; } diff --git a/tutorial/src/rgb2gray/imp.rs b/tutorial/src/rgb2gray/imp.rs index e182d067..fc386b44 100644 --- a/tutorial/src/rgb2gray/imp.rs +++ b/tutorial/src/rgb2gray/imp.rs @@ -126,7 +126,7 @@ impl ObjectImpl for Rgb2Gray { let invert = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing invert from {} to {}", settings.invert, invert @@ -138,7 +138,7 @@ impl ObjectImpl for Rgb2Gray { let shift = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing shift from {} to {}", settings.shift, shift @@ -289,7 +289,7 @@ impl BaseTransformImpl for Rgb2Gray { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, diff --git a/tutorial/src/sinesrc/imp.rs b/tutorial/src/sinesrc/imp.rs index 0ff2d8ef..f47f0f8c 100644 --- a/tutorial/src/sinesrc/imp.rs +++ b/tutorial/src/sinesrc/imp.rs @@ -227,7 +227,7 @@ impl ObjectImpl for SineSrc { let samples_per_buffer = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing samples-per-buffer from {} to {}", settings.samples_per_buffer, samples_per_buffer @@ -244,7 +244,7 @@ impl ObjectImpl for SineSrc { let freq = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing freq from {} to {}", settings.freq, freq @@ -256,7 +256,7 @@ impl ObjectImpl for SineSrc { let volume = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing volume from {} to {}", settings.volume, volume @@ -268,7 +268,7 @@ impl ObjectImpl for SineSrc { let mute = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing mute from {} to {}", settings.mute, mute @@ -280,7 +280,7 @@ impl ObjectImpl for SineSrc { let is_live = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing is-live from {} to {}", settings.is_live, is_live @@ -400,7 +400,7 @@ impl BaseSrcImpl for SineSrc { gst::loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps) })?; - gst::debug!(CAT, imp: self, "Configuring for caps {}", caps); + gst::debug!(CAT, imp = self, "Configuring for caps {}", caps); self.obj() .set_blocksize(info.bpf() * (self.settings.lock().unwrap()).samples_per_buffer); @@ -451,7 +451,7 @@ impl BaseSrcImpl for SineSrc { *self.state.lock().unwrap() = Default::default(); self.unlock_stop()?; - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -462,7 +462,7 @@ impl BaseSrcImpl for SineSrc { *self.state.lock().unwrap() = Default::default(); self.unlock()?; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -482,7 +482,7 @@ impl BaseSrcImpl for SineSrc { let latency = gst::ClockTime::SECOND .mul_div_floor(settings.samples_per_buffer as u64, info.rate() as u64) .unwrap(); - gst::debug!(CAT, imp: self, "Returning latency {}", latency); + gst::debug!(CAT, imp = self, "Returning latency {}", latency); q.set(settings.is_live, latency, gst::ClockTime::NONE); true } else { @@ -527,7 +527,7 @@ impl BaseSrcImpl for SineSrc { // and for calculating the timestamps, etc. if segment.rate() < 0.0 { - gst::error!(CAT, imp: self, "Reverse playback not supported"); + gst::error!(CAT, imp = self, "Reverse playback not supported"); return false; } @@ -561,7 +561,7 @@ impl BaseSrcImpl for SineSrc { gst::debug!( CAT, - imp: self, + imp = self, "Seeked to {}-{:?} (accum: {}) for segment {:?}", sample_offset, sample_stop, @@ -583,7 +583,7 @@ impl BaseSrcImpl for SineSrc { if state.info.is_none() { gst::error!( CAT, - imp: self, + imp = self, "Can only seek in Default format if sample rate is known" ); return false; @@ -597,7 +597,7 @@ impl BaseSrcImpl for SineSrc { gst::debug!( CAT, - imp: self, + imp = self, "Seeked to {}-{:?} (accum: {}) for segment {:?}", sample_offset, sample_stop, @@ -616,7 +616,7 @@ impl BaseSrcImpl for SineSrc { } else { gst::error!( CAT, - imp: self, + imp = self, "Can't seek in format {:?}", segment.format() ); @@ -628,7 +628,7 @@ impl BaseSrcImpl for SineSrc { fn unlock(&self) -> Result<(), gst::ErrorMessage> { // This should unblock the create() function ASAP, so we // just unschedule the clock it here, if any. - gst::debug!(CAT, imp: self, "Unlocking"); + gst::debug!(CAT, imp = self, "Unlocking"); let mut clock_wait = self.clock_wait.lock().unwrap(); if let Some(clock_id) = clock_wait.clock_id.take() { clock_id.unschedule(); @@ -641,7 +641,7 @@ impl BaseSrcImpl for SineSrc { fn unlock_stop(&self) -> Result<(), gst::ErrorMessage> { // This signals that unlocking is done, so we can reset // all values again. - gst::debug!(CAT, imp: self, "Unlock stop"); + gst::debug!(CAT, imp = self, "Unlock stop"); let mut clock_wait = self.clock_wait.lock().unwrap(); clock_wait.flushing = false; @@ -674,7 +674,7 @@ impl PushSrcImpl for SineSrc { // point but at most samples_per_buffer samples per buffer let n_samples = if let Some(sample_stop) = state.sample_stop { if sample_stop <= state.sample_offset { - gst::log!(CAT, imp: self, "At EOS"); + gst::log!(CAT, imp = self, "At EOS"); return Err(gst::FlowError::Eos); } @@ -767,7 +767,7 @@ impl PushSrcImpl for SineSrc { // so that we immediately stop waiting on e.g. shutdown. let mut clock_wait = self.clock_wait.lock().unwrap(); if clock_wait.flushing { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } @@ -777,24 +777,24 @@ impl PushSrcImpl for SineSrc { gst::log!( CAT, - imp: self, + imp = self, "Waiting until {}, now {}", wait_until, clock.time().display(), ); let (res, jitter) = id.wait(); - gst::log!(CAT, imp: self, "Waited res {:?} jitter {}", res, jitter); + gst::log!(CAT, imp = self, "Waited res {:?} jitter {}", res, jitter); self.clock_wait.lock().unwrap().clock_id.take(); // If the clock ID was unscheduled, unlock() was called // and we should return Flushing immediately. if res == Err(gst::ClockError::Unscheduled) { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } } - gst::debug!(CAT, imp: self, "Produced buffer {:?}", buffer); + gst::debug!(CAT, imp = self, "Produced buffer {:?}", buffer); Ok(CreateSuccess::NewBuffer(buffer)) } diff --git a/tutorial/tutorial-1.md b/tutorial/tutorial-1.md index bcae5856..4dd5c460 100644 --- a/tutorial/tutorial-1.md +++ b/tutorial/tutorial-1.md @@ -428,7 +428,7 @@ impl BaseTransformImpl for Rgb2Gray { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, @@ -652,7 +652,7 @@ impl ObjectImpl for Rgb2Gray { let invert = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing invert from {} to {}", settings.invert, invert @@ -664,7 +664,7 @@ impl ObjectImpl for Rgb2Gray { let shift = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing shift from {} to {}", settings.shift, shift diff --git a/tutorial/tutorial-2.md b/tutorial/tutorial-2.md index 72f884be..66a48166 100644 --- a/tutorial/tutorial-2.md +++ b/tutorial/tutorial-2.md @@ -181,7 +181,7 @@ impl ObjectImpl for SineSrc { let samples_per_buffer = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing samples-per-buffer from {} to {}", settings.samples_per_buffer, samples_per_buffer @@ -196,7 +196,7 @@ impl ObjectImpl for SineSrc { let freq = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing freq from {} to {}", settings.freq, freq @@ -208,7 +208,7 @@ impl ObjectImpl for SineSrc { let volume = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing volume from {} to {}", settings.volume, volume @@ -220,7 +220,7 @@ impl ObjectImpl for SineSrc { let mute = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing mute from {} to {}", settings.mute, mute @@ -232,7 +232,7 @@ impl ObjectImpl for SineSrc { let is_live = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing is-live from {} to {}", settings.is_live, is_live @@ -325,7 +325,7 @@ impl BaseSrcImpl for SineSrc { // Reset state *self.state.lock().unwrap() = Default::default(); - gst::info!(CAT, imp: self, "Started"); + gst::info!(CAT, imp = self, "Started"); Ok(()) } @@ -335,7 +335,7 @@ impl BaseSrcImpl for SineSrc { // Reset state *self.state.lock().unwrap() = Default::default(); - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); true } @@ -399,7 +399,7 @@ First of all, we need to get notified whenever the caps that our source is confi gst::loggable_error!(CAT, "Failed to build `AudioInfo` from caps {}", caps) })?; - gst::debug!(CAT, imp: self, "Configuring for caps {}", caps); + gst::debug!(CAT, imp = self, "Configuring for caps {}", caps); self.obj().set_blocksize(info.bpf() * (*self.settings.lock().unwrap()).samples_per_buffer); @@ -564,7 +564,7 @@ Now that this is done, we need to implement the `PushSrc::create` virtual meth // point but at most samples_per_buffer samples per buffer let n_samples = if let Some(sample_stop) = state.sample_stop { if sample_stop <= state.sample_offset { - gst::log!(CAT, imp: self, "At EOS"); + gst::log!(CAT, imp = self, "At EOS"); return Err(gst::FlowError::Eos); } @@ -623,7 +623,7 @@ Now that this is done, we need to implement the `PushSrc::create` virtual meth state.sample_offset += n_samples; drop(state); - gst::debug!(CAT, imp: self, "Produced buffer {:?}", buffer); + gst::debug!(CAT, imp = self, "Produced buffer {:?}", buffer); Ok(CreateSuccess::NewBuffer(buffer)) } @@ -692,7 +692,7 @@ For working in live mode, we have to add a few different parts in various places gst::log!( CAT, - imp: self, + imp = self, "Waiting until {}, now {}", wait_until, clock.time().display(), @@ -700,14 +700,14 @@ For working in live mode, we have to add a few different parts in various places let (res, jitter) = id.wait(); gst::log!( CAT, - imp: self, + imp = self, "Waited res {:?} jitter {}", res, jitter ); } - gst::debug!(CAT, imp: self, "Produced buffer {:?}", buffer); + gst::debug!(CAT, imp = self, "Produced buffer {:?}", buffer); Ok(CreateSuccess::NewBuffer(buffer)) } @@ -760,7 +760,7 @@ This querying is done with the `LATENCY` query, which we will have to handle i let latency = gst::ClockTime::SECOND .mul_div_floor(settings.samples_per_buffer as u64, info.rate() as u64) .unwrap(); - gst::debug!(CAT, imp: self, "Returning latency {}", latency); + gst::debug!(CAT, imp = self, "Returning latency {}", latency); q.set(settings.is_live, latency, gst::ClockTime::NONE); true } else { @@ -814,7 +814,7 @@ struct SineSrc { fn unlock(&self) -> Result<(), gst::ErrorMessage> { // This should unblock the create() function ASAP, so we // just unschedule the clock it here, if any. - gst::debug!(CAT, imp: self, "Unlocking"); + gst::debug!(CAT, imp = self, "Unlocking"); let mut clock_wait = self.clock_wait.lock().unwrap(); if let Some(clock_id) = clock_wait.clock_id.take() { clock_id.unschedule(); @@ -833,7 +833,7 @@ Once everything is unlocked, we need to reset things again so that data flow can fn unlock_stop(&self) -> Result<(), gst::ErrorMessage> { // This signals that unlocking is done, so we can reset // all values again. - gst::debug!(CAT, imp: self, "Unlock stop"); + gst::debug!(CAT, imp = self, "Unlock stop"); let mut clock_wait = self.clock_wait.lock().unwrap(); clock_wait.flushing = false; @@ -851,7 +851,7 @@ Now as a last step, we need to actually make use of the new struct we added arou // so that we immediately stop waiting on e.g. shutdown. let mut clock_wait = self.clock_wait.lock().unwrap(); if clock_wait.flushing { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } @@ -861,7 +861,7 @@ Now as a last step, we need to actually make use of the new struct we added arou gst::log!( CAT, - imp: self, + imp = self, "Waiting until {}, now {}", wait_until, clock.time().display(), @@ -869,7 +869,7 @@ Now as a last step, we need to actually make use of the new struct we added arou let (res, jitter) = id.wait(); gst::log!( CAT, - imp: self, + imp = self, "Waited res {:?} jitter {}", res, jitter @@ -879,7 +879,7 @@ Now as a last step, we need to actually make use of the new struct we added arou // If the clock ID was unscheduled, unlock() was called // and we should return Flushing immediately. if res == Err(gst::ClockError::Unscheduled) { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } ``` @@ -908,7 +908,7 @@ Seeking is implemented in the `BaseSrc::do_seek` virtual method, and signallin // and for calculating the timestamps, etc. if segment.rate() < 0.0 { - gst::error!(CAT, imp: self, "Reverse playback not supported"); + gst::error!(CAT, imp = self, "Reverse playback not supported"); return false; } @@ -942,7 +942,7 @@ Seeking is implemented in the `BaseSrc::do_seek` virtual method, and signallin gst::debug!( CAT, - imp: self, + imp = self, "Seeked to {}-{:?} (accum: {}) for segment {:?}", sample_offset, sample_stop, @@ -964,7 +964,7 @@ Seeking is implemented in the `BaseSrc::do_seek` virtual method, and signallin if state.info.is_none() { gst::error!( CAT, - imp: self, + imp = self, "Can only seek in Default format if sample rate is known" ); return false; @@ -978,7 +978,7 @@ Seeking is implemented in the `BaseSrc::do_seek` virtual method, and signallin gst::debug!( CAT, - imp: self, + imp = self, "Seeked to {}-{:?} (accum: {}) for segment {:?}", sample_offset, sample_stop, @@ -997,7 +997,7 @@ Seeking is implemented in the `BaseSrc::do_seek` virtual method, and signallin } else { gst::error!( CAT, - imp: self, + imp = self, "Can't seek in format {:?}", segment.format() ); diff --git a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs index 89a05a9e..c917cef5 100644 --- a/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/custom_source/imp.rs @@ -162,7 +162,7 @@ impl BinImpl for CustomSource { impl CustomSource { fn start(&self) -> Result { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); let source = self.source.get().unwrap(); let templates = source.pad_template_list(); @@ -171,7 +171,7 @@ impl CustomSource { .iter() .any(|templ| templ.presence() == gst::PadPresence::Request) { - gst::error!(CAT, imp: self, "Request pads not supported"); + gst::error!(CAT, imp = self, "Request pads not supported"); gst::element_imp_error!( self, gst::LibraryError::Settings, @@ -195,7 +195,7 @@ impl CustomSource { if !has_sometimes_pads { self.handle_source_no_more_pads(); } else { - gst::debug!(CAT, imp: self, "Found sometimes pads"); + gst::debug!(CAT, imp = self, "Found sometimes pads"); let pad_added_sig_id = source.connect_pad_added(move |source, pad| { let element = match source @@ -247,7 +247,7 @@ impl CustomSource { } fn handle_source_pad_added(&self, pad: &gst::Pad) -> Result<(), gst::ErrorMessage> { - gst::debug!(CAT, imp: self, "Source added pad {}", pad.name()); + gst::debug!(CAT, imp = self, "Source added pad {}", pad.name()); let mut state = self.state.lock().unwrap(); @@ -263,7 +263,7 @@ impl CustomSource { let caps = match pad.current_caps().unwrap_or_else(|| pad.query_caps(None)) { caps if !caps.is_any() && !caps.is_empty() => caps, _ => { - gst::error!(CAT, imp: self, "Pad {} had no caps", pad.name()); + gst::error!(CAT, imp = self, "Pad {} had no caps", pad.name()); return Err(gst::error_msg!( gst::CoreError::Negotiation, ["Pad had no caps"] @@ -315,7 +315,7 @@ impl CustomSource { } fn handle_source_pad_removed(&self, pad: &gst::Pad) { - gst::debug!(CAT, imp: self, "Source removed pad {}", pad.name()); + gst::debug!(CAT, imp = self, "Source removed pad {}", pad.name()); let mut state = self.state.lock().unwrap(); let (i, stream) = match state @@ -338,7 +338,7 @@ impl CustomSource { } fn handle_source_no_more_pads(&self) { - gst::debug!(CAT, imp: self, "Source signalled no-more-pads"); + gst::debug!(CAT, imp = self, "Source signalled no-more-pads"); let state = self.state.lock().unwrap(); let collection = gst::StreamCollection::builder(None) @@ -356,7 +356,7 @@ impl CustomSource { } fn stop(&self) { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); let mut state = self.state.lock().unwrap(); let source = self.source.get().unwrap(); diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index a5d8e8fb..344215dc 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -347,7 +347,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing enable-audio from {:?} to {:?}", settings.enable_audio, new_value, @@ -359,7 +359,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing enable-video from {:?} to {:?}", settings.enable_video, new_value, @@ -371,7 +371,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing URI from {:?} to {:?}", settings.uri, new_value, @@ -383,7 +383,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing source from {:?} to {:?}", settings.source, new_value, @@ -395,7 +395,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing Fallback URI from {:?} to {:?}", settings.fallback_uri, new_value, @@ -407,7 +407,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing timeout from {:?} to {:?}", settings.timeout, new_value, @@ -419,7 +419,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing Restart Timeout from {:?} to {:?}", settings.restart_timeout, new_value, @@ -431,7 +431,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing Retry Timeout from {:?} to {:?}", settings.retry_timeout, new_value, @@ -443,7 +443,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing restart-on-eos from {:?} to {:?}", settings.restart_on_eos, new_value, @@ -455,7 +455,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing Minimum Latency from {:?} to {:?}", settings.min_latency, new_value, @@ -467,7 +467,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing Buffer Duration from {:?} to {:?}", settings.buffer_duration, new_value, @@ -479,7 +479,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing immediate-fallback from {:?} to {:?}", settings.immediate_fallback, new_value, @@ -491,7 +491,7 @@ impl ObjectImpl for FallbackSrc { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing manual-unblock from {:?} to {:?}", settings.manual_unblock, new_value, @@ -506,7 +506,7 @@ impl ObjectImpl for FallbackSrc { .unwrap_or_else(gst::Caps::new_any); gst::info!( CAT, - imp: self, + imp = self, "Changing fallback video caps from {} to {}", settings.fallback_video_caps, new_value, @@ -521,7 +521,7 @@ impl ObjectImpl for FallbackSrc { .unwrap_or_else(gst::Caps::new_any); gst::info!( CAT, - imp: self, + imp = self, "Changing fallback audio caps from {} to {}", settings.fallback_audio_caps, new_value, @@ -759,7 +759,7 @@ impl ElementImpl for FallbackSrc { &self, transition: gst::StateChange, ) -> Result { - gst::debug!(CAT, imp: self, "Changing state {:?}", transition); + gst::debug!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::NullToReady => { @@ -771,7 +771,7 @@ impl ElementImpl for FallbackSrc { self.parent_change_state(transition).map_err(|err| { gst::error!( CAT, - imp: self, + imp = self, "Parent state change transition {:?} failed", transition ); @@ -806,7 +806,7 @@ impl ElementImpl for FallbackSrc { gst::EventView::Eos(..) => { gst::debug!( CAT, - imp: self, + imp = self, "Handling element-level EOS, forwarding to all streams" ); @@ -1231,7 +1231,7 @@ impl FallbackSrc { } fn start(&self) -> Result<(), gst::StateChangeError> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); let mut state_guard = self.state.lock(); if state_guard.is_some() { return Err(gst::StateChangeError); @@ -1247,7 +1247,7 @@ impl FallbackSrc { { Some(source) => source, None => { - gst::error!(CAT, imp: self, "No URI or source element configured"); + gst::error!(CAT, imp = self, "No URI or source element configured"); gst::element_imp_error!( self, gst::LibraryError::Settings, @@ -1339,12 +1339,12 @@ impl FallbackSrc { self.obj().notify("status"); - gst::debug!(CAT, imp: self, "Started"); + gst::debug!(CAT, imp = self, "Started"); Ok(()) } fn stop(&self) { - gst::debug!(CAT, imp: self, "Stopping"); + gst::debug!(CAT, imp = self, "Stopping"); let mut state_guard = self.state.lock(); let mut state = match state_guard.take() { Some(state) => state, @@ -1424,13 +1424,13 @@ impl FallbackSrc { self.obj().remove(source).unwrap(); } - gst::debug!(CAT, imp: self, "Stopped"); + gst::debug!(CAT, imp = self, "Stopped"); } fn change_source_state(&self, transition: gst::StateChange, fallback_source: bool) { gst::debug!( CAT, - imp: self, + imp = self, "Changing {}source state: {:?}", if fallback_source { "fallback " } else { "" }, transition @@ -1454,7 +1454,7 @@ impl FallbackSrc { if transition.current() <= transition.next() && source.pending_restart { gst::debug!( CAT, - imp: self, + imp = self, "Not starting {}source because pending restart", if fallback_source { "fallback " } else { "" } ); @@ -1462,7 +1462,7 @@ impl FallbackSrc { } else if transition.next() <= gst::State::Ready && source.pending_restart { gst::debug!( CAT, - imp: self, + imp = self, "Unsetting pending {}restart because shutting down", if fallback_source { "fallback " } else { "" } ); @@ -1481,7 +1481,7 @@ impl FallbackSrc { Err(_) => { gst::error!( CAT, - imp: self, + imp = self, "{}source failed to change state", if fallback_source { "fallback " } else { "" } ); @@ -1502,7 +1502,7 @@ impl FallbackSrc { Ok(res) => { gst::debug!( CAT, - imp: self, + imp = self, "{}source changed state successfully: {:?}", if fallback_source { "fallback " } else { "" }, res @@ -1719,7 +1719,7 @@ impl FallbackSrc { ) -> Result<(), gst::ErrorMessage> { gst::debug!( CAT, - imp: self, + imp = self, "Pad {} added to {}source", pad.name(), if fallback_source { "fallback " } else { "" } @@ -1797,7 +1797,7 @@ impl FallbackSrc { let (branch_storage, filter_caps, switch) = match stream { None => { - gst::debug!(CAT, imp: self, "No {} stream enabled", type_); + gst::debug!(CAT, imp = self, "No {} stream enabled", type_); return Ok(()); } Some(Stream { @@ -1807,7 +1807,7 @@ impl FallbackSrc { .. }) if !fallback_source => { if main_branch.is_some() { - gst::debug!(CAT, imp: self, "Already configured a {} stream", type_); + gst::debug!(CAT, imp = self, "Already configured a {} stream", type_); return Ok(()); } @@ -1822,7 +1822,7 @@ impl FallbackSrc { if fallback_branch.is_some() { gst::debug!( CAT, - imp: self, + imp = self, "Already configured a {} fallback stream", type_ ); @@ -1872,7 +1872,7 @@ impl FallbackSrc { let sinkpad = converters.static_pad("sink").unwrap(); pad.link(&sinkpad).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to link new source pad: {}", err); + gst::error!(CAT, imp = self, "Failed to link new source pad: {}", err); gst::error_msg!( gst::CoreError::Negotiation, ["Failed to link new source pad: {}", err] @@ -1921,7 +1921,7 @@ impl FallbackSrc { gst::debug!( CAT, - obj: element, + obj = element, "Received EOS from {}source on pad {}", if fallback_source { "fallback " } else { "" }, pad.name() @@ -2013,7 +2013,7 @@ impl FallbackSrc { // is fixed. gst::debug!( CAT, - imp: self, + imp = self, "Adding blocking probe to pad {} for pad {} (fallback: {})", block_pad.name(), pad.name(), @@ -2104,7 +2104,7 @@ impl FallbackSrc { } if !fallback_source && &branch.queue_srcpad == pad => { gst::debug!( CAT, - imp: self, + imp = self, "Called probe on pad {} for pad {} (fallback: {})", pad.name(), branch.source_srcpad.name(), @@ -2124,7 +2124,7 @@ impl FallbackSrc { } if fallback_source && &branch.queue_srcpad == pad => { gst::debug!( CAT, - imp: self, + imp = self, "Called probe on pad {} for pad {} (fallback: {})", pad.name(), branch.source_srcpad.name(), @@ -2144,7 +2144,7 @@ impl FallbackSrc { } if !fallback_source && &branch.queue_srcpad == pad => { gst::debug!( CAT, - imp: self, + imp = self, "Called probe on pad {} for pad {} (fallback: {})", pad.name(), branch.source_srcpad.name(), @@ -2164,7 +2164,7 @@ impl FallbackSrc { } if fallback_source && &branch.queue_srcpad == pad => { gst::debug!( CAT, - imp: self, + imp = self, "Called probe on pad {} for pad {} (fallback: {})", pad.name(), branch.source_srcpad.name(), @@ -2181,7 +2181,7 @@ impl FallbackSrc { if let Some(block) = branch.source_srcpad_block.take() { gst::debug!( CAT, - imp: self, + imp = self, "Removing pad probe on pad {} for pad {} (fallback: {})", pad.name(), branch.source_srcpad.name(), @@ -2191,7 +2191,7 @@ impl FallbackSrc { block.pad.remove_probe(block.qos_probe_id); } - gst::debug!(CAT, imp: self, "Live source, unblocking directly"); + gst::debug!(CAT, imp = self, "Live source, unblocking directly"); drop(state_guard); self.obj().notify("status"); @@ -2208,13 +2208,13 @@ impl FallbackSrc { let segment = match pad.sticky_event::(0) { Some(ev) => ev.segment().clone(), None => { - gst::warning!(CAT, imp: self, "Have no segment event yet"); + gst::warning!(CAT, imp = self, "Have no segment event yet"); return Ok(()); } }; let segment = segment.downcast::().map_err(|_| { - gst::error!(CAT, imp: self, "Have no time segment"); + gst::error!(CAT, imp = self, "Have no time segment"); gst::error_msg!(gst::CoreError::Clock, ["Have no time segment"]) })?; @@ -2231,7 +2231,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Have block running time {}", running_time.display(), ); @@ -2250,13 +2250,13 @@ impl FallbackSrc { let current_running_time = match self.obj().current_running_time() { Some(current_running_time) => current_running_time, None => { - gst::debug!(CAT, imp: self, "Waiting for current_running_time"); + gst::debug!(CAT, imp = self, "Waiting for current_running_time"); return; } }; if !fallback_source && state.manually_blocked { - gst::debug!(CAT, imp: self, "Not unblocking yet: manual unblock",); + gst::debug!(CAT, imp = self, "Not unblocking yet: manual unblock",); return; } @@ -2267,7 +2267,7 @@ impl FallbackSrc { { gst::debug!( CAT, - imp: self, + imp = self, "Not unblocking yet: buffering {}%", state.stats.buffering_percent ); @@ -2287,7 +2287,7 @@ impl FallbackSrc { let streams = match source.streams { None => { - gst::debug!(CAT, imp: self, "Have no stream collection yet"); + gst::debug!(CAT, imp = self, "Have no stream collection yet"); return; } Some(ref streams) => streams, @@ -2359,13 +2359,13 @@ impl FallbackSrc { && video_running_time.is_none() && !video_is_eos { - gst::debug!(CAT, imp: self, "Waiting for audio and video pads to block"); + gst::debug!(CAT, imp = self, "Waiting for audio and video pads to block"); return; } else if audio_running_time.is_none() && !audio_is_eos { - gst::debug!(CAT, imp: self, "Waiting for audio pad to block"); + gst::debug!(CAT, imp = self, "Waiting for audio pad to block"); return; } else if video_running_time.is_none() && !video_is_eos { - gst::debug!(CAT, imp: self, "Waiting for video pad to block"); + gst::debug!(CAT, imp = self, "Waiting for video pad to block"); return; } @@ -2388,7 +2388,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Unblocking at {} with pad offset {} (audio: {} eos {}, video {} eos {})", current_running_time, offset, @@ -2423,7 +2423,7 @@ impl FallbackSrc { let audio_running_time = match audio_running_time { Some(audio_running_time) => audio_running_time, None => { - gst::debug!(CAT, imp: self, "Waiting for audio pad to block"); + gst::debug!(CAT, imp = self, "Waiting for audio pad to block"); return; } }; @@ -2436,7 +2436,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Unblocking at {} with pad offset {} (audio: {} eos {})", current_running_time, offset, @@ -2458,7 +2458,7 @@ impl FallbackSrc { let video_running_time = match video_running_time { Some(video_running_time) => video_running_time, None => { - gst::debug!(CAT, imp: self, "Waiting for video pad to block"); + gst::debug!(CAT, imp = self, "Waiting for video pad to block"); return; } }; @@ -2471,7 +2471,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Unblocking at {} with pad offset {} (video: {} eos {})", current_running_time, offset, @@ -2495,7 +2495,7 @@ impl FallbackSrc { fn handle_source_pad_removed(&self, pad: &gst::Pad, fallback_source: bool) { gst::debug!( CAT, - imp: self, + imp = self, "Pad {} removed from {}source", pad.name(), if fallback_source { "fallback " } else { "" } @@ -2631,13 +2631,13 @@ impl FallbackSrc { }; if source.pending_restart { - gst::debug!(CAT, imp: self, "Has pending restart"); + gst::debug!(CAT, imp = self, "Has pending restart"); return; } gst::debug!( CAT, - imp: self, + imp = self, "Got buffering {}% (fallback: {})", m.percent(), fallback_source @@ -2718,7 +2718,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Got stream collection {:?} (fallback: {})", streams.debug(), fallback_source, @@ -2732,11 +2732,19 @@ impl FallbackSrc { } if !have_audio && state.settings.enable_audio { - gst::warning!(CAT, imp: self, "Have no audio streams but audio is enabled"); + gst::warning!( + CAT, + imp = self, + "Have no audio streams but audio is enabled" + ); } if !have_video && state.settings.enable_video { - gst::warning!(CAT, imp: self, "Have no video streams but video is enabled"); + gst::warning!( + CAT, + imp = self, + "Have no video streams but video is enabled" + ); } if fallback_source { @@ -2791,7 +2799,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: self, + imp = self, "Got error message from {}", src.path_string() ); @@ -2817,7 +2825,7 @@ impl FallbackSrc { gst::error!( CAT, - imp: self, + imp = self, "Give up for error message from {}", src.path_string() ); @@ -2828,7 +2836,7 @@ impl FallbackSrc { fn handle_source_error(&self, state: &mut State, reason: RetryReason, fallback_source: bool) { gst::debug!( CAT, - imp: self, + imp = self, "Handling source error (fallback: {}): {:?}", fallback_source, reason @@ -2849,7 +2857,7 @@ impl FallbackSrc { if source.pending_restart { gst::debug!( CAT, - imp: self, + imp = self, "{}source is already pending restart", if fallback_source { "fallback " } else { "" } ); @@ -2904,7 +2912,7 @@ impl FallbackSrc { None => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -2920,7 +2928,7 @@ impl FallbackSrc { }) if !fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -2936,7 +2944,7 @@ impl FallbackSrc { }) if fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -2964,7 +2972,7 @@ impl FallbackSrc { { gst::debug!( CAT, - imp: imp, + imp = imp, "Removing pad probe for pad {}", source_srcpad.name() ); @@ -2985,7 +2993,7 @@ impl FallbackSrc { .collect::>(); drop(state_guard); - gst::debug!(CAT, imp: imp, "Flushing source"); + gst::debug!(CAT, imp = imp, "Flushing source"); for pad in switch_sinkpads { let _ = pad.push_event(gst::event::FlushStart::builder().build()); if let Some(switch) = pad.parent().map(|p| p.downcast::().unwrap()) { @@ -2995,7 +3003,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: imp, + imp = imp, "Shutting down {}source", if fallback_source { "fallback " } else { "" } ); @@ -3008,7 +3016,7 @@ impl FallbackSrc { None => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3024,7 +3032,7 @@ impl FallbackSrc { }) if !fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3040,7 +3048,7 @@ impl FallbackSrc { }) if fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3063,7 +3071,7 @@ impl FallbackSrc { branch.source_srcpad_block = None; } - gst::debug!(CAT, imp: imp, "Waiting for 1s before retrying"); + gst::debug!(CAT, imp = imp, "Waiting for 1s before retrying"); let clock = gst::SystemClock::obtain(); let wait_time = clock.time().unwrap() + gst::ClockTime::SECOND; if fallback_source { @@ -3084,7 +3092,7 @@ impl FallbackSrc { return; }; - gst::debug!(CAT, obj: element, "Woke up, retrying"); + gst::debug!(CAT, obj = element, "Woke up, retrying"); element.call_async(move |element| { let imp = element.imp(); @@ -3093,7 +3101,7 @@ impl FallbackSrc { None => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3109,7 +3117,7 @@ impl FallbackSrc { }) if !fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3125,7 +3133,7 @@ impl FallbackSrc { }) if fallback_source => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3156,7 +3164,7 @@ impl FallbackSrc { state.last_buffering_update = None; if let Some(timeout) = state.source.restart_timeout.take() { - gst::debug!(CAT, imp: imp, "Unscheduling restart timeout"); + gst::debug!(CAT, imp = imp, "Unscheduling restart timeout"); timeout.unschedule(); } @@ -3169,7 +3177,7 @@ impl FallbackSrc { state.fallback_last_buffering_update = None; if let Some(timeout) = source.restart_timeout.take() { - gst::debug!(CAT, imp: imp, "Unscheduling restart timeout"); + gst::debug!(CAT, imp = imp, "Unscheduling restart timeout"); timeout.unschedule(); } @@ -3189,7 +3197,7 @@ impl FallbackSrc { if source.sync_state_with_parent().is_err() { gst::error!( CAT, - imp: imp, + imp = imp, "{}source failed to change state", if fallback_source { "fallback " } else { "" } ); @@ -3247,7 +3255,7 @@ impl FallbackSrc { if fallback_source { gst::fixme!( CAT, - imp: self, + imp = self, "Restart timeout not implemented for fallback source" ); return; @@ -3266,7 +3274,7 @@ impl FallbackSrc { if source.pending_restart { gst::debug!( CAT, - imp: self, + imp = self, "Not scheduling {}source restart timeout because source is pending restart already", if fallback_source { "fallback " } else { "" }, ); @@ -3276,7 +3284,7 @@ impl FallbackSrc { if source.is_image { gst::debug!( CAT, - imp: self, + imp = self, "Not scheduling {}source restart timeout because we are playing back an image", if fallback_source { "fallback " } else { "" }, ); @@ -3286,7 +3294,7 @@ impl FallbackSrc { if !fallback_source && state.manually_blocked { gst::debug!( CAT, - imp: self, + imp = self, "Not scheduling source restart timeout because we are manually blocked", ); return; @@ -3296,7 +3304,7 @@ impl FallbackSrc { let wait_time = clock.time().unwrap() + state.settings.restart_timeout - elapsed; gst::debug!( CAT, - imp: self, + imp = self, "Scheduling {}source restart timeout for {}", if fallback_source { "fallback " } else { "" }, wait_time, @@ -3315,7 +3323,7 @@ impl FallbackSrc { gst::debug!( CAT, - imp: imp, + imp = imp, "{}source restart timeout triggered", if fallback_source { "fallback " } else { "" } ); @@ -3324,7 +3332,7 @@ impl FallbackSrc { None => { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3362,7 +3370,7 @@ impl FallbackSrc { { gst::debug!( CAT, - imp: imp, + imp = imp, "Not buffering, restarting {}source", if fallback_source { "fallback " } else { "" } ); @@ -3373,7 +3381,7 @@ impl FallbackSrc { } else { gst::debug!( CAT, - imp: imp, + imp = imp, "Buffering, restarting {}source later", if fallback_source { "fallback " } else { "" } ); @@ -3388,7 +3396,7 @@ impl FallbackSrc { } else { gst::debug!( CAT, - imp: imp, + imp = imp, "Restarting {}source not needed anymore", if fallback_source { "fallback " } else { "" } ); @@ -3446,7 +3454,7 @@ impl FallbackSrc { if self.have_fallback_activated(state) { gst::warning!( CAT, - imp: self, + imp = self, "Switched to {} fallback stream", if is_audio { "audio" } else { "video " } ); @@ -3456,17 +3464,17 @@ impl FallbackSrc { } else { gst::debug!( CAT, - imp: self, + imp = self, "Switched to {} main stream", if is_audio { "audio" } else { "video" } ); if let Some(timeout) = state.source.retry_timeout.take() { - gst::debug!(CAT, imp: self, "Unscheduling retry timeout"); + gst::debug!(CAT, imp = self, "Unscheduling retry timeout"); timeout.unschedule(); } if let Some(timeout) = state.source.restart_timeout.take() { - gst::debug!(CAT, imp: self, "Unscheduling restart timeout"); + gst::debug!(CAT, imp = self, "Unscheduling restart timeout"); timeout.unschedule(); } } diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index b13eafb0..73f7c521 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -350,7 +350,7 @@ impl SinkState { if wait_until < now { debug!( CAT, - obj: pad, + obj = pad, "Skipping buffer wait until {} - clock already {}", wait_until, now @@ -360,7 +360,7 @@ impl SinkState { debug!( CAT, - obj: pad, + obj = pad, "Scheduling buffer wait until {} = {} + extra {} + base time {}", wait_until, running_time, @@ -394,7 +394,7 @@ impl SinkState { let timeout_running_time = pad_running_time.saturating_add(settings.timeout); log!( CAT, - obj: pad, + obj = pad, "pad_running_time {} timeout_running_time {} now_running_time {}", pad_running_time, timeout_running_time, @@ -408,7 +408,7 @@ impl SinkState { let timeout_running_time = pad_running_time.saturating_add(settings.timeout); log!( CAT, - obj: pad, + obj = pad, "pad_running_time {} timeout_running_time {} now_running_time {}", pad_running_time, timeout_running_time, @@ -454,13 +454,13 @@ impl FallbackSwitch { pad_state.cancel_wait(); drop(pad_state); - debug!(CAT, obj: pad, "Now active pad"); + debug!(CAT, obj = pad, "Now active pad"); } fn handle_timeout(&self, state: &mut State, settings: &Settings) { debug!( CAT, - imp: self, + imp = self, "timeout fired - looking for a pad to switch to" ); @@ -504,7 +504,7 @@ impl FallbackSwitch { if let Some(best_pad) = best_pad { debug!( CAT, - imp: self, + imp = self, "Found viable pad to switch to: {:?}", best_pad ); @@ -520,7 +520,7 @@ impl FallbackSwitch { if state.timeout_clock_id.as_ref() != Some(clock_id) { /* Timeout fired late, ignore it. */ - debug!(CAT, imp: self, "Late timeout callback. Ignoring"); + debug!(CAT, imp = self, "Late timeout callback. Ignoring"); return; } @@ -574,7 +574,7 @@ impl FallbackSwitch { return true; } - debug!(CAT, imp: self, "Scheduling timeout for {}", wait_until); + debug!(CAT, imp = self, "Scheduling timeout for {}", wait_until); let timeout_id = clock.new_single_shot_id(wait_until); state.timeout_clock_id = Some(timeout_id.clone().into()); @@ -615,7 +615,7 @@ impl FallbackSwitch { drop(pad_state); if health_changed { - log!(CAT, obj: pad, "Health changed to {}", is_healthy); + log!(CAT, obj = pad, "Health changed to {}", is_healthy); changed.push(pad.clone()); } } @@ -658,7 +658,7 @@ impl FallbackSwitch { let pad_imp = pad.imp(); if settings.stop_on_eos && self.has_sink_pad_eos() { - debug!(CAT, obj: pad, "return eos as stop-on-eos is enabled"); + debug!(CAT, obj = pad, "return eos as stop-on-eos is enabled"); return Err(gst::FlowError::Eos); } @@ -666,7 +666,7 @@ impl FallbackSwitch { let pad_state = pad_imp.state.lock(); trace!( CAT, - obj: pad, + obj = pad, "Clipping {:?} against segment {:?}", buffer, pad_state.segment, @@ -676,7 +676,7 @@ impl FallbackSwitch { None => { log!( CAT, - obj: pad, + obj = pad, "Dropping raw buffer completely out of segment", ); @@ -747,7 +747,7 @@ impl FallbackSwitch { let (mut state, mut pad_state) = if health_changed { drop(pad_state); drop(state); - log!(CAT, obj: pad, "Health changed to {}", is_healthy); + log!(CAT, obj = pad, "Health changed to {}", is_healthy); pad.notify(PROP_IS_HEALTHY); if !settings.auto_switch { @@ -763,7 +763,7 @@ impl FallbackSwitch { log!( CAT, - obj: pad, + obj = pad, "Handling {:?} run ts start {} end {} pad active {}", buffer, start_running_time.display(), @@ -787,7 +787,7 @@ impl FallbackSwitch { if raw_pad { log!( CAT, - obj: pad, + obj = pad, "Dropping trailing raw {:?} before timeout {}", buffer, state.timeout_running_time.unwrap() @@ -796,7 +796,7 @@ impl FallbackSwitch { } else { log!( CAT, - obj: pad, + obj = pad, "Not dropping trailing non-raw {:?} before timeout {}", buffer, state.timeout_running_time.unwrap() @@ -837,7 +837,7 @@ impl FallbackSwitch { let pad_state = pad_imp.state.lock(); if pad_state.flushing { - debug!(CAT, imp: self, "Flushing"); + debug!(CAT, imp = self, "Flushing"); return Err(gst::FlowError::Flushing); } // calling schedule_timeout() may result in handle_timeout() being called right away, @@ -852,7 +852,7 @@ impl FallbackSwitch { if raw_pad { log!( CAT, - obj: pad, + obj = pad, "Dropping trailing raw {:?} before output running time {}", buffer, state.output_running_time.display(), @@ -861,7 +861,7 @@ impl FallbackSwitch { } else { log!( CAT, - obj: pad, + obj = pad, "Not dropping trailing non-raw {:?} before output running time {}", buffer, state.output_running_time.display(), @@ -896,7 +896,7 @@ impl FallbackSwitch { let is_healthy = pad_state.is_healthy(pad, &state, &settings, state.output_running_time); let health_changed = is_healthy != pad_state.is_healthy; if health_changed { - log!(CAT, obj: pad, "Health changed to {}", is_healthy); + log!(CAT, obj = pad, "Health changed to {}", is_healthy); } pad_state.is_healthy = is_healthy; drop(pad_state); @@ -917,7 +917,7 @@ impl FallbackSwitch { }; if !is_active { - log!(CAT, obj: pad, "Dropping {:?} on inactive pad", buffer); + log!(CAT, obj = pad, "Dropping {:?} on inactive pad", buffer); drop(state); if health_changed { @@ -932,7 +932,7 @@ impl FallbackSwitch { is_active = self.active_sinkpad.lock().as_ref() == Some(pad); if !is_active { - log!(CAT, obj: pad, "Dropping {:?} on inactive pad", buffer); + log!(CAT, obj = pad, "Dropping {:?} on inactive pad", buffer); drop(state); if health_changed { @@ -976,7 +976,7 @@ impl FallbackSwitch { /* TODO: Clip raw video and audio buffers to avoid going backward? */ - log!(CAT, obj: pad, "Forwarding {:?}", buffer); + log!(CAT, obj = pad, "Forwarding {:?}", buffer); if let Some(in_gap_event) = from_gap { // Safe unwrap: the buffer was constructed from a gap event with @@ -1017,7 +1017,7 @@ impl FallbackSwitch { pad: &super::FallbackSwitchSinkPad, list: gst::BufferList, ) -> Result { - log!(CAT, obj: pad, "Handling buffer list {:?}", list); + log!(CAT, obj = pad, "Handling buffer list {:?}", list); // TODO: Keep the list intact and forward it in one go (or broken into several // pieces if needed) when outputting to the active pad for buffer in list.iter_owned() { @@ -1028,7 +1028,7 @@ impl FallbackSwitch { } fn sink_event(&self, pad: &super::FallbackSwitchSinkPad, event: gst::Event) -> bool { - log!(CAT, obj: pad, "Handling event {:?}", event); + log!(CAT, obj = pad, "Handling event {:?}", event); if let gst::EventView::Gap(ev) = event.view() { let mut buffer = gst::Buffer::new(); @@ -1045,7 +1045,7 @@ impl FallbackSwitch { Ok(_) => true, Err(gst::FlowError::Flushing) | Err(gst::FlowError::Eos) => true, Err(err) => { - gst::error!(CAT, obj: pad, "Error processing gap event: {}", err); + gst::error!(CAT, obj = pad, "Error processing gap event: {}", err); false } }; @@ -1058,7 +1058,7 @@ impl FallbackSwitch { match event.view() { gst::EventView::Caps(caps) => { let caps = caps.caps(); - debug!(CAT, obj: pad, "Received caps {}", caps); + debug!(CAT, obj = pad, "Received caps {}", caps); let caps_info = match caps.structure(0).unwrap().name().as_str() { "audio/x-raw" => { @@ -1107,7 +1107,7 @@ impl FallbackSwitch { let mut is_active = self.active_sinkpad.lock().as_ref() == Some(pad); if !is_active { - log!(CAT, obj: pad, "Dropping {:?} on inactive pad", event); + log!(CAT, obj = pad, "Dropping {:?} on inactive pad", event); return true; } @@ -1118,7 +1118,7 @@ impl FallbackSwitch { is_active = self.active_sinkpad.lock().as_ref() == Some(pad); if !is_active { - log!(CAT, obj: pad, "Dropping {:?} on inactive pad", event); + log!(CAT, obj = pad, "Dropping {:?} on inactive pad", event); return true; } @@ -1148,7 +1148,7 @@ impl FallbackSwitch { fn sink_query(&self, pad: &super::FallbackSwitchSinkPad, query: &mut gst::QueryRef) -> bool { use gst::QueryView; - log!(CAT, obj: pad, "Handling query {:?}", query); + log!(CAT, obj = pad, "Handling query {:?}", query); let forward = match query.view() { QueryView::Context(_) => true, @@ -1168,7 +1168,7 @@ impl FallbackSwitch { }; if forward { - log!(CAT, obj: pad, "Forwarding query {:?}", query); + log!(CAT, obj = pad, "Forwarding query {:?}", query); self.src_pad.peer_query(query) } else { false @@ -1184,7 +1184,7 @@ impl FallbackSwitch { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - log!(CAT, obj: pad, "Handling {:?}", query); + log!(CAT, obj = pad, "Handling {:?}", query); match query.view_mut() { QueryViewMut::Latency(ref mut q) => { @@ -1213,7 +1213,7 @@ impl FallbackSwitch { let mut state = self.state.lock(); min_latency = min_latency.max(settings.min_upstream_latency); state.upstream_latency = min_latency; - log!(CAT, obj: pad, "Upstream latency {}", min_latency); + log!(CAT, obj = pad, "Upstream latency {}", min_latency); q.set(true, min_latency + settings.latency, max_latency); @@ -1378,7 +1378,7 @@ impl ObjectImpl for FallbackSwitch { if settings.auto_switch { gst::warning!( CAT, - imp: self, + imp = self, "active-pad property setting ignored, because auto-switch=true" ); } else { @@ -1402,7 +1402,7 @@ impl ObjectImpl for FallbackSwitch { let new_value = value.get().expect("type checked upstream"); settings.timeout = new_value; - debug!(CAT, imp: self, "Timeout now {}", settings.timeout); + debug!(CAT, imp = self, "Timeout now {}", settings.timeout); drop(settings); let _ = self .obj() @@ -1534,7 +1534,7 @@ impl ElementImpl for FallbackSwitch { &self, transition: gst::StateChange, ) -> Result { - trace!(CAT, imp: self, "Changing state {:?}", transition); + trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::PlayingToPaused => { diff --git a/utils/livesync/src/livesync/imp.rs b/utils/livesync/src/livesync/imp.rs index 106a8035..0eb1d1e4 100644 --- a/utils/livesync/src/livesync/imp.rs +++ b/utils/livesync/src/livesync/imp.rs @@ -448,7 +448,7 @@ impl ElementImpl for LiveSync { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if transition == gst::StateChange::PausedToPlaying { let mut state = self.state.lock(); @@ -639,7 +639,7 @@ impl LiveSync { self.set_flushing(&mut self.state.lock()); if let Err(e) = self.srcpad.pause_task() { - gst::error!(CAT, imp: self, "Failed to pause task: {e}"); + gst::error!(CAT, imp = self, "Failed to pause task: {e}"); return false; } @@ -654,7 +654,7 @@ impl LiveSync { self.src_reset(&mut state); if let Err(e) = self.start_src_task(&mut state) { - gst::error!(CAT, imp: self, "Failed to start task: {e}"); + gst::error!(CAT, imp = self, "Failed to start task: {e}"); return false; } @@ -667,7 +667,7 @@ impl LiveSync { is_restart = true; let Some(segment) = e.segment().downcast_ref() else { - gst::error!(CAT, imp: self, "Got non-TIME segment"); + gst::error!(CAT, imp = self, "Got non-TIME segment"); return false; }; @@ -683,7 +683,7 @@ impl LiveSync { let audio_info = match audio_info_from_caps(&caps) { Ok(ai) => ai, Err(e) => { - gst::error!(CAT, imp: self, "Failed to parse audio caps: {}", e); + gst::error!(CAT, imp = self, "Failed to parse audio caps: {}", e); return false; } }; @@ -697,7 +697,7 @@ impl LiveSync { } gst::EventView::Gap(_) => { - gst::debug!(CAT, imp: self, "Got gap event"); + gst::debug!(CAT, imp = self, "Got gap event"); return true; } @@ -715,14 +715,14 @@ impl LiveSync { if state.srcresult == Err(gst::FlowError::Eos) { if let Err(e) = self.start_src_task(&mut state) { - gst::error!(CAT, imp: self, "Failed to start task: {e}"); + gst::error!(CAT, imp = self, "Failed to start task: {e}"); return false; } } } if state.eos { - gst::trace!(CAT, imp: self, "Refusing event, we are EOS: {:?}", event); + gst::trace!(CAT, imp = self, "Refusing event, we are EOS: {:?}", event); return false; } @@ -741,7 +741,7 @@ impl LiveSync { return false; } - gst::trace!(CAT, imp: self, "Queueing {:?}", event); + gst::trace!(CAT, imp = self, "Queueing {:?}", event); state.queue.push_back(Item::Event(event)); self.cond.notify_all(); @@ -764,7 +764,7 @@ impl LiveSync { let mut state = self.state.lock(); if state.srcresult == Err(gst::FlowError::NotLinked) { if let Err(e) = self.start_src_task(&mut state) { - gst::error!(CAT, imp: self, "Failed to start task: {e}"); + gst::error!(CAT, imp = self, "Failed to start task: {e}"); } } } @@ -785,7 +785,7 @@ impl LiveSync { return false; } - gst::trace!(CAT, imp: self, "Queueing {:?}", query); + gst::trace!(CAT, imp = self, "Queueing {:?}", query); state .queue .push_back(Item::Query(std::ptr::NonNull::from(query), sender)); @@ -830,24 +830,24 @@ impl LiveSync { _pad: &gst::Pad, mut buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, imp: self, "Incoming {:?}", buffer); + gst::trace!(CAT, imp = self, "Incoming {:?}", buffer); let mut state = self.state.lock(); if state.eos { - gst::debug!(CAT, imp: self, "Refusing buffer, we are EOS"); + gst::debug!(CAT, imp = self, "Refusing buffer, we are EOS"); return Err(gst::FlowError::Eos); } if state.upstream_latency.is_none() { - gst::debug!(CAT, imp: self, "Have no upstream latency yet, querying"); + gst::debug!(CAT, imp = self, "Have no upstream latency yet, querying"); let mut q = gst::query::Latency::new(); if MutexGuard::unlocked(&mut state, || self.sinkpad.peer_query(&mut q)) { let (live, min, max) = q.result(); gst::debug!( CAT, - imp: self, + imp = self, "Latency query response: live {} min {} max {}", live, min, @@ -858,7 +858,7 @@ impl LiveSync { } else { gst::warning!( CAT, - imp: self, + imp = self, "Can't query upstream latency -- assuming zero" ); state.upstream_latency = Some(gst::ClockTime::ZERO); @@ -873,7 +873,7 @@ impl LiveSync { let buf_mut = buffer.make_mut(); if buf_mut.pts().is_none() { - gst::warning!(CAT, imp: self, "Incoming buffer has no timestamps"); + gst::warning!(CAT, imp = self, "Incoming buffer has no timestamps"); } if let Some(audio_info) = &state.in_audio_info { @@ -883,7 +883,7 @@ impl LiveSync { else { gst::error!( CAT, - imp: self, + imp = self, "Failed to calculate duration of {:?}", buf_mut, ); @@ -904,14 +904,18 @@ impl LiveSync { if diff > sample_duration { gst::warning!( CAT, - imp: self, + imp = self, "Correcting duration on audio buffer from {} to {}", buf_duration, calc_duration, ); } } else { - gst::debug!(CAT, imp: self, "Patching incoming buffer with duration {calc_duration}"); + gst::debug!( + CAT, + imp = self, + "Patching incoming buffer with duration {calc_duration}" + ); } buf_mut.set_duration(calc_duration); @@ -920,13 +924,17 @@ impl LiveSync { dur.clamp(MINIMUM_DURATION, MAXIMUM_DURATION) }); - gst::debug!(CAT, imp: self, "Patching incoming buffer with duration {duration}"); + gst::debug!( + CAT, + imp = self, + "Patching incoming buffer with duration {duration}" + ); buf_mut.set_duration(duration); } // At this stage we should really really have a segment let segment = state.in_segment.as_ref().ok_or_else(|| { - gst::error!(CAT, imp: self, "Missing segment"); + gst::error!(CAT, imp = self, "Missing segment"); gst::FlowError::Error })?; @@ -953,12 +961,12 @@ impl LiveSync { let lateness = self.buffer_is_backwards(&state, timestamp); if lateness == BufferLateness::LateUnderThreshold { - gst::debug!(CAT, imp: self, "Discarding late {:?}", buf_mut); + gst::debug!(CAT, imp = self, "Discarding late {:?}", buf_mut); state.num_drop += 1; return Ok(gst::FlowSuccess::Ok); } - gst::trace!(CAT, imp: self, "Queueing {:?} ({:?})", buffer, lateness); + gst::trace!(CAT, imp = self, "Queueing {:?} ({:?})", buffer, lateness); state .queue .push_back(Item::Buffer(buffer, timestamp, lateness)); @@ -1018,7 +1026,7 @@ impl LiveSync { self.srcpad.push_event(gst::event::Eos::new()); } - gst::log!(CAT, imp: self, "Loop stopping"); + gst::log!(CAT, imp = self, "Loop stopping"); let _ = self.srcpad.pause_task(); } @@ -1042,12 +1050,12 @@ impl LiveSync { let element = self.obj(); let base_time = element.base_time().ok_or_else(|| { - gst::error!(CAT, imp: self, "Missing base time"); + gst::error!(CAT, imp = self, "Missing base time"); gst::FlowError::Flushing })?; let clock = element.clock().ok_or_else(|| { - gst::error!(CAT, imp: self, "Missing clock"); + gst::error!(CAT, imp = self, "Missing clock"); gst::FlowError::Flushing })?; @@ -1056,22 +1064,26 @@ impl LiveSync { gst::trace!( CAT, - imp: self, + imp = self, "Waiting for clock to reach {}", clock_id.time(), ); let (res, jitter) = MutexGuard::unlocked(&mut state, || clock_id.wait()); - gst::trace!(CAT, imp: self, "Clock returned {res:?} {}{}", - if jitter.is_negative() {"-"} else {""}, - gst::ClockTime::from_nseconds(jitter.unsigned_abs())); + gst::trace!( + CAT, + imp = self, + "Clock returned {res:?} {}{}", + if jitter.is_negative() { "-" } else { "" }, + gst::ClockTime::from_nseconds(jitter.unsigned_abs()) + ); state.clock_id = None; state.srcresult?; } let in_item = state.queue.pop_front(); - gst::trace!(CAT, imp: self, "Unqueueing {:?}", in_item); + gst::trace!(CAT, imp = self, "Unqueueing {:?}", in_item); let in_buffer = match in_item { None => None, @@ -1104,7 +1116,7 @@ impl LiveSync { match event.view() { gst::EventView::Segment(e) => { let segment = e.segment().downcast_ref().unwrap(); - gst::debug!(CAT, imp: self, "pending {segment:?}"); + gst::debug!(CAT, imp = self, "pending {segment:?}"); state.pending_segment = Some(segment.clone()); push = false; } @@ -1169,7 +1181,7 @@ impl LiveSync { Some((buffer, _timestamp, BufferLateness::LateOverThreshold)) if !state.pending_events() => { - gst::debug!(CAT, imp: self, "Accepting late {:?}", buffer); + gst::debug!(CAT, imp = self, "Accepting late {:?}", buffer); state.num_in += 1; self.patch_output_buffer(&mut state, Some(buffer))?; @@ -1177,7 +1189,7 @@ impl LiveSync { Some((buffer, _timestamp, BufferLateness::LateOverThreshold)) => { // Cannot accept late-over-threshold buffers while we have pending events - gst::debug!(CAT, imp: self, "Discarding late {:?}", buffer); + gst::debug!(CAT, imp = self, "Discarding late {:?}", buffer); state.num_drop += 1; self.patch_output_buffer(&mut state, None)?; @@ -1199,7 +1211,7 @@ impl LiveSync { .map_or(gst::ClockTime::ZERO, |t| t.start); if let Some(caps) = caps { - gst::debug!(CAT, imp: self, "Sending new caps: {}", caps); + gst::debug!(CAT, imp = self, "Sending new caps: {}", caps); let event = gst::event::Caps::new(&caps); MutexGuard::unlocked(&mut state, || self.srcpad.push_event(event)); @@ -1212,11 +1224,16 @@ impl LiveSync { if let Some(mut segment) = segment { if !state.single_segment { if let Some(stop) = segment.stop() { - gst::debug!(CAT, imp: self, "Removing stop {} from outgoing segment", stop); + gst::debug!( + CAT, + imp = self, + "Removing stop {} from outgoing segment", + stop + ); segment.set_stop(gst::ClockTime::NONE); } - gst::debug!(CAT, imp: self, "Forwarding segment: {:?}", segment); + gst::debug!(CAT, imp = self, "Forwarding segment: {:?}", segment); let event = gst::event::Segment::new(&segment); MutexGuard::unlocked(&mut state, || self.srcpad.push_event(event)); @@ -1229,7 +1246,7 @@ impl LiveSync { live_segment.set_time(sync_ts); live_segment.set_position(sync_ts + SEGMENT_OFFSET); - gst::debug!(CAT, imp: self, "Sending new segment: {:?}", live_segment); + gst::debug!(CAT, imp = self, "Sending new segment: {:?}", live_segment); let event = gst::event::Segment::new(&live_segment); MutexGuard::unlocked(&mut state, || self.srcpad.push_event(event)); @@ -1243,7 +1260,7 @@ impl LiveSync { drop(state); - gst::trace!(CAT, imp: self, "Pushing {buffer:?}"); + gst::trace!(CAT, imp = self, "Pushing {buffer:?}"); self.srcpad.push(buffer) } @@ -1262,7 +1279,7 @@ impl LiveSync { gst::debug!( CAT, - imp: self, + imp = self, "Timestamp regresses: buffer ends at {}, expected {}", timestamp.end, out_timestamp.end, @@ -1313,7 +1330,7 @@ impl LiveSync { gst::debug!( CAT, - imp: self, + imp = self, "Timestamp is too early: buffer starts at {}, expected {}", timestamp.start, out_timestamp.end, @@ -1351,11 +1368,17 @@ impl LiveSync { let pts = out_buffer.pts().map(|t| t + duration); if let Some(source) = source { - gst::debug!(CAT, imp: self, "Repeating {:?} using {:?}", out_buffer, source); + gst::debug!( + CAT, + imp = self, + "Repeating {:?} using {:?}", + out_buffer, + source + ); *out_buffer = source; duplicate = false; } else { - gst::debug!(CAT, imp: self, "Repeating {:?}", out_buffer); + gst::debug!(CAT, imp = self, "Repeating {:?}", out_buffer); } let buffer = out_buffer.make_mut(); @@ -1378,7 +1401,7 @@ impl LiveSync { .flatten() .and_then(|bytes| usize::try_from(bytes).ok()) else { - gst::error!(CAT, imp: self, "Failed to calculate size of repeat buffer"); + gst::error!(CAT, imp = self, "Failed to calculate size of repeat buffer"); return Err(gst::FlowError::Error); }; @@ -1386,12 +1409,16 @@ impl LiveSync { } buffer.set_duration(duration); - gst::debug!(CAT, imp: self, "Patched output buffer duration to {duration}"); + gst::debug!( + CAT, + imp = self, + "Patched output buffer duration to {duration}" + ); } if let Some(audio_info) = &state.out_audio_info { let mut map_info = buffer.map_writable().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to map buffer: {}", e); + gst::error!(CAT, imp = self, "Failed to map buffer: {}", e); gst::FlowError::Error })?; audio_info diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs index d9a1394a..fd4fa7c1 100644 --- a/utils/togglerecord/src/togglerecord/imp.rs +++ b/utils/togglerecord/src/togglerecord/imp.rs @@ -364,12 +364,12 @@ impl ToggleRecord { } drop(rec_state); while !settings.record && !state.flushing { - gst::debug!(CAT, obj: pad, "Waiting for record=true"); + gst::debug!(CAT, obj = pad, "Waiting for record=true"); self.main_stream_cond.wait(state); settings = *self.settings.lock(); } if state.flushing { - gst::debug!(CAT, obj: pad, "Flushing"); + gst::debug!(CAT, obj = pad, "Flushing"); return Err(gst::FlowError::Flushing); } state.segment_pending = true; @@ -392,15 +392,15 @@ impl ToggleRecord { // How did we even get here? gst::warning!( CAT, - obj: pad, + obj = pad, "Have no clock and no current running time. Will not offset buffers" ); } drop(rec_state); - gst::log!(CAT, obj: pad, "Done blocking main stream"); + gst::log!(CAT, obj = pad, "Done blocking main stream"); Ok(true) } else { - gst::log!(CAT, obj: pad, "Dropping buffer (stopped)"); + gst::log!(CAT, obj = pad, "Dropping buffer (stopped)"); Ok(false) } } @@ -417,7 +417,7 @@ impl ToggleRecord { let data = match data.clip(&state, &state.in_segment) { Some(data) => data, None => { - gst::log!(CAT, obj: pad, "Dropping raw data outside segment"); + gst::log!(CAT, obj = pad, "Dropping raw data outside segment"); return Ok(HandleResult::Drop); } }; @@ -459,7 +459,7 @@ impl ToggleRecord { gst::log!( CAT, - obj: pad, + obj = pad, "Main stream current running time {}-{} (position: {}-{})", current_running_time.display(), current_running_time_end.display(), @@ -477,12 +477,12 @@ impl ToggleRecord { RecordingState::Recording if !settings.record => { let clock = self.obj().clock().expect("Cannot find pipeline clock"); rec_state.time_start_block = Some(clock.time().unwrap()); - gst::debug!(CAT, obj: pad, "Stopping recording"); + gst::debug!(CAT, obj = pad, "Stopping recording"); rec_state.recording_state = RecordingState::Stopping; true } RecordingState::Stopped if settings.record => { - gst::debug!(CAT, obj: pad, "Starting recording"); + gst::debug!(CAT, obj = pad, "Starting recording"); rec_state.recording_state = RecordingState::Starting; true } @@ -493,19 +493,19 @@ impl ToggleRecord { RecordingState::Recording => { // Remember where we stopped last, in case of EOS rec_state.last_recording_stop = current_running_time_end; - gst::log!(CAT, obj: pad, "Passing buffer (recording)"); + gst::log!(CAT, obj = pad, "Passing buffer (recording)"); Ok(HandleResult::Pass(data)) } RecordingState::Stopping => { if !data.is_keyframe() { // Remember where we stopped last, in case of EOS rec_state.last_recording_stop = current_running_time_end; - gst::log!(CAT, obj: pad, "Passing non-keyframe buffer (stopping)"); + gst::log!(CAT, obj = pad, "Passing non-keyframe buffer (stopping)"); drop(rec_state); drop(state); if settings_changed { - gst::debug!(CAT, obj: pad, "Requesting a new keyframe"); + gst::debug!(CAT, obj = pad, "Requesting a new keyframe"); stream .sinkpad .push_event(gst_video::UpstreamForceKeyUnitEvent::builder().build()); @@ -523,7 +523,7 @@ impl ToggleRecord { .flatten(); gst::debug!( CAT, - obj: pad, + obj = pad, "Stopping at {}, started at {}, current duration {}, previous accumulated recording duration {}", rec_state.last_recording_stop.display(), rec_state.last_recording_start.display(), @@ -545,12 +545,12 @@ impl ToggleRecord { .unwrap_or(false) }) { - gst::log!(CAT, obj: pad, "Waiting for other streams to stop"); + gst::log!(CAT, obj = pad, "Waiting for other streams to stop"); self.main_stream_cond.wait(&mut state); } if state.flushing { - gst::debug!(CAT, obj: pad, "Flushing"); + gst::debug!(CAT, obj = pad, "Flushing"); return Err(gst::FlowError::Flushing); } @@ -563,7 +563,7 @@ impl ToggleRecord { gst::debug!( CAT, - obj: pad, + obj = pad, "Stopped at {}, recording duration {}", current_running_time.display(), rec_state.recording_duration.display(), @@ -598,12 +598,12 @@ impl ToggleRecord { RecordingState::Starting => { // If this is no keyframe, we can directly go out again here and drop the frame if !data.is_keyframe() { - gst::log!(CAT, obj: pad, "Dropping non-keyframe buffer (starting)"); + gst::log!(CAT, obj = pad, "Dropping non-keyframe buffer (starting)"); drop(rec_state); drop(state); if settings_changed { - gst::debug!(CAT, obj: pad, "Requesting a new keyframe"); + gst::debug!(CAT, obj = pad, "Requesting a new keyframe"); stream .sinkpad .push_event(gst_video::UpstreamForceKeyUnitEvent::builder().build()); @@ -612,7 +612,7 @@ impl ToggleRecord { if !upstream_live { gst::log!( CAT, - obj: pad, + obj = pad, "Always passing data when upstream is not live" ); return Ok(HandleResult::Pass(data)); @@ -633,7 +633,7 @@ impl ToggleRecord { }; gst::debug!( CAT, - obj: pad, + obj = pad, "Starting at {}, previous accumulated recording duration {}, offset {}", current_running_time.display(), rec_state.recording_duration, @@ -662,12 +662,12 @@ impl ToggleRecord { .unwrap_or(false) }) { - gst::log!(CAT, obj: pad, "Waiting for other streams to start"); + gst::log!(CAT, obj = pad, "Waiting for other streams to start"); self.main_stream_cond.wait(&mut state); } if state.flushing { - gst::debug!(CAT, obj: pad, "Flushing"); + gst::debug!(CAT, obj = pad, "Flushing"); return Err(gst::FlowError::Flushing); } @@ -675,13 +675,13 @@ impl ToggleRecord { rec_state.recording_state = RecordingState::Recording; gst::debug!( CAT, - obj: pad, + obj = pad, "Started at {}, recording duration {}", current_running_time.display(), rec_state.recording_duration ); - gst::log!(CAT, obj: pad, "Passing buffer (recording)"); + gst::log!(CAT, obj = pad, "Passing buffer (recording)"); drop(rec_state); drop(state); @@ -730,7 +730,7 @@ impl ToggleRecord { let data = match data.clip(&state, &state.in_segment) { None => { - gst::log!(CAT, obj: pad, "Dropping raw data outside segment"); + gst::log!(CAT, obj = pad, "Dropping raw data outside segment"); return Ok(HandleResult::Drop); } Some(data) => data, @@ -755,7 +755,7 @@ impl ToggleRecord { gst::log!( CAT, - obj: pad, + obj = pad, "Secondary stream current running time {}-{} (position: {}-{}", current_running_time.display(), current_running_time_end.display(), @@ -807,7 +807,7 @@ impl ToggleRecord { { gst::log!( CAT, - obj: pad, + obj = pad, "Waiting at {}-{} in {:?} state, main stream at {}-{}", current_running_time.display(), current_running_time_end.display(), @@ -824,7 +824,7 @@ impl ToggleRecord { } if state.flushing { - gst::debug!(CAT, obj: pad, "Flushing"); + gst::debug!(CAT, obj = pad, "Flushing"); return Err(gst::FlowError::Flushing); } @@ -833,7 +833,11 @@ impl ToggleRecord { if main_state.eos { // If we have no start or stop position (we never recorded) then we're EOS too now if rec_state.last_recording_stop.is_none() || rec_state.last_recording_start.is_none() { - gst::debug!(CAT, obj: pad, "Main stream EOS and recording never started",); + gst::debug!( + CAT, + obj = pad, + "Main stream EOS and recording never started", + ); return Ok(HandleResult::Eos(self.check_and_update_eos( pad, stream, @@ -856,7 +860,7 @@ impl ToggleRecord { // the start and we can clip, clip the buffer and pass it onwards. gst::debug!( CAT, - obj: pad, + obj = pad, "Main stream EOS and we're not EOS yet (overlapping recording start, {} < {} < {})", current_running_time.display(), last_recording_start, @@ -879,12 +883,12 @@ impl ToggleRecord { segment.set_start(clip_start); segment.set_stop(clip_stop); - gst::log!(CAT, obj: pad, "Clipping to segment {:?}", segment); + gst::log!(CAT, obj = pad, "Clipping to segment {:?}", segment); if let Some(data) = data.clip(&state, &segment) { return Ok(HandleResult::Pass(data)); } else { - gst::warning!(CAT, obj: pad, "Complete buffer clipped!"); + gst::warning!(CAT, obj = pad, "Complete buffer clipped!"); return Ok(HandleResult::Drop); } } else if current_running_time @@ -896,7 +900,7 @@ impl ToggleRecord { // recording start gst::debug!( CAT, - obj: pad, + obj = pad, "Main stream EOS and we're not EOS yet (before recording start, {} < {})", current_running_time.display(), last_recording_start, @@ -914,7 +918,7 @@ impl ToggleRecord { // can clip, clip the buffer and pass it through. gst::debug!( CAT, - obj: pad, + obj = pad, "Main stream EOS and we're not EOS yet (overlapping recording end, {} < {} < {})", current_running_time.display(), rec_state.last_recording_stop.display(), @@ -937,12 +941,12 @@ impl ToggleRecord { segment.set_start(clip_start); segment.set_stop(clip_stop); - gst::log!(CAT, obj: pad, "Clipping to segment {:?}", segment,); + gst::log!(CAT, obj = pad, "Clipping to segment {:?}", segment,); if let Some(data) = data.clip(&state, &segment) { return Ok(HandleResult::Pass(data)); } else { - gst::warning!(CAT, obj: pad, "Complete buffer clipped!"); + gst::warning!(CAT, obj = pad, "Complete buffer clipped!"); return Ok(HandleResult::Eos(self.check_and_update_eos( pad, stream, @@ -959,7 +963,7 @@ impl ToggleRecord { // the recording stop gst::debug!( CAT, - obj: pad, + obj = pad, "Main stream EOS and we're EOS too (after recording end, {} > {})", current_running_time_end.display(), rec_state.last_recording_stop.display(), @@ -982,7 +986,7 @@ impl ToggleRecord { gst::debug!( CAT, - obj: pad, + obj = pad, "Main stream EOS and we're not EOS yet (before recording end, {} <= {} <= {})", last_recording_start, current_running_time.display(), @@ -1009,7 +1013,7 @@ impl ToggleRecord { assert!(current_running_time .opt_ge(rec_state.last_recording_start) .unwrap_or(false)); - gst::log!(CAT, obj: pad, "Passing buffer (recording)"); + gst::log!(CAT, obj = pad, "Passing buffer (recording)"); Ok(HandleResult::Pass(data)) } RecordingState::Stopping => { @@ -1019,7 +1023,7 @@ impl ToggleRecord { None => { gst::log!( CAT, - obj: pad, + obj = pad, "Passing buffer (stopping: waiting for keyframe)", ); return Ok(HandleResult::Pass(data)); @@ -1036,7 +1040,7 @@ impl ToggleRecord { { gst::log!( CAT, - obj: pad, + obj = pad, "Passing buffer (stopping: {} <= {})", current_running_time_end.display(), last_recording_stop, @@ -1049,7 +1053,7 @@ impl ToggleRecord { { gst::log!( CAT, - obj: pad, + obj = pad, "Passing buffer (stopping: {} < {} < {})", current_running_time, last_recording_stop, @@ -1065,18 +1069,18 @@ impl ToggleRecord { let mut segment = state.in_segment.clone(); segment.set_stop(clip_stop); - gst::log!(CAT, obj: pad, "Clipping to segment {:?}", segment,); + gst::log!(CAT, obj = pad, "Clipping to segment {:?}", segment,); if let Some(data) = data.clip(&state, &segment) { Ok(HandleResult::Pass(data)) } else { - gst::warning!(CAT, obj: pad, "Complete buffer clipped!"); + gst::warning!(CAT, obj = pad, "Complete buffer clipped!"); Ok(HandleResult::Drop) } } else { gst::log!( CAT, - obj: pad, + obj = pad, "Dropping buffer (stopping: {} > {})", current_running_time_end.display(), rec_state.last_recording_stop.display(), @@ -1092,7 +1096,7 @@ impl ToggleRecord { .unwrap_or(false)); // We're properly stopped - gst::log!(CAT, obj: pad, "Dropping buffer (stopped)"); + gst::log!(CAT, obj = pad, "Dropping buffer (stopped)"); Ok(HandleResult::Drop) } RecordingState::Starting => { @@ -1102,7 +1106,7 @@ impl ToggleRecord { None => { gst::log!( CAT, - obj: pad, + obj = pad, "Dropping buffer (starting: waiting for keyframe)", ); return Ok(HandleResult::Drop); @@ -1117,7 +1121,7 @@ impl ToggleRecord { if current_running_time >= last_recording_start { gst::log!( CAT, - obj: pad, + obj = pad, "Passing buffer (starting: {} >= {})", current_running_time, last_recording_start, @@ -1130,7 +1134,7 @@ impl ToggleRecord { { gst::log!( CAT, - obj: pad, + obj = pad, "Passing buffer (starting: {} < {} < {})", current_running_time, last_recording_start, @@ -1146,18 +1150,18 @@ impl ToggleRecord { let mut segment = state.in_segment.clone(); segment.set_start(clip_start); - gst::log!(CAT, obj: pad, "Clipping to segment {:?}", segment); + gst::log!(CAT, obj = pad, "Clipping to segment {:?}", segment); if let Some(data) = data.clip(&state, &segment) { Ok(HandleResult::Pass(data)) } else { - gst::warning!(CAT, obj: pad, "Complete buffer clipped!"); + gst::warning!(CAT, obj = pad, "Complete buffer clipped!"); Ok(HandleResult::Drop) } } else { gst::log!( CAT, - obj: pad, + obj = pad, "Dropping buffer (starting: {} < {})", current_running_time, last_recording_start, @@ -1199,7 +1203,7 @@ impl ToggleRecord { if all_others_eos { gst::debug!( CAT, - obj: pad, + obj = pad, "All streams are in EOS state, change state to Stopped" ); @@ -1242,7 +1246,7 @@ impl ToggleRecord { if !all_others_not_eos { let settings = self.settings.lock(); if settings.record { - gst::debug!(CAT, obj: pad, "Restarting recording after EOS"); + gst::debug!(CAT, obj = pad, "Restarting recording after EOS"); rec_state.recording_state = RecordingState::Starting; } } @@ -1284,7 +1288,7 @@ impl ToggleRecord { upstream_live = false; gst::warning!( CAT, - obj: pad, + obj = pad, "Latency query failed, assuming non-live input, will retry" ); } @@ -1332,7 +1336,7 @@ impl ToggleRecord { let mut state = stream.state.lock(); if state.discont_pending { - gst::debug!(CAT, obj: pad, "Pending discont"); + gst::debug!(CAT, obj = pad, "Pending discont"); let buffer = buffer.make_mut(); buffer.set_flags(gst::BufferFlags::DISCONT); state.discont_pending = false; @@ -1363,11 +1367,11 @@ impl ToggleRecord { .build(), ); state.segment_pending = false; - gst::debug!(CAT, obj: pad, "Pending Segment {:?}", &state.out_segment); + gst::debug!(CAT, obj = pad, "Pending Segment {:?}", &state.out_segment); } if !state.pending_events.is_empty() { - gst::debug!(CAT, obj: pad, "Pushing pending events"); + gst::debug!(CAT, obj = pad, "Pushing pending events"); } events.append(&mut state.pending_events); @@ -1387,7 +1391,7 @@ impl ToggleRecord { gst::log!( CAT, - obj: pad, + obj = pad, "Pushing buffer with running time {}: {:?}", out_running_time.display(), buffer, @@ -1410,7 +1414,7 @@ impl ToggleRecord { Some(stream) => stream.clone(), }; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); let mut forward = true; let mut send_pending = false; @@ -1444,12 +1448,12 @@ impl ToggleRecord { let s = caps.structure(0).unwrap(); if s.name().starts_with("audio/") { state.audio_info = gst_audio::AudioInfo::from_caps(caps).ok(); - gst::log!(CAT, obj: pad, "Got audio caps {:?}", state.audio_info); + gst::log!(CAT, obj = pad, "Got audio caps {:?}", state.audio_info); state.video_info = None; } else if s.name().starts_with("video/") { state.audio_info = None; state.video_info = gst_video::VideoInfo::from_caps(caps).ok(); - gst::log!(CAT, obj: pad, "Got video caps {:?}", state.video_info); + gst::log!(CAT, obj = pad, "Got video caps {:?}", state.video_info); } else { state.audio_info = None; state.video_info = None; @@ -1488,12 +1492,12 @@ impl ToggleRecord { state.current_running_time = None; state.current_running_time_end = None; - gst::debug!(CAT, obj: pad, "Got new Segment {:?}", state.in_segment); + gst::debug!(CAT, obj = pad, "Got new Segment {:?}", state.in_segment); forward = false; } EventView::Gap(e) => { - gst::debug!(CAT, obj: pad, "Handling Gap event {:?}", event); + gst::debug!(CAT, obj = pad, "Handling Gap event {:?}", event); let (pts, duration) = e.get(); let upstream_live; @@ -1512,7 +1516,7 @@ impl ToggleRecord { upstream_live = false; gst::warning!( CAT, - obj: pad, + obj = pad, "Latency query failed, assuming non-live input, will retry" ); } @@ -1560,7 +1564,7 @@ impl ToggleRecord { } self.main_stream_cond.notify_all(); - gst::debug!(CAT, obj: pad, "Stream is not EOS now"); + gst::debug!(CAT, obj = pad, "Stream is not EOS now"); } EventView::Eos(..) => { let main_state = if stream != self.main_stream { @@ -1584,7 +1588,7 @@ impl ToggleRecord { self.main_stream_cond.notify_all(); gst::debug!( CAT, - obj: pad, + obj = pad, "Stream is EOS now, sending any pending events" ); @@ -1607,7 +1611,7 @@ impl ToggleRecord { { let mut state = stream.state.lock(); if state.segment_pending { - gst::log!(CAT, obj: pad, "Storing event for later pushing"); + gst::log!(CAT, obj = pad, "Storing event for later pushing"); state.pending_events.push(event); return true; } @@ -1635,10 +1639,10 @@ impl ToggleRecord { } if forward { - gst::log!(CAT, obj: pad, "Forwarding event {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding event {:?}", event); stream.srcpad.push_event(event) } else { - gst::log!(CAT, obj: pad, "Dropping event {:?}", event); + gst::log!(CAT, obj = pad, "Dropping event {:?}", event); true } } @@ -1656,7 +1660,7 @@ impl ToggleRecord { Some(stream) => stream.clone(), }; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); let success = stream.srcpad.peer_query(query); @@ -1691,7 +1695,7 @@ impl ToggleRecord { Some(stream) => stream.clone(), }; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); let forward = !matches!(event.view(), EventView::Seek(..)); @@ -1703,10 +1707,10 @@ impl ToggleRecord { drop(rec_state); if forward { - gst::log!(CAT, obj: pad, "Forwarding event {:?}", event); + gst::log!(CAT, obj = pad, "Forwarding event {:?}", event); stream.sinkpad.push_event(event) } else { - gst::log!(CAT, obj: pad, "Dropping event {:?}", event); + gst::log!(CAT, obj = pad, "Dropping event {:?}", event); false } } @@ -1726,7 +1730,7 @@ impl ToggleRecord { Some(stream) => stream.clone(), }; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Scheduling(q) => { let mut new_query = gst::query::Scheduling::new(); @@ -1735,7 +1739,7 @@ impl ToggleRecord { return res; } - gst::log!(CAT, obj: pad, "Downstream returned {:?}", new_query); + gst::log!(CAT, obj = pad, "Downstream returned {:?}", new_query); let (flags, min, max, align) = new_query.result(); q.set(flags, min, max, align); @@ -1747,7 +1751,7 @@ impl ToggleRecord { .filter(|m| m != &gst::PadMode::Pull) .collect::>(), ); - gst::log!(CAT, obj: pad, "Returning {:?}", q.query_mut()); + gst::log!(CAT, obj = pad, "Returning {:?}", q.query_mut()); true } QueryViewMut::Seeking(q) => { @@ -1759,7 +1763,7 @@ impl ToggleRecord { gst::GenericFormattedValue::none_for_format(format), ); - gst::log!(CAT, obj: pad, "Returning {:?}", q.query_mut()); + gst::log!(CAT, obj = pad, "Returning {:?}", q.query_mut()); true } // Position and duration is always the current recording position @@ -1779,7 +1783,7 @@ impl ToggleRecord { { gst::debug!( CAT, - obj: pad, + obj = pad, "Returning position {} = {} - ({} + {})", recording_duration + delta, recording_duration, @@ -1789,7 +1793,7 @@ impl ToggleRecord { recording_duration += delta; } } else { - gst::debug!(CAT, obj: pad, "Returning position {}", recording_duration); + gst::debug!(CAT, obj = pad, "Returning position {}", recording_duration); } q.set(recording_duration); true @@ -1813,7 +1817,7 @@ impl ToggleRecord { { gst::debug!( CAT, - obj: pad, + obj = pad, "Returning duration {} = {} - ({} + {})", recording_duration + delta, recording_duration, @@ -1823,7 +1827,7 @@ impl ToggleRecord { recording_duration += delta; } } else { - gst::debug!(CAT, obj: pad, "Returning duration {}", recording_duration); + gst::debug!(CAT, obj = pad, "Returning duration {}", recording_duration); } q.set(recording_duration); true @@ -1832,7 +1836,7 @@ impl ToggleRecord { } } _ => { - gst::log!(CAT, obj: pad, "Forwarding query {:?}", query); + gst::log!(CAT, obj = pad, "Forwarding query {:?}", query); stream.sinkpad.peer_query(query) } } @@ -1979,7 +1983,7 @@ impl ObjectImpl for ToggleRecord { let record = value.get().expect("type checked upstream"); gst::debug!( CAT, - imp: self, + imp = self, "Setting record from {:?} to {:?}", settings.record, record @@ -1993,7 +1997,7 @@ impl ObjectImpl for ToggleRecord { let live = value.get().expect("type checked upstream"); gst::debug!( CAT, - imp: self, + imp = self, "Setting live from {:?} to {:?}", settings.live, live @@ -2100,7 +2104,7 @@ impl ElementImpl for ToggleRecord { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/utils/tracers/src/buffer_lateness/imp.rs b/utils/tracers/src/buffer_lateness/imp.rs index 48228750..7fb00594 100644 --- a/utils/tracers/src/buffer_lateness/imp.rs +++ b/utils/tracers/src/buffer_lateness/imp.rs @@ -88,24 +88,24 @@ impl Settings { let s = match gst::Structure::from_str(&format!("buffer-lateness,{params}")) { Ok(s) => s, Err(err) => { - gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); + gst::warning!(CAT, imp = imp, "failed to parse tracer parameters: {}", err); return; } }; if let Ok(file) = s.get::<&str>("file") { - gst::log!(CAT, imp: imp, "file= {}", file); + gst::log!(CAT, imp = imp, "file= {}", file); self.file = PathBuf::from(file); } if let Ok(filter) = s.get::<&str>("include-filter") { - gst::log!(CAT, imp: imp, "include filter= {}", filter); + gst::log!(CAT, imp = imp, "include filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile include-filter regex: {}", err ); @@ -116,13 +116,13 @@ impl Settings { } if let Ok(filter) = s.get::<&str>("exclude-filter") { - gst::log!(CAT, imp: imp, "exclude filter= {}", filter); + gst::log!(CAT, imp = imp, "exclude filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile exclude-filter regex: {}", err ); @@ -194,14 +194,14 @@ impl ObjectImpl for BufferLateness { let mut file = match std::fs::File::create(&state.settings.file) { Ok(file) => file, Err(err) => { - gst::error!(CAT, imp: self, "Failed to create file: {err}"); + gst::error!(CAT, imp = self, "Failed to create file: {err}"); return; } }; gst::debug!( CAT, - imp: self, + imp = self, "Writing file {}", state.settings.file.display() ); @@ -218,7 +218,7 @@ impl ObjectImpl for BufferLateness { } in &state.log { if let Err(err) = writeln!(&mut file, "{timestamp},{element_name}:{pad_name},0x{ptr:08x},{buffer_clock_time},{pipeline_clock_time},{lateness},{min_latency}") { - gst::error!(CAT, imp: self, "Failed to write to file: {err}"); + gst::error!(CAT, imp = self, "Failed to write to file: {err}"); return; } } @@ -236,7 +236,7 @@ impl TracerImpl for BufferLateness { let ptr = pad.as_ptr() as usize; gst::debug!( CAT, - imp: self, + imp = self, "new source pad: {} 0x{:08x}", pad.name(), ptr diff --git a/utils/tracers/src/pad_push_timings/imp.rs b/utils/tracers/src/pad_push_timings/imp.rs index f8ebac2d..ac3132a0 100644 --- a/utils/tracers/src/pad_push_timings/imp.rs +++ b/utils/tracers/src/pad_push_timings/imp.rs @@ -87,24 +87,24 @@ impl Settings { let s = match gst::Structure::from_str(&format!("pad-push-timings,{params}")) { Ok(s) => s, Err(err) => { - gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); + gst::warning!(CAT, imp = imp, "failed to parse tracer parameters: {}", err); return; } }; if let Ok(file) = s.get::<&str>("file") { - gst::log!(CAT, imp: imp, "file= {}", file); + gst::log!(CAT, imp = imp, "file= {}", file); self.file = PathBuf::from(file); } if let Ok(filter) = s.get::<&str>("include-filter") { - gst::log!(CAT, imp: imp, "include filter= {}", filter); + gst::log!(CAT, imp = imp, "include filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile include-filter regex: {}", err ); @@ -115,13 +115,13 @@ impl Settings { } if let Ok(filter) = s.get::<&str>("exclude-filter") { - gst::log!(CAT, imp: imp, "exclude filter= {}", filter); + gst::log!(CAT, imp = imp, "exclude filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile exclude-filter regex: {}", err ); @@ -191,14 +191,14 @@ impl ObjectImpl for PadPushTimings { let mut file = match std::fs::File::create(&state.settings.file) { Ok(file) => file, Err(err) => { - gst::error!(CAT, imp: self, "Failed to create file: {err}"); + gst::error!(CAT, imp = self, "Failed to create file: {err}"); return; } }; gst::debug!( CAT, - imp: self, + imp = self, "Writing file {}", state.settings.file.display() ); @@ -223,7 +223,7 @@ impl ObjectImpl for PadPushTimings { ) }; if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to write to file: {err}"); + gst::error!(CAT, imp = self, "Failed to write to file: {err}"); return; } } diff --git a/utils/tracers/src/pipeline_snapshot/imp.rs b/utils/tracers/src/pipeline_snapshot/imp.rs index 1e9229c7..20e3b5e0 100644 --- a/utils/tracers/src/pipeline_snapshot/imp.rs +++ b/utils/tracers/src/pipeline_snapshot/imp.rs @@ -93,18 +93,18 @@ impl Settings { let s = match gst::Structure::from_str(&format!("pipeline-snapshot,{params}")) { Ok(s) => s, Err(err) => { - gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); + gst::warning!(CAT, imp = imp, "failed to parse tracer parameters: {}", err); return; } }; if let Ok(dot_prefix) = s.get("dot-prefix") { - gst::log!(CAT, imp: imp, "dot-prefix = {}", dot_prefix); + gst::log!(CAT, imp = imp, "dot-prefix = {}", dot_prefix); self.dot_prefix = dot_prefix; } if let Ok(dot_ts) = s.get("dot-ts") { - gst::log!(CAT, imp: imp, "dot-ts = {}", dot_ts); + gst::log!(CAT, imp = imp, "dot-ts = {}", dot_ts); self.dot_ts = dot_ts; } } @@ -142,7 +142,7 @@ impl ObjectImpl for PipelineSnapshot { self.register_hook(TracerHook::ObjectDestroyed); if let Err(err) = self.setup_signal(settings) { - gst::warning!(CAT, imp: self, "failed to setup UNIX signals: {}", err); + gst::warning!(CAT, imp = self, "failed to setup UNIX signals: {}", err); } } @@ -161,7 +161,7 @@ impl GstObjectImpl for PipelineSnapshot {} impl TracerImpl for PipelineSnapshot { fn element_new(&self, _ts: u64, element: &gst::Element) { if element.is::() { - gst::debug!(CAT, imp: self, "new pipeline: {}", element.name()); + gst::debug!(CAT, imp = self, "new pipeline: {}", element.name()); let weak = element.downgrade(); let mut pipelines = self.pipelines.lock().unwrap(); @@ -206,7 +206,7 @@ impl PipelineSnapshot { for pipeline in pipelines.into_iter() { let pipeline = pipeline.downcast::().unwrap(); - gst::debug!(CAT, obj: tracer, "dump {}", pipeline.name()); + gst::debug!(CAT, obj = tracer, "dump {}", pipeline.name()); let dump_name = format!("{}{}", settings.dot_prefix, pipeline.name()); diff --git a/utils/tracers/src/queue_levels/imp.rs b/utils/tracers/src/queue_levels/imp.rs index 3a9ac7c7..bc17455f 100644 --- a/utils/tracers/src/queue_levels/imp.rs +++ b/utils/tracers/src/queue_levels/imp.rs @@ -128,24 +128,24 @@ impl Settings { let s = match gst::Structure::from_str(&format!("queue-levels,{params}")) { Ok(s) => s, Err(err) => { - gst::warning!(CAT, imp: imp, "failed to parse tracer parameters: {}", err); + gst::warning!(CAT, imp = imp, "failed to parse tracer parameters: {}", err); return; } }; if let Ok(file) = s.get::<&str>("file") { - gst::log!(CAT, imp: imp, "file= {}", file); + gst::log!(CAT, imp = imp, "file= {}", file); self.file = PathBuf::from(file); } if let Ok(filter) = s.get::<&str>("include-filter") { - gst::log!(CAT, imp: imp, "include filter= {}", filter); + gst::log!(CAT, imp = imp, "include filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile include-filter regex: {}", err ); @@ -156,13 +156,13 @@ impl Settings { } if let Ok(filter) = s.get::<&str>("exclude-filter") { - gst::log!(CAT, imp: imp, "exclude filter= {}", filter); + gst::log!(CAT, imp = imp, "exclude filter= {}", filter); let filter = match Regex::new(filter) { Ok(filter) => Some(filter), Err(err) => { gst::error!( CAT, - imp: imp, + imp = imp, "Failed to compile exclude-filter regex: {}", err ); @@ -247,14 +247,14 @@ impl ObjectImpl for QueueLevels { let mut file = match std::fs::File::create(&state.settings.file) { Ok(file) => file, Err(err) => { - gst::error!(CAT, imp: self, "Failed to create file: {err}"); + gst::error!(CAT, imp = self, "Failed to create file: {err}"); return; } }; gst::debug!( CAT, - imp: self, + imp = self, "Writing file {}", state.settings.file.display() ); @@ -278,7 +278,7 @@ impl ObjectImpl for QueueLevels { writeln!(&mut file, "{timestamp},{name},0x{ptr:08x},{cur_level_bytes},{cur_level_time},{cur_level_buffers},{max_size_bytes},{max_size_time},{max_size_buffers}") }; if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to write to file: {err}"); + gst::error!(CAT, imp = self, "Failed to write to file: {err}"); return; } } @@ -296,7 +296,7 @@ impl TracerImpl for QueueLevels { let ptr = element.as_ptr() as usize; gst::debug!( CAT, - imp: self, + imp = self, "new queue: {} 0x{:08x}", element.name(), ptr diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs index f48a8648..c62d7b35 100644 --- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs +++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs @@ -218,7 +218,7 @@ impl ObjectImpl for UriPlaylistBin { let new_value = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing uris from {:?} to {:?}", settings.uris, new_value, @@ -231,7 +231,7 @@ impl ObjectImpl for UriPlaylistBin { let mut settings = self.settings.lock().unwrap(); gst::info!( CAT, - imp: self, + imp = self, "Changing iterations from {:?} to {:?}", settings.iterations, new_value, @@ -406,7 +406,7 @@ impl ElementImpl for UriPlaylistBin { impl UriPlaylistBin { fn start(&self) -> Result<(), PlaylistError> { - gst::debug!(CAT, imp: self, "Starting"); + gst::debug!(CAT, imp = self, "Starting"); { let mut state_guard = self.state.lock().unwrap(); assert!(state_guard.is_none()); @@ -433,7 +433,7 @@ impl UriPlaylistBin { gst::debug!( CAT, - obj: bin, + obj = bin, "uridecodebin src pad added: {}", src_pad.name() ); @@ -474,7 +474,7 @@ impl UriPlaylistBin { gst::debug!( CAT, - obj: bin, + obj = bin, "uridecodebin src pad removed: {}", src_pad.name() ); @@ -498,7 +498,7 @@ impl UriPlaylistBin { let bin = bin_weak.upgrade()?; let self_ = bin.imp(); - gst::debug!(CAT, obj: bin, "current URI about to finish"); + gst::debug!(CAT, obj = bin, "current URI about to finish"); let _ = self_.start_next_item(); @@ -542,7 +542,7 @@ impl UriPlaylistBin { let item = match state.playlist.next() { Some(item) => item, None => { - gst::debug!(CAT, imp: self, "no more item to queue",); + gst::debug!(CAT, imp = self, "no more item to queue",); state.pending_current_items.push_back(None); return Ok(()); @@ -551,7 +551,7 @@ impl UriPlaylistBin { gst::debug!( CAT, - imp: self, + imp = self, "start next item #{}: {}", item.index(), item.uri() @@ -618,7 +618,7 @@ impl UriPlaylistBin { fn failed(&self, error: PlaylistError) { let error_msg = error.to_string(); - gst::error!(CAT, imp: self, "{}", error_msg); + gst::error!(CAT, imp = self, "{}", error_msg); match error { PlaylistError::PluginMissing { .. } => { diff --git a/video/cdg/src/cdgdec/imp.rs b/video/cdg/src/cdgdec/imp.rs index ae6874c8..1473bed5 100644 --- a/video/cdg/src/cdgdec/imp.rs +++ b/video/cdg/src/cdgdec/imp.rs @@ -188,7 +188,12 @@ impl VideoDecoderImpl for CdgDec { } } - gst::debug!(CAT, imp: self, "Finish frame pts={}", frame.pts().display()); + gst::debug!( + CAT, + imp = self, + "Finish frame pts={}", + frame.pts().display() + ); self.obj().finish_frame(frame) } @@ -214,7 +219,7 @@ impl VideoDecoderImpl for CdgDec { } fn flush(&self) -> bool { - gst::debug!(CAT, imp: self, "flushing, reset CDG interpreter"); + gst::debug!(CAT, imp = self, "flushing, reset CDG interpreter"); let mut cdg_inter = self.cdg_inter.lock().unwrap(); cdg_inter.reset(false); diff --git a/video/cdg/src/cdgparse/imp.rs b/video/cdg/src/cdgparse/imp.rs index d80a9bb6..f7749f22 100644 --- a/video/cdg/src/cdgparse/imp.rs +++ b/video/cdg/src/cdgparse/imp.rs @@ -200,7 +200,7 @@ impl BaseParseImpl for CdgParse { buffer.set_flags(gst::BufferFlags::HEADER); } - gst::debug!(CAT, imp: self, "Found frame pts={}", pts); + gst::debug!(CAT, imp = self, "Found frame pts={}", pts); self.obj().finish_frame(frame, CDG_PACKET_SIZE as u32)?; diff --git a/video/closedcaption/src/ccdetect/imp.rs b/video/closedcaption/src/ccdetect/imp.rs index f291eab2..1267f7b2 100644 --- a/video/closedcaption/src/ccdetect/imp.rs +++ b/video/closedcaption/src/ccdetect/imp.rs @@ -75,7 +75,7 @@ impl CCDetect { if data.len() % 3 != 0 { gst::warning!( CAT, - imp: self, + imp = self, "cc_data length is not a multiple of 3, truncating" ); } @@ -89,7 +89,7 @@ impl CCDetect { let cc_type = triple[0] & 0x03; gst::trace!( CAT, - imp: self, + imp = self, "triple:{} have ccp:{} 608:{} 708:{} data:{:02x},{:02x},{:02x} cc_valid:{} cc_type:{:02b}", i * 3, started_ccp, @@ -163,7 +163,7 @@ impl CCDetect { gst::trace!( CAT, - imp: self, + imp = self, "packet contains {:?} current settings {:?} and state {:?}", cc_packet, settings, @@ -199,7 +199,7 @@ impl CCDetect { gst::trace!( CAT, - imp: self, + imp = self, "changed to settings {:?} state {:?}", settings, state @@ -362,7 +362,7 @@ impl BaseTransformImpl for CCDetect { let cc_packet = match self.detect(format, map.as_slice()) { Ok(v) => v, Err(e) => { - gst::warning!(CAT, imp: self, "{e}"); + gst::warning!(CAT, imp = self, "{e}"); gst::element_imp_warning!(self, gst::StreamError::Decode, ["{e}"]); CCPacketContents { cc608: false, diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs index fc500c52..93f5d9d4 100644 --- a/video/closedcaption/src/cea608overlay/imp.rs +++ b/video/closedcaption/src/cea608overlay/imp.rs @@ -148,7 +148,7 @@ impl Cea608Overlay { if cc_type == 0x00 || cc_type == 0x01 { if state.selected_field.is_none() { state.selected_field = Some(cc_type); - gst::info!(CAT, imp: self, "Selected field {} automatically", cc_type); + gst::info!(CAT, imp = self, "Selected field {} automatically", cc_type); } if Some(cc_type) != state.selected_field { @@ -156,7 +156,12 @@ impl Cea608Overlay { }; match state.renderer.push_pair([triple[1], triple[2]]) { Err(e) => { - gst::warning!(CAT, imp: self, "Failed to parse incoming CEA-608 ({:x?}): {e:?}", [triple[1], triple[2]]); + gst::warning!( + CAT, + imp = self, + "Failed to parse incoming CEA-608 ({:x?}): {e:?}", + [triple[1], triple[2]] + ); continue; } Ok(true) => { @@ -183,7 +188,7 @@ impl Cea608Overlay { let cc_type = triple[0] & 0x01; if state.selected_field.is_none() { state.selected_field = Some(cc_type); - gst::info!(CAT, imp: self, "Selected field {} automatically", cc_type); + gst::info!(CAT, imp = self, "Selected field {} automatically", cc_type); } if Some(cc_type) != state.selected_field { @@ -191,7 +196,12 @@ impl Cea608Overlay { }; match state.renderer.push_pair([triple[1], triple[2]]) { Err(e) => { - gst::warning!(CAT, imp: self, "Failed to parse incoming CEA-608 ({:x?}): {e:?}", [triple[1], triple[2]]); + gst::warning!( + CAT, + imp = self, + "Failed to parse incoming CEA-608 ({:x?}): {e:?}", + [triple[1], triple[2]] + ); continue; } Ok(true) => { @@ -214,10 +224,10 @@ impl Cea608Overlay { pad: &gst::Pad, mut buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); gst::FlowError::Error })?; @@ -248,7 +258,12 @@ impl Cea608Overlay { for pair in data.chunks_exact(2) { match state.renderer.push_pair([pair[0], pair[1]]) { Err(e) => { - gst::warning!(CAT, imp: self, "Failed to parse incoming CEA-608 ({:x?}): {e:?}", [pair[0], pair[1]]); + gst::warning!( + CAT, + imp = self, + "Failed to parse incoming CEA-608 ({:x?}): {e:?}", + [pair[0], pair[1]] + ); continue; } Ok(true) => { @@ -267,7 +282,7 @@ impl Cea608Overlay { if let Some(timeout) = self.settings.lock().unwrap().timeout { if let Some(interval) = pts.opt_saturating_sub(state.last_cc_pts) { if interval > timeout { - gst::info!(CAT, imp: self, "Reached timeout, clearing overlay"); + gst::info!(CAT, imp = self, "Reached timeout, clearing overlay"); state.composition.take(); state.last_cc_pts.take(); } @@ -286,7 +301,7 @@ impl Cea608Overlay { .unwrap(); if composition.blend(&mut frame).is_err() { - gst::error!(CAT, obj: pad, "Failed to blend composition"); + gst::error!(CAT, obj = pad, "Failed to blend composition"); } } } @@ -298,7 +313,7 @@ impl Cea608Overlay { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(c) => { let mut state = self.state.lock().unwrap(); @@ -517,7 +532,7 @@ impl ElementImpl for Cea608Overlay { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/video/closedcaption/src/cea608tocea708/imp.rs b/video/closedcaption/src/cea608tocea708/imp.rs index dcbc8fc3..13d6f3b1 100644 --- a/video/closedcaption/src/cea608tocea708/imp.rs +++ b/video/closedcaption/src/cea608tocea708/imp.rs @@ -356,7 +356,7 @@ impl State { if let Ok(Some(cea608)) = self.cea608.tracker[field as usize].decode(cc_data) { gst::trace!( CAT, - imp: imp, + imp = imp, "have field:{field} channel:{:?} {cea608:?}", cea608.channel() ); @@ -495,17 +495,17 @@ impl Cea608ToCea708 { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.borrow_mut(); let buffer_pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); gst::FlowError::Error })?; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -516,7 +516,7 @@ impl Cea608ToCea708 { if data_len % 3 != 0 { gst::warning!( CAT, - obj: pad, + obj = pad, "Invalid closed caption packet size, truncating" ); data_len -= data_len % 3; @@ -524,7 +524,7 @@ impl Cea608ToCea708 { if data_len < 3 { gst::warning!( CAT, - obj: pad, + obj = pad, "Invalid closed caption packet size, dropping" ); return Ok(gst::FlowSuccess::Ok); @@ -539,7 +539,7 @@ impl Cea608ToCea708 { if data_len % 2 != 0 { gst::warning!( CAT, - obj: pad, + obj = pad, "Invalid closed caption packet size, truncating" ); data_len -= data_len % 3; @@ -547,7 +547,7 @@ impl Cea608ToCea708 { if data_len < 2 { gst::warning!( CAT, - obj: pad, + obj = pad, "Invalid closed caption packet size, dropping" ); return Ok(gst::FlowSuccess::Ok); @@ -587,7 +587,7 @@ impl Cea608ToCea708 { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(event) => { let mut state = self.state.borrow_mut(); @@ -603,7 +603,7 @@ impl Cea608ToCea708 { _ => { gst::error!( CAT, - imp: self, + imp = self, "unknown \'field\' value in caps, {caps:?}" ); return false; @@ -617,7 +617,7 @@ impl Cea608ToCea708 { v => { gst::error!( CAT, - imp: self, + imp = self, "unknown or missing \'format\' value {v:?} in caps, {caps:?}" ); return false; @@ -757,7 +757,7 @@ impl ElementImpl for Cea608ToCea708 { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/cea608tojson/imp.rs b/video/closedcaption/src/cea608tojson/imp.rs index a67766a0..f37aa1dc 100644 --- a/video/closedcaption/src/cea608tojson/imp.rs +++ b/video/closedcaption/src/cea608tojson/imp.rs @@ -265,7 +265,7 @@ fn dump( }; gst::debug!( CAT, - imp: imp, + imp = imp, "{} -> {}: {:?}", pts.display(), end.display(), @@ -274,7 +274,7 @@ fn dump( } else { gst::trace!( CAT, - imp: imp, + imp = imp, "{} -> {}: padding", pts.display(), end.display() @@ -317,7 +317,7 @@ impl State { } fn drain(&mut self, imp: &Cea608ToJson, flush: bool) -> Option { - gst::log!(CAT, imp: imp, "Draining"); + gst::log!(CAT, imp = imp, "Draining"); let pts = if self.settings.unbuffered { self.current_pts @@ -393,7 +393,7 @@ impl State { fn drain_pending(&mut self, imp: &Cea608ToJson) -> Option { if let Some(mut pending) = self.pending_lines.take() { - gst::log!(CAT, imp: imp, "Draining pending"); + gst::log!(CAT, imp = imp, "Draining pending"); pending.duration = self .current_pts .opt_add(self.current_duration) @@ -411,7 +411,7 @@ impl State { imp: &Cea608ToJson, preamble: cea608_types::tables::PreambleAddressCode, ) -> Option { - gst::log!(CAT, imp: imp, "preamble: {:?}", preamble); + gst::log!(CAT, imp = imp, "preamble: {:?}", preamble); let drain_roll_up = self.cursor.row != preamble.row() as u32; @@ -524,7 +524,7 @@ impl State { row.push(&mut self.cursor, c); } } else { - gst::warning!(CAT, imp: imp, "No row to append decoded text to!"); + gst::warning!(CAT, imp = imp, "No row to append decoded text to!"); } } @@ -572,7 +572,7 @@ impl State { } Cea608::NewMode(_chan, mode) => return self.update_mode(imp, mode.into()), Cea608::CarriageReturn(_chan) => { - gst::log!(CAT, imp: imp, "carriage return"); + gst::log!(CAT, imp = imp, "carriage return"); if let Some(mode) = self.mode { // https://www.law.cornell.edu/cfr/text/47/79.101 (f)(2)(i) (f)(3)(i) @@ -640,7 +640,7 @@ impl State { Cea608::Text(text) => { if let Some(mode) = self.mode { self.mode?; - gst::log!(CAT, imp: imp, "text"); + gst::log!(CAT, imp = imp, "text"); self.handle_text(imp, text); if mode.is_rollup() && self.settings.unbuffered { @@ -659,7 +659,7 @@ impl State { impl Cea608ToJson { fn output(&self, lines: TimestampedLines) -> Result { - gst::debug!(CAT, imp: self, "outputting: {:?}", lines); + gst::debug!(CAT, imp = self, "outputting: {:?}", lines); let json = serde_json::to_string(&lines.lines).map_err(|err| { gst::element_imp_error!( @@ -678,7 +678,7 @@ impl Cea608ToJson { buf_mut.set_duration(lines.duration); } - gst::log!(CAT, imp: self, "Pushing {:?}", buf); + gst::log!(CAT, imp = self, "Pushing {:?}", buf); self.srcpad.push(buf) } @@ -688,30 +688,30 @@ impl Cea608ToJson { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::trace!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.borrow_mut(); let pts = buffer.pts(); if pts.is_none() { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); return Err(gst::FlowError::Error); } let duration = buffer.duration(); if duration.is_none() { - gst::error!(CAT, obj: pad, "Require buffers with duration"); + gst::error!(CAT, obj = pad, "Require buffers with duration"); return Err(gst::FlowError::Error); } let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; if data.len() < 2 { - gst::error!(CAT, obj: pad, "Invalid closed caption packet size"); + gst::error!(CAT, obj = pad, "Invalid closed caption packet size"); return Ok(gst::FlowSuccess::Ok); } @@ -739,7 +739,7 @@ impl Cea608ToJson { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(..) => { // We send our own caps downstream @@ -908,7 +908,7 @@ impl ElementImpl for Cea608ToJson { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/cea608tott/imp.rs b/video/closedcaption/src/cea608tott/imp.rs index f368b4ac..b913fc27 100644 --- a/video/closedcaption/src/cea608tott/imp.rs +++ b/video/closedcaption/src/cea608tott/imp.rs @@ -67,30 +67,30 @@ impl Cea608ToTt { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.borrow_mut(); let format = match state.format { Some(format) => format, None => { - gst::error!(CAT, obj: pad, "Not negotiated yet"); + gst::error!(CAT, obj = pad, "Not negotiated yet"); return Err(gst::FlowError::NotNegotiated); } }; let buffer_pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); gst::FlowError::Error })?; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; if data.len() < 2 { - gst::error!(CAT, obj: pad, "Invalid closed caption packet size"); + gst::error!(CAT, obj = pad, "Invalid closed caption packet size"); return Ok(gst::FlowSuccess::Ok); } @@ -98,14 +98,23 @@ impl Cea608ToTt { let previous_text = { match state.state.decode([data[0], data[1]]) { Err(e) => { - gst::error!(CAT, obj: pad, "Failed to decode closed caption packet: {e:?}"); + gst::error!( + CAT, + obj = pad, + "Failed to decode closed caption packet: {e:?}" + ); return Ok(gst::FlowSuccess::Ok); } Ok(Some(cea608)) => { - gst::trace!(CAT, obj: pad, "received {:x?} cea608: {cea608:?}", [data[0], data[1]]); + gst::trace!( + CAT, + obj = pad, + "received {:x?} cea608: {cea608:?}", + [data[0], data[1]] + ); if state.frame.push_code(cea608) { let text = state.frame.get_text(); - gst::trace!(CAT, obj: pad, "generated text: {text}"); + gst::trace!(CAT, obj = pad, "generated text: {text}"); if text.is_empty() { state.previous_text.take() } else if state.frame.mode() == Some(cea608_types::Mode::PaintOn) @@ -135,7 +144,7 @@ impl Cea608ToTt { }; let Some(previous_text) = previous_text else { - gst::debug!(CAT, obj: pad, "Have no previous text"); + gst::debug!(CAT, obj = pad, "Have no previous text"); return Ok(gst::FlowSuccess::Ok); }; @@ -278,7 +287,7 @@ impl Cea608ToTt { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(..) => { let mut state = self.state.borrow_mut(); @@ -293,7 +302,7 @@ impl Cea608ToTt { }; if downstream_caps.is_empty() { - gst::error!(CAT, obj: pad, "Empty downstream caps"); + gst::error!(CAT, obj = pad, "Empty downstream caps"); return false; } @@ -301,7 +310,7 @@ impl Cea608ToTt { gst::debug!( CAT, - obj: pad, + obj = pad, "Negotiating for downstream caps {}", downstream_caps ); @@ -335,7 +344,7 @@ impl Cea608ToTt { EventView::Eos(..) => { let mut state = self.state.borrow_mut(); if let Some((timestamp, text)) = state.previous_text.take() { - gst::debug!(CAT, obj: pad, "Outputting final text on EOS"); + gst::debug!(CAT, obj = pad, "Outputting final text on EOS"); let format = state.format.unwrap(); @@ -498,7 +507,7 @@ impl ElementImpl for Cea608ToTt { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/cea708mux/imp.rs b/video/closedcaption/src/cea708mux/imp.rs index 2dc9f405..5dcc538f 100644 --- a/video/closedcaption/src/cea708mux/imp.rs +++ b/video/closedcaption/src/cea708mux/imp.rs @@ -128,10 +128,14 @@ impl AggregatorImpl for Cea708Mux { .nseconds(); let end_running_time = start_running_time + duration; let mut need_data = false; - gst::debug!(CAT, imp: self, "Aggregating for start time {} end {} timeout {}", + gst::debug!( + CAT, + imp = self, + "Aggregating for start time {} end {} timeout {}", start_running_time.display(), end_running_time.display(), - timeout); + timeout + ); let sinkpads = self.obj().sink_pads(); @@ -183,7 +187,7 @@ impl AggregatorImpl for Cea708Mux { let buffer_end_ts = buffer_start_ts + duration; // allow a 1 second grace period before dropping data if start_running_time.saturating_sub(buffer_end_ts) > gst::ClockTime::from_seconds(1) { - gst::warning!(CAT, obj: pad, + gst::warning!(CAT, obj = pad, "Dropping buffer because start_running_time {} is more than 1s later than buffer_end_ts {}", start_running_time.display(), buffer_end_ts.display()); @@ -204,7 +208,7 @@ impl AggregatorImpl for Cea708Mux { return Err(gst::FlowError::Error); }; - gst::debug!(CAT, obj: pad, "Parsing input buffer {buffer:?}"); + gst::debug!(CAT, obj = pad, "Parsing input buffer {buffer:?}"); let in_format = pad_state.format; match in_format { CeaFormat::CcData => { @@ -272,7 +276,12 @@ impl AggregatorImpl for Cea708Mux { } for code in service.codes() { - gst::trace!(CAT, obj: pad, "Handling service {} code {code:?}", service.number()); + gst::trace!( + CAT, + obj = pad, + "Handling service {} code {code:?}", + service.number() + ); if overflowed { pad_state .pending_services @@ -306,7 +315,12 @@ impl AggregatorImpl for Cea708Mux { for (_service_no, service) in services.into_iter() { // FIXME: handle needing to split services - gst::trace!(CAT, imp: self, "Adding service {} to packet", service.number()); + gst::trace!( + CAT, + imp = self, + "Adding service {} to packet", + service.number() + ); packet.push_service(service).unwrap(); } @@ -396,7 +410,7 @@ impl AggregatorImpl for Cea708Mux { .expect("Not a Cea708MuxSinkPad"); use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); #[allow(clippy::single_match)] match event.view() { EventView::Caps(event) => { @@ -525,7 +539,7 @@ impl ElementImpl for Cea708Mux { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/cea708overlay/imp.rs b/video/closedcaption/src/cea708overlay/imp.rs index 5ff81527..94a806f5 100644 --- a/video/closedcaption/src/cea708overlay/imp.rs +++ b/video/closedcaption/src/cea708overlay/imp.rs @@ -202,10 +202,15 @@ impl Cea708Overlay { cea608: [u8; 2], pts: gst::ClockTime, ) { - gst::trace!(CAT, imp: self, "Handling CEA-608 for field {field:?} (selected: {:?}) data: {cea608:x?}", state.selected); + gst::trace!( + CAT, + imp = self, + "Handling CEA-608 for field {field:?} (selected: {:?}) data: {cea608:x?}", + state.selected + ); match state.cea708_renderer.push_cea608(field, cea608) { - Err(e) => gst::warning!(CAT, imp: self, "Failed to parse CEA-608 data: {e:?}"), + Err(e) => gst::warning!(CAT, imp = self, "Failed to parse CEA-608 data: {e:?}"), Ok(true) => self.reset_timeout(state, pts), _ => (), } @@ -223,7 +228,12 @@ impl Cea708Overlay { for service in packet.services() { if state.selected.is_none() { - gst::info!(CAT, imp: self, "Automatic selection chose CEA-708 service {}", service.number()); + gst::info!( + CAT, + imp = self, + "Automatic selection chose CEA-708 service {}", + service.number() + ); state.selected = Some(ServiceOrChannel::Service(service.number())); } if Some(ServiceOrChannel::Service(service.number())) != state.selected { @@ -235,7 +245,7 @@ impl Cea708Overlay { } let Some(cea608) = cea608 else { - gst::log!(CAT, imp: self, "No CEA-608"); + gst::log!(CAT, imp = self, "No CEA-608"); return; }; @@ -245,7 +255,13 @@ impl Cea708Overlay { None | Some(ServiceOrChannel::Cea608Channel(_)) ) { - gst::log!(CAT, imp: self, "CEA-608 not to be used (enabled {}, selected {:?})", state.enabled_608, state.selected); + gst::log!( + CAT, + imp = self, + "CEA-608 not to be used (enabled {}, selected {:?})", + state.enabled_608, + state.selected + ); return; } @@ -288,10 +304,10 @@ impl Cea708Overlay { pad: &gst::Pad, mut buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); gst::FlowError::Error })?; @@ -307,7 +323,12 @@ impl Cea708Overlay { self.check_service_channel(&mut state); for meta in buffer.iter_meta::() { - gst::log!(CAT, imp: self, "Have caption meta of type {:?}", meta.caption_type()); + gst::log!( + CAT, + imp = self, + "Have caption meta of type {:?}", + meta.caption_type() + ); if meta.caption_type() == gst_video::VideoCaptionType::Cea708Cdp { match extract_cdp(meta.data()) { @@ -371,7 +392,7 @@ impl Cea708Overlay { if let Some(timeout) = caption_timeout { if let Some(interval) = pts.opt_saturating_sub(state.last_cc_pts) { if interval > timeout { - gst::info!(CAT, imp: self, "Reached timeout, clearing overlay"); + gst::info!(CAT, imp = self, "Reached timeout, clearing overlay"); state.cea708_renderer.clear_composition(); state.last_cc_pts.take(); } @@ -390,7 +411,7 @@ impl Cea708Overlay { .unwrap(); if composition.blend(&mut frame).is_err() { - gst::error!(CAT, obj: pad, "Failed to blend composition"); + gst::error!(CAT, obj = pad, "Failed to blend composition"); } } } @@ -402,7 +423,7 @@ impl Cea708Overlay { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(c) => { let mut state = self.state.lock().unwrap(); @@ -614,7 +635,7 @@ impl ElementImpl for Cea708Overlay { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/video/closedcaption/src/jsontovtt/imp.rs b/video/closedcaption/src/jsontovtt/imp.rs index 4350110f..892b561d 100644 --- a/video/closedcaption/src/jsontovtt/imp.rs +++ b/video/closedcaption/src/jsontovtt/imp.rs @@ -243,7 +243,7 @@ impl State { } else { gst::debug!( CAT, - imp: imp, + imp = imp, "Reached timeout, clearing line running time {}, cur running time {}", line_running_time, running_time @@ -273,7 +273,7 @@ impl State { } else { gst::debug!( CAT, - imp: imp, + imp = imp, "Dropping empty duration cue, pts: {}, text: {}", lines.pts, output_text @@ -300,24 +300,24 @@ impl State { let mut ret = vec![]; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; let lines: Lines = serde_json::from_slice(&data).map_err(|err| { - gst::error!(CAT, obj: pad, "Failed to parse input as json: {}", err); + gst::error!(CAT, obj = pad, "Failed to parse input as json: {}", err); gst::FlowError::Error })?; let pts = buffer.pts().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require timestamped buffers"); + gst::error!(CAT, obj = pad, "Require timestamped buffers"); gst::FlowError::Error })?; let duration = buffer.duration().ok_or_else(|| { - gst::error!(CAT, obj: pad, "Require buffers with duration"); + gst::error!(CAT, obj = pad, "Require buffers with duration"); gst::FlowError::Error })?; @@ -326,7 +326,7 @@ impl State { None => { gst::warning!( CAT, - obj: pad, + obj = pad, "Dropping buffer outside segment: {:?}", buffer ); @@ -362,7 +362,7 @@ impl State { let (pts, duration) = match clamp(&self.segment, pts, duration) { Some((pts, duration)) => (pts, duration), None => { - gst::warning!(CAT, imp: imp, "Ignoring gap outside segment"); + gst::warning!(CAT, imp = imp, "Ignoring gap outside segment"); return ret; } }; @@ -381,7 +381,7 @@ impl State { fn handle_eos(&mut self, imp: &JsonToVtt) -> Vec { let mut ret = vec![]; - gst::log!(CAT, imp: imp, "handling EOS, {}", self.pending.len()); + gst::log!(CAT, imp = imp, "handling EOS, {}", self.pending.len()); self.drain(imp, &mut ret, None); ret @@ -394,7 +394,7 @@ impl JsonToVtt { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::trace!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::trace!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.lock().unwrap(); let buffers = state.handle_buffer(self, pad, buffer)?; @@ -413,14 +413,14 @@ impl JsonToVtt { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::CustomUpstream(ev) => { if gst_video::ForceKeyUnitEvent::is(ev) { match gst_video::UpstreamForceKeyUnitEvent::parse(ev) { Ok(fku_event) => { - gst::log!(CAT, obj: pad, "Handling fku {:?}", fku_event); + gst::log!(CAT, obj = pad, "Handling fku {:?}", fku_event); if fku_event.running_time.is_some() { self.handle_fku(ForceKeyUnitRequest::new_from_event(&fku_event)); @@ -428,7 +428,7 @@ impl JsonToVtt { } Err(_) => gst::warning!( CAT, - imp: self, + imp = self, "Invalid force-key-unit event received from downstream: {:?}", &ev ), @@ -444,10 +444,10 @@ impl JsonToVtt { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Eos(..) => { - gst::log!(CAT, obj: pad, "Handling EOS"); + gst::log!(CAT, obj = pad, "Handling EOS"); let mut state = self.state.lock().unwrap(); let buffers = state.handle_eos(self); drop(state); @@ -461,7 +461,7 @@ impl JsonToVtt { }; if downstream_caps.is_empty() { - gst::error!(CAT, obj: pad, "Empty downstream caps"); + gst::error!(CAT, obj = pad, "Empty downstream caps"); return false; } @@ -469,7 +469,7 @@ impl JsonToVtt { gst::debug!( CAT, - obj: pad, + obj = pad, "Negotiating for downstream caps {}", downstream_caps ); @@ -508,7 +508,7 @@ impl JsonToVtt { gst::Pad::event_default(pad, Some(&*self.obj()), event) } EventView::Gap(ev) => { - gst::log!(CAT, obj: pad, "Handling gap {:?}", ev); + gst::log!(CAT, obj = pad, "Handling gap {:?}", ev); let mut state = self.state.lock().unwrap(); let buffers = state.handle_gap(self, ev); drop(state); @@ -683,7 +683,7 @@ impl ElementImpl for JsonToVtt { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if transition == gst::StateChange::ReadyToPaused { let settings = self.settings.lock().unwrap(); diff --git a/video/closedcaption/src/mcc_enc/imp.rs b/video/closedcaption/src/mcc_enc/imp.rs index 634955dc..ee899baf 100644 --- a/video/closedcaption/src/mcc_enc/imp.rs +++ b/video/closedcaption/src/mcc_enc/imp.rs @@ -113,7 +113,7 @@ impl MccEnc { .latest() }) .ok_or_else(|| { - gst::error!(CAT, imp: self, "Invalid creation datetime"); + gst::error!(CAT, imp = self, "Invalid creation datetime"); gst::FlowError::Error })?; @@ -318,7 +318,7 @@ impl MccEnc { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.lock().unwrap(); @@ -342,7 +342,7 @@ impl MccEnc { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(ev) => { @@ -351,7 +351,7 @@ impl MccEnc { let framerate = match s.get::("framerate") { Ok(framerate) => framerate, Err(structure::GetError::FieldNotFound { .. }) => { - gst::error!(CAT, obj: pad, "Caps without framerate"); + gst::error!(CAT, obj = pad, "Caps without framerate"); return false; } err => panic!("MccEnc::sink_event caps: {err:?}"), @@ -385,10 +385,10 @@ impl MccEnc { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(_) => { - gst::log!(CAT, obj: pad, "Dropping seek event"); + gst::log!(CAT, obj = pad, "Dropping seek event"); false } _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -398,7 +398,7 @@ impl MccEnc { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -584,7 +584,7 @@ impl ElementImpl for MccEnc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs index f2e03274..1caea52a 100644 --- a/video/closedcaption/src/mcc_parse/imp.rs +++ b/video/closedcaption/src/mcc_parse/imp.rs @@ -186,7 +186,7 @@ impl State { gst::warning!( CAT, - imp: imp, + imp = imp, "Invalid timecode {:?}, using previous {:?}", timecode, last_timecode @@ -210,7 +210,7 @@ impl State { } else { gst::fixme!( CAT, - imp: imp, + imp = imp, "New position {} < last position {}", nsecs, self.last_position.display(), @@ -284,7 +284,7 @@ impl State { }; events.push(gst::event::Caps::new(&caps)); - gst::info!(CAT, imp: imp, "Caps changed to {:?}", &caps); + gst::info!(CAT, imp = imp, "Caps changed to {:?}", &caps); } } @@ -362,7 +362,7 @@ impl MccParse { gst::debug!( CAT, - imp: self, + imp = self, "Got caption buffer with timecode {:?} and size {}", tc, data.len() @@ -379,7 +379,7 @@ impl MccParse { } if data.len() < 3 { - gst::debug!(CAT, imp: self, "Too small caption packet: {}", data.len(),); + gst::debug!(CAT, imp = self, "Too small caption packet: {}", data.len(),); continue; } @@ -387,7 +387,7 @@ impl MccParse { (0x61, 0x01) => Format::Cea708Cdp, (0x61, 0x02) => Format::Cea608, (did, sdid) => { - gst::debug!(CAT, imp: self, "Unknown DID {:x} SDID {:x}", did, sdid); + gst::debug!(CAT, imp = self, "Unknown DID {:x} SDID {:x}", did, sdid); continue; } }; @@ -396,7 +396,7 @@ impl MccParse { if data.len() < 3 + len as usize { gst::debug!( CAT, - imp: self, + imp = self, "Too small caption packet: {} < {}", data.len(), 3 + len, @@ -424,7 +424,7 @@ impl MccParse { Ok(Some(MccLine::TimeCodeRate(rate, df))) => { gst::debug!( CAT, - imp: self, + imp = self, "Got timecode rate {} (drop frame {})", rate, df @@ -436,7 +436,7 @@ impl MccParse { } } Ok(Some(line)) => { - gst::debug!(CAT, imp: self, "Got line '{:?}'", line); + gst::debug!(CAT, imp = self, "Got line '{:?}'", line); } Err((line, err)) => { gst::element_imp_error!( @@ -527,13 +527,13 @@ impl MccParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } self.srcpad.push(buffer).map_err(|err| { if err != gst::FlowError::Flushing && err != gst::FlowError::Eos { - gst::error!(CAT, imp: self, "Pushing buffer returned {:?}", err); + gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err); } err })?; @@ -553,18 +553,18 @@ impl MccParse { state.pull = None; if !pad.peer_query(&mut query) { - gst::debug!(CAT, obj: pad, "Scheduling query failed on peer"); + gst::debug!(CAT, obj = pad, "Scheduling query failed on peer"); gst::PadMode::Push } else if query .has_scheduling_mode_with_flags(gst::PadMode::Pull, gst::SchedulingFlags::SEEKABLE) { - gst::debug!(CAT, obj: pad, "Activating in Pull mode"); + gst::debug!(CAT, obj = pad, "Activating in Pull mode"); state.pull = Some(PullState::new(self, &self.srcpad)); gst::PadMode::Pull } else { - gst::debug!(CAT, obj: pad, "Activating in Push mode"); + gst::debug!(CAT, obj = pad, "Activating in Push mode"); gst::PadMode::Push } }; @@ -602,7 +602,7 @@ impl MccParse { } fn scan_duration(&self) -> Result, gst::LoggableError> { - gst::debug!(CAT, imp: self, "Scanning duration"); + gst::debug!(CAT, imp = self, "Scanning duration"); /* First let's query the bytes duration upstream */ let mut q = gst::query::Duration::new(gst::Format::Bytes); @@ -675,7 +675,12 @@ impl MccParse { } if last_tc.is_some() || offset == 0 { - gst::debug!(CAT, imp: self, "Duration scan done, last_tc: {:?}", last_tc); + gst::debug!( + CAT, + imp = self, + "Duration scan done, last_tc: {:?}", + last_tc + ); break (Ok(last_tc)); } } @@ -703,7 +708,7 @@ impl MccParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } } @@ -736,13 +741,22 @@ impl MccParse { Ok(buffer) => Some(buffer), Err(gst::FlowError::Eos) => None, Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.sinkpad, "Pausing after pulling buffer, reason: flushing"); + gst::debug!( + CAT, + obj = self.sinkpad, + "Pausing after pulling buffer, reason: flushing" + ); let _ = self.sinkpad.pause_task(); return; } Err(flow) => { - gst::error!(CAT, obj: self.sinkpad, "Failed to pull, reason: {:?}", flow); + gst::error!( + CAT, + obj = self.sinkpad, + "Failed to pull, reason: {:?}", + flow + ); gst::element_imp_error!( self, @@ -787,17 +801,17 @@ impl MccParse { Err(flow) => { match flow { gst::FlowError::Flushing => { - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } gst::FlowError::Eos => { self.push_eos(); - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } _ => { self.push_eos(); - gst::error!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::error!(CAT, imp = self, "Pausing after flow {:?}", flow); gst::element_imp_error!( self, @@ -817,7 +831,7 @@ impl MccParse { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); self.handle_buffer(Some(buffer), false) } @@ -844,17 +858,17 @@ impl MccParse { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(_) => { // We send a proper caps event from the chain function later - gst::log!(CAT, obj: pad, "Dropping caps event"); + gst::log!(CAT, obj = pad, "Dropping caps event"); true } EventView::Segment(_) => { // We send a gst::Format::Time segment event later when needed - gst::log!(CAT, obj: pad, "Dropping segment event"); + gst::log!(CAT, obj = pad, "Dropping segment event"); true } EventView::FlushStop(_) => { @@ -865,9 +879,9 @@ impl MccParse { gst::Pad::event_default(pad, Some(&*self.obj()), event) } EventView::Eos(_) => { - gst::log!(CAT, obj: pad, "Draining"); + gst::log!(CAT, obj = pad, "Draining"); if let Err(err) = self.handle_buffer(None, false) { - gst::error!(CAT, obj: pad, "Failed to drain parser: {:?}", err); + gst::error!(CAT, obj = pad, "Failed to drain parser: {:?}", err); } gst::Pad::event_default(pad, Some(&*self.obj()), event) } @@ -876,7 +890,7 @@ impl MccParse { && !self.srcpad.has_current_caps() && event.type_() > gst::EventType::Caps { - gst::log!(CAT, obj: pad, "Deferring sticky event until we have caps"); + gst::log!(CAT, obj = pad, "Deferring sticky event until we have caps"); let mut state = self.state.lock().unwrap(); state.pending_events.push(event); true @@ -889,7 +903,7 @@ impl MccParse { fn perform_seek(&self, event: &gst::event::Seek) -> bool { if self.state.lock().unwrap().pull.is_none() { - gst::error!(CAT, imp: self, "seeking is only supported in pull mode"); + gst::error!(CAT, imp = self, "seeking is only supported in pull mode"); return false; } @@ -898,7 +912,7 @@ impl MccParse { let mut start: Option = match start.try_into() { Ok(start) => start, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; @@ -906,18 +920,18 @@ impl MccParse { let mut stop: Option = match stop.try_into() { Ok(stop) => stop, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; if !flags.contains(gst::SeekFlags::FLUSH) { - gst::error!(CAT, imp: self, "only flushing seeks are supported"); + gst::error!(CAT, imp = self, "only flushing seeks are supported"); return false; } if start_type == gst::SeekType::End || stop_type == gst::SeekType::End { - gst::error!(CAT, imp: self, "Relative seeks are not supported"); + gst::error!(CAT, imp = self, "Relative seeks are not supported"); return false; } @@ -927,14 +941,14 @@ impl MccParse { .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); let event = gst::event::FlushStart::builder() .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); let _ = self.sinkpad.pause_task(); @@ -962,7 +976,7 @@ impl MccParse { /* Drop our state while we push a serialized event upstream */ drop(state); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); state = self.state.lock().unwrap(); @@ -983,7 +997,7 @@ impl MccParse { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(e) => self.perform_seek(e), _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -993,7 +1007,7 @@ impl MccParse { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -1192,7 +1206,7 @@ impl ElementImpl for MccParse { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs index 4c04fa82..55c4f8b5 100644 --- a/video/closedcaption/src/scc_enc/imp.rs +++ b/video/closedcaption/src/scc_enc/imp.rs @@ -250,13 +250,13 @@ impl SccEnc { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.lock().unwrap(); let res = state.generate_caption(self, buffer)?; if let Some(outbuf) = res { - gst::trace!(CAT, obj: pad, "Pushing buffer {:?} to the pad", &outbuf); + gst::trace!(CAT, obj = pad, "Pushing buffer {:?} to the pad", &outbuf); drop(state); self.srcpad.push(outbuf)?; @@ -268,7 +268,7 @@ impl SccEnc { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(ev) => { @@ -277,7 +277,7 @@ impl SccEnc { let framerate = match s.get::("framerate") { Ok(framerate) => Some(framerate), Err(structure::GetError::FieldNotFound { .. }) => { - gst::error!(CAT, obj: pad, "Caps without framerate"); + gst::error!(CAT, obj = pad, "Caps without framerate"); return false; } err => panic!("SccEnc::sink_event caps: {err:?}"), @@ -296,15 +296,20 @@ impl SccEnc { let outbuf = state.write_line(self); if let Ok(Some(buffer)) = outbuf { - gst::trace!(CAT, obj: pad, "Pushing buffer {:?} to the pad", &buffer); + gst::trace!(CAT, obj = pad, "Pushing buffer {:?} to the pad", &buffer); drop(state); if self.srcpad.push(buffer).is_err() { - gst::error!(CAT, obj: pad, "Failed to push buffer to the pad"); + gst::error!(CAT, obj = pad, "Failed to push buffer to the pad"); return false; } } else if let Err(err) = outbuf { - gst::error!(CAT, obj: pad, "Failed to write a line after EOS: {:?}", err); + gst::error!( + CAT, + obj = pad, + "Failed to write a line after EOS: {:?}", + err + ); return false; } gst::Pad::event_default(pad, Some(&*self.obj()), event) @@ -316,10 +321,10 @@ impl SccEnc { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(_) => { - gst::log!(CAT, obj: pad, "Dropping seek event"); + gst::log!(CAT, obj = pad, "Dropping seek event"); false } _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -329,7 +334,7 @@ impl SccEnc { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -485,7 +490,7 @@ impl ElementImpl for SccEnc { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/scc_parse/imp.rs b/video/closedcaption/src/scc_parse/imp.rs index ea150ad7..f4e88983 100644 --- a/video/closedcaption/src/scc_parse/imp.rs +++ b/video/closedcaption/src/scc_parse/imp.rs @@ -161,7 +161,7 @@ impl State { gst::warning!( CAT, - imp: imp, + imp = imp, "Invalid timecode {:?}, using previous {:?}", err, last_timecode @@ -185,7 +185,7 @@ impl State { } else { gst::fixme!( CAT, - imp: imp, + imp = imp, "New position {} < last position {}", nsecs, self.last_position.display(), @@ -247,7 +247,7 @@ impl State { self.framerate = Some(framerate); events.push(gst::event::Caps::new(&caps)); - gst::info!(CAT, imp: imp, "Caps changed to {:?}", &caps); + gst::info!(CAT, imp = imp, "Caps changed to {:?}", &caps); } } @@ -304,7 +304,7 @@ impl SccParse { state = self.handle_line(tc, data, state)?; } Ok(Some(line)) => { - gst::debug!(CAT, imp: self, "Got line '{:?}'", line); + gst::debug!(CAT, imp = self, "Got line '{:?}'", line); } Err((line, err)) => { gst::element_imp_error!( @@ -333,7 +333,7 @@ impl SccParse { ) -> Result, gst::FlowError> { gst::trace!( CAT, - imp: self, + imp = self, "Got caption buffer with timecode {:?} and size {}", tc, data.len() @@ -361,7 +361,7 @@ impl SccParse { gst::trace!( CAT, - imp: self, + imp = self, "Checking inside of segment, line start {} line stop {} segment start {} num bufs {}", start_time, stop_time, @@ -410,7 +410,7 @@ impl SccParse { if clip_buffers { let end_time = buffer.pts().opt_add(buffer.duration()); if end_time.opt_lt(segment_start).unwrap_or(false) { - gst::trace!(CAT, imp: self, "Skip segment clipped buffer {:?}", buffer,); + gst::trace!(CAT, imp = self, "Skip segment clipped buffer {:?}", buffer,); continue; } @@ -440,13 +440,13 @@ impl SccParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } self.srcpad.push_list(buffers).map_err(|err| { if err != gst::FlowError::Flushing && err != gst::FlowError::Eos { - gst::error!(CAT, imp: self, "Pushing buffer returned {:?}", err); + gst::error!(CAT, imp = self, "Pushing buffer returned {:?}", err); } err })?; @@ -466,18 +466,18 @@ impl SccParse { state.pull = None; if !pad.peer_query(&mut query) { - gst::debug!(CAT, obj: pad, "Scheduling query failed on peer"); + gst::debug!(CAT, obj = pad, "Scheduling query failed on peer"); gst::PadMode::Push } else if query .has_scheduling_mode_with_flags(gst::PadMode::Pull, gst::SchedulingFlags::SEEKABLE) { - gst::debug!(CAT, obj: pad, "Activating in Pull mode"); + gst::debug!(CAT, obj = pad, "Activating in Pull mode"); state.pull = Some(PullState::new(self, &self.srcpad)); gst::PadMode::Pull } else { - gst::debug!(CAT, obj: pad, "Activating in Push mode"); + gst::debug!(CAT, obj = pad, "Activating in Push mode"); gst::PadMode::Push } }; @@ -515,7 +515,7 @@ impl SccParse { } fn scan_duration(&self) -> Result, gst::LoggableError> { - gst::debug!(CAT, imp: self, "Scanning duration"); + gst::debug!(CAT, imp = self, "Scanning duration"); /* First let's query the bytes duration upstream */ let mut q = gst::query::Duration::new(gst::Format::Bytes); @@ -590,7 +590,12 @@ impl SccParse { } if last_tc.is_some() || offset == 0 { - gst::debug!(CAT, imp: self, "Duration scan done, last_tc: {:?}", last_tc); + gst::debug!( + CAT, + imp = self, + "Duration scan done, last_tc: {:?}", + last_tc + ); break (Ok(last_tc)); } } @@ -616,7 +621,7 @@ impl SccParse { drop(state); for event in events { - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); } } @@ -640,13 +645,22 @@ impl SccParse { Ok(buffer) => Some(buffer), Err(gst::FlowError::Eos) => None, Err(gst::FlowError::Flushing) => { - gst::debug!(CAT, obj: self.sinkpad, "Pausing after pulling buffer, reason: flushing"); + gst::debug!( + CAT, + obj = self.sinkpad, + "Pausing after pulling buffer, reason: flushing" + ); let _ = self.sinkpad.pause_task(); return; } Err(flow) => { - gst::error!(CAT, obj: self.sinkpad, "Failed to pull, reason: {:?}", flow); + gst::error!( + CAT, + obj = self.sinkpad, + "Failed to pull, reason: {:?}", + flow + ); gst::element_imp_error!( self, @@ -690,17 +704,17 @@ impl SccParse { Err(flow) => { match flow { gst::FlowError::Flushing => { - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } gst::FlowError::Eos => { self.push_eos(); - gst::debug!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::debug!(CAT, imp = self, "Pausing after flow {:?}", flow); } _ => { self.push_eos(); - gst::error!(CAT, imp: self, "Pausing after flow {:?}", flow); + gst::error!(CAT, imp = self, "Pausing after flow {:?}", flow); gst::element_imp_error!( self, @@ -720,7 +734,7 @@ impl SccParse { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); self.handle_buffer(Some(buffer)) } @@ -745,17 +759,17 @@ impl SccParse { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(_) => { // We send a proper caps event from the chain function later - gst::log!(CAT, obj: pad, "Dropping caps event"); + gst::log!(CAT, obj = pad, "Dropping caps event"); true } EventView::Segment(_) => { // We send a gst::Format::Time segment event later when needed - gst::log!(CAT, obj: pad, "Dropping segment event"); + gst::log!(CAT, obj = pad, "Dropping segment event"); true } EventView::FlushStop(_) => { @@ -766,9 +780,9 @@ impl SccParse { gst::Pad::event_default(pad, Some(&*self.obj()), event) } EventView::Eos(_) => { - gst::log!(CAT, obj: pad, "Draining"); + gst::log!(CAT, obj = pad, "Draining"); if let Err(err) = self.handle_buffer(None) { - gst::error!(CAT, obj: pad, "Failed to drain parser: {:?}", err); + gst::error!(CAT, obj = pad, "Failed to drain parser: {:?}", err); } gst::Pad::event_default(pad, Some(&*self.obj()), event) } @@ -777,7 +791,7 @@ impl SccParse { && !self.srcpad.has_current_caps() && event.type_() > gst::EventType::Caps { - gst::log!(CAT, obj: pad, "Deferring sticky event until we have caps"); + gst::log!(CAT, obj = pad, "Deferring sticky event until we have caps"); let mut state = self.state.lock().unwrap(); state.pending_events.push(event); true @@ -790,7 +804,7 @@ impl SccParse { fn perform_seek(&self, event: &gst::event::Seek) -> bool { if self.state.lock().unwrap().pull.is_none() { - gst::error!(CAT, imp: self, "seeking is only supported in pull mode"); + gst::error!(CAT, imp = self, "seeking is only supported in pull mode"); return false; } @@ -799,7 +813,7 @@ impl SccParse { let mut start: Option = match start.try_into() { Ok(start) => start, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; @@ -807,18 +821,18 @@ impl SccParse { let mut stop: Option = match stop.try_into() { Ok(stop) => stop, Err(_) => { - gst::error!(CAT, imp: self, "seek has invalid format"); + gst::error!(CAT, imp = self, "seek has invalid format"); return false; } }; if !flags.contains(gst::SeekFlags::FLUSH) { - gst::error!(CAT, imp: self, "only flushing seeks are supported"); + gst::error!(CAT, imp = self, "only flushing seeks are supported"); return false; } if start_type == gst::SeekType::End || stop_type == gst::SeekType::End { - gst::error!(CAT, imp: self, "Relative seeks are not supported"); + gst::error!(CAT, imp = self, "Relative seeks are not supported"); return false; } @@ -828,14 +842,14 @@ impl SccParse { .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); let event = gst::event::FlushStart::builder() .seqnum(seek_seqnum) .build(); - gst::debug!(CAT, imp: self, "Pushing event {:?}", event); + gst::debug!(CAT, imp = self, "Pushing event {:?}", event); self.srcpad.push_event(event); let _ = self.sinkpad.pause_task(); @@ -863,7 +877,7 @@ impl SccParse { /* Drop our state while we push a serialized event upstream */ drop(state); - gst::debug!(CAT, imp: self, "Sending event {:?} upstream", event); + gst::debug!(CAT, imp = self, "Sending event {:?} upstream", event); self.sinkpad.push_event(event); state = self.state.lock().unwrap(); @@ -884,7 +898,7 @@ impl SccParse { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(e) => self.perform_seek(e), _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -894,7 +908,7 @@ impl SccParse { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Seeking(q) => { @@ -1078,7 +1092,7 @@ impl ElementImpl for SccParse { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused | gst::StateChange::PausedToReady => { diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index ea32b359..0c0d8146 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -233,7 +233,7 @@ impl TranscriberBin { pad_state: &TranscriberSinkPadState, state: &mut State, ) -> Result<(), Error> { - gst::debug!(CAT, imp: self, "Linking input audio stream {pad_name}"); + gst::debug!(CAT, imp = self, "Linking input audio stream {pad_name}"); pad_state .transcription_bin @@ -323,7 +323,7 @@ impl TranscriberBin { } fn construct_transcription_bin(&self, state: &mut State) -> Result<(), Error> { - gst::debug!(CAT, imp: self, "Building transcription bin"); + gst::debug!(CAT, imp = self, "Building transcription bin"); let ccconverter = gst::ElementFactory::make("ccconverter").build()?; @@ -517,7 +517,11 @@ impl TranscriberBin { } if !settings.passthrough { - gst::debug!(CAT, imp: self, "Linking transcription bins and synchronizing state"); + gst::debug!( + CAT, + imp = self, + "Linking transcription bins and synchronizing state" + ); state .transcription_bin .link_pads(Some("src"), &state.cccombiner, Some("caption")) @@ -558,7 +562,7 @@ impl TranscriberBin { let passthrough = self.settings.lock().unwrap().passthrough; if passthrough { - gst::debug!(CAT, imp: self, "disabling transcription bin"); + gst::debug!(CAT, imp = self, "disabling transcription bin"); for pad in state.audio_sink_pads.values() { let ps = pad.imp().state.lock().unwrap(); @@ -643,7 +647,13 @@ impl TranscriberBin { mux_method: MuxMethod, mode: Cea608Mode, ) { - gst::debug!(CAT, imp: self, "setting CC mode {:?} for pad {:?}", mode, pad); + gst::debug!( + CAT, + imp = self, + "setting CC mode {:?} for pad {:?}", + mode, + pad + ); for channel in pad_state.transcription_channels.values() { match mux_method { @@ -681,7 +691,7 @@ impl TranscriberBin { ) -> Result<(), Error> { gst::debug!( CAT, - imp: self, + imp = self, "Relinking transcriber, old: {:?}, new: {:?}", old_transcriber, pad_state.transcriber @@ -788,7 +798,7 @@ impl TranscriberBin { gst::debug!( CAT, - imp: self, + imp = self, "Updating transcription/translation language" ); @@ -799,7 +809,7 @@ impl TranscriberBin { .unwrap(); let peer = sinkpad.peer(); if let Some(peer) = &peer { - gst::debug!(CAT, imp: self, "Unlinking {:?}", peer); + gst::debug!(CAT, imp = self, "Unlinking {:?}", peer); peer.unlink(&sinkpad)?; pad_state.audio_tee.release_request_pad(peer); } @@ -816,7 +826,7 @@ impl TranscriberBin { if lang_code_only { if !settings.passthrough { - gst::debug!(CAT, imp: self, "Syncing state with parent"); + gst::debug!(CAT, imp = self, "Syncing state with parent"); drop(settings); @@ -897,7 +907,7 @@ impl TranscriberBin { self.setup_cc_mode(&pad.obj(), pad_state, state.mux_method, pad_settings.mode); if !settings.passthrough { - gst::debug!(CAT, imp: self, "Syncing state with parent"); + gst::debug!(CAT, imp = self, "Syncing state with parent"); let audio_tee_pad = pad_state.audio_tee.request_pad_simple("src_%u").unwrap(); @@ -916,7 +926,7 @@ impl TranscriberBin { fn update_languages(&self, pad: &super::TranscriberSinkPad, lang_code_only: bool) { gst::debug!( CAT, - imp: self, + imp = self, "Schedule transcription/translation language update for pad {pad:?}" ); @@ -930,7 +940,7 @@ impl TranscriberBin { .transcription_bin .static_pad(pad.name().as_str()) else { - gst::debug!(CAT, imp: pad.imp(), "transcription bin not set up yet"); + gst::debug!(CAT, imp = pad.imp(), "transcription bin not set up yet"); return; }; @@ -994,7 +1004,7 @@ impl TranscriberBin { fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool { use gst::QueryViewMut; - gst::log!(CAT, obj: pad, "Handling query {:?}", query); + gst::log!(CAT, obj = pad, "Handling query {:?}", query); match query.view_mut() { QueryViewMut::Latency(q) => { @@ -1104,7 +1114,7 @@ impl TranscriberBin { fn video_sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(e) => { let mut state = self.state.lock().unwrap(); @@ -1124,7 +1134,7 @@ impl TranscriberBin { if !had_framerate { gst::info!( CAT, - imp: self, + imp = self, "Received video caps, setting up transcription" ); self.setup_transcription(state); @@ -1345,10 +1355,14 @@ impl ObjectImpl for TranscriberBin { let s = self.state.lock().unwrap(); if let Some(state) = s.as_ref() { if settings.caption_source == CaptionSource::Inband { - gst::debug!(CAT, imp: self, "Use inband caption, dropping transcription"); + gst::debug!( + CAT, + imp = self, + "Use inband caption, dropping transcription" + ); state.transcription_valve.set_property("drop", true); } else { - gst::debug!(CAT, imp: self, "Stop dropping transcription"); + gst::debug!(CAT, imp = self, "Stop dropping transcription"); state.transcription_valve.set_property("drop", false); } } @@ -1528,7 +1542,11 @@ impl ElementImpl for TranscriberBin { fn release_pad(&self, pad: &gst::Pad) { if self.obj().current_state() > gst::State::Null { - gst::fixme!(CAT, obj: pad, "releasing secondary audio stream while PLAYING is untested"); + gst::fixme!( + CAT, + obj = pad, + "releasing secondary audio stream while PLAYING is untested" + ); } // In practice we will probably at least need some flushing here, @@ -1536,7 +1554,7 @@ impl ElementImpl for TranscriberBin { // releasing is in place let Some(pad) = pad.downcast_ref::() else { - gst::error!(CAT, imp: self, "not a transcriber sink pad: {pad:?}"); + gst::error!(CAT, imp = self, "not a transcriber sink pad: {pad:?}"); return; }; @@ -1704,7 +1722,7 @@ impl ElementImpl for TranscriberBin { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { @@ -1714,7 +1732,7 @@ impl ElementImpl for TranscriberBin { if state.framerate.is_some() { gst::info!( CAT, - imp: self, + imp = self, "Received video caps, setting up transcription" ); self.setup_transcription(state); @@ -1751,7 +1769,7 @@ impl BinImpl for TranscriberBin { if msg.src() == Some(pad_state.transcriber.upcast_ref()) { gst::error!( CAT, - imp: self, + imp = self, "Transcriber has posted an error ({m:?}), going back to passthrough", ); drop(ps); @@ -1888,7 +1906,7 @@ impl ObjectImpl for TranscriberSinkPad { .expect("type checked upstream"); gst::debug!( CAT, - imp: self, + imp = self, "Updated translation-languages {:?}", settings.translation_languages ); @@ -1937,7 +1955,7 @@ impl ObjectImpl for TranscriberSinkPad { if new_code != old_code { gst::debug!( CAT, - imp: self, + imp = self, "Updating language code {old_code} -> {new_code}", ); diff --git a/video/closedcaption/src/tttocea608/imp.rs b/video/closedcaption/src/tttocea608/imp.rs index 38d12a07..6afe20de 100644 --- a/video/closedcaption/src/tttocea608/imp.rs +++ b/video/closedcaption/src/tttocea608/imp.rs @@ -85,16 +85,9 @@ fn cc_data_buffer( if cc_data != [0x80, 0x80] { let code = cea608_types::tables::Code::from_data(cc_data); - gst::log!( - CAT, - imp: imp, - "{} -> {}: {:?}", - pts, - pts + duration, - code - ); + gst::log!(CAT, imp = imp, "{} -> {}: {:?}", pts, pts + duration, code); } else { - gst::trace!(CAT, imp: imp, "{} -> {}: padding", pts, pts + duration); + gst::trace!(CAT, imp = imp, "{} -> {}: padding", pts, pts + duration); } buf_mut.copy_from_slice(0, &cc_data).unwrap(); @@ -146,7 +139,7 @@ impl TtToCea608 { let mut_list = bufferlist.get_mut().unwrap(); while let Some(cea608) = state.translator.pop_output() { if cea608.frame_no > state.max_frame_no { - gst::warning!(CAT, imp: self, "Too much text for bandwidth"); + gst::warning!(CAT, imp = self, "Too much text for bandwidth"); } let frame_no = cea608.frame_no.min(state.max_frame_no); let pts = frame_no @@ -170,7 +163,7 @@ impl TtToCea608 { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, imp: self, "Handling {:?}", buffer); + gst::log!(CAT, imp = self, "Handling {:?}", buffer); let pts = buffer.pts().ok_or_else(|| { gst::element_imp_error!( @@ -191,7 +184,7 @@ impl TtToCea608 { })?; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -208,7 +201,7 @@ impl TtToCea608 { match state.json_input { false => { let data = std::str::from_utf8(&data).map_err(|err| { - gst::error!(CAT, obj: pad, "Can't decode utf8: {}", err); + gst::error!(CAT, obj = pad, "Can't decode utf8: {}", err); gst::FlowError::Error })?; @@ -242,7 +235,7 @@ impl TtToCea608 { } true => { lines = serde_json::from_slice(&data).map_err(|err| { - gst::error!(CAT, obj: pad, "Failed to parse input as json: {}", err); + gst::error!(CAT, obj = pad, "Failed to parse input as json: {}", err); gst::FlowError::Error })?; @@ -259,7 +252,7 @@ impl TtToCea608 { } fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); use gst::EventView; @@ -271,7 +264,7 @@ impl TtToCea608 { }; if downstream_caps.is_empty() { - gst::error!(CAT, obj: pad, "Empty downstream caps"); + gst::error!(CAT, obj = pad, "Empty downstream caps"); return false; } @@ -296,7 +289,7 @@ impl TtToCea608 { let s = upstream_caps.structure(0).unwrap(); state.json_input = s.name() == "application/x-json"; - gst::debug!(CAT, obj: pad, "Pushing caps {}", caps); + gst::debug!(CAT, obj = pad, "Pushing caps {}", caps); let new_event = gst::event::Caps::new(&caps); @@ -588,7 +581,7 @@ impl ElementImpl for TtToCea608 { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/tttocea708/imp.rs b/video/closedcaption/src/tttocea708/imp.rs index aa706bc0..31156f8c 100644 --- a/video/closedcaption/src/tttocea708/imp.rs +++ b/video/closedcaption/src/tttocea708/imp.rs @@ -157,7 +157,7 @@ impl TtToCea708 { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, imp: self, "Handling {:?}", buffer); + gst::log!(CAT, imp = self, "Handling {:?}", buffer); let pts = buffer.pts().ok_or_else(|| { gst::element_imp_error!( @@ -178,7 +178,7 @@ impl TtToCea708 { })?; let data = buffer.map_readable().map_err(|_| { - gst::error!(CAT, obj: pad, "Can't map buffer readable"); + gst::error!(CAT, obj = pad, "Can't map buffer readable"); gst::FlowError::Error })?; @@ -203,7 +203,7 @@ impl TtToCea708 { }; state.force_clear = false; let data = std::str::from_utf8(&data).map_err(|err| { - gst::error!(CAT, obj: pad, "Can't decode utf8: {}", err); + gst::error!(CAT, obj = pad, "Can't decode utf8: {}", err); gst::FlowError::Error })?; @@ -245,7 +245,7 @@ impl TtToCea708 { } fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); use gst::EventView; @@ -257,7 +257,7 @@ impl TtToCea708 { }; if downstream_caps.is_empty() { - gst::error!(CAT, obj: pad, "Empty downstream caps"); + gst::error!(CAT, obj = pad, "Empty downstream caps"); return false; } @@ -277,7 +277,7 @@ impl TtToCea708 { state.framerate = framerate; state.translator.set_framerate(framerate); - gst::debug!(CAT, obj: pad, "Pushing caps {}", caps); + gst::debug!(CAT, obj = pad, "Pushing caps {}", caps); let new_event = gst::event::Caps::new(&caps); @@ -300,7 +300,7 @@ impl TtToCea708 { gst::debug!( CAT, - imp: self, + imp = self, "Initial skip to frame no {}", state.last_frame_no ); @@ -653,7 +653,7 @@ impl ElementImpl for TtToCea708 { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); match transition { gst::StateChange::ReadyToPaused => { diff --git a/video/closedcaption/src/tttojson/imp.rs b/video/closedcaption/src/tttojson/imp.rs index e4f98fe3..2a69196c 100644 --- a/video/closedcaption/src/tttojson/imp.rs +++ b/video/closedcaption/src/tttojson/imp.rs @@ -123,7 +123,7 @@ impl TtToJson { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Caps(_) => { diff --git a/video/dav1d/src/dav1ddec/imp.rs b/video/dav1d/src/dav1ddec/imp.rs index 8195ca15..52e9ea2f 100644 --- a/video/dav1d/src/dav1ddec/imp.rs +++ b/video/dav1d/src/dav1ddec/imp.rs @@ -86,7 +86,7 @@ impl Dav1dDec { (layout, bpc) => { gst::warning!( CAT, - imp: self, + imp = self, "Unsupported dav1d format {:?}/{:?}", layout, bpc @@ -114,7 +114,7 @@ impl Dav1dDec { } }; f.parse::().unwrap_or_else(|_| { - gst::warning!(CAT, imp: self, "Unsupported dav1d format: {}", f); + gst::warning!(CAT, imp = self, "Unsupported dav1d format: {}", f); gst_video::VideoFormat::Unknown }) } @@ -141,7 +141,11 @@ impl Dav1dDec { gst_video::VideoColorMatrix::Bt2020 } _ => { - gst::warning!(CAT, imp: self, "Unsupported dav1d colorimetry matrix coefficients"); + gst::warning!( + CAT, + imp = self, + "Unsupported dav1d colorimetry matrix coefficients" + ); return None; } }; @@ -172,7 +176,11 @@ impl Dav1dDec { gst_video::VideoTransferFunction::AribStdB67 } _ => { - gst::warning!(CAT, imp: self, "Unsupported dav1d colorimetry transfer function"); + gst::warning!( + CAT, + imp = self, + "Unsupported dav1d colorimetry transfer function" + ); return None; } }; @@ -190,7 +198,7 @@ impl Dav1dDec { pixel::ColorPrimaries::P3Display => gst_video::VideoColorPrimaries::Smpteeg432, pixel::ColorPrimaries::Tech3213 => gst_video::VideoColorPrimaries::Ebu3213, _ => { - gst::warning!(CAT, imp: self, "Unsupported dav1d color primaries"); + gst::warning!(CAT, imp = self, "Unsupported dav1d color primaries"); return None; } }; @@ -241,7 +249,7 @@ impl Dav1dDec { gst::info!( CAT, - imp: self, + imp = self, "Negotiating format {:?} picture dimensions {}x{}", format, pic.width(), @@ -302,7 +310,7 @@ impl Dav1dDec { } fn flush_decoder(&self, state: &mut State) { - gst::info!(CAT, imp: self, "Flushing decoder"); + gst::info!(CAT, imp = self, "Flushing decoder"); state.decoder.flush(); } @@ -315,7 +323,7 @@ impl Dav1dDec { ) -> Result, gst::FlowError> { gst::trace!( CAT, - imp: self, + imp = self, "Sending data to decoder for frame {}", frame.system_frame_number() ); @@ -336,15 +344,15 @@ impl Dav1dDec { .send_data(input_data, frame_number, timestamp, duration) { Ok(()) => { - gst::trace!(CAT, imp: self, "Decoder returned OK"); + gst::trace!(CAT, imp = self, "Decoder returned OK"); Ok(std::ops::ControlFlow::Break(())) } Err(dav1d::Error::Again) => { - gst::trace!(CAT, imp: self, "Decoder returned EAGAIN"); + gst::trace!(CAT, imp = self, "Decoder returned EAGAIN"); Ok(std::ops::ControlFlow::Continue(())) } Err(dav1d::Error::InvalidArgument) => { - gst::trace!(CAT, imp: self, "Decoder returned EINVAL"); + gst::trace!(CAT, imp = self, "Decoder returned EINVAL"); gst_video::video_decoder_error!( &*self.obj(), 1, @@ -371,17 +379,17 @@ impl Dav1dDec { &self, state_guard: &mut MutexGuard>, ) -> Result, gst::FlowError> { - gst::trace!(CAT, imp: self, "Sending pending data to decoder"); + gst::trace!(CAT, imp = self, "Sending pending data to decoder"); let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?; match state.decoder.send_pending_data() { Ok(()) => { - gst::trace!(CAT, imp: self, "Decoder returned OK"); + gst::trace!(CAT, imp = self, "Decoder returned OK"); Ok(std::ops::ControlFlow::Break(())) } Err(err) if err.is_again() => { - gst::trace!(CAT, imp: self, "Decoder returned EAGAIN"); + gst::trace!(CAT, imp = self, "Decoder returned EAGAIN"); Ok(std::ops::ControlFlow::Continue(())) } Err(err) => { @@ -438,7 +446,7 @@ impl Dav1dDec { } else { gst::trace!( gst::CAT_PERFORMANCE, - imp: self, + imp = self, "Copying decoded video frame component {:?}", component ); @@ -496,7 +504,7 @@ impl Dav1dDec { mut state_guard: MutexGuard<'s, Option>, pic: &dav1d::Picture, ) -> Result>, gst::FlowError> { - gst::trace!(CAT, imp: self, "Handling picture {}", pic.offset()); + gst::trace!(CAT, imp = self, "Handling picture {}", pic.offset()); state_guard = self.handle_resolution_change(state_guard, pic)?; @@ -515,7 +523,7 @@ impl Dav1dDec { instance.finish_frame(frame)?; Ok(self.state.lock().unwrap()) } else { - gst::warning!(CAT, imp: self, "No frame found for offset {}", offset); + gst::warning!(CAT, imp = self, "No frame found for offset {}", offset); Ok(state_guard) } } @@ -524,23 +532,23 @@ impl Dav1dDec { &self, state_guard: &mut MutexGuard>, ) -> Result, gst::FlowError> { - gst::trace!(CAT, imp: self, "Retrieving pending picture"); + gst::trace!(CAT, imp = self, "Retrieving pending picture"); let state = state_guard.as_mut().ok_or(gst::FlowError::Flushing)?; match state.decoder.get_picture() { Ok(pic) => { - gst::trace!(CAT, imp: self, "Retrieved picture {}", pic.offset()); + gst::trace!(CAT, imp = self, "Retrieved picture {}", pic.offset()); Ok(Some(pic)) } Err(err) if err.is_again() => { - gst::trace!(CAT, imp: self, "Decoder needs more data"); + gst::trace!(CAT, imp = self, "Decoder needs more data"); Ok(None) } Err(err) => { gst::error!( CAT, - imp: self, + imp = self, "Retrieving decoded picture failed (error code {})", err ); @@ -767,7 +775,7 @@ impl VideoDecoderImpl for Dav1dDec { let latency = frame_latency * (info.fps().denom() as u64).seconds() / (fps_n as u64); - gst::debug!(CAT, imp: self, "Reporting latency of {}", latency); + gst::debug!(CAT, imp = self, "Reporting latency of {}", latency); min += latency; max = max.opt_add(latency); @@ -809,7 +817,7 @@ impl VideoDecoderImpl for Dav1dDec { let max_frame_delay: u32; let n_cpus = num_cpus::get(); - gst::info!(CAT, imp: self, "Detected {} logical CPUs", n_cpus); + gst::info!(CAT, imp = self, "Detected {} logical CPUs", n_cpus); if settings.max_frame_delay == -1 { let mut latency_query = gst::query::Latency::new(); @@ -826,7 +834,7 @@ impl VideoDecoderImpl for Dav1dDec { gst::info!( CAT, - imp: self, + imp = self, "Creating decoder with n-threads={} and max-frame-delay={}", settings.n_threads, max_frame_delay @@ -877,7 +885,7 @@ impl VideoDecoderImpl for Dav1dDec { } fn flush(&self) -> bool { - gst::info!(CAT, imp: self, "Flushing"); + gst::info!(CAT, imp = self, "Flushing"); { let mut state_guard = self.state.lock().unwrap(); @@ -890,7 +898,7 @@ impl VideoDecoderImpl for Dav1dDec { } fn drain(&self) -> Result { - gst::info!(CAT, imp: self, "Draining"); + gst::info!(CAT, imp = self, "Draining"); { let state_guard = self.state.lock().unwrap(); @@ -903,7 +911,7 @@ impl VideoDecoderImpl for Dav1dDec { } fn finish(&self) -> Result { - gst::info!(CAT, imp: self, "Finishing"); + gst::info!(CAT, imp = self, "Finishing"); { let state_guard = self.state.lock().unwrap(); diff --git a/video/gif/src/gifenc/imp.rs b/video/gif/src/gifenc/imp.rs index e92451c3..887184bf 100644 --- a/video/gif/src/gifenc/imp.rs +++ b/video/gif/src/gifenc/imp.rs @@ -266,7 +266,7 @@ impl VideoEncoderImpl for GifEnc { .map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?; let video_info = state.info(); - gst::debug!(CAT, imp: self, "Setting format {:?}", video_info); + gst::debug!(CAT, imp = self, "Setting format {:?}", video_info); { let mut state = State::new(video_info); @@ -299,7 +299,7 @@ impl VideoEncoderImpl for GifEnc { gst::debug!( CAT, - imp: self, + imp = self, "Sending frame {}", frame.system_frame_number() ); @@ -403,7 +403,7 @@ impl VideoEncoderImpl for GifEnc { impl GifEnc { fn flush_encoder(&self) -> Result { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); let trailer_buffer = self.state.borrow_mut().as_mut().map(|state| { // Drop encoder to flush and take flushed data (gif trailer) diff --git a/video/gtk4/src/lib.rs b/video/gtk4/src/lib.rs index 12c8dff4..519667b2 100644 --- a/video/gtk4/src/lib.rs +++ b/video/gtk4/src/lib.rs @@ -35,7 +35,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { #[cfg(not(feature = "gtk_v4_10"))] { if gtk::micro_version() >= 13 { - gst::warning!(sink::imp::CAT, obj: plugin, "GTK 4.13 or newer detected but plugin not compiled with support for this version. Rendering of video frames with alpha will likely be wrong"); + gst::warning!(sink::imp::CAT, obj = plugin, "GTK 4.13 or newer detected but plugin not compiled with support for this version. Rendering of video frames with alpha will likely be wrong"); } } diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index 53848a09..8c21d482 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -125,7 +125,7 @@ impl ObjectImpl for PaintableSink { // checking if GtkBin is registered to know if libgtk3.so is already present // GtkBin was dropped for GTK4 https://gitlab.gnome.org/GNOME/gtk/-/commit/3c165b3b77 if glib::types::Type::from_name("GtkBin").is_some() { - gst::error!(CAT, imp: self, "Skipping the creation of paintable to avoid segfault between GTK3 and GTK4"); + gst::error!(CAT, imp = self, "Skipping the creation of paintable to avoid segfault between GTK3 and GTK4"); return None::<&gdk::Paintable>.to_value(); } @@ -139,7 +139,7 @@ impl ObjectImpl for PaintableSink { let paintable = match &*paintable_guard { Some(ref paintable) => paintable, None => { - gst::error!(CAT, imp: self, "Failed to create paintable"); + gst::error!(CAT, imp = self, "Failed to create paintable"); return None::<&gdk::Paintable>.to_value(); } }; @@ -148,7 +148,7 @@ impl ObjectImpl for PaintableSink { if !paintable.is_owner() { gst::error!( CAT, - imp: self, + imp = self, "Can't retrieve Paintable from non-main thread" ); return None::<&gdk::Paintable>.to_value(); @@ -322,7 +322,7 @@ impl ElementImpl for PaintableSink { let res = utils::invoke_on_main_thread(gtk::init); if let Err(err) = res { - gst::error!(CAT, imp: self, "Failed to create initialize GTK: {err}"); + gst::error!(CAT, imp = self, "Failed to create initialize GTK: {err}"); return Err(gst::StateChangeError); } } @@ -335,7 +335,7 @@ impl ElementImpl for PaintableSink { } if paintable_guard.is_none() { - gst::error!(CAT, imp: self, "Failed to create paintable"); + gst::error!(CAT, imp = self, "Failed to create paintable"); return Err(gst::StateChangeError); } @@ -438,24 +438,24 @@ impl BaseSinkImpl for PaintableSink { templ[0].caps().clone() }); - gst::debug!(CAT, imp: self, "Advertising our own caps: {tmp_caps:?}"); + gst::debug!(CAT, imp = self, "Advertising our own caps: {tmp_caps:?}"); if let Some(filter_caps) = filter { gst::debug!( CAT, - imp: self, + imp = self, "Intersecting with filter caps: {filter_caps:?}", ); tmp_caps = filter_caps.intersect_with_mode(&tmp_caps, gst::CapsIntersectMode::First); }; - gst::debug!(CAT, imp: self, "Returning caps: {tmp_caps:?}"); + gst::debug!(CAT, imp = self, "Returning caps: {tmp_caps:?}"); Some(tmp_caps) } fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Setting caps {caps:?}"); + gst::debug!(CAT, imp = self, "Setting caps {caps:?}"); #[allow(unused_mut)] let mut video_info = None; @@ -482,7 +482,7 @@ impl BaseSinkImpl for PaintableSink { &self, query: &mut gst::query::Allocation, ) -> Result<(), gst::LoggableError> { - gst::debug!(CAT, imp: self, "Proposing Allocation query"); + gst::debug!(CAT, imp = self, "Proposing Allocation query"); self.parent_propose_allocation(query)?; @@ -508,7 +508,7 @@ impl BaseSinkImpl for PaintableSink { } fn query(&self, query: &mut gst::QueryRef) -> bool { - gst::log!(CAT, imp: self, "Handling query {:?}", query); + gst::log!(CAT, imp = self, "Handling query {:?}", query); match query.view_mut() { #[cfg(any(target_os = "macos", target_os = "windows", feature = "gst-gl"))] @@ -573,13 +573,13 @@ impl BaseSinkImpl for PaintableSink { impl VideoSinkImpl for PaintableSink { fn show_frame(&self, buffer: &gst::Buffer) -> Result { - gst::trace!(CAT, imp: self, "Rendering buffer {:?}", buffer); + gst::trace!(CAT, imp = self, "Rendering buffer {:?}", buffer); // Empty buffer, nothing to render if buffer.n_memory() == 0 { gst::trace!( CAT, - imp: self, + imp = self, "Empty buffer, nothing to render. Returning." ); return Ok(gst::FlowSuccess::Ok); @@ -587,7 +587,7 @@ impl VideoSinkImpl for PaintableSink { let config = self.config.lock().unwrap(); let info = config.info.as_ref().ok_or_else(|| { - gst::error!(CAT, imp: self, "Received no caps yet"); + gst::error!(CAT, imp = self, "Received no caps yet"); gst::FlowError::NotNegotiated })?; let orientation = config @@ -614,24 +614,24 @@ impl VideoSinkImpl for PaintableSink { }; let frame = Frame::new(buffer, info, orientation, wrapped_context.as_ref()).map_err(|err| { - gst::error!(CAT, imp: self, "Failed to map video frame"); + gst::error!(CAT, imp = self, "Failed to map video frame"); err })?; self.pending_frame.lock().unwrap().replace(frame); let sender = self.sender.lock().unwrap(); let sender = sender.as_ref().ok_or_else(|| { - gst::error!(CAT, imp: self, "Have no main thread sender"); + gst::error!(CAT, imp = self, "Have no main thread sender"); gst::FlowError::Flushing })?; match sender.try_send(SinkEvent::FrameChanged) { Ok(_) => (), Err(async_channel::TrySendError::Full(_)) => { - gst::warning!(CAT, imp: self, "Have too many pending frames"); + gst::warning!(CAT, imp = self, "Have too many pending frames"); } Err(async_channel::TrySendError::Closed(_)) => { - gst::error!(CAT, imp: self, "Have main thread receiver shut down"); + gst::error!(CAT, imp = self, "Have main thread receiver shut down"); return Err(gst::FlowError::Flushing); } } @@ -657,7 +657,7 @@ impl PaintableSink { let Some(frame) = self.pending_frame() else { return glib::ControlFlow::Continue; }; - gst::trace!(CAT, imp: self, "Frame changed"); + gst::trace!(CAT, imp = self, "Frame changed"); paintable.get_ref().handle_frame_changed(&self.obj(), frame); } } @@ -800,7 +800,7 @@ impl PaintableSink { &self, paintable_storage: &mut MutexGuard>>, ) { - gst::debug!(CAT, imp: self, "Initializing paintable"); + gst::debug!(CAT, imp = self, "Initializing paintable"); // The channel for the SinkEvents let (sender, receiver) = async_channel::bounded(3); @@ -845,7 +845,7 @@ impl PaintableSink { #[cfg(any(target_os = "macos", target_os = "windows", feature = "gst-gl"))] fn initialize_gl_context(&self) { - gst::debug!(CAT, imp: self, "Realizing GDK GL Context"); + gst::debug!(CAT, imp = self, "Realizing GDK GL Context"); let self_ = self.to_owned(); utils::invoke_on_main_thread(move || { @@ -855,11 +855,11 @@ impl PaintableSink { #[cfg(any(target_os = "macos", target_os = "windows", feature = "gst-gl"))] fn initialize_gl_context_main(&self) { - gst::debug!(CAT, imp: self, "Realizing GDK GL Context from main thread"); + gst::debug!(CAT, imp = self, "Realizing GDK GL Context from main thread"); let mut gl_context_guard = GL_CONTEXT.lock().unwrap(); if !matches!(&*gl_context_guard, GLContext::Uninitialized) { - gst::debug!(CAT, imp: self, "Already initialized GL context before"); + gst::debug!(CAT, imp = self, "Already initialized GL context before"); return; } *gl_context_guard = GLContext::Unsupported; @@ -880,14 +880,14 @@ impl PaintableSink { let gdk_display = match gdk::Display::default() { Some(display) => display, None => { - gst::warning!(CAT, imp: self, "Failed to retrieve GDK display"); + gst::warning!(CAT, imp = self, "Failed to retrieve GDK display"); return; } }; let gdk_context = match gdk_display.create_gl_context() { Ok(gdk_context) => gdk_context, Err(err) => { - gst::warning!(CAT, imp: self, "Failed to create GDK GL Context: {err}"); + gst::warning!(CAT, imp = self, "Failed to create GDK GL Context: {err}"); return; } }; @@ -906,19 +906,19 @@ impl PaintableSink { #[cfg(all(windows, feature = "winegl"))] "GdkWin32GLContextEGL" => (), display => { - gst::error!(CAT, imp: self, "Unsupported GDK display {display} for GL"); + gst::error!(CAT, imp = self, "Unsupported GDK display {display} for GL"); return; } } - gst::info!(CAT, imp: self, "Realizing GDK GL Context",); + gst::info!(CAT, imp = self, "Realizing GDK GL Context",); if let Err(err) = gdk_context.realize() { - gst::warning!(CAT, imp: self, "Failed to realize GDK GL Context: {err}"); + gst::warning!(CAT, imp = self, "Failed to realize GDK GL Context: {err}"); return; } - gst::info!(CAT, imp: self, "Successfully realized GDK GL Context"); + gst::info!(CAT, imp = self, "Successfully realized GDK GL Context"); gdk_context.make_current(); @@ -941,9 +941,9 @@ impl PaintableSink { }; let (display, wrapped_context) = res.unwrap(); match wrapped_context.activate(true) { - Ok(_) => gst::info!(CAT, imp: self, "Successfully activated GL Context"), + Ok(_) => gst::info!(CAT, imp = self, "Successfully activated GL Context"), Err(_) => { - gst::error!(CAT, imp: self, "Failed to activate GL context",); + gst::error!(CAT, imp = self, "Failed to activate GL context",); return; } }; @@ -951,21 +951,21 @@ impl PaintableSink { if let Err(err) = wrapped_context.fill_info() { gst::error!( CAT, - imp: self, + imp = self, "Failed to fill info on the GL Context: {err}", ); // Deactivate the context upon failure if wrapped_context.activate(false).is_err() { gst::error!( CAT, - imp: self, + imp = self, "Failed to deactivate the context after failing fill info", ); } return; } - gst::info!(CAT, imp: self, "Successfully initialized GL Context"); + gst::info!(CAT, imp = self, "Successfully initialized GL Context"); *gl_context_guard = GLContext::Initialized { display, @@ -981,7 +981,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL for x11 EGL backend and display" ); @@ -990,7 +990,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext"); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext"); return None; } @@ -1002,7 +1002,7 @@ impl PaintableSink { let x11_display = gdk_x11::ffi::gdk_x11_display_get_egl_display(display.to_glib_none().0); if x11_display.is_null() { - gst::error!(CAT, imp: self, "Failed to get EGL display"); + gst::error!(CAT, imp = self, "Failed to get EGL display"); return None; } @@ -1014,7 +1014,7 @@ impl PaintableSink { gst_gl::GLContext::new_wrapped(&gst_display, gl_ctx, platform, gl_api); let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, @@ -1031,7 +1031,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL for x11 GLX backend and display" ); @@ -1040,7 +1040,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext"); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext"); return None; } @@ -1051,7 +1051,7 @@ impl PaintableSink { let display = display.downcast::().unwrap(); let x11_display = gdk_x11::ffi::gdk_x11_display_get_xdisplay(display.to_glib_none().0); if x11_display.is_null() { - gst::error!(CAT, imp: self, "Failed to get X11 display"); + gst::error!(CAT, imp = self, "Failed to get X11 display"); return None; } @@ -1063,7 +1063,7 @@ impl PaintableSink { gst_gl::GLContext::new_wrapped(&gst_display, gl_ctx, platform, gl_api); let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, @@ -1080,7 +1080,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL for Wayland EGL backend and display" ); @@ -1089,7 +1089,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext"); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext"); return None; } @@ -1103,7 +1103,7 @@ impl PaintableSink { let wayland_display = gdk_wayland::ffi::gdk_wayland_display_get_wl_display(display.to_glib_none().0); if wayland_display.is_null() { - gst::error!(CAT, imp: self, "Failed to get Wayland display"); + gst::error!(CAT, imp = self, "Failed to get Wayland display"); return None; } @@ -1117,7 +1117,7 @@ impl PaintableSink { let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, @@ -1134,7 +1134,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL for macOS backend and display" ); @@ -1143,7 +1143,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext"); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext"); return None; } @@ -1154,7 +1154,7 @@ impl PaintableSink { let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, @@ -1172,7 +1172,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL with for Windows WGL backend and display." ); @@ -1186,7 +1186,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext",); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext",); return None; } @@ -1195,7 +1195,7 @@ impl PaintableSink { if let Some(display) = gst_gl::GLDisplay::with_type(gst_gl::GLDisplayType::WIN32) { display } else { - gst::error!(CAT, imp: self, "Failed to get GL display"); + gst::error!(CAT, imp = self, "Failed to get GL display"); return None; }; @@ -1205,7 +1205,7 @@ impl PaintableSink { gst_gl::GLContext::new_wrapped(&gst_display, gl_ctx, platform, gl_api); let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, @@ -1222,7 +1222,7 @@ impl PaintableSink { ) -> Option<(gst_gl::GLDisplay, gst_gl::GLContext)> { gst::info!( CAT, - imp: self, + imp = self, "Initializing GL with for Windows EGL backend and display." ); @@ -1232,7 +1232,7 @@ impl PaintableSink { let gl_ctx = gst_gl::GLContext::current_gl_context(platform); if gl_ctx == 0 { - gst::error!(CAT, imp: self, "Failed to get handle from GdkGLContext",); + gst::error!(CAT, imp = self, "Failed to get handle from GdkGLContext",); return None; } @@ -1248,7 +1248,7 @@ impl PaintableSink { let gst_display = gst_gl_egl::ffi::gst_gl_display_egl_from_gl_display(egl_display.cast()); if gst_display.is_null() { - gst::error!(CAT, imp: self, "Failed to get EGL display"); + gst::error!(CAT, imp = self, "Failed to get EGL display"); return None; } let gst_display = @@ -1261,7 +1261,7 @@ impl PaintableSink { let wrapped_context = match wrapped_context { None => { - gst::error!(CAT, imp: self, "Failed to create wrapped GL context"); + gst::error!(CAT, imp = self, "Failed to create wrapped GL context"); return None; } Some(wrapped_context) => wrapped_context, diff --git a/video/gtk4/src/sink/paintable/imp.rs b/video/gtk4/src/sink/paintable/imp.rs index 5a4b4391..872214ca 100644 --- a/video/gtk4/src/sink/paintable/imp.rs +++ b/video/gtk4/src/sink/paintable/imp.rs @@ -214,7 +214,7 @@ impl PaintableImpl for Paintable { let paintables = self.paintables.borrow(); let Some(first_paintable) = paintables.first() else { - gst::trace!(CAT, imp: self, "Snapshotting black frame"); + gst::trace!(CAT, imp = self, "Snapshotting black frame"); snapshot.append_color( &background_color, &graphene::Rect::new(0f32, 0f32, width as f32, height as f32), @@ -223,7 +223,7 @@ impl PaintableImpl for Paintable { return; }; - gst::trace!(CAT, imp: self, "Snapshotting frame"); + gst::trace!(CAT, imp = self, "Snapshotting frame"); // The first paintable is the actual video frame and defines the overall size. // @@ -513,7 +513,7 @@ impl Paintable { pub(super) fn handle_frame_changed(&self, sink: &crate::PaintableSink, frame: Frame) { let context = self.gl_context.borrow(); - gst::trace!(CAT, imp: self, "Received new frame"); + gst::trace!(CAT, imp = self, "Received new frame"); let new_paintables = match frame.into_textures(context.as_ref(), &mut self.cached_textures.borrow_mut()) { @@ -541,7 +541,7 @@ impl Paintable { if Some(new_size) != old_size { gst::debug!( CAT, - imp: self, + imp = self, "Size changed from {old_size:?} to {new_size:?}", ); self.obj().invalidate_size(); @@ -551,7 +551,7 @@ impl Paintable { } pub(super) fn handle_flush_frames(&self) { - gst::debug!(CAT, imp: self, "Flushing frames"); + gst::debug!(CAT, imp = self, "Flushing frames"); self.paintables.borrow_mut().clear(); self.cached_textures.borrow_mut().clear(); self.obj().invalidate_size(); diff --git a/video/hsv/src/hsvdetector/imp.rs b/video/hsv/src/hsvdetector/imp.rs index e32b3534..db36a1e2 100644 --- a/video/hsv/src/hsvdetector/imp.rs +++ b/video/hsv/src/hsvdetector/imp.rs @@ -223,7 +223,7 @@ impl ObjectImpl for HsvDetector { let hue_ref = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing hue-ref from {} to {}", settings.hue_ref, hue_ref @@ -235,7 +235,7 @@ impl ObjectImpl for HsvDetector { let hue_var = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing hue-var from {} to {}", settings.hue_var, hue_var @@ -247,7 +247,7 @@ impl ObjectImpl for HsvDetector { let saturation_ref = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing saturation-ref from {} to {}", settings.saturation_ref, saturation_ref @@ -259,7 +259,7 @@ impl ObjectImpl for HsvDetector { let saturation_var = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing saturation-var from {} to {}", settings.saturation_var, saturation_var @@ -271,7 +271,7 @@ impl ObjectImpl for HsvDetector { let value_ref = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing value-ref from {} to {}", settings.value_ref, value_ref @@ -283,7 +283,7 @@ impl ObjectImpl for HsvDetector { let value_var = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing value-var from {} to {}", settings.value_var, value_var @@ -402,7 +402,7 @@ impl BaseTransformImpl for HsvDetector { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, diff --git a/video/hsv/src/hsvfilter/imp.rs b/video/hsv/src/hsvfilter/imp.rs index 8beccf7c..3c577f1f 100644 --- a/video/hsv/src/hsvfilter/imp.rs +++ b/video/hsv/src/hsvfilter/imp.rs @@ -167,7 +167,7 @@ impl ObjectImpl for HsvFilter { let hue_shift = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing hue-shift from {} to {}", settings.hue_shift, hue_shift @@ -179,7 +179,7 @@ impl ObjectImpl for HsvFilter { let saturation_mul = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing saturation-mul from {} to {}", settings.saturation_mul, saturation_mul @@ -191,7 +191,7 @@ impl ObjectImpl for HsvFilter { let saturation_off = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing saturation-off from {} to {}", settings.saturation_off, saturation_off @@ -203,7 +203,7 @@ impl ObjectImpl for HsvFilter { let value_mul = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing value-mul from {} to {}", settings.value_mul, value_mul @@ -215,7 +215,7 @@ impl ObjectImpl for HsvFilter { let value_off = value.get().expect("type checked upstream"); gst::info!( CAT, - imp: self, + imp = self, "Changing value-off from {} to {}", settings.value_off, value_off diff --git a/video/png/src/pngenc/imp.rs b/video/png/src/pngenc/imp.rs index 5adacbde..d9477e1d 100644 --- a/video/png/src/pngenc/imp.rs +++ b/video/png/src/pngenc/imp.rs @@ -178,7 +178,7 @@ impl VideoEncoderImpl for PngEncoder { state: &gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>, ) -> Result<(), gst::LoggableError> { let video_info = state.info(); - gst::debug!(CAT, imp: self, "Setting format {:?}", video_info); + gst::debug!(CAT, imp = self, "Setting format {:?}", video_info); *self.state.lock() = Some(State { video_info }); @@ -201,7 +201,7 @@ impl VideoEncoderImpl for PngEncoder { gst::debug!( CAT, - imp: self, + imp = self, "Sending frame {}", frame.system_frame_number() ); @@ -232,7 +232,7 @@ impl VideoEncoderImpl for PngEncoder { encoder.set_filter(png::FilterType::from(settings.filter)); let mut writer = encoder.write_header().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to create encoder: {e}"); + gst::error!(CAT, imp = self, "Failed to create encoder: {e}"); gst::element_imp_error!(self, gst::CoreError::Failed, ["{e}"]); gst::FlowError::Error })?; @@ -241,14 +241,14 @@ impl VideoEncoderImpl for PngEncoder { let input_buffer = frame.input_buffer().expect("frame without input buffer"); let input_map = input_buffer.map_readable().unwrap(); writer.write_image_data(&input_map).map_err(|e| { - gst::error!(CAT, imp: self, "Failed to write image data: {e}"); + gst::error!(CAT, imp = self, "Failed to write image data: {e}"); gst::element_imp_error!(self, gst::CoreError::Failed, ["{e}"]); gst::FlowError::Error })?; } writer.finish().map_err(|e| { - gst::error!(CAT, imp: self, "Failed to finish encoder: {e}"); + gst::error!(CAT, imp = self, "Failed to finish encoder: {e}"); gst::element_imp_error!(self, gst::CoreError::Failed, ["{e}"]); gst::FlowError::Error })?; diff --git a/video/rav1e/src/rav1enc/imp.rs b/video/rav1e/src/rav1enc/imp.rs index 403b9fc8..6ab22b0e 100644 --- a/video/rav1e/src/rav1enc/imp.rs +++ b/video/rav1e/src/rav1enc/imp.rs @@ -575,7 +575,7 @@ impl VideoEncoderImpl for Rav1Enc { .map_err(|_| gst::loggable_error!(CAT, "Failed to drain"))?; let video_info = state.info(); - gst::debug!(CAT, imp: self, "Setting format {:?}", video_info); + gst::debug!(CAT, imp = self, "Setting format {:?}", video_info); let settings = self.settings.lock().unwrap(); @@ -825,13 +825,13 @@ impl VideoEncoderImpl for Rav1Enc { } fn flush(&self) -> bool { - gst::debug!(CAT, imp: self, "Flushing"); + gst::debug!(CAT, imp = self, "Flushing"); let mut state_guard = self.state.borrow_mut(); if let Some(ref mut state) = *state_guard { state.context.flush(); while let Ok(_) | Err(data::EncoderStatus::Encoded) = state.context.receive_packet() { - gst::debug!(CAT, imp: self, "Dropping packet on flush",); + gst::debug!(CAT, imp = self, "Dropping packet on flush",); } } @@ -839,7 +839,7 @@ impl VideoEncoderImpl for Rav1Enc { } fn finish(&self) -> Result { - gst::debug!(CAT, imp: self, "Finishing"); + gst::debug!(CAT, imp = self, "Finishing"); let mut state_guard = self.state.borrow_mut(); if let Some(ref mut state) = *state_guard { @@ -861,7 +861,7 @@ impl VideoEncoderImpl for Rav1Enc { gst::debug!( CAT, - imp: self, + imp = self, "Sending frame {}", frame.system_frame_number() ); @@ -887,7 +887,12 @@ impl VideoEncoderImpl for Rav1Enc { .contains(gst_video::VideoCodecFrameFlags::FORCE_KEYFRAME), ) { Ok(_) => { - gst::debug!(CAT, imp: self, "Sent frame {}", frame.system_frame_number()); + gst::debug!( + CAT, + imp = self, + "Sent frame {}", + frame.system_frame_number() + ); } Err(data::EncoderStatus::Failure) => { gst::element_imp_error!(self, gst::CoreError::Failed, ["Failed to send frame"]); @@ -907,7 +912,7 @@ impl Rav1Enc { Ok((packet_type, packet_number, frame_number, packet_data)) => { gst::debug!( CAT, - imp: self, + imp = self, "Received packet {} of size {}, frame type {:?}", packet_number, packet_data.len(), @@ -927,10 +932,10 @@ impl Rav1Enc { instance.finish_frame(frame)?; } Err(data::EncoderStatus::Encoded) => { - gst::debug!(CAT, imp: self, "Encoded but not output frame yet",); + gst::debug!(CAT, imp = self, "Encoded but not output frame yet",); } Err(data::EncoderStatus::NeedMoreData) => { - gst::debug!(CAT, imp: self, "Encoded but need more data",); + gst::debug!(CAT, imp = self, "Encoded but need more data",); return Ok(gst::FlowSuccess::Ok); } Err(data::EncoderStatus::Failure) => { @@ -942,7 +947,12 @@ impl Rav1Enc { return Err(gst::FlowError::Error); } Err(err) => { - gst::debug!(CAT, imp: self, "Soft error when receiving frame: {:?}", err); + gst::debug!( + CAT, + imp = self, + "Soft error when receiving frame: {:?}", + err + ); return Ok(gst::FlowSuccess::Ok); } } diff --git a/video/videofx/src/border/imp.rs b/video/videofx/src/border/imp.rs index 99681b75..eabeb786 100644 --- a/video/videofx/src/border/imp.rs +++ b/video/videofx/src/border/imp.rs @@ -298,7 +298,7 @@ impl ObjectImpl for RoundedCorners { settings.changed = true; gst::info!( CAT, - imp: self, + imp = self, "Changing border radius from {} to {}", settings.border_radius_px, border_radius @@ -378,7 +378,7 @@ impl BaseTransformImpl for RoundedCorners { fn stop(&self) -> Result<(), gst::ErrorMessage> { let _ = self.state.lock().unwrap().take(); - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -425,7 +425,7 @@ impl BaseTransformImpl for RoundedCorners { gst::debug!( CAT, - imp: self, + imp = self, "Transformed caps from {} to {} in direction {:?}", caps, other_caps, @@ -449,7 +449,7 @@ impl BaseTransformImpl for RoundedCorners { gst::debug!( CAT, - imp: self, + imp = self, "Configured for caps {} to {}", incaps, outcaps @@ -490,7 +490,7 @@ impl BaseTransformImpl for RoundedCorners { settings.changed = false; gst::debug!( CAT, - imp: self, + imp = self, "Caps or border radius changed, generating alpha mask" ); let state_guard = self.state.lock().unwrap(); @@ -530,7 +530,7 @@ impl BaseTransformImpl for RoundedCorners { InputBuffer::Writable(outbuf) => { gst::log!( CAT, - imp: self, + imp = self, "Received writable input buffer of size: {}", outbuf.size() ); @@ -542,7 +542,7 @@ impl BaseTransformImpl for RoundedCorners { InputBuffer::Readable(buf) => { gst::log!( CAT, - imp: self, + imp = self, "Received readable input buffer of size: {}", buf.size() ); diff --git a/video/videofx/src/colordetect/imp.rs b/video/videofx/src/colordetect/imp.rs index f3112c86..9132d999 100644 --- a/video/videofx/src/colordetect/imp.rs +++ b/video/videofx/src/colordetect/imp.rs @@ -95,7 +95,7 @@ impl ColorDetect { fn color_changed(&self, dominant_color_name: &str, palette: Vec) { gst::debug!( CAT, - imp: self, + imp = self, "Dominant color changed to {}", dominant_color_name ); @@ -159,7 +159,7 @@ impl ObjectImpl for ColorDetect { if settings.quality != quality { gst::info!( CAT, - imp: self, + imp = self, "Changing quality from {} to {}", settings.quality, quality @@ -173,7 +173,7 @@ impl ObjectImpl for ColorDetect { if settings.max_colors != max_colors { gst::info!( CAT, - imp: self, + imp = self, "Changing max_colors from {} to {}", settings.max_colors, max_colors @@ -258,7 +258,7 @@ impl BaseTransformImpl for ColorDetect { fn stop(&self) -> Result<(), gst::ErrorMessage> { *self.state.borrow_mut() = None; - gst::info!(CAT, imp: self, "Stopped"); + gst::info!(CAT, imp = self, "Stopped"); Ok(()) } @@ -275,7 +275,7 @@ impl BaseTransformImpl for ColorDetect { gst::debug!( CAT, - imp: self, + imp = self, "Configured for caps {} to {}", incaps, outcaps diff --git a/video/videofx/src/videocompare/imp.rs b/video/videofx/src/videocompare/imp.rs index 15b9aa3f..41c91d7a 100644 --- a/video/videofx/src/videocompare/imp.rs +++ b/video/videofx/src/videocompare/imp.rs @@ -101,7 +101,7 @@ impl ObjectImpl for VideoCompare { if settings.hash_algo != hash_algo { gst::info!( CAT, - imp: self, + imp = self, "Changing hash-algo from {:?} to {:?}", settings.hash_algo, hash_algo @@ -117,7 +117,7 @@ impl ObjectImpl for VideoCompare { if settings.max_distance_threshold != max_distance_threshold { gst::info!( CAT, - imp: self, + imp = self, "Changing max-dist-threshold from {} to {}", settings.max_distance_threshold, max_distance_threshold @@ -222,7 +222,7 @@ impl AggregatorImpl for VideoCompare { let pad = pad.clone().upcast::(); gst::info!( CAT, - imp: self, + imp = self, "Reference sink pad selected: {}", pad.name() ); @@ -242,7 +242,7 @@ impl AggregatorImpl for VideoCompare { if !sink_caps.can_intersect(caps) { gst::error!( CAT, - imp: self, + imp = self, "Proposed src caps ({:?}) not supported, needs to intersect with the reference sink caps ({:?})", caps, sink_caps @@ -250,7 +250,7 @@ impl AggregatorImpl for VideoCompare { return Err(gst::FlowError::NotNegotiated); } - gst::info!(CAT, imp: self, "Caps for src pad: {:?}", sink_caps); + gst::info!(CAT, imp = self, "Caps for src pad: {:?}", sink_caps); Ok(sink_caps) } } @@ -273,7 +273,7 @@ impl VideoAggregatorImpl for VideoCompare { .unwrap() }) .ok_or_else(|| { - gst::warning!(CAT, imp: self, "No reference sink pad exists"); + gst::warning!(CAT, imp = self, "No reference sink pad exists"); gst::FlowError::Eos })? }; @@ -286,7 +286,7 @@ impl VideoAggregatorImpl for VideoCompare { } else { gst::warning!( CAT, - imp: self, + imp = self, "The reference sink pad '{}' has not produced a buffer, image comparison not possible", reference_pad.name() ); @@ -339,7 +339,7 @@ impl VideoAggregatorImpl for VideoCompare { { gst::error!( CAT, - imp: self, + imp = self, "Video streams do not have the same sizes (add videoscale and force the sizes to be equal on all sink pads)", ); return Err(gst::FlowError::NotNegotiated); @@ -365,7 +365,7 @@ impl VideoAggregatorImpl for VideoCompare { { gst::debug!( CAT, - imp: self, + imp = self, "Image detected {}", message.running_time.unwrap().display() ); @@ -378,7 +378,7 @@ impl VideoAggregatorImpl for VideoCompare { } else { gst::debug!( CAT, - imp: self, + imp = self, "Compared images and could not find any frame with distance lower than the threshold of {}: {:?}", max_distance_threshold, message diff --git a/video/webp/src/dec/imp.rs b/video/webp/src/dec/imp.rs index 8e70c950..3e8eea01 100644 --- a/video/webp/src/dec/imp.rs +++ b/video/webp/src/dec/imp.rs @@ -138,7 +138,7 @@ impl WebPDec { pad: &gst::Pad, buffer: gst::Buffer, ) -> Result { - gst::log!(CAT, obj: pad, "Handling buffer {:?}", buffer); + gst::log!(CAT, obj = pad, "Handling buffer {:?}", buffer); let mut state = self.state.lock().unwrap(); @@ -236,7 +236,7 @@ impl WebPDec { fn sink_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::FlushStop(..) => { let mut state = self.state.lock().unwrap(); @@ -257,7 +257,7 @@ impl WebPDec { fn src_event(&self, pad: &gst::Pad, event: gst::Event) -> bool { use gst::EventView; - gst::log!(CAT, obj: pad, "Handling event {:?}", event); + gst::log!(CAT, obj = pad, "Handling event {:?}", event); match event.view() { EventView::Seek(..) => false, _ => gst::Pad::event_default(pad, Some(&*self.obj()), event), @@ -365,7 +365,7 @@ impl ElementImpl for WebPDec { &self, transition: gst::StateChange, ) -> Result { - gst::trace!(CAT, imp: self, "Changing state {:?}", transition); + gst::trace!(CAT, imp = self, "Changing state {:?}", transition); if transition == gst::StateChange::PausedToReady { *self.state.lock().unwrap() = State::default();