mirror of
https://github.com/oscar-davids/lpmsdemo.git
synced 2024-05-30 19:13:30 +08:00
modified: stream/basic_hls_videostream.go
modified: transcoder/ffmpeg_segment_transcoder.go
This commit is contained in:
parent
7108c55737
commit
5ca69bd515
@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/oscar-davids/lpmsdemo/ffmpeg"
|
||||
"github.com/oscar-davids/lpmsdemo/m3u8"
|
||||
)
|
||||
|
||||
@ -107,10 +108,12 @@ func (s *BasicHLSVideoStream) AddHLSSegment(seg *HLSSegment) error {
|
||||
case ContentsNone:
|
||||
}
|
||||
|
||||
isYolo := ffmpeg.GetYoloDetectorID()
|
||||
|
||||
nanosec := int64(seg.Duration * 1000000000.0)
|
||||
nowplus := now.Add(time.Duration(nanosec))
|
||||
nowplusend := now.Add(time.Duration(nanosec + nanosec))
|
||||
if seg.FgContents == ContentsStart || seg.FgContents == ContentsEnd || seg.FgContents == ContentsContinue {
|
||||
if seg.FgContents == ContentsStart || seg.FgContents == ContentsEnd || isYolo >= 0 {
|
||||
DateRange := &m3u8.DateRange{
|
||||
ID: "2020",
|
||||
StartDate: nowplus,
|
||||
@ -124,7 +127,6 @@ func (s *BasicHLSVideoStream) AddHLSSegment(seg *HLSSegment) error {
|
||||
SCTE35Command: SCTE35Commandtag,
|
||||
}
|
||||
s.plCache.SetDateRange(DateRange)
|
||||
// fmt.Println("################daterange:", DateRange)
|
||||
}
|
||||
//Add segment to media playlist and buffer
|
||||
s.plCache.AppendSegment(&m3u8.MediaSegment{SeqId: seg.SeqNo, Duration: seg.Duration, URI: seg.Name})
|
||||
|
@ -32,7 +32,7 @@ func (t *FFMpegSegmentTranscoder) SetParallelID(pid int) {
|
||||
func (t *FFMpegSegmentTranscoder) SetGpuID(gid int) {
|
||||
t.gpuid = gid
|
||||
}
|
||||
func (t *FFMpegSegmentTranscoder) Transcode(fname string) ([][]byte, string ,error) {
|
||||
func (t *FFMpegSegmentTranscoder) Transcode(fname string) ([][]byte, string, error) {
|
||||
//Invoke ffmpeg
|
||||
contents := ""
|
||||
contents, err := ffmpeg.Transcode(fname, t.workDir, t.parallelid, t.gpuid, t.tProfiles)
|
||||
|
Loading…
Reference in New Issue
Block a user