Skip to content

Commit

Permalink
Issues #185, #265
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Larson committed Jan 12, 2020
1 parent 3a80982 commit 2565f2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,24 @@ func stream(lineup *lineup) gin.HandlerFunc {
}

if channel, ok := lineup.channels[channelID]; ok {
channelURI := channel.providerChannel.Track.URI

log.Infof("Serving channel number %d", channelID)

if !viper.IsSet("iptv.ffmpeg") {
c.Redirect(http.StatusMovedPermanently, channel.providerChannel.Track.URI)
useFFMpeg := viper.IsSet("iptv.ffmpeg")
if useFFMpeg {
useFFMpeg = viper.GetBool("iptv.ffmpeg")
}

if !useFFMpeg {
log.Debugf("Redirecting caller to %s", channelURI)
c.Redirect(http.StatusMovedPermanently, channelURI)
return
}

log.Infoln("Remuxing stream with ffmpeg")

run := exec.Command("ffmpeg", "-i", channel.providerChannel.Track.URI, "-codec", "copy", "-f", "mpegts", "pipe:1")
run := exec.Command("ffmpeg", "-i", channelURI, "-codec", "copy", "-f", "mpegts", "pipe:1")
ffmpegout, err := run.StdoutPipe()
if err != nil {
log.WithError(err).Errorln("StdoutPipe Error")
Expand Down

0 comments on commit 2565f2d

Please sign in to comment.