mirror of
https://github.com/nxshock/promodj.git
synced 2025-07-04 00:13:10 +05:00
Add custom bitrate parser
This commit is contained in:
parent
87bc382747
commit
e8abe97992
3 changed files with 11 additions and 5 deletions
|
@ -12,7 +12,7 @@ import (
|
|||
"gopkg.in/djherbis/buffer.v1"
|
||||
)
|
||||
|
||||
func stream(url string, w http.ResponseWriter) error {
|
||||
func stream(url string, w http.ResponseWriter, bitrateKbps uint64) error {
|
||||
if url == "" {
|
||||
err := errors.New("empty url")
|
||||
|
||||
|
@ -24,10 +24,10 @@ func stream(url string, w http.ResponseWriter) error {
|
|||
w.Header().Set("Accept-Ranges", "none")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
return encode(url, w)
|
||||
return encode(url, w, bitrateKbps)
|
||||
}
|
||||
|
||||
func encode(url string, w io.Writer) error {
|
||||
func encode(url string, w io.Writer, bitrateKbps uint64) error {
|
||||
cmd := exec.Command("ffmpeg",
|
||||
"-i", url,
|
||||
"-vn",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue