Skip to content

Commit

Permalink
examples: add MakeIncrement
Browse files Browse the repository at this point in the history
  • Loading branch information
nareix committed Jul 18, 2016
1 parent 2db58d0 commit bc5e321
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/rtmp_server_channels/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func main() {
if ch != nil {
cursor := ch.que.Latest()
query := conn.URL.Query()

if q := query.Get("delaygop"); q != "" {
n := 0
fmt.Sscanf(q, "%d", &n)
Expand All @@ -97,16 +98,21 @@ func main() {
dur, _ := time.ParseDuration(q)
cursor = ch.que.DelayedTime(dur)
}

filters := pktque.Filters{}

if q := query.Get("waitkey"); q != "" {
filters = append(filters, &pktque.WaitKeyFrame{})
}
filters = append(filters, &pktque.FixTime{StartFromZero: true})

filters = append(filters, &pktque.FixTime{StartFromZero: true, MakeIncrement: true})

if q := query.Get("framedrop"); q != "" {
n := 0
fmt.Sscanf(q, "%d", &n)
filters = append(filters, &FrameDropper{Interval: n})
}

if q := query.Get("delayskip"); q != "" {
dur, _ := time.ParseDuration(q)
skipper := &FrameDropper{DelaySkip: dur}
Expand All @@ -117,10 +123,12 @@ func main() {
}
filters = append(filters, skipper)
}

demuxer := &pktque.FilterDemuxer{
Filter: filters,
Demuxer: cursor,
}

avutil.CopyFile(conn, demuxer)
}
}
Expand Down

0 comments on commit bc5e321

Please sign in to comment.