Files
monibuca/plugin/gb28181/catalogsub.go
langhuihui 8a9fffb987 refactor: frame converter and mp4 track improvements
- Refactor frame converter implementation
- Update mp4 track to use ICodex
- General refactoring and code improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 19:55:37 +08:00

41 lines
969 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package plugin_gb28181pro
import (
"time"
"m7s.live/v5/pkg/task"
)
// CatalogSubscribeTask 目录订阅任务
type CatalogSubscribeTask struct {
task.TickTask
device *Device
}
// NewCatalogSubscribeTask 创建新的目录订阅任务
func NewCatalogSubscribeTask(device *Device) *CatalogSubscribeTask {
return &CatalogSubscribeTask{
device: device,
}
}
// GetTickInterval 获取定时间隔
func (c *CatalogSubscribeTask) GetTickInterval() time.Duration {
// 如果设备配置了订阅周期则使用设备配置的周期否则使用默认值3600秒
if c.device.SubscribeCatalog > 0 {
return time.Second * time.Duration(c.device.SubscribeCatalog)
}
return time.Second * 3600
}
// Tick 定时执行的方法
func (c *CatalogSubscribeTask) Tick(any) {
// 执行目录订阅
response, err := c.device.subscribeCatalog()
if err != nil {
c.Error("subCatalog", "err", err)
} else {
c.Debug("subCatalog", "response", response.String())
}
}