Documentation ¶
Overview ¶
This is a package for reading, writing and inspecting media files. In order to operate on media, call NewManager() and then use the manager functions to determine capabilities and manage media files and devices.
This is a package for reading, writing and inspecting media files. In order to operate on media, call NewManager() and then use the manager functions to determine capabilities and manage media files and devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶ added in v1.6.3
type Format interface { // The type of the format, which can be combinations of // INPUT, OUTPUT, DEVICE, AUDIO, VIDEO and SUBTITLE Type() Type // The unique name that the format can be referenced as Name() string // Description of the format Description() string }
A container format for a media file or stream
type Manager ¶ added in v1.5.1
type Manager interface { // Open a media file or device for reading, from a path or url. // If a format is specified, then the format will be used to open // the file. Close the media object when done. Open(string, Format, ...string) (Media, error) // Return supported input and output container formats which match any filter, // which can be a name, extension (with preceeding period) or mimetype. The Type // can be a combination of DEVICE, INPUT, OUTPUT or ANY to select the right kind of // format Formats(Type, ...string) []Format // Return all supported sample formats SampleFormats() []Metadata // Return all supported pixel formats PixelFormats() []Metadata // Return standard channel layouts which can be used for audio, // with the number of channels provided. If no channels are provided, // then all standard channel layouts are returned. ChannelLayouts() []Metadata // Return all supported codecs, of a specific type or all // if ANY is used. If any names is provided, then only the codecs // with those names are returned. Codecs(Type, ...string) []Metadata // Return version information for the media manager as a set of // metadata Version() []Metadata // Log error messages with arguments Errorf(string, ...any) // Log warning messages with arguments Warningf(string, ...any) // Log info messages with arguments Infof(string, ...any) }
Manager represents a manager for media formats and devices. Create a new manager object using the NewManager function.
import "github.com/mutablelogic/go-media/pkg/ffmpeg" manager, err := ffmpeg.NewManager() if err != nil { ... }
Various options are available to control the manager, for logging and affecting decoding, that can be applied when creating the manager by passing them as arguments.
Only one manager can be created. If NewManager is called a second time, the previously created manager is returned, but any new options are applied.
type Media ¶
type Media interface { io.Closer // The type of the format, which can be combinations of // INPUT, OUTPUT, DEVICE Type() Type }
A container format for a media file, reader, device or network stream
type Metadata ¶ added in v1.5.1
type Metadata interface { // Return the metadata key Key() string // Return the value as a string. Returns the mimetype // if the value is a byte slice, and the mimetype can be // detected. Value() string // Returns the value as a byte slice Bytes() []byte // Returns the value as an image Image() image.Image // Returns the value as an interface Any() any }
Metadata is a key/value pair which can be used to describe a media object or other metadata. The value can be retrieved as a string value, data, or other type. If the value is a byte slice, then it can also be retrieved as an image (for artwork)
type Type ¶ added in v1.6.7
type Type int
Type of codec, device, format or stream
const ( NONE Type = 0 // Type is not defined VIDEO Type = (1 << iota) // Type is video AUDIO // Type is audio SUBTITLE // Type is subtitle DATA // Type is data UNKNOWN // Type is unknown INPUT // Type is input format OUTPUT // Type is output format DEVICE // Type is input or output device ANY = NONE // Type is any (used for filtering) )
func (Type) FlagString ¶ added in v1.6.7
Return a flag as a string
func (Type) MarshalJSON ¶ added in v1.6.7
Return the type as a string
Directories ¶
Path | Synopsis |
---|---|
This is a package for reading, writing and inspecting media files.
|
This is a package for reading, writing and inspecting media files. |
cmd
|
|
examples/sdlplayer
This example demonstrates how to play audio and video files using SDL2.
|
This example demonstrates how to play audio and video files using SDL2. |
etc
|
|
pkg
|
|
chromaprint
chromaprint provides bindings to the Chromaprint library, which is a library for extracting audio fingerprints.
|
chromaprint provides bindings to the Chromaprint library, which is a library for extracting audio fingerprints. |
file
Package file provides file system support, including file system walking
|
Package file provides file system support, including file system walking |
sys
|
|
chromaprint
This package provides chromaprint audio fingerprinting bindings
|
This package provides chromaprint audio fingerprinting bindings |
dvb
DVB (Digital Video Broadcasting) bindings for Go
|
DVB (Digital Video Broadcasting) bindings for Go |
ffmpeg51
Package ffmpeg provides low-level ffmpeg for go
|
Package ffmpeg provides low-level ffmpeg for go |
ffmpeg61
The low-level ffmpeg bindings for ffmpeg version 6.1.
|
The low-level ffmpeg bindings for ffmpeg version 6.1. |