Documentation
¶
Index ¶
- func NewPayload(r io.Reader, contentType string) *payload
- func NewReader(r io.Reader, onRead func(total int64)) *reader
- type Client
- func (c *Client) Metadata(ctx context.Context, req taskmetadata.MetadataRequest, contentType string, ...) (*taskmetadata.MetadataResponse, error)
- func (c *Client) ProbeMedia(ctx context.Context, req task.ProbeMediaRequest, contentType string, ...) (*task.ProbeResponse, error)
- func (c *Client) ProbeSource(ctx context.Context, req task.ProbeSourceRequest) (*task.ProbeResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPayload ¶
Types ¶
type Client ¶
Client is a profile HTTP client that wraps the base HTTP client
func New ¶
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.