Move VideoProfile into ffmpeg package.

Avoids a circular dependency between ffmpeg and core once ffmpeg
starts using the profiles.
This commit is contained in:
Josh Allmann
2018-02-08 23:59:46 -08:00
parent 29763958ae
commit 90b7017a0c
4 changed files with 14 additions and 13 deletions
+5 -4
View File
@@ -19,6 +19,7 @@ import (
"github.com/ericxtang/m3u8"
"github.com/golang/glog"
"github.com/livepeer/lpms/core"
"github.com/livepeer/lpms/ffmpeg"
"github.com/livepeer/lpms/segmenter"
"github.com/livepeer/lpms/stream"
)
@@ -185,10 +186,10 @@ func main() {
func transcode(hlsStream stream.HLSVideoStream) (func(*stream.HLSSegment, bool), error) {
//Create Transcoder
profiles := []core.VideoProfile{
core.P144p30fps16x9,
core.P240p30fps16x9,
core.P576p30fps16x9,
profiles := []ffmpeg.VideoProfile{
ffmpeg.P144p30fps16x9,
ffmpeg.P240p30fps16x9,
ffmpeg.P576p30fps16x9,
}
t := transcoder.NewFFMpegSegmentTranscoder(profiles, "", "./tmp")
@@ -1,4 +1,4 @@
package core
package ffmpeg
import (
"strconv"
+3 -3
View File
@@ -10,17 +10,17 @@ import (
"time"
"github.com/golang/glog"
"github.com/livepeer/lpms/core"
"github.com/livepeer/lpms/ffmpeg"
)
//SegmentTranscoder transcodes segments individually. This is a simple wrapper for calling FFMpeg on the command line.
type FFMpegSegmentTranscoder struct {
tProfiles []core.VideoProfile
tProfiles []ffmpeg.VideoProfile
ffmpegPath string
workDir string
}
func NewFFMpegSegmentTranscoder(ps []core.VideoProfile, ffmpegp, workd string) *FFMpegSegmentTranscoder {
func NewFFMpegSegmentTranscoder(ps []ffmpeg.VideoProfile, ffmpegp, workd string) *FFMpegSegmentTranscoder {
return &FFMpegSegmentTranscoder{tProfiles: ps, ffmpegPath: ffmpegp, workDir: workd}
}
+5 -5
View File
@@ -4,7 +4,7 @@ import (
"io/ioutil"
"testing"
"github.com/livepeer/lpms/core"
"github.com/livepeer/lpms/ffmpeg"
)
func TestTrans(t *testing.T) {
@@ -13,10 +13,10 @@ func TestTrans(t *testing.T) {
t.Errorf("Error reading test segment: %v", err)
}
configs := []core.VideoProfile{
core.P144p30fps16x9,
core.P240p30fps16x9,
core.P576p30fps16x9,
configs := []ffmpeg.VideoProfile{
ffmpeg.P144p30fps16x9,
ffmpeg.P240p30fps16x9,
ffmpeg.P576p30fps16x9,
}
tr := NewFFMpegSegmentTranscoder(configs, "", "./")
r, err := tr.Transcode(testSeg)