From 2c988ec142d8db73d06acb68d728f556c6a883b9 Mon Sep 17 00:00:00 2001 From: Tim Otto Date: Fri, 15 Mar 2019 09:18:56 +0100 Subject: [PATCH 1/3] add audio filter --- models/media.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models/media.go b/models/media.go index 43ae3e0..82ea9dd 100644 --- a/models/media.go +++ b/models/media.go @@ -55,11 +55,16 @@ type Mediafile struct { streamIds map[int]string metadata Metadata filter string + audioFilter string skipVideo bool skipAudio bool } /*** SETTERS ***/ +func (m *Mediafile) SetAudioFilter(v string) { + m.audioFilter = v +} + func (m *Mediafile) SetFilter(v string) { m.filter = v } @@ -499,6 +504,7 @@ func (m *Mediafile) ToStrCommand() []string { "HlsSegmentDuration", "HlsPlaylistType", "Filter", + "AudioFilter", "HttpMethod", "HttpKeepAlive", "OutputPath", @@ -517,6 +523,13 @@ func (m *Mediafile) ToStrCommand() []string { return strCommand } +func (m *Mediafile) ObtainAudioFilter() []string { + if m.audioFilter != "" { + return []string{"-af", m.audioFilter} + } + return nil +} + func (m *Mediafile) ObtainFilter() []string { if m.filter != "" { return []string{"-vf", m.filter} From adb6da3e5401c62e3da42ebb476bb9ebdd7faa50 Mon Sep 17 00:00:00 2001 From: Tim Otto Date: Thu, 28 Mar 2019 23:34:43 +0100 Subject: [PATCH 2/3] replace SetFilter with SetVideoFilter, deprecate SetFilter --- models/media.go | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/models/media.go b/models/media.go index 82ea9dd..dd618e2 100644 --- a/models/media.go +++ b/models/media.go @@ -54,7 +54,7 @@ type Mediafile struct { httpKeepAlive bool streamIds map[int]string metadata Metadata - filter string + videoFilter string audioFilter string skipVideo bool skipAudio bool @@ -65,8 +65,13 @@ 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) { @@ -259,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 { @@ -505,6 +519,7 @@ func (m *Mediafile) ToStrCommand() []string { "HlsPlaylistType", "Filter", "AudioFilter", + "VideoFilter", "HttpMethod", "HttpKeepAlive", "OutputPath", @@ -530,9 +545,14 @@ func (m *Mediafile) ObtainAudioFilter() []string { return nil } +// Deprecated: Use ObtainVideoFilter instead. func (m *Mediafile) ObtainFilter() []string { - if m.filter != "" { - return []string{"-vf", m.filter} + return m.ObtainVideoFilter() +} + +func (m *Mediafile) ObtainVideoFilter() []string { + if m.videoFilter != "" { + return []string{"-vf", m.videoFilter} } return nil } From 6853b60ca4554c10ec6db77b2099a08dfac4f9b5 Mon Sep 17 00:00:00 2001 From: Tim Otto Date: Fri, 29 Mar 2019 19:36:43 +0100 Subject: [PATCH 3/3] cleanup --- models/media.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/models/media.go b/models/media.go index dd618e2..6385751 100644 --- a/models/media.go +++ b/models/media.go @@ -517,7 +517,6 @@ func (m *Mediafile) ToStrCommand() []string { "HlsListSize", "HlsSegmentDuration", "HlsPlaylistType", - "Filter", "AudioFilter", "VideoFilter", "HttpMethod", @@ -545,11 +544,6 @@ func (m *Mediafile) ObtainAudioFilter() []string { return nil } -// Deprecated: Use ObtainVideoFilter instead. -func (m *Mediafile) ObtainFilter() []string { - return m.ObtainVideoFilter() -} - func (m *Mediafile) ObtainVideoFilter() []string { if m.videoFilter != "" { return []string{"-vf", m.videoFilter}