Skip to content

Commit

Permalink
move out decode ending test from process input function
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramart committed Feb 21, 2024
1 parent d4e0ede commit cb681c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/order/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Order {
pub outputs: Vec<Output>,
pub graph: Vec<Filter>,
#[serde(skip)]
total_streams: u32,
pub total_streams: u32,
#[serde(skip)]
input_formats: Vec<DecoderFormat>,
#[serde(skip)]
Expand Down Expand Up @@ -81,7 +81,9 @@ impl Order {

while !decode_end {
let (in_audio_frames, in_video_frames, in_subtitle_packets, end) = self.process_input();
decode_end = end;
if end == self.total_streams {
decode_end = true;
}

match self.filtering(&in_audio_frames, &in_video_frames, &in_subtitle_packets) {
Ok(result) => {
Expand All @@ -96,12 +98,11 @@ impl Order {
Ok(results)
}

pub fn process_input(&mut self) -> (Vec<Frame>, Vec<Frame>, Vec<Packet>, bool) {
pub fn process_input(&mut self) -> (Vec<Frame>, Vec<Frame>, Vec<Packet>, u32) {
let mut audio_frames = vec![];
let mut subtitle_packets = vec![];
let mut video_frames = vec![];
let mut end = 0;
let mut decode_end = false;

for format in &mut self.input_formats {
for _ in 0..format.context.get_nb_streams() {
Expand Down Expand Up @@ -149,11 +150,8 @@ impl Order {
}
}
}
if end == self.total_streams {
decode_end = true;
}

(audio_frames, video_frames, subtitle_packets, decode_end)
(audio_frames, video_frames, subtitle_packets, end)
}

pub fn filtering(
Expand Down
4 changes: 3 additions & 1 deletion src/probe/deep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ impl DeepProbe {

while !decode_end {
let (in_audio_frames, in_video_frames, in_subtitle_packets, end) = order_src.process_input();
decode_end = end;
if end == order_src.total_streams {
decode_end = true;
}

for order in &mut deep_orders.orders {
match order
Expand Down

0 comments on commit cb681c0

Please sign in to comment.