Skip to content

Commit e027261

Browse files
committed
parser: use native flv parser, without additional dependancies
1 parent 00e8cdb commit e027261

4 files changed

Lines changed: 39 additions & 9 deletions

File tree

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
package ffmpeg
1+
package parser
22

33
import (
44
"io"
55
"os/exec"
66
"sync"
77

88
l "github.com/go-olive/olive/src/log"
9-
"github.com/go-olive/olive/src/parser"
109
"github.com/sirupsen/logrus"
1110
)
1211

@@ -15,7 +14,7 @@ const (
1514
)
1615

1716
func init() {
18-
parser.SharedManager.Register(
17+
SharedManager.Register(
1918
new(ffmpeg),
2019
)
2120
}
@@ -28,7 +27,7 @@ type ffmpeg struct {
2827
stop chan struct{}
2928
}
3029

31-
func (p *ffmpeg) New() parser.Parser {
30+
func (p *ffmpeg) New() Parser {
3231
return &ffmpeg{
3332
stop: make(chan struct{}),
3433
}

src/parser/flv.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package parser
2+
3+
import (
4+
"github.com/go-olive/flv"
5+
l "github.com/go-olive/olive/src/log"
6+
"github.com/sirupsen/logrus"
7+
)
8+
9+
func init() {
10+
SharedManager.Register(
11+
new(customFlv),
12+
)
13+
}
14+
15+
type customFlv struct {
16+
*flv.Parser
17+
}
18+
19+
func (this *customFlv) New() Parser {
20+
return &customFlv{
21+
Parser: flv.NewParser(),
22+
}
23+
}
24+
25+
func (this *customFlv) Parse(streamURL string, out string) (err error) {
26+
l.Logger.WithFields(logrus.Fields{
27+
// "streamURL": streamURL,
28+
"out": out,
29+
}).Debug("flv working")
30+
31+
return this.Parser.Parse(streamURL, out)
32+
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
package streamlink
1+
package parser
22

33
import (
44
"io"
55
"os/exec"
66
"sync"
77

88
l "github.com/go-olive/olive/src/log"
9-
"github.com/go-olive/olive/src/parser"
109
"github.com/sirupsen/logrus"
1110
)
1211

1312
func init() {
14-
parser.SharedManager.Register(
13+
SharedManager.Register(
1514
new(streamlink),
1615
)
1716
}
@@ -24,7 +23,7 @@ type streamlink struct {
2423
stop chan struct{}
2524
}
2625

27-
func (s *streamlink) New() parser.Parser {
26+
func (s *streamlink) New() Parser {
2827
return &streamlink{
2928
stop: make(chan struct{}),
3029
}

src/platform/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type Base struct {
44
}
55

66
func (b *Base) ParserType() string {
7-
return "ffmpeg"
7+
return "flv"
88
}
99

1010
func (b *Base) DefaultOptions(pc PlatformCtrl) []Option {

0 commit comments

Comments
 (0)