Skip to content

Commit

Permalink
Merge pull request #29 from timotto/feature/audiofilter
Browse files Browse the repository at this point in the history
add audio filter
  • Loading branch information
xfrr authored Apr 16, 2019
2 parents c4d93c0 + 6853b60 commit df9067d
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions models/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -498,7 +517,8 @@ func (m *Mediafile) ToStrCommand() []string {
"HlsListSize",
"HlsSegmentDuration",
"HlsPlaylistType",
"Filter",
"AudioFilter",
"VideoFilter",
"HttpMethod",
"HttpKeepAlive",
"OutputPath",
Expand All @@ -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
}
Expand Down

0 comments on commit df9067d

Please sign in to comment.