feat: add hls pull support

This commit is contained in:
langhuihui
2024-11-14 18:58:39 +08:00
parent 4f9cb3305b
commit 3ede6ec08f
10 changed files with 422 additions and 29 deletions

View File

@@ -36,7 +36,7 @@ type (
PullJob struct {
Connection
Publisher *Publisher
publishConfig *config.Publish
PublishConfig *config.Publish
puller IPuller
conf *config.Pull
}
@@ -83,9 +83,9 @@ func (p *PullJob) GetPullJob() *PullJob {
func (p *PullJob) Init(puller IPuller, plugin *Plugin, streamPath string, conf config.Pull) *PullJob {
if conf.PubConf != nil {
p.publishConfig = conf.PubConf
p.PublishConfig = conf.PubConf
} else {
p.publishConfig = &plugin.config.Publish
p.PublishConfig = &plugin.config.Publish
}
p.Args = url.Values(conf.Args.DeepClone())
p.conf = &conf
@@ -129,7 +129,7 @@ func (p *PullJob) Publish() (err error) {
if len(p.Args) > 0 {
streamPath += "?" + p.Args.Encode()
}
p.Publisher, err = p.Plugin.PublishWithConfig(p.puller.GetTask().Context, streamPath, *p.publishConfig)
p.Publisher, err = p.Plugin.PublishWithConfig(p.puller.GetTask().Context, streamPath, *p.PublishConfig)
p.Publisher.Type = PublishTypePull
if err == nil && p.conf.MaxRetry != 0 {
p.Publisher.OnDispose(func() {