Skip to content

Commit 3d49cbf

Browse files
committed
updates
1 parent a7d7952 commit 3d49cbf

File tree

4 files changed

+67
-11
lines changed

4 files changed

+67
-11
lines changed

manager.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package media
2+
3+
import ffmpeg "github.com/mutablelogic/go-media/sys/ffmpeg61"
4+
5+
////////////////////////////////////////////////////////////////////////////
6+
// TYPES
7+
8+
type manager struct {
9+
}
10+
11+
////////////////////////////////////////////////////////////////////////////
12+
// LIFECYCLE
13+
14+
func NewManager() *manager {
15+
return new(manager)
16+
}
17+
18+
////////////////////////////////////////////////////////////////////////////
19+
// PUBLIC METHODS
20+
21+
// Return the list of input formats, filtering by name or mimetype
22+
func (this *manager) InputFormats(mimetype string) []InputFormat {
23+
var result []InputFormat
24+
var opaque uintptr
25+
for {
26+
demuxer := ffmpeg.AVFormat_demuxer_iterate(&opaque)
27+
if demuxer == nil {
28+
break
29+
}
30+
if this.matchesInput(demuxer, mimetype) {
31+
result = append(result, demuxer)
32+
}
33+
}
34+
return result
35+
36+
}
37+
38+
// Return the list of output formats, filtering by name or mimetype
39+
func (this *manager) OutputFormats(name string) []OutputFormat {
40+
return nil
41+
}
42+
43+
////////////////////////////////////////////////////////////////////////////
44+
// PRIVATE METHODS
45+
46+
func (this *manager) matchesInput(demuxer *ffmpeg.AVInputFormat, mimetype string) bool {
47+
return true
48+
}

media.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ package media
33

44
import "io"
55

6+
// InputFormat represents a container format for input
7+
// of media streams.
8+
type InputFormat interface{}
9+
10+
// OuputFormat represents a container format for output
11+
// of media streams.
12+
type OutputFormat interface{}
13+
614
// Media represents a media stream, which can
715
// be input or output. A new media object is created
816
// using NewReader, Open, NewWriter or Create.

mediatype.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package media
22

3-
import (
4-
ff "github.com/mutablelogic/go-media/sys/ffmpeg61"
5-
)
6-
73
////////////////////////////////////////////////////////////////////////////
84
// TYPES
95

10-
// Media Types: Audio, Video, Subtitle or Data
11-
type MediaType int
6+
// Media type flags
7+
type MediaType uint32
128

139
////////////////////////////////////////////////////////////////////////////
1410
// GLOBALS
1511

1612
const (
17-
AUDIO = MediaType(ff.AVMEDIA_TYPE_AUDIO) // Audio media type
18-
VIDEO = MediaType(ff.AVMEDIA_TYPE_VIDEO) // Video media type
13+
UNKNOWN MediaType = (1 << iota) // Usually treated as DATA
14+
VIDEO // Video stream
15+
AUDIO // Audio stream
16+
DATA // Opaque data information usually continuous
17+
SUBTITLE // Subtitle stream
18+
ATTACHMENT
1919
)

reader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (r *reader) Decode(fn FrameFunc) DecoderFunc {
227227
}
228228
}
229229

230-
type jsonMetadata struct {
230+
type metadata struct {
231231
Key string `json:"key"`
232232
Value string `json:"value"`
233233
}
@@ -237,10 +237,10 @@ func (r *reader) Metadata() []Metadata {
237237
entries := ff.AVUtil_dict_entries(r.input.Metadata())
238238
result := make([]Metadata, len(entries))
239239
for i, entry := range entries {
240-
result[i] = Metadata(&jsonMetadata{
240+
result[i] = &metadata{
241241
Key: entry.Key(),
242242
Value: entry.Value(),
243-
})
243+
}
244244
}
245245
return result
246246
}

0 commit comments

Comments
 (0)