func (h *HLSFilter) FilterContent(ctx context.Context, filters *parsers.MediaFilters) (string, error) {
	m, manifestType, err := m3u8.DecodeFrom(strings.NewReader(h.originContent), true)
	if err != nil {
		return "", err
	}
	if manifestType != m3u8.MASTER {
		if filters.Trim != nil {
			return h.trimRenditionManifest(filters, m.(*m3u8.MediaPlaylist))
		}
		return isEmpty(h.originContent)
	}
	manifest := m.(*m3u8.MasterPlaylist)
	filteredManifest := copyPlaylistDefaults(manifest)
	var pipeline pipelineType
	if filters.DeWeave && pipeline == "" {
		p, err := h.filterPipeline(ctx, manifest.Variants[0].URI)
		if err != nil {
			return "", fmt.Errorf("filtering pipeline: %w", err)
		}
		pipeline = p
	}
	trimmedAlternatives := make(map[string]struct{})
	for i, v := range manifest.Variants {
		if !isValidPipeline(pipeline, i) {
			continue
		}
		if filters.SuppressIFrame() && v.Iframe {
			continue
		}
		absolute, aErr := getAbsoluteURL(h.originURL)
		if aErr != nil {
			return h.originContent, aErr
		}
		normalizedVariant, err := h.normalizeVariant(v, *absolute)
		if err != nil {
			return "", err
		}
		filteredVariant, err := h.filterVariant(filters, normalizedVariant)
		if err != nil {
			return "", err
		}
		if filteredVariant {
			continue
		}
		uri := normalizedVariant.URI
		if filters.Trim != nil {
			uri, err = h.normalizeTrimmedVariant(filters, uri)
			if err != nil {
				return "", err
			}
			trimmedAlternatives, err = h.normalizeTrimmedVariantAlternatives(filters, v, trimmedAlternatives)
			if err != nil {
				return "", err
			}
		}
		filteredManifest.Append(uri, normalizedVariant.Chunklist, normalizedVariant.VariantParams)
	}
	return filteredManifest.String(), nil
}
FilterContent will be responsible for filtering the manifest
according  to the MediaFilters
package filters
import (
	"context"
	"encoding/base64"
	"errors"
	"fmt"
	"net/url"
	"path/filepath"
	"strings"
	"time"
	"github.com/cbsinteractive/bakery/config"
	"github.com/cbsinteractive/bakery/origin"
	"github.com/cbsinteractive/bakery/parsers"
	"github.com/grafov/m3u8"
)
type execPluginHLS func(variant *m3u8.Variant)
const EmptyHLSManifestContent = "#EXTM3U"
type HLSFilter struct {
	originURL      string
	originContent  string
	maxSegmentSize float64
	config         config.Config
}
var matchFunctions = map[ContentType]func(string) bool{
	audioContentType:   isAudioCodec,
	videoContentType:   isVideoCodec,
	captionContentType: isCaptionCodec,
}
type pipelineType string
const (
	primaryPipeline pipelineType = "primary"
	backupPipeline               = "backup"
)
func NewHLSFilter(originURL, originContent string, c config.Config) *HLSFilter {
	return &HLSFilter{
		originURL:     originURL,
		originContent: originContent,
		config:        c,
	}
}
func (h *HLSFilter) GetMaxAge() string {
	return fmt.Sprintf("%.0f", h.maxSegmentSize/2)
}