@@ -13,8 +13,8 @@ import (
1313 "strconv"
1414 "strings"
1515
16- "github.com/floostack/gotrans "
17- "github.com/floostack/gotrans /utils"
16+ "github.com/floostack/transcoder "
17+ "github.com/floostack/transcoder /utils"
1818)
1919
2020// Transcoder ...
@@ -31,16 +31,16 @@ type Transcoder struct {
3131}
3232
3333// New ...
34- func New (cfg * Config ) gotrans .Transcoder {
34+ func New (cfg * Config ) transcoder .Transcoder {
3535 return & Transcoder {config : cfg }
3636}
3737
3838// 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 ) {
4040
4141 var stderrIn io.ReadCloser
4242
43- out := make (chan gotrans .Progress )
43+ out := make (chan transcoder .Progress )
4444
4545 defer t .closePipes ()
4646
@@ -64,8 +64,6 @@ func (t *Transcoder) Start(opts gotrans.Options) (<-chan gotrans.Progress, error
6464 // Initialize command
6565 cmd := exec .Command (t .config .FfmpegBinPath , args ... )
6666
67- // cmd.Stderr = os.Stdout
68-
6967 // If progresss enabled, get stderr pipe and start progress process
7068 if t .config .ProgressEnabled && ! t .config .Verbose {
7169 stderrIn , err = cmd .StderrPipe ()
@@ -88,31 +86,32 @@ func (t *Transcoder) Start(opts gotrans.Options) (<-chan gotrans.Progress, error
8886 go func () {
8987 t .progress (stderrIn , out )
9088 }()
91- }
9289
93- go func () {
94- defer close (out )
95- // Start process
90+ go func () {
91+ defer close (out )
92+ err = cmd .Wait ()
93+ }()
94+ } else {
9695 err = cmd .Wait ()
97- }()
96+ }
9897
9998 return out , nil
10099}
101100
102101// Input ...
103- func (t * Transcoder ) Input (arg string ) gotrans .Transcoder {
102+ func (t * Transcoder ) Input (arg string ) transcoder .Transcoder {
104103 t .input = arg
105104 return t
106105}
107106
108107// Output ...
109- func (t * Transcoder ) Output (arg string ) gotrans .Transcoder {
108+ func (t * Transcoder ) Output (arg string ) transcoder .Transcoder {
110109 t .output = arg
111110 return t
112111}
113112
114113// 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 {
116115 if & t .input == nil {
117116 t .inputPipeWriter = w
118117 t .inputPipeReader = r
@@ -121,7 +120,7 @@ func (t *Transcoder) InputPipe(w *io.WriteCloser, r *io.ReadCloser) gotrans.Tran
121120}
122121
123122// 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 {
125124 if & t .output == nil {
126125 t .outputPipeWriter = w
127126 t .outputPipeReader = r
@@ -130,7 +129,7 @@ func (t *Transcoder) OutputPipe(w *io.WriteCloser, r *io.ReadCloser) gotrans.Tra
130129}
131130
132131// WithOptions ...
133- func (t * Transcoder ) WithOptions (opts gotrans .Options ) gotrans .Transcoder {
132+ func (t * Transcoder ) WithOptions (opts transcoder .Options ) transcoder .Transcoder {
134133 t .options = opts .GetStrArguments ()
135134 return t
136135}
@@ -187,7 +186,7 @@ func (t *Transcoder) getMetadata() (metadata *Metadata, err error) {
187186}
188187
189188// 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 ) {
191190
192191 defer stream .Close ()
193192
0 commit comments