mirror of
https://github.com/livepeer/lpms
synced 2026-04-23 00:07:25 +08:00
Move VideoProfile into ffmpeg package.
Avoids a circular dependency between ffmpeg and core once ffmpeg starts using the profiles.
This commit is contained in:
+5
-4
@@ -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"
|
||||
@@ -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}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user