Build a list of lists of non-overlapping chunks.
(cs []GenericChunk)
| 206 | |
| 207 | // Build a list of lists of non-overlapping chunks. |
| 208 | func partitionChunks(cs []GenericChunk) [][]GenericChunk { |
| 209 | sort.Sort(byMinTime(cs)) |
| 210 | |
| 211 | css := [][]GenericChunk{} |
| 212 | outer: |
| 213 | for _, c := range cs { |
| 214 | for i, cs := range css { |
| 215 | if cs[len(cs)-1].MaxTime < c.MinTime { |
| 216 | css[i] = append(css[i], c) |
| 217 | continue outer |
| 218 | } |
| 219 | } |
| 220 | cs := make([]GenericChunk, 0, len(cs)/(len(css)+1)) |
| 221 | cs = append(cs, c) |
| 222 | css = append(css, cs) |
| 223 | } |
| 224 | |
| 225 | return css |
| 226 | } |
| 227 | |
| 228 | type byMinTime []GenericChunk |
| 229 |
no test coverage detected