Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 73269cc

Browse files
author
xucai.hong
committed
add *os.Process in return values
1 parent 9367de1 commit 73269cc

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

ffmpeg/ffmpeg.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"strconv"
1515
"strings"
1616

17-
"github.com/floostack/transcoder"
18-
"github.com/floostack/transcoder/utils"
17+
"github.com/wolfhong/transcoder"
18+
"github.com/wolfhong/transcoder/utils"
1919
)
2020

2121
// Transcoder ...
@@ -38,7 +38,7 @@ func New(cfg *Config) transcoder.Transcoder {
3838
}
3939

4040
// Start ...
41-
func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress, error) {
41+
func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress, *os.Process, error) {
4242

4343
var stderrIn io.ReadCloser
4444

@@ -48,13 +48,13 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
4848

4949
// Validates config
5050
if err := t.validate(); err != nil {
51-
return nil, err
51+
return nil, nil, err
5252
}
5353

5454
// Get file metadata
5555
_, err := t.GetMetadata()
5656
if err != nil {
57-
return nil, err
57+
return nil, nil, err
5858
}
5959

6060
// Append input file and standard options
@@ -98,7 +98,7 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
9898
if t.config.ProgressEnabled && !t.config.Verbose {
9999
stderrIn, err = cmd.StderrPipe()
100100
if err != nil {
101-
return nil, fmt.Errorf("Failed getting transcoding progress (%s) with args (%s) with error %s", t.config.FfmpegBinPath, args, err)
101+
return nil, nil, fmt.Errorf("Failed getting transcoding progress (%s) with args (%s) with error %s", t.config.FfmpegBinPath, args, err)
102102
}
103103
}
104104

@@ -109,7 +109,7 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
109109
// Start process
110110
err = cmd.Start()
111111
if err != nil {
112-
return nil, fmt.Errorf("Failed starting transcoding (%s) with args (%s) with error %s", t.config.FfmpegBinPath, args, err)
112+
return nil, nil, fmt.Errorf("Failed starting transcoding (%s) with args (%s) with error %s", t.config.FfmpegBinPath, args, err)
113113
}
114114

115115
if t.config.ProgressEnabled && !t.config.Verbose {
@@ -125,7 +125,7 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
125125
err = cmd.Wait()
126126
}
127127

128-
return out, nil
128+
return out, cmd.Process, nil
129129
}
130130

131131
// Input ...

ffmpeg/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ffmpeg
22

3-
import "github.com/floostack/transcoder"
3+
import "github.com/wolfhong/transcoder"
44

55
// Metadata ...
66
type Metadata struct {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/floostack/transcoder
1+
module github.com/wolfhong/transcoder
22

33
go 1.13

transcoder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package transcoder
33
import (
44
"context"
55
"io"
6+
"os"
67
)
78

89
// Transcoder ...
910
type Transcoder interface {
10-
Start(opts Options) (<-chan Progress, error)
11+
Start(opts Options) (<-chan Progress, *os.Process, error)
1112
Input(i string) Transcoder
1213
InputPipe(w *io.WriteCloser, r *io.ReadCloser) Transcoder
1314
Output(o string) Transcoder

0 commit comments

Comments
 (0)