Documentation ¶
Index ¶
- Variables
- func Abs(x int32) int32
- func Extract(path string, sha string) (<-chan struct{}, error)
- func ExtractThumbnail(path string, sha string) (string, error)
- func GetEnvOr(env string, def string) string
- func GetMimeCodec(mi *mediainfo.File, kind mediainfo.StreamKind, i int) *string
- func Map[T, U any](ts []T, f func(T, int) U) []U
- func NewStream(file *FileStream, handle StreamHandle, ret *Stream)
- func OrNull(str string) *string
- func ParseFloat(str string) float32
- func ParseTime(str string) float32
- func ParseUint(str string) uint32
- func ParseUint64(str string) uint64
- type Audio
- type AudioStream
- type CMap
- type Chapter
- type ClientInfo
- type FileStream
- func (fs *FileStream) Destroy()
- func (fs *FileStream) GetAudioIndex(audio int32) (string, error)
- func (fs *FileStream) GetAudioSegment(audio int32, segment int32) (string, error)
- func (fs *FileStream) GetMaster() string
- func (fs *FileStream) GetVideoIndex(quality Quality) (string, error)
- func (fs *FileStream) GetVideoSegment(quality Quality, segment int32) (string, error)
- func (fs *FileStream) Kill()
- type Flags
- type Head
- type HwAccelT
- type Keyframe
- type KeyframeInfo
- type MICache
- type MediaInfo
- type Quality
- type Segment
- type SettingsT
- type Stream
- type StreamHandle
- type Subtitle
- type Thumbnail
- type Tracker
- func (t *Tracker) DestroyStreamIfOld(path string)
- func (t *Tracker) KillAudioIfDead(path string, audio int32) bool
- func (t *Tracker) KillOrphanedHeads(path string, quality *Quality, audio int32)
- func (t *Tracker) KillQualityIfDead(path string, quality Quality) bool
- func (t *Tracker) KillStreamIfDead(path string) bool
- type Transcoder
- func (t *Transcoder) GetAudioIndex(path string, audio int32, client string, sha string) (string, error)
- func (t *Transcoder) GetAudioSegment(path string, audio int32, segment int32, client string, sha string) (string, error)
- func (t *Transcoder) GetMaster(path string, client string, sha string) (string, error)
- func (t *Transcoder) GetVideoIndex(path string, quality Quality, client string, sha string) (string, error)
- func (t *Transcoder) GetVideoSegment(path string, quality Quality, segment int32, client string, sha string) (string, error)
- type Video
- type VideoStream
Constants ¶
This section is empty.
Variables ¶
View Source
var DeletedHead = Head{ // contains filtered or unexported fields }
Purposfully removing Original from this list (since it require special treatments anyways)
View Source
var Settings = SettingsT{ Outpath: GetEnvOr("GOCODER_CACHE_ROOT", "/cache"), Metadata: GetEnvOr("GOCODER_METADATA_ROOT", "/metadata"), RoutePrefix: GetEnvOr("GOCODER_PREFIX", ""), HwAccel: DetectHardwareAccel(), }
View Source
var SubtitleExtensions = map[string]string{
"subrip": "srt",
"ass": "ass",
"vtt": "vtt",
}
Functions ¶
func GetMimeCodec ¶
convert mediainfo to RFC 6381, waiting for either of those tickets to be resolved:
https://sourceforge.net/p/mediainfo/feature-requests/499 https://trac.ffmpeg.org/ticket/6617
this code is addapted from https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Api/Helpers/HlsCodecStringHelpers.cs
func NewStream ¶
func NewStream(file *FileStream, handle StreamHandle, ret *Stream)
func ParseFloat ¶
func ParseUint64 ¶
Types ¶
type Audio ¶
type Audio struct { /// The index of this track on the media. Index uint32 `json:"index"` /// The title of the stream. Title *string `json:"title"` /// The language of this stream (as a ISO-639-2 language code) Language *string `json:"language"` /// The human readable codec name. Codec string `json:"codec"` /// The codec of this stream (defined as the RFC 6381). MimeCodec *string `json:"mimeCodec"` /// Is this stream the default one of it's type? IsDefault bool `json:"isDefault"` /// Is this stream tagged as forced? (useful only for subtitles) IsForced bool `json:"isForced"` }
type AudioStream ¶
type AudioStream struct { Stream // contains filtered or unexported fields }
func NewAudioStream ¶
func NewAudioStream(file *FileStream, idx int32) *AudioStream
type CMap ¶
type CMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewCMap ¶
func NewCMap[K comparable, V any]() CMap[K, V]
func (*CMap[K, V]) GetAndRemove ¶
func (*CMap[K, V]) GetOrCreate ¶
type Chapter ¶
type Chapter struct { /// The start time of the chapter (in second from the start of the episode). StartTime float32 `json:"startTime"` /// The end time of the chapter (in second from the start of the episode). EndTime float32 `json:"endTime"` /// The name of this chapter. This should be a human-readable name that could be presented to the user. Name string `json:"name"` }
type ClientInfo ¶
type ClientInfo struct {
// contains filtered or unexported fields
}
type FileStream ¶
type FileStream struct { Path string Out string Keyframes *Keyframe Info *MediaInfo // contains filtered or unexported fields }
func NewFileStream ¶
func NewFileStream(path string, sha string) *FileStream
func (*FileStream) Destroy ¶
func (fs *FileStream) Destroy()
func (*FileStream) GetAudioIndex ¶
func (fs *FileStream) GetAudioIndex(audio int32) (string, error)
func (*FileStream) GetAudioSegment ¶
func (fs *FileStream) GetAudioSegment(audio int32, segment int32) (string, error)
func (*FileStream) GetMaster ¶
func (fs *FileStream) GetMaster() string
func (*FileStream) GetVideoIndex ¶
func (fs *FileStream) GetVideoIndex(quality Quality) (string, error)
func (*FileStream) GetVideoSegment ¶
func (fs *FileStream) GetVideoSegment(quality Quality, segment int32) (string, error)
func (*FileStream) Kill ¶
func (fs *FileStream) Kill()
type HwAccelT ¶
func DetectHardwareAccel ¶
func DetectHardwareAccel() HwAccelT
type Keyframe ¶
type Keyframe struct { Sha string Keyframes []float64 CanTransmux bool IsDone bool // contains filtered or unexported fields }
func GetKeyframes ¶
func (*Keyframe) AddListener ¶
type KeyframeInfo ¶
type KeyframeInfo struct {
// contains filtered or unexported fields
}
type MediaInfo ¶
type MediaInfo struct { // The sha1 of the video file. Sha string `json:"sha"` /// The internal path of the video file. Path string `json:"path"` /// The extension currently used to store this video file Extension string `json:"extension"` /// The whole mimetype (defined as the RFC 6381). ex: `video/mp4; codecs="avc1.640028, mp4a.40.2"` MimeCodec *string `json:"mimeCodec"` /// The file size of the video file. Size uint64 `json:"size"` /// The length of the media in seconds. Duration float32 `json:"duration"` /// The container of the video file of this episode. Container *string `json:"container"` /// The video codec and infromations. Video *Video `json:"video"` /// The list of videos if there are multiples. Videos []Video `json:"videos"` /// The list of audio tracks. Audios []Audio `json:"audios"` /// The list of subtitles tracks. Subtitles []Subtitle `json:"subtitles"` /// The list of fonts that can be used to display subtitles. Fonts []string `json:"fonts"` /// The list of chapters. See Chapter for more information. Chapters []Chapter `json:"chapters"` }
type Quality ¶
type Quality string
func QualityFromHeight ¶
func QualityFromString ¶
func (Quality) AverageBitrate ¶
I'm not entierly sure about the values for bitrates. Double checking would be nice.
func (Quality) MaxBitrate ¶
type StreamHandle ¶
type StreamHandle interface {
// contains filtered or unexported methods
}
type Subtitle ¶
type Subtitle struct { /// The index of this track on the media. Index uint32 `json:"index"` /// The title of the stream. Title *string `json:"title"` /// The language of this stream (as a ISO-639-2 language code) Language *string `json:"language"` /// The codec of this stream. Codec string `json:"codec"` /// The extension for the codec. Extension *string `json:"extension"` /// Is this stream the default one of it's type? IsDefault bool `json:"isDefault"` /// Is this stream tagged as forced? (useful only for subtitles) IsForced bool `json:"isForced"` /// The link to access this subtitle. Link *string `json:"link"` }
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
func NewTracker ¶
func NewTracker(t *Transcoder) *Tracker
func (*Tracker) DestroyStreamIfOld ¶
func (*Tracker) KillOrphanedHeads ¶
func (*Tracker) KillQualityIfDead ¶
func (*Tracker) KillStreamIfDead ¶
type Transcoder ¶
type Transcoder struct {
// contains filtered or unexported fields
}
func NewTranscoder ¶
func NewTranscoder() (*Transcoder, error)
func (*Transcoder) GetAudioIndex ¶
func (*Transcoder) GetAudioSegment ¶
func (*Transcoder) GetVideoIndex ¶
func (*Transcoder) GetVideoSegment ¶
type Video ¶
type Video struct { /// The human readable codec name. Codec string `json:"codec"` /// The codec of this stream (defined as the RFC 6381). MimeCodec *string `json:"mimeCodec"` /// The language of this stream (as a ISO-639-2 language code) Language *string `json:"language"` /// The max quality of this video track. Quality Quality `json:"quality"` /// The width of the video stream Width uint32 `json:"width"` /// The height of the video stream Height uint32 `json:"height"` /// The average bitrate of the video in bytes/s Bitrate uint32 `json:"bitrate"` }
type VideoStream ¶
type VideoStream struct { Stream // contains filtered or unexported fields }
func NewVideoStream ¶
func NewVideoStream(file *FileStream, quality Quality) *VideoStream
Click to show internal directories.
Click to hide internal directories.