@@ -5,6 +5,8 @@ functions to determine capabilities and manage media files and devices.
55*/
66package media
77
8+ import "io"
9+
810// Manager represents a manager for media formats and devices.
911// Create a new manager object using the NewManager function.
1012//
@@ -26,7 +28,7 @@ type Manager interface {
2628 // Open a media file or device for reading, from a path or url.
2729 // If a format is specified, then the format will be used to open
2830 // the file. Close the media object when done.
29- // Open(string, Format, ...string) (Media, error)
31+ Open (string , Format , ... string ) (Media , error )
3032
3133 // Open a media stream for reading. If a format is
3234 // specified, then the format will be used to open the file. Close the
@@ -47,11 +49,6 @@ type Manager interface {
4749 // of the caller to also close the writer when done.
4850 //Write(io.Writer, Format, []Metadata, ...Parameters) (Media, error)
4951
50- // Return supported devices for a given format.
51- // Not all devices may be supported on all platforms or listed
52- // if the device does not support enumeration.
53- //Devices(Format) []Device
54-
5552 // Return audio parameters for encoding
5653 // ChannelLayout, SampleFormat, Samplerate
5754 //AudioParameters(string, string, int) (Parameters, error)
@@ -68,15 +65,11 @@ type Manager interface {
6865 // Codec name, Profile name, Framerate (fps) and VideoParameters
6966 //VideoCodecParameters(string, string, float64, VideoParameters) (Parameters, error)
7067
71- // Return supported input formats which match any filter, which can be
72- // a name, extension (with preceeding period) or mimetype. The MediaType
73- // can be NONE (for any) or combinations of DEVICE and STREAM.
74- //InputFormats(Type, ...string) []Format
75-
76- // Return supported output formats which match any filter, which can be
77- // a name, extension (with preceeding period) or mimetype. The MediaType
78- // can be NONE (for any) or combinations of DEVICE and STREAM.
79- //OutputFormats(Type, ...string) []Format
68+ // Return supported input and output container formats which match any filter,
69+ // which can be a name, extension (with preceeding period) or mimetype. The Type
70+ // can be a combination of DEVICE, INPUT, OUTPUT or ANY to select the right kind of
71+ // format
72+ Formats (Type , ... string ) []Format
8073
8174 // Return all supported sample formats
8275 SampleFormats () []Metadata
@@ -107,3 +100,26 @@ type Manager interface {
107100 // Log info messages with arguments
108101 Infof (string , ... any )
109102}
103+
104+ // A container format for a media file or stream
105+ type Format interface {
106+ // The type of the format, which can be combinations of
107+ // INPUT, OUTPUT, DEVICE, AUDIO, VIDEO and SUBTITLE
108+ Type () Type
109+
110+ // The unique name that the format can be referenced as
111+ Name () string
112+
113+ // Description of the format
114+ Description () string
115+ }
116+
117+ // A container format for a media file, reader, device or
118+ // network stream
119+ type Media interface {
120+ io.Closer
121+
122+ // The type of the format, which can be combinations of
123+ // INPUT, OUTPUT, DEVICE
124+ Type () Type
125+ }
0 commit comments