httpclient

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPayload

func NewPayload(r io.Reader, contentType string) *payload

func NewReader

func NewReader(r io.Reader, onRead func(total int64)) *reader

Types

type Client

type Client struct {
	*client.Client
}

Client is a profile HTTP client that wraps the base HTTP client

func New

func New(url string, opts ...client.ClientOpt) (*Client, error)

New creates a new profile HTTP client with the given base URL and options. The url parameter should point to the profile API endpoint, e.g. "http://localhost:8080/api".

func (*Client) Metadata

func (c *Client) Metadata(ctx context.Context, req taskmetadata.MetadataRequest, contentType string, onRead func(n int64)) (*taskmetadata.MetadataResponse, error)

Metadata uploads req.Reader to the metadata endpoint and returns the detected content type and container-level metadata (excludes artwork and chapters, and doesn't probe streams, unlike ProbeMedia). req.Filter/ req.Format/req.Opts are attached to the request as query parameters.

Upload semantics (contentType, onRead, ownership of req.Reader, and the NamedReader filename convention) are identical to ProbeMedia - see its doc comment.

func (*Client) ProbeMedia

func (c *Client) ProbeMedia(ctx context.Context, req task.ProbeMediaRequest, contentType string, onRead func(n int64)) (*task.ProbeResponse, error)

ProbeMedia uploads req.Reader to the probe endpoint and returns its container format, streams, and metadata. req.Format/req.Opts are attached to the request as query parameters.

If contentType is multipart/form-data, req.Reader is streamed as a single "file" field using go-client's streaming multipart encoder (so the whole body is never buffered in memory, matching the server's expected upload shape); for any other content type, req.Reader is streamed directly as the raw request body with that Content-Type. Either way, the caller retains ownership of req.Reader - ProbeMedia doesn't close it.

If req.Reader implements gomedia.NamedReader, its name is used as the uploaded filename. If onRead is non-nil, it's called with the cumulative number of bytes read from req.Reader as the upload progresses, regardless of which of the two upload paths is taken.

func (*Client) ProbeSource

func (c *Client) ProbeSource(ctx context.Context, req task.ProbeSourceRequest) (*task.ProbeResponse, error)

ProbeSource probes a URL - a network source FFmpeg can read directly (http, https, rtmp, ...), or a "device://<format>/<address>" URL (see ProbeSourceTask's doc comment) - rather than an uploaded file's bytes.

Jump to

Keyboard shortcuts

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