@@ -13,8 +13,8 @@ import (
13
13
"strconv"
14
14
"strings"
15
15
16
- "github.com/floostack/gotrans "
17
- "github.com/floostack/gotrans /utils"
16
+ "github.com/floostack/transcoder "
17
+ "github.com/floostack/transcoder /utils"
18
18
)
19
19
20
20
// Transcoder ...
@@ -31,16 +31,16 @@ type Transcoder struct {
31
31
}
32
32
33
33
// New ...
34
- func New (cfg * Config ) gotrans .Transcoder {
34
+ func New (cfg * Config ) transcoder .Transcoder {
35
35
return & Transcoder {config : cfg }
36
36
}
37
37
38
38
// Start ...
39
- func (t * Transcoder ) Start (opts gotrans .Options ) (<- chan gotrans .Progress , error ) {
39
+ func (t * Transcoder ) Start (opts transcoder .Options ) (<- chan transcoder .Progress , error ) {
40
40
41
41
var stderrIn io.ReadCloser
42
42
43
- out := make (chan gotrans .Progress )
43
+ out := make (chan transcoder .Progress )
44
44
45
45
defer t .closePipes ()
46
46
@@ -64,8 +64,6 @@ func (t *Transcoder) Start(opts gotrans.Options) (<-chan gotrans.Progress, error
64
64
// Initialize command
65
65
cmd := exec .Command (t .config .FfmpegBinPath , args ... )
66
66
67
- // cmd.Stderr = os.Stdout
68
-
69
67
// If progresss enabled, get stderr pipe and start progress process
70
68
if t .config .ProgressEnabled && ! t .config .Verbose {
71
69
stderrIn , err = cmd .StderrPipe ()
@@ -88,31 +86,32 @@ func (t *Transcoder) Start(opts gotrans.Options) (<-chan gotrans.Progress, error
88
86
go func () {
89
87
t .progress (stderrIn , out )
90
88
}()
91
- }
92
89
93
- go func () {
94
- defer close (out )
95
- // Start process
90
+ go func () {
91
+ defer close (out )
92
+ err = cmd .Wait ()
93
+ }()
94
+ } else {
96
95
err = cmd .Wait ()
97
- }()
96
+ }
98
97
99
98
return out , nil
100
99
}
101
100
102
101
// Input ...
103
- func (t * Transcoder ) Input (arg string ) gotrans .Transcoder {
102
+ func (t * Transcoder ) Input (arg string ) transcoder .Transcoder {
104
103
t .input = arg
105
104
return t
106
105
}
107
106
108
107
// Output ...
109
- func (t * Transcoder ) Output (arg string ) gotrans .Transcoder {
108
+ func (t * Transcoder ) Output (arg string ) transcoder .Transcoder {
110
109
t .output = arg
111
110
return t
112
111
}
113
112
114
113
// InputPipe ...
115
- func (t * Transcoder ) InputPipe (w * io.WriteCloser , r * io.ReadCloser ) gotrans .Transcoder {
114
+ func (t * Transcoder ) InputPipe (w * io.WriteCloser , r * io.ReadCloser ) transcoder .Transcoder {
116
115
if & t .input == nil {
117
116
t .inputPipeWriter = w
118
117
t .inputPipeReader = r
@@ -121,7 +120,7 @@ func (t *Transcoder) InputPipe(w *io.WriteCloser, r *io.ReadCloser) gotrans.Tran
121
120
}
122
121
123
122
// OutputPipe ...
124
- func (t * Transcoder ) OutputPipe (w * io.WriteCloser , r * io.ReadCloser ) gotrans .Transcoder {
123
+ func (t * Transcoder ) OutputPipe (w * io.WriteCloser , r * io.ReadCloser ) transcoder .Transcoder {
125
124
if & t .output == nil {
126
125
t .outputPipeWriter = w
127
126
t .outputPipeReader = r
@@ -130,7 +129,7 @@ func (t *Transcoder) OutputPipe(w *io.WriteCloser, r *io.ReadCloser) gotrans.Tra
130
129
}
131
130
132
131
// WithOptions ...
133
- func (t * Transcoder ) WithOptions (opts gotrans .Options ) gotrans .Transcoder {
132
+ func (t * Transcoder ) WithOptions (opts transcoder .Options ) transcoder .Transcoder {
134
133
t .options = opts .GetStrArguments ()
135
134
return t
136
135
}
@@ -187,7 +186,7 @@ func (t *Transcoder) getMetadata() (metadata *Metadata, err error) {
187
186
}
188
187
189
188
// progress sends through given channel the transcoding status
190
- func (t * Transcoder ) progress (stream io.ReadCloser , out chan gotrans .Progress ) {
189
+ func (t * Transcoder ) progress (stream io.ReadCloser , out chan transcoder .Progress ) {
191
190
192
191
defer stream .Close ()
193
192
0 commit comments