embedded

package
v0.10.0-dev.70 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package embedded reads the subtitle tracks inside a video file and stores them as its instance's probe, and owns the embedded_subtitles section. It inspects local media and is not a provider.

Index

Constants

This section is empty.

Variables

View Source
var (
	Codecs = []string{
		codecSRT, codecASS, codecSSA, codecWebVTT, codecMovText, codecPGS,
		codecVobSub, codecDVBSub, codecTeletext, codecCEA608, codecTTML,
	}
	DefaultIgnored = []string{codecPGS, codecVobSub}
	// TextCodecs can serve as a sync reference; the image's ffmpeg decodes each.
	TextCodecs = []string{codecSRT, codecASS, codecSSA, codecWebVTT, codecMovText}
)

Codecs is ignore_codecs' closed value set; DefaultIgnored is the section's default, the two picture formats.

View Source
var Schema = formschema.Schema{Fields: []formschema.Field{{
	Key: fieldIgnoreCodecs, Label: "Ignored embedded formats", Kind: formschema.StringList,
	Enum: Codecs, Default: "[" + strings.Join(DefaultIgnored, ", ") + "]",
	Help: "Subtitle tracks inside a video in these formats do not count as subtitles it has, so subflux still downloads them.",
}}}

Schema is the embedded_subtitles section's form.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the embedded_subtitles section. Its zero value ignores no format; ParseConfig of an absent section ignores DefaultIgnored.

func ParseConfig

func ParseConfig(n *yaml.Node) (Config, []formschema.FieldError)

ParseConfig decodes the embedded_subtitles section, n being its node or nil when absent, reporting each error at embedded_subtitles.<key>.

func (Config) Ignored

func (c Config) Ignored() []string

Ignored is the formats whose tracks count toward no coverage, sorted and each once: the Activation's IgnoredCodecs.

type Prober

type Prober struct {
	// contains filtered or unexported fields
}

Prober probes videos with ffprobe from PATH and stores what it finds.

func New

func New(store *statedb.Store) *Prober

New returns a Prober storing its probes in store.

func (*Prober) Probe

func (p *Prober) Probe(ctx context.Context, inst statedb.InstanceID, video *os.File) (statedb.VideoProbe, error)

Probe returns inst's probe of video, the file mediawrite.Writer.OpenVideo opened, which the caller closes after Probe returns. ffprobe runs only when video's size or modification time differs from the stored probe's stamp, and its result is stored with PutEmbedded. A Stat failure stores nothing; a failed ffprobe stores a probe with no tracks and a zero stamp, so the inventory completes and the next Probe runs ffprobe again, and returns the failure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL