format/context: fix the packets iterator
This commit is contained in:
parent
1e5d77816a
commit
b712412e77
@ -195,15 +195,19 @@ impl<'a> Iterator for PacketIter<'a> {
|
||||
fn next(&mut self) -> Option<<Self as Iterator>::Item> {
|
||||
let mut packet = Packet::empty();
|
||||
|
||||
loop {
|
||||
match packet.read(self.context) {
|
||||
Ok(..) => unsafe {
|
||||
let stream = Stream::wrap(*(*self.context.as_ptr()).streams.offset(packet.stream() as isize));
|
||||
Ok(..) =>
|
||||
return Some((unsafe {
|
||||
Stream::wrap(*(*self.context.as_ptr()).streams.offset(packet.stream() as isize))
|
||||
}, packet)),
|
||||
|
||||
Some((stream, packet))
|
||||
},
|
||||
Err(Error::Eof) =>
|
||||
return None,
|
||||
|
||||
_ =>
|
||||
None
|
||||
Err(..) =>
|
||||
()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user