File tree Expand file tree Collapse file tree 4 files changed +67
-11
lines changed Expand file tree Collapse file tree 4 files changed +67
-11
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ package media
3
3
4
4
import "io"
5
5
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
+
6
14
// Media represents a media stream, which can
7
15
// be input or output. A new media object is created
8
16
// using NewReader, Open, NewWriter or Create.
Original file line number Diff line number Diff line change 1
1
package media
2
2
3
- import (
4
- ff "github.com/mutablelogic/go-media/sys/ffmpeg61"
5
- )
6
-
7
3
////////////////////////////////////////////////////////////////////////////
8
4
// TYPES
9
5
10
- // Media Types: Audio, Video, Subtitle or Data
11
- type MediaType int
6
+ // Media type flags
7
+ type MediaType uint32
12
8
13
9
////////////////////////////////////////////////////////////////////////////
14
10
// GLOBALS
15
11
16
12
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
19
19
)
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ func (r *reader) Decode(fn FrameFunc) DecoderFunc {
227
227
}
228
228
}
229
229
230
- type jsonMetadata struct {
230
+ type metadata struct {
231
231
Key string `json:"key"`
232
232
Value string `json:"value"`
233
233
}
@@ -237,10 +237,10 @@ func (r *reader) Metadata() []Metadata {
237
237
entries := ff .AVUtil_dict_entries (r .input .Metadata ())
238
238
result := make ([]Metadata , len (entries ))
239
239
for i , entry := range entries {
240
- result [i ] = Metadata ( & jsonMetadata {
240
+ result [i ] = & metadata {
241
241
Key : entry .Key (),
242
242
Value : entry .Value (),
243
- })
243
+ }
244
244
}
245
245
return result
246
246
}
You can’t perform that action at this time.
0 commit comments