mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-28 18:31:49 +08:00
Now compatible with n6.1.1
This commit is contained in:
24
stream.go
24
stream.go
@@ -3,10 +3,6 @@ package astiav
|
||||
//#cgo pkg-config: libavformat
|
||||
//#include <libavformat/avformat.h>
|
||||
import "C"
|
||||
import (
|
||||
"errors"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavformat/avformat.h#L937
|
||||
type Stream struct {
|
||||
@@ -80,26 +76,6 @@ func (s *Stream) SetSampleAspectRatio(r Rational) {
|
||||
s.c.sample_aspect_ratio = r.c
|
||||
}
|
||||
|
||||
func (s *Stream) SideData(t PacketSideDataType) []byte {
|
||||
return bytesFromC(func(size *C.size_t) *C.uint8_t {
|
||||
return C.av_stream_get_side_data(s.c, (C.enum_AVPacketSideDataType)(t), size)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Stream) AddSideData(t PacketSideDataType, d []byte) error {
|
||||
if len(d) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
ptr := C.av_stream_new_side_data(s.c, (C.enum_AVPacketSideDataType)(t), C.size_t(len(d)))
|
||||
if ptr == nil {
|
||||
return errors.New("astiav: nil pointer")
|
||||
}
|
||||
|
||||
C.memcpy(unsafe.Pointer(ptr), unsafe.Pointer(&d[0]), C.size_t(len(d)))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Stream) StartTime() int64 {
|
||||
return int64(s.c.start_time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user