diff --git a/models/media.go b/models/media.go index 43ae3e0..6385751 100644 --- a/models/media.go +++ b/models/media.go @@ -54,14 +54,24 @@ type Mediafile struct { httpKeepAlive bool streamIds map[int]string metadata Metadata - filter string + videoFilter string + audioFilter string skipVideo bool skipAudio bool } /*** SETTERS ***/ +func (m *Mediafile) SetAudioFilter(v string) { + m.audioFilter = v +} + +func (m *Mediafile) SetVideoFilter(v string) { + m.videoFilter = v +} + +// Deprecated: Use SetVideoFilter instead. func (m *Mediafile) SetFilter(v string) { - m.filter = v + m.SetVideoFilter(v) } func (m *Mediafile) SetAspect(v string) { @@ -254,8 +264,17 @@ func (m *Mediafile) SetMetadata(v Metadata) { /*** GETTERS ***/ +// Deprecated: Use VideoFilter instead. func (m *Mediafile) Filter() string { - return m.filter + return m.VideoFilter() +} + +func (m *Mediafile) VideoFilter() string { + return m.videoFilter +} + +func (m *Mediafile) AudioFilter() string { + return m.audioFilter } func (m *Mediafile) Aspect() string { @@ -498,7 +517,8 @@ func (m *Mediafile) ToStrCommand() []string { "HlsListSize", "HlsSegmentDuration", "HlsPlaylistType", - "Filter", + "AudioFilter", + "VideoFilter", "HttpMethod", "HttpKeepAlive", "OutputPath", @@ -517,9 +537,16 @@ func (m *Mediafile) ToStrCommand() []string { return strCommand } -func (m *Mediafile) ObtainFilter() []string { - if m.filter != "" { - return []string{"-vf", m.filter} +func (m *Mediafile) ObtainAudioFilter() []string { + if m.audioFilter != "" { + return []string{"-af", m.audioFilter} + } + return nil +} + +func (m *Mediafile) ObtainVideoFilter() []string { + if m.videoFilter != "" { + return []string{"-vf", m.videoFilter} } return nil }