transcode

package
v0.0.2 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 blocking ring buffer. Write blocks when full, applying backpressure to ffmpeg so no data is ever silently overwritten.

func NewStreamServer

func NewStreamServer(ctx context.Context, cfg StreamServerConfig, stream io.Reader) (*StreamServer, error)

NewStreamServer creates, starts, and returns a StreamServer. It begins ingesting from stream and serving HTTP immediately.

func (*StreamServer) Stop

func (s *StreamServer) Stop()

Stop cancels ingestion and closes the server.

func (*StreamServer) URL

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

URL returns the full URL the server is listening on.

func (*StreamServer) Wait added in v0.0.2

func (s *StreamServer) Wait(ctx context.Context) error

Wait blocks until the server exits or the context is cancelled.

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
}

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