-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.go
More file actions
58 lines (51 loc) · 1.61 KB
/
Copy pathoptions.go
File metadata and controls
58 lines (51 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package mediasim
import "runtime"
// FrameOptions represents the configuration options for loading media frames.
//
// # Fields:
// - FrameFlip: A flag indicating whether the frame should be flipped.
// - FrameRotate: A flag indicating whether the frame should be rotated.
type FrameOptions struct {
FrameFlip bool
FrameRotate bool
}
// FilesOptions represents the configuration options for processing multiple files.
//
// # Fields:
// - Parallel: The number of files to process in parallel.
// - FrameOptions: Frame transformation options (flip, rotate).
type FilesOptions struct {
Parallel int
FrameOptions
}
func (o *FilesOptions) SetDefaults() {
if o.Parallel == 0 {
o.Parallel = runtime.NumCPU()
}
}
// DirectoryOptions represents the configuration options for loading media from a directory.
//
// # Fields:
// - IncludeImages: A flag indicating whether to include image files.
// - IncludeVideos: A flag indicating whether to include video files.
// - IsRecursive: A flag indicating whether to search subdirectories recursively.
// - Parallel: The number of files to process in parallel.
// - FrameOptions: Frame transformation options (flip, rotate).
type DirectoryOptions struct {
IncludeImages bool
IncludeVideos bool
IsRecursive bool
Parallel int
FrameOptions
}
func (o *DirectoryOptions) SetDefaults() {
// You can't search for files in a directory without including either images or videos. If none are included,
// default to both.
if !o.IncludeImages && !o.IncludeVideos {
o.IncludeImages = true
o.IncludeVideos = true
}
if o.Parallel == 0 {
o.Parallel = runtime.NumCPU()
}
}