mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-02 00:11:01 +00:00
jsontovtt: Print object information to debug message
Use GST_*_OBJECT() variant debug printing method whenever possible
This commit is contained in:
parent
3d317b976e
commit
b1b707008f
1 changed files with 19 additions and 11 deletions
|
@ -182,7 +182,12 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drain(&mut self, buffers: &mut Vec<gst::Buffer>, running_time: Option<gst::ClockTime>) {
|
fn drain(
|
||||||
|
&mut self,
|
||||||
|
imp: &JsonToVtt,
|
||||||
|
buffers: &mut Vec<gst::Buffer>,
|
||||||
|
running_time: Option<gst::ClockTime>,
|
||||||
|
) {
|
||||||
/* We don't output anything until we've received the first request, we trigger
|
/* We don't output anything until we've received the first request, we trigger
|
||||||
* that first request by sending a first header buffer for each new fragment.
|
* that first request by sending a first header buffer for each new fragment.
|
||||||
*
|
*
|
||||||
|
@ -239,6 +244,7 @@ impl State {
|
||||||
} else {
|
} else {
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
CAT,
|
CAT,
|
||||||
|
imp: imp,
|
||||||
"Reached timeout, clearing line running time {}, cur running time {}",
|
"Reached timeout, clearing line running time {}, cur running time {}",
|
||||||
line_running_time,
|
line_running_time,
|
||||||
running_time
|
running_time
|
||||||
|
@ -268,6 +274,7 @@ impl State {
|
||||||
} else {
|
} else {
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
CAT,
|
CAT,
|
||||||
|
imp: imp,
|
||||||
"Dropping empty duration cue, pts: {}, text: {}",
|
"Dropping empty duration cue, pts: {}, text: {}",
|
||||||
lines.pts,
|
lines.pts,
|
||||||
output_text
|
output_text
|
||||||
|
@ -287,6 +294,7 @@ impl State {
|
||||||
|
|
||||||
fn handle_buffer(
|
fn handle_buffer(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
imp: &JsonToVtt,
|
||||||
pad: &gst::Pad,
|
pad: &gst::Pad,
|
||||||
buffer: gst::Buffer,
|
buffer: gst::Buffer,
|
||||||
) -> Result<Vec<gst::Buffer>, gst::FlowError> {
|
) -> Result<Vec<gst::Buffer>, gst::FlowError> {
|
||||||
|
@ -340,14 +348,14 @@ impl State {
|
||||||
line_running_time,
|
line_running_time,
|
||||||
});
|
});
|
||||||
|
|
||||||
self.drain(&mut ret, line_running_time);
|
self.drain(imp, &mut ret, line_running_time);
|
||||||
|
|
||||||
self.last_pts = Some(pts + duration);
|
self.last_pts = Some(pts + duration);
|
||||||
|
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_gap(&mut self, gap: &gst::event::Gap) -> Vec<gst::Buffer> {
|
fn handle_gap(&mut self, imp: &JsonToVtt, gap: &gst::event::Gap) -> Vec<gst::Buffer> {
|
||||||
let mut ret = vec![];
|
let mut ret = vec![];
|
||||||
|
|
||||||
let (pts, duration) = gap.get();
|
let (pts, duration) = gap.get();
|
||||||
|
@ -355,7 +363,7 @@ impl State {
|
||||||
let (pts, duration) = match clamp(&self.segment, pts, duration) {
|
let (pts, duration) = match clamp(&self.segment, pts, duration) {
|
||||||
Some((pts, duration)) => (pts, duration),
|
Some((pts, duration)) => (pts, duration),
|
||||||
None => {
|
None => {
|
||||||
gst::warning!(CAT, "Ignoring gap outside segment");
|
gst::warning!(CAT, imp: imp, "Ignoring gap outside segment");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -364,18 +372,18 @@ impl State {
|
||||||
ret.push(buffer);
|
ret.push(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.drain(&mut ret, self.segment.to_running_time(pts));
|
self.drain(imp, &mut ret, self.segment.to_running_time(pts));
|
||||||
|
|
||||||
self.last_pts = Some(pts).opt_add(duration).or(Some(pts));
|
self.last_pts = Some(pts).opt_add(duration).or(Some(pts));
|
||||||
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_eos(&mut self) -> Vec<gst::Buffer> {
|
fn handle_eos(&mut self, imp: &JsonToVtt) -> Vec<gst::Buffer> {
|
||||||
let mut ret = vec![];
|
let mut ret = vec![];
|
||||||
|
|
||||||
gst::log!(CAT, "handling EOS, {}", self.pending.len());
|
gst::log!(CAT, imp: imp, "handling EOS, {}", self.pending.len());
|
||||||
self.drain(&mut ret, None);
|
self.drain(imp, &mut ret, None);
|
||||||
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
@ -390,7 +398,7 @@ impl JsonToVtt {
|
||||||
gst::trace!(CAT, obj: pad, "Handling buffer {:?}", buffer);
|
gst::trace!(CAT, obj: pad, "Handling buffer {:?}", buffer);
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
|
|
||||||
let buffers = state.handle_buffer(pad, buffer)?;
|
let buffers = state.handle_buffer(self, pad, buffer)?;
|
||||||
drop(state);
|
drop(state);
|
||||||
self.output(buffers)?;
|
self.output(buffers)?;
|
||||||
|
|
||||||
|
@ -442,7 +450,7 @@ impl JsonToVtt {
|
||||||
EventView::Eos(..) => {
|
EventView::Eos(..) => {
|
||||||
gst::log!(CAT, obj: pad, "Handling EOS");
|
gst::log!(CAT, obj: pad, "Handling EOS");
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
let buffers = state.handle_eos();
|
let buffers = state.handle_eos(self);
|
||||||
drop(state);
|
drop(state);
|
||||||
let _ = self.output(buffers);
|
let _ = self.output(buffers);
|
||||||
pad.event_default(Some(&*self.instance()), event)
|
pad.event_default(Some(&*self.instance()), event)
|
||||||
|
@ -503,7 +511,7 @@ impl JsonToVtt {
|
||||||
EventView::Gap(ev) => {
|
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 mut state = self.state.lock().unwrap();
|
||||||
let buffers = state.handle_gap(ev);
|
let buffers = state.handle_gap(self, ev);
|
||||||
drop(state);
|
drop(state);
|
||||||
let _ = self.output(buffers);
|
let _ = self.output(buffers);
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in a new issue