Skip to content

Commit 36e8b19

Browse files
committed
Updated interfaces
1 parent 4c75dd4 commit 36e8b19

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

interfaces.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Manager interface {
3333
Create(string, Format, []Metadata, ...Parameters) (Media, error)
3434

3535
// 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
3737
// create the streams. If no parameters are provided, then the
3838
// default parameters for the format are used. It is the responsibility
3939
// of the caller to also close the writer when done.
@@ -233,9 +233,12 @@ type VideoParameters interface {
233233
// io.EOF if you want to stop processing the packets early.
234234
type DecoderFunc func(Packet) error
235235

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)
239242

240243
// FrameFunc is a function that processes a frame of audio
241244
// or video data. Return io.EOF if you want to stop
@@ -254,9 +257,15 @@ type Codec interface {
254257
Type() MediaType
255258
}
256259

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+
}
260269

261270
// Frame represents a frame of audio or video data.
262271
type Frame interface {

0 commit comments

Comments
 (0)