transcode

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Transcode

func Transcode(ctx context.Context, cfg app.TranscodeConfig, sourceURL *url.URL, headers map[string]string) (io.ReadCloser, func() error, error)

Transcode starts an ffmpeg process that reads from sourceURL and writes transcoded output to a pipe. Returns the readable end, a wait function for the process, and any startup error.

Types

type StreamServer

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

StreamServer serves transcode output over HTTP using a fixed-size ring buffer instead of an unbounded append-only buffer.

func NewStreamServer

func NewStreamServer(cfg StreamServerConfig) (*StreamServer, error)

NewStreamServer creates a new StreamServer. The stream data source is provided later via Start.

func (*StreamServer) Err

func (s *StreamServer) Err() <-chan error

Err returns a channel that receives any server error.

func (*StreamServer) Start

func (s *StreamServer) Start(stream io.Reader)

Start begins the ingestion goroutine and HTTP server.

func (*StreamServer) Stop

func (s *StreamServer) Stop()

Stop forcibly closes the server and all active connections.

func (*StreamServer) URL

func (s *StreamServer) URL() (*url.URL, error)

URL returns the full URL the server is listening on.

func (*StreamServer) WaitForData

func (s *StreamServer) WaitForData(ctx context.Context, minBytes int) error

WaitForData blocks until the buffer has at least minBytes of data or the context is cancelled.

type StreamServerConfig

type StreamServerConfig struct {
	LocalIP        string
	ContentType    string
	Extension      string
	Headers        map[string]string
	BufferCapacity int
	ReadBufSize    int
}

StreamServerConfig holds configuration for creating a StreamServer.

Jump to

Keyboard shortcuts

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