minor fixes

This commit is contained in:
alex
2019-01-30 17:38:59 +03:00
parent ea994bb2d0
commit 18fab6f065
2 changed files with 18 additions and 7 deletions

View File

@@ -49,6 +49,7 @@ import "C"
import (
"errors"
"fmt"
"io"
"os"
"syscall"
"time"
@@ -358,6 +359,9 @@ func (this *FmtCtx) GetNextPacket() (*Packet, error) {
time.Sleep(10000 * time.Microsecond)
continue
}
if ret == AVERROR_EOF {
return nil, io.EOF
}
if ret < 0 {
return nil, AvError(ret)
}
@@ -420,7 +424,7 @@ func (this *FmtCtx) StreamsCnt() int {
}
func (this *FmtCtx) GetStream(idx int) (*Stream, error) {
if idx > this.StreamsCnt() || this.StreamsCnt() == 0 {
if idx > this.StreamsCnt()-1 || this.StreamsCnt() == 0 {
return nil, errors.New(fmt.Sprintf("Stream index '%d' is out of range. There is only '%d' streams.", idx, this.StreamsCnt()))
}
@@ -566,6 +570,10 @@ func (this *FmtCtx) SetProbeSize(v int64) {
this.avCtx.probesize = C.int64_t(v)
}
func (this *FmtCtx) GetProbeSize() int64 {
return int64(this.avCtx.probesize)
}
type OutputFmt struct {
Filename string
avOutputFmt *C.struct_AVOutputFormat

View File

@@ -14,12 +14,15 @@ import (
)
type Stream struct {
avStream *C.struct_AVStream
cc *CodecCtx
SwsCtx *SwsCtx
SwrCtx *SwrCtx
AvFifo *AVAudioFifo
DstFrame *Frame
avStream *C.struct_AVStream
cc *CodecCtx
SwsCtx *SwsCtx
SwrCtx *SwrCtx
AvFifo *AVAudioFifo
DstFrame *Frame
Pts int64
Resampler func(*Stream, []*Frame, bool) []*Frame
Rescaler func(*Stream, []*Frame) []*Frame
CgoMemoryManage
}