WithEncoderPadding will add padding to all output so the size will be a multiple of n. This can be used to obfuscate the exact output size or make blocks of a certain size. The contents will be a skippable frame, so it will be invisible by the decoder. n must be > 0 and <= 1GB, 1<<30 bytes. The padd
(n int)
| 140 | // If `EncodeAll` is used with data already in the destination, the total size will be multiple of this. |
| 141 | // Can be changed with ResetWithOptions. |
| 142 | func WithEncoderPadding(n int) EOption { |
| 143 | return func(o *encoderOptions) error { |
| 144 | if n <= 0 { |
| 145 | return fmt.Errorf("padding must be at least 1") |
| 146 | } |
| 147 | // No need to waste our time. |
| 148 | if n == 1 { |
| 149 | n = 0 |
| 150 | } |
| 151 | if n > 1<<30 { |
| 152 | return fmt.Errorf("padding must less than 1GB (1<<30 bytes) ") |
| 153 | } |
| 154 | o.pad = n |
| 155 | return nil |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // EncoderLevel predefines encoder compression levels. |
| 160 | // Only use the constants made available, since the actual mapping |
no outgoing calls
searching dependent graphs…