@@ -33,7 +33,7 @@ type Manager interface {
33
33
Create (string , Format , []Metadata , ... Parameters ) (Media , error )
34
34
35
35
// Create a media stream for writing. The format will be used to
36
- // determine the formar type and one or more CodecParameters used to
36
+ // determine the format and one or more CodecParameters used to
37
37
// create the streams. If no parameters are provided, then the
38
38
// default parameters for the format are used. It is the responsibility
39
39
// of the caller to also close the writer when done.
@@ -233,9 +233,12 @@ type VideoParameters interface {
233
233
// io.EOF if you want to stop processing the packets early.
234
234
type DecoderFunc func (Packet ) error
235
235
236
- // MuxFunc is a function that multiplexes a packet. Return
237
- // io.EOF to stop multiplexing normally.
238
- type MuxFunc func (Packet ) error
236
+ // MuxFunc is a function that multiplexes a packet. It is
237
+ // repeatedly called with a stream identifier - return a packet
238
+ // for that stream if one is available, or nil if no
239
+ // packet is available for muxing. Return io.EOF to
240
+ // stop multiplexing.
241
+ type MuxFunc func (int ) (Packet , error )
239
242
240
243
// FrameFunc is a function that processes a frame of audio
241
244
// or video data. Return io.EOF if you want to stop
@@ -254,9 +257,15 @@ type Codec interface {
254
257
Type () MediaType
255
258
}
256
259
257
- // Packet represents a packet of demultiplexed data.
258
- // Currently this is quite opaque!
259
- type Packet interface {}
260
+ // Packet represents a packet of demultiplexed data, or a packet
261
+ // to be multiplexed.
262
+ type Packet interface {
263
+ // The packet can be audio, video, subtitle or data.
264
+ Type () MediaType
265
+
266
+ // The stream identifier for the packet
267
+ Id () int
268
+ }
260
269
261
270
// Frame represents a frame of audio or video data.
262
271
type Frame interface {
0 commit comments