+ if fmt.is_paletted() {
+//todo various-sized palettes?
+ let stride = vinfo.get_format().get_chromaton(0).unwrap().get_linesize(width);
+ let pic_sz = stride.checked_mul(height);
+ if pic_sz == None { return Err(AllocatorError::TooLargeDimensions); }
+ let pal_size = 256 * (fmt.get_elem_size() as usize);
+ let new_size = pic_sz.unwrap().checked_add(pal_size);
+ if new_size == None { return Err(AllocatorError::TooLargeDimensions); }
+ offs.push(0);
+ offs.push(stride * height);
+ strides.push(stride);
+ let mut data: Vec<u8> = Vec::with_capacity(new_size.unwrap());
+ data.resize(new_size.unwrap(), 0);
+ let buf: NAVideoBuffer<u8> = NAVideoBuffer { data: Rc::new(RefCell::new(data)), info: vinfo, offs: offs, strides: strides };
+ Ok(NABufferType::Video(buf))
+ } else if !all_packed {