mirror of
https://github.com/3d0c/gmf
synced 2025-12-24 10:40:59 +08:00
minor fixes
This commit is contained in:
10
format.go
10
format.go
@@ -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
|
||||
|
||||
15
stream.go
15
stream.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user