Documentation
¶
Index ¶
- Constants
- Variables
- func AnalyzeTs(status *SpeedStatus, tsFileList []string, OutputMp4Name string, ...) (mergeList []string, err error)
- func FindUrlInStr(str string) string
- func GetFileNameFromUrl(u string) string
- func GetVersion() string
- func GetWd() string
- func IsContextCancel(ctx context.Context) bool
- func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
- func ParseProxyFormat(origin string) (after string, urlObj *url.URL, errMsg string)
- func ResolveRefUrl(baseUrl string, extUrl string) (after string, errMsg string)
- func RunDownload_Req_ToCurlStr(req StartDownload_Req) string
- func UpdateMp4Time(firstTsName string, mp4FileName string) error
- func UrlHasSuffix(urlS string, suff string) bool
- type DownloadEnv
- func (this *DownloadEnv) CloseEnv()
- func (this *DownloadEnv) GetIsCancel() bool
- func (this *DownloadEnv) GetStatus() (resp GetStatus_Resp)
- func (this *DownloadEnv) SleepDur(d time.Duration)
- func (this *DownloadEnv) StartDownload(req StartDownload_Req) (errMsg string)
- func (this *DownloadEnv) WaitDownloadFinish() GetStatus_Resp
- type GetStatus_Resp
- type MergeTsFileListToSingleMp4_Req
- type ParseCurl_Resp
- type SkipTsInfo
- type SkipTsUnit
- type SpeedInfo
- type SpeedStatus
- func (this *SpeedStatus) DrawProgressBar(total int, current int)
- func (this *SpeedStatus) GetPercent() (percent int)
- func (this *SpeedStatus) GetTitle() (title string)
- func (this *SpeedStatus) SetProgressBarTitle(title string)
- func (this *SpeedStatus) SpeedAdd1Block(now time.Time, byteCount int)
- func (this *SpeedStatus) SpeedReadAll(r io.Reader) (b []byte, err error)
- func (this *SpeedStatus) SpeedRecent5sGetAndUpdate() (speed SpeedInfo)
- func (this *SpeedStatus) SpeedResetBytes()
- func (this *SpeedStatus) SpeedResetTotalBlockCount(count int)
- type StartDownload_Req
- type TsVideoInfo
Constants ¶
View Source
const SkipTimeSecEnd = 99 * 60 * 60
Variables ¶
View Source
var PNG_SIGN = []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}
Functions ¶
func FindUrlInStr ¶ added in v1.24.8
func GetFileNameFromUrl ¶
func GetVersion ¶ added in v1.24.25
func GetVersion() string
func IsContextCancel ¶ added in v1.20.0
func MergeTsFileListToSingleMp4 ¶
func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
func ParseProxyFormat ¶ added in v1.20.0
func ResolveRefUrl ¶ added in v1.25.1
func RunDownload_Req_ToCurlStr ¶
func RunDownload_Req_ToCurlStr(req StartDownload_Req) string
func UpdateMp4Time ¶ added in v1.24.41
func UrlHasSuffix ¶
Types ¶
type DownloadEnv ¶ added in v1.20.0
type DownloadEnv struct {
// contains filtered or unexported fields
}
func (*DownloadEnv) CloseEnv ¶ added in v1.20.0
func (this *DownloadEnv) CloseEnv()
func (*DownloadEnv) GetIsCancel ¶ added in v1.20.0
func (this *DownloadEnv) GetIsCancel() bool
func (*DownloadEnv) GetStatus ¶ added in v1.20.0
func (this *DownloadEnv) GetStatus() (resp GetStatus_Resp)
func (*DownloadEnv) SleepDur ¶ added in v1.20.0
func (this *DownloadEnv) SleepDur(d time.Duration)
func (*DownloadEnv) StartDownload ¶ added in v1.20.0
func (this *DownloadEnv) StartDownload(req StartDownload_Req) (errMsg string)
func (*DownloadEnv) WaitDownloadFinish ¶ added in v1.20.0
func (this *DownloadEnv) WaitDownloadFinish() GetStatus_Resp
type GetStatus_Resp ¶ added in v1.20.0
type MergeTsFileListToSingleMp4_Req ¶
type MergeTsFileListToSingleMp4_Req struct { TsFileList []string OutputMp4 string Status *SpeedStatus Ctx context.Context }
type ParseCurl_Resp ¶
type ParseCurl_Resp struct { ErrMsg string DownloadReq StartDownload_Req }
func ParseCurl ¶
func ParseCurl(cmdList []string) (resp ParseCurl_Resp)
func ParseCurlStr ¶
func ParseCurlStr(s string) (resp ParseCurl_Resp)
type SkipTsInfo ¶ added in v1.24.28
type SkipTsInfo struct { HttpCodeList []int SkipByIdxList []SkipTsUnit IfHttpCodeMergeTs bool SkipByTimeSecList []SkipTsUnit KeepByTimeSecList []SkipTsUnit }
func ParseSkipTsExpr ¶ added in v1.24.3
func ParseSkipTsExpr(expr string) (info SkipTsInfo, errMsg string)
type SkipTsUnit ¶ added in v1.24.3
func (*SkipTsUnit) HasIntersect ¶ added in v1.25.3
func (this *SkipTsUnit) HasIntersect(begin float64, end float64) bool
func (*SkipTsUnit) IsCoverageFull ¶ added in v1.25.3
func (this *SkipTsUnit) IsCoverageFull(begin float64, end float64) bool
type SpeedInfo ¶ added in v1.20.0
type SpeedStatus ¶
type SpeedStatus struct { Locker sync.Mutex IsRunning bool ProgressBarShow bool // contains filtered or unexported fields }
func (*SpeedStatus) DrawProgressBar ¶
func (this *SpeedStatus) DrawProgressBar(total int, current int)
func (*SpeedStatus) GetPercent ¶
func (this *SpeedStatus) GetPercent() (percent int)
func (*SpeedStatus) GetTitle ¶
func (this *SpeedStatus) GetTitle() (title string)
func (*SpeedStatus) SetProgressBarTitle ¶
func (this *SpeedStatus) SetProgressBarTitle(title string)
func (*SpeedStatus) SpeedAdd1Block ¶ added in v1.20.0
func (this *SpeedStatus) SpeedAdd1Block(now time.Time, byteCount int)
func (*SpeedStatus) SpeedReadAll ¶ added in v1.24.27
func (this *SpeedStatus) SpeedReadAll(r io.Reader) (b []byte, err error)
func (*SpeedStatus) SpeedRecent5sGetAndUpdate ¶
func (this *SpeedStatus) SpeedRecent5sGetAndUpdate() (speed SpeedInfo)
func (*SpeedStatus) SpeedResetBytes ¶
func (this *SpeedStatus) SpeedResetBytes()
func (*SpeedStatus) SpeedResetTotalBlockCount ¶ added in v1.25.1
func (this *SpeedStatus) SpeedResetTotalBlockCount(count int)
type StartDownload_Req ¶ added in v1.20.0
type StartDownload_Req struct { M3u8Url string Insecure bool // "是否允许不安全的请求(默认为false)" SaveDir string // "文件保存路径(默认为当前路径)" FileName string // 文件名 SkipTsExpr string // 跳过ts信息,ts编号从1开始,可以以逗号","为分隔符跳过多部分ts,例如: 1,92-100 表示跳过第1号ts、跳过92到100号ts SetProxy string //代理 HeaderMap map[string][]string // 自定义http头信息 SkipRemoveTs bool // 不删除ts文件 ProgressBarShow bool // 在控制台打印进度条 ThreadCount int // 线程数 SkipCacheCheck bool // 不缓存已下载的m3u8的文件信息 SkipMergeTs bool // 不合并ts为mp4 DebugLog bool // 调试日志 TsTempDir string // 临时ts文件目录 UseServerSideTime bool // 使用服务端提供的文件时间 WithSkipLog bool // 在mp4旁记录跳过ts文件的信息 }
type TsVideoInfo ¶ added in v1.25.1
func GetTsVideoInfo ¶ added in v1.25.1
func GetTsVideoInfo(tsPath string) (info TsVideoInfo)
GetTsVideoInfo 参考: https://github.com/yapingcat/gomedia/issues/154
Source Files
¶
Click to show internal directories.
Click to hide internal directories.