Skip to content

Commit 3911364

Browse files
committed
unify slice handling
1 parent f05c971 commit 3911364

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/h264/decoder.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ impl Decoder {
101101
NalUnitType::SliceDataA => {}
102102
NalUnitType::SliceDataB => {}
103103
NalUnitType::SliceDataC => {}
104-
NalUnitType::NonIDRSlice => {
104+
NalUnitType::IDRSlice | NalUnitType::NonIDRSlice => {
105105
let mut slice =
106106
parser::parse_slice_header(&self.context, &nal, &mut unit_input)
107107
.map_err(parse_error_handler)?;
108108

109-
info!("non-IDR Slice: {:#?}", slice);
109+
info!("{:?} {:#?}", nal.nal_unit_type, slice);
110110
let frame = VideoFrame::new_with_padding(
111111
slice.sps.pic_width(),
112112
slice.sps.pic_hight(),
@@ -120,25 +120,6 @@ impl Decoder {
120120
info!("Blocks: {:#?}", slice.get_macroblock_count());
121121
self.process_slice(&mut slice)?;
122122
}
123-
NalUnitType::IDRSlice => {
124-
let mut slice =
125-
parser::parse_slice_header(&self.context, &nal, &mut unit_input)
126-
.map_err(parse_error_handler)?;
127-
128-
info!("IDR Slice: {:#?}", slice);
129-
let frame = VideoFrame::new_with_padding(
130-
slice.sps.pic_width(),
131-
slice.sps.pic_hight(),
132-
v_frame::pixel::ChromaSampling::Cs420,
133-
16,
134-
);
135-
self.frame_buffer.push(frame);
136-
137-
parser::parse_slice_data(&mut unit_input, &mut slice)
138-
.map_err(parse_error_handler)?;
139-
info!("Blocks: {:#?}", slice.get_macroblock_count());
140-
self.process_slice(&mut slice)?; // Temporarily stop after first slice
141-
}
142123
NalUnitType::SupplementalEnhancementInfo => {}
143124
NalUnitType::SeqParameterSet => {
144125
let sps = parser::parse_sps(&mut unit_input).map_err(parse_error_handler)?;

0 commit comments

Comments
 (0)