ok trnscode swp
This commit is contained in:
parent
54668c0d93
commit
e9766de877
12 changed files with 221 additions and 243 deletions
69
patches/go-vod-sheepflix.patch
Normal file
69
patches/go-vod-sheepflix.patch
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
diff --git a/transcoder/handler.go b/transcoder/handler.go
|
||||
index 8c5bb08..0ad7458 100644
|
||||
--- a/transcoder/handler.go
|
||||
+++ b/transcoder/handler.go
|
||||
@@ -37,6 +37,14 @@ func NewHandler(c *Config) *Handler {
|
||||
}
|
||||
|
||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
+ w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
+ w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS")
|
||||
+ w.Header().Set("Access-Control-Allow-Headers", "Range, Content-Type")
|
||||
+ if r.Method == http.MethodOptions {
|
||||
+ w.WriteHeader(http.StatusNoContent)
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
// Check version if monitoring is enabled
|
||||
if h.c.VersionMonitor && !h.versionOk(w, r) {
|
||||
return
|
||||
@@ -55,15 +63,15 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Serve actual file from manager
|
||||
- if len(parts) < 3 {
|
||||
+ if len(parts) < 5 || parts[0] != "vod" {
|
||||
log.Println("Invalid URL", url)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Get streamid and chunk
|
||||
- streamid := parts[0]
|
||||
- path := "/" + strings.Join(parts[1:len(parts)-1], "/")
|
||||
+ streamid := parts[1]
|
||||
+ path := "/" + strings.Join(parts[2:len(parts)-1], "/")
|
||||
chunk := parts[len(parts)-1]
|
||||
|
||||
// Check if POST request to create temp file
|
||||
diff --git a/transcoder/stream.go b/transcoder/stream.go
|
||||
index cf353fc..f8694fc 100644
|
||||
--- a/transcoder/stream.go
|
||||
+++ b/transcoder/stream.go
|
||||
@@ -370,8 +370,12 @@ func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {
|
||||
// Check whether hwaccel should be used
|
||||
if s.c.VAAPI {
|
||||
CV = ENCODER_VAAPI
|
||||
- extra := "-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -init_hw_device vaapi=memories:/dev/dri/renderD128 -filter_hw_device memories"
|
||||
+ extra := "-init_hw_device vaapi=memories:/dev/dri/renderD128 -filter_hw_device memories"
|
||||
args = append(args, strings.Split(extra, " ")...)
|
||||
+ if s.m.probe.CodecName == CODEC_H264 {
|
||||
+ extra = "-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi"
|
||||
+ args = append(args, strings.Split(extra, " ")...)
|
||||
+ }
|
||||
} else if s.c.NVENC {
|
||||
CV = ENCODER_NVENC
|
||||
extra := "-hwaccel cuda"
|
||||
@@ -397,7 +401,11 @@ func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {
|
||||
scalerArgs = append(scalerArgs, "force_original_aspect_ratio=decrease")
|
||||
|
||||
if CV == ENCODER_VAAPI {
|
||||
- format = "format=nv12|vaapi,hwupload"
|
||||
+ if s.m.probe.CodecName == CODEC_H264 {
|
||||
+ format = "format=nv12|vaapi,hwupload"
|
||||
+ } else {
|
||||
+ format = "format=nv12,hwupload"
|
||||
+ }
|
||||
scaler = "scale_vaapi"
|
||||
scalerArgs = append(scalerArgs, "format=nv12")
|
||||
} else if CV == ENCODER_NVENC {
|
||||
Loading…
Add table
Add a link
Reference in a new issue