|
| 1 | +/* |
| 2 | +This is a package for reading, writing and inspecting media files. In |
| 3 | +order to operate on media, call NewManager() and then use the manager |
| 4 | +functions to determine capabilities and manage media files and devices. |
| 5 | +*/ |
| 6 | +package media |
| 7 | + |
| 8 | +// Manager represents a manager for media formats and devices. |
| 9 | +// Create a new manager object using the NewManager function. |
| 10 | +// |
| 11 | +// import "github.com/mutablelogic/go-media/pkg/ffmpeg" |
| 12 | +// |
| 13 | +// manager, err := ffmpeg.NewManager() |
| 14 | +// if err != nil { |
| 15 | +// ... |
| 16 | +// } |
| 17 | +// |
| 18 | +// Various options are available to control the manager, for |
| 19 | +// logging and affecting decoding. |
| 20 | +// |
| 21 | +// Only one manager can be created. If NewManager is called |
| 22 | +// a second time, the previously created manager is returned, |
| 23 | +// but any new options are applied. |
| 24 | +type Manager interface { |
| 25 | + // Open a media file or device for reading, from a path or url. |
| 26 | + // If a format is specified, then the format will be used to open |
| 27 | + // the file. Close the media object when done. |
| 28 | + //Open(string, Format, ...string) (Media, error) |
| 29 | + |
| 30 | + // Open a media stream for reading. If a format is |
| 31 | + // specified, then the format will be used to open the file. Close the |
| 32 | + // media object when done. It is the responsibility of the caller to |
| 33 | + // also close the reader when done. |
| 34 | + //Read(io.Reader, Format, ...string) (Media, error) |
| 35 | + |
| 36 | + // Create a media file or device for writing, from a path. If a format is |
| 37 | + // specified, then the format will be used to create the file or else |
| 38 | + // the format is guessed from the path. If no parameters are provided, |
| 39 | + // then the default parameters for the format are used. |
| 40 | + //Create(string, Format, []Metadata, ...Parameters) (Media, error) |
| 41 | + |
| 42 | + // Create a media stream for writing. The format will be used to |
| 43 | + // determine the format and one or more CodecParameters used to |
| 44 | + // create the streams. If no parameters are provided, then the |
| 45 | + // default parameters for the format are used. It is the responsibility |
| 46 | + // of the caller to also close the writer when done. |
| 47 | + //Write(io.Writer, Format, []Metadata, ...Parameters) (Media, error) |
| 48 | + |
| 49 | + // Return supported input formats which match any filter, which can be |
| 50 | + // a name, extension (with preceeding period) or mimetype. The MediaType |
| 51 | + // can be NONE (for any) or combinations of DEVICE and STREAM. |
| 52 | + //InputFormats(Type, ...string) []Format |
| 53 | + |
| 54 | + // Return supported output formats which match any filter, which can be |
| 55 | + // a name, extension (with preceeding period) or mimetype. The MediaType |
| 56 | + // can be NONE (for any) or combinations of DEVICE and STREAM. |
| 57 | + //OutputFormats(Type, ...string) []Format |
| 58 | + |
| 59 | + // Return supported devices for a given format. |
| 60 | + // Not all devices may be supported on all platforms or listed |
| 61 | + // if the device does not support enumeration. |
| 62 | + //Devices(Format) []Device |
| 63 | + |
| 64 | + // Return all supported channel layouts |
| 65 | + //ChannelLayouts() []Metadata |
| 66 | + |
| 67 | + // Return all supported sample formats |
| 68 | + //SampleFormats() []Metadata |
| 69 | + |
| 70 | + // Return all supported pixel formats |
| 71 | + //PixelFormats() []Metadata |
| 72 | + |
| 73 | + // Return all supported codecs |
| 74 | + //Codecs() []Metadata |
| 75 | + |
| 76 | + // Return audio parameters for encoding |
| 77 | + // ChannelLayout, SampleFormat, Samplerate |
| 78 | + //AudioParameters(string, string, int) (Parameters, error) |
| 79 | + |
| 80 | + // Return video parameters for encoding |
| 81 | + // Width, Height, PixelFormat |
| 82 | + //VideoParameters(int, int, string) (Parameters, error) |
| 83 | + |
| 84 | + // Return codec parameters for audio encoding |
| 85 | + // Codec name and AudioParameters |
| 86 | + //AudioCodecParameters(string, AudioParameters) (Parameters, error) |
| 87 | + |
| 88 | + // Return codec parameters for video encoding |
| 89 | + // Codec name, Profile name, Framerate (fps) and VideoParameters |
| 90 | + //VideoCodecParameters(string, string, float64, VideoParameters) (Parameters, error) |
| 91 | + |
| 92 | + // Return version information for the media manager as a set of |
| 93 | + // metadata |
| 94 | + Version() []Metadata |
| 95 | + |
| 96 | + // Log error messages with arguments |
| 97 | + Errorf(string, ...any) |
| 98 | + |
| 99 | + // Log warning messages with arguments |
| 100 | + Warningf(string, ...any) |
| 101 | + |
| 102 | + // Log info messages with arguments |
| 103 | + Infof(string, ...any) |
| 104 | +} |
0 commit comments