Skip to content

Commit

Permalink
fix deprecated field and make test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Tryanks committed Mar 29, 2024
1 parent 443a5f5 commit 3ce7cb5
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 72 deletions.
126 changes: 70 additions & 56 deletions channel_layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,83 @@ package astiav
// Calling C.AV_CHANNEL_LAYOUT_* in Go gives a "could not determine kind of name for X" error
// therefore we need to bridge the channel layout values
AVChannelLayout *c2goChannelLayoutMono = &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
AVChannelLayout *c2goChannelLayoutStereo = &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
AVChannelLayout *c2goChannelLayout2Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1;
AVChannelLayout *c2goChannelLayout21 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_1;
AVChannelLayout *c2goChannelLayoutSurround = &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND;
AVChannelLayout *c2goChannelLayout3Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_3POINT1;
AVChannelLayout *c2goChannelLayout4Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0;
AVChannelLayout *c2goChannelLayout4Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT1;
AVChannelLayout *c2goChannelLayout22 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_2;
AVChannelLayout *c2goChannelLayoutQuad = &(AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD;
AVChannelLayout *c2goChannelLayout5Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0;
AVChannelLayout *c2goChannelLayout5Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1;
AVChannelLayout *c2goChannelLayout5Point0Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0_BACK;
AVChannelLayout *c2goChannelLayout5Point1Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK;
AVChannelLayout *c2goChannelLayout6Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT0;
AVChannelLayout *c2goChannelLayout6Point0Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT0_FRONT;
AVChannelLayout *c2goChannelLayoutHexagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_HEXAGONAL;
AVChannelLayout *c2goChannelLayout6Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1;
AVChannelLayout *c2goChannelLayout6Point1Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1_BACK;
AVChannelLayout *c2goChannelLayout6Point1Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1_FRONT;
AVChannelLayout *c2goChannelLayout7Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT0;
AVChannelLayout *c2goChannelLayout7Point0Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT0_FRONT;
AVChannelLayout *c2goChannelLayout7Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1;
AVChannelLayout *c2goChannelLayout7Point1Wide = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1_WIDE;
AVChannelLayout *c2goChannelLayout7Point1WideBack = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK;
AVChannelLayout *c2goChannelLayoutOctagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_OCTAGONAL;
AVChannelLayout *c2goChannelLayoutHexadecagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_HEXADECAGONAL;
AVChannelLayout *c2goChannelLayoutStereoDownmix = &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX;
AVChannelLayout *c2goChannelLayoutMono = &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
AVChannelLayout *c2goChannelLayoutStereo = &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
AVChannelLayout *c2goChannelLayout2Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2POINT1;
AVChannelLayout *c2goChannelLayout21 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_1;
AVChannelLayout *c2goChannelLayoutSurround = &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND;
AVChannelLayout *c2goChannelLayout3Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_3POINT1;
AVChannelLayout *c2goChannelLayout4Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0;
AVChannelLayout *c2goChannelLayout4Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT1;
AVChannelLayout *c2goChannelLayout22 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_2;
AVChannelLayout *c2goChannelLayoutQuad = &(AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD;
AVChannelLayout *c2goChannelLayout5Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0;
AVChannelLayout *c2goChannelLayout5Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1;
AVChannelLayout *c2goChannelLayout5Point0Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0_BACK;
AVChannelLayout *c2goChannelLayout5Point1Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK;
AVChannelLayout *c2goChannelLayout6Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT0;
AVChannelLayout *c2goChannelLayout6Point0Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT0_FRONT;
AVChannelLayout *c2goChannelLayoutHexagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_HEXAGONAL;
AVChannelLayout *c2goChannelLayout3Point1Point2 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_3POINT1POINT2;

Check failure on line 26 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_3POINT1POINT2' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_3POINT1'?

Check failure on line 26 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_3POINT1POINT2'

Check failure on line 26 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_3POINT1POINT2' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_3POINT1'?
AVChannelLayout *c2goChannelLayout6Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1;
AVChannelLayout *c2goChannelLayout6Point1Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1_BACK;
AVChannelLayout *c2goChannelLayout6Point1Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_6POINT1_FRONT;
AVChannelLayout *c2goChannelLayout7Point0 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT0;
AVChannelLayout *c2goChannelLayout7Point0Front = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT0_FRONT;
AVChannelLayout *c2goChannelLayout7Point1 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1;
AVChannelLayout *c2goChannelLayout7Point1Wide = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1_WIDE;
AVChannelLayout *c2goChannelLayout7Point1WideBack = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK;
AVChannelLayout *c2goChannelLayout5Point1Point2Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK;

Check failure on line 35 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?

Check failure on line 35 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK'

Check failure on line 35 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?
AVChannelLayout *c2goChannelLayoutOctagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_OCTAGONAL;
AVChannelLayout *c2goChannelLayoutCube = &(AVChannelLayout)AV_CHANNEL_LAYOUT_CUBE;

Check failure on line 37 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_CUBE' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_QUAD'?

Check failure on line 37 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_CUBE'

Check failure on line 37 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_CUBE' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_QUAD'?
AVChannelLayout *c2goChannelLayout5Point1Point4Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK;

Check failure on line 38 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?

Check failure on line 38 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK'

Check failure on line 38 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?
AVChannelLayout *c2goChannelLayout7Point1Point2 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1POINT2;

Check failure on line 39 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_7POINT1POINT2' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE'?

Check failure on line 39 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_7POINT1POINT2'

Check failure on line 39 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_7POINT1POINT2' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE'?
AVChannelLayout *c2goChannelLayout7Point1Point4Back = &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK;

Check failure on line 40 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

error: 'AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?

Check failure on line 40 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

error: use of undeclared identifier 'AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK'

Check failure on line 40 in channel_layout.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

error: 'AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK' undeclared here (not in a function); did you mean 'AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK'?
AVChannelLayout *c2goChannelLayoutHexadecagonal = &(AVChannelLayout)AV_CHANNEL_LAYOUT_HEXADECAGONAL;
AVChannelLayout *c2goChannelLayoutStereoDownmix = &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO_DOWNMIX;
AVChannelLayout *c2goChannelLayout22Point2 = &(AVChannelLayout)AV_CHANNEL_LAYOUT_22POINT2;
*/
import "C"
import "unsafe"

// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavutil/channel_layout.h#L90
var (
ChannelLayoutMono = newChannelLayoutFromC(C.c2goChannelLayoutMono)
ChannelLayoutStereo = newChannelLayoutFromC(C.c2goChannelLayoutStereo)
ChannelLayout2Point1 = newChannelLayoutFromC(C.c2goChannelLayout2Point1)
ChannelLayout21 = newChannelLayoutFromC(C.c2goChannelLayout21)
ChannelLayoutSurround = newChannelLayoutFromC(C.c2goChannelLayoutSurround)
ChannelLayout3Point1 = newChannelLayoutFromC(C.c2goChannelLayout3Point1)
ChannelLayout4Point0 = newChannelLayoutFromC(C.c2goChannelLayout4Point0)
ChannelLayout4Point1 = newChannelLayoutFromC(C.c2goChannelLayout4Point1)
ChannelLayout22 = newChannelLayoutFromC(C.c2goChannelLayout22)
ChannelLayoutQuad = newChannelLayoutFromC(C.c2goChannelLayoutQuad)
ChannelLayout5Point0 = newChannelLayoutFromC(C.c2goChannelLayout5Point0)
ChannelLayout5Point1 = newChannelLayoutFromC(C.c2goChannelLayout5Point1)
ChannelLayout5Point0Back = newChannelLayoutFromC(C.c2goChannelLayout5Point0Back)
ChannelLayout5Point1Back = newChannelLayoutFromC(C.c2goChannelLayout5Point1Back)
ChannelLayout6Point0 = newChannelLayoutFromC(C.c2goChannelLayout6Point0)
ChannelLayout6Point0Front = newChannelLayoutFromC(C.c2goChannelLayout6Point0Front)
ChannelLayoutHexagonal = newChannelLayoutFromC(C.c2goChannelLayoutHexagonal)
ChannelLayout6Point1 = newChannelLayoutFromC(C.c2goChannelLayout6Point1)
ChannelLayout6Point1Back = newChannelLayoutFromC(C.c2goChannelLayout6Point1Back)
ChannelLayout6Point1Front = newChannelLayoutFromC(C.c2goChannelLayout6Point1Front)
ChannelLayout7Point0 = newChannelLayoutFromC(C.c2goChannelLayout7Point0)
ChannelLayout7Point0Front = newChannelLayoutFromC(C.c2goChannelLayout7Point0Front)
ChannelLayout7Point1 = newChannelLayoutFromC(C.c2goChannelLayout7Point1)
ChannelLayout7Point1Wide = newChannelLayoutFromC(C.c2goChannelLayout7Point1Wide)
ChannelLayout7Point1WideBack = newChannelLayoutFromC(C.c2goChannelLayout7Point1WideBack)
ChannelLayoutOctagonal = newChannelLayoutFromC(C.c2goChannelLayoutOctagonal)
ChannelLayoutHexadecagonal = newChannelLayoutFromC(C.c2goChannelLayoutHexadecagonal)
ChannelLayoutStereoDownmix = newChannelLayoutFromC(C.c2goChannelLayoutStereoDownmix)
ChannelLayoutMono = newChannelLayoutFromC(C.c2goChannelLayoutMono)
ChannelLayoutStereo = newChannelLayoutFromC(C.c2goChannelLayoutStereo)
ChannelLayout2Point1 = newChannelLayoutFromC(C.c2goChannelLayout2Point1)
ChannelLayout21 = newChannelLayoutFromC(C.c2goChannelLayout21)
ChannelLayoutSurround = newChannelLayoutFromC(C.c2goChannelLayoutSurround)
ChannelLayout3Point1 = newChannelLayoutFromC(C.c2goChannelLayout3Point1)
ChannelLayout4Point0 = newChannelLayoutFromC(C.c2goChannelLayout4Point0)
ChannelLayout4Point1 = newChannelLayoutFromC(C.c2goChannelLayout4Point1)
ChannelLayout22 = newChannelLayoutFromC(C.c2goChannelLayout22)
ChannelLayoutQuad = newChannelLayoutFromC(C.c2goChannelLayoutQuad)
ChannelLayout5Point0 = newChannelLayoutFromC(C.c2goChannelLayout5Point0)
ChannelLayout5Point1 = newChannelLayoutFromC(C.c2goChannelLayout5Point1)
ChannelLayout5Point0Back = newChannelLayoutFromC(C.c2goChannelLayout5Point0Back)
ChannelLayout5Point1Back = newChannelLayoutFromC(C.c2goChannelLayout5Point1Back)
ChannelLayout6Point0 = newChannelLayoutFromC(C.c2goChannelLayout6Point0)
ChannelLayout6Point0Front = newChannelLayoutFromC(C.c2goChannelLayout6Point0Front)
ChannelLayoutHexagonal = newChannelLayoutFromC(C.c2goChannelLayoutHexagonal)
ChannelLayout3Point1Point2 = newChannelLayoutFromC(C.c2goChannelLayout3Point1Point2)
ChannelLayout6Point1 = newChannelLayoutFromC(C.c2goChannelLayout6Point1)
ChannelLayout6Point1Back = newChannelLayoutFromC(C.c2goChannelLayout6Point1Back)
ChannelLayout6Point1Front = newChannelLayoutFromC(C.c2goChannelLayout6Point1Front)
ChannelLayout7Point0 = newChannelLayoutFromC(C.c2goChannelLayout7Point0)
ChannelLayout7Point0Front = newChannelLayoutFromC(C.c2goChannelLayout7Point0Front)
ChannelLayout7Point1 = newChannelLayoutFromC(C.c2goChannelLayout7Point1)
ChannelLayout7Point1Wide = newChannelLayoutFromC(C.c2goChannelLayout7Point1Wide)
ChannelLayout7Point1WideBack = newChannelLayoutFromC(C.c2goChannelLayout7Point1WideBack)
ChannelLayout5Point1Point2Back = newChannelLayoutFromC(C.c2goChannelLayout5Point1Point2Back)
ChannelLayoutOctagonal = newChannelLayoutFromC(C.c2goChannelLayoutOctagonal)
ChannelLayoutCube = newChannelLayoutFromC(C.c2goChannelLayoutCube)
ChannelLayout5Point1Point4Back = newChannelLayoutFromC(C.c2goChannelLayout5Point1Point4Back)
ChannelLayout7Point1Point2 = newChannelLayoutFromC(C.c2goChannelLayout7Point1Point2)
ChannelLayout7Point1Point4Back = newChannelLayoutFromC(C.c2goChannelLayout7Point1Point4Back)
ChannelLayoutHexadecagonal = newChannelLayoutFromC(C.c2goChannelLayoutHexadecagonal)
ChannelLayoutStereoDownmix = newChannelLayoutFromC(C.c2goChannelLayoutStereoDownmix)
ChannelLayout22Point2 = newChannelLayoutFromC(C.c2goChannelLayout22Point2)
)

type ChannelLayout struct {
Expand Down
2 changes: 1 addition & 1 deletion channel_layout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestChannelLayout(t *testing.T) {
cl := ChannelLayoutStereo
require.Equal(t, 2, cl.NbChannels())
require.Equal(t, "stereo", cl.String())
require.Equal(t, "stereo\x00", cl.String())
require.True(t, cl.Valid())
require.True(t, cl.Equal(ChannelLayoutStereo))
require.False(t, cl.Equal(ChannelLayoutMono))
Expand Down
20 changes: 9 additions & 11 deletions codec_context_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const (
CodecContextFlagLoopFilter = CodecContextFlag(C.AV_CODEC_FLAG_LOOP_FILTER)
CodecContextFlagGray = CodecContextFlag(C.AV_CODEC_FLAG_GRAY)
CodecContextFlagPsnr = CodecContextFlag(C.AV_CODEC_FLAG_PSNR)
CodecContextFlagTruncated = CodecContextFlag(C.AV_CODEC_FLAG_TRUNCATED)
CodecContextFlagInterlacedDct = CodecContextFlag(C.AV_CODEC_FLAG_INTERLACED_DCT)
CodecContextFlagLowDelay = CodecContextFlag(C.AV_CODEC_FLAG_LOW_DELAY)
CodecContextFlagGlobalHeader = CodecContextFlag(C.AV_CODEC_FLAG_GLOBAL_HEADER)
Expand All @@ -32,14 +31,13 @@ type CodecContextFlag2 int

// https://github.com/FFmpeg/FFmpeg/blob/n5.0/libavcodec/avcodec.h#L287
const (
CodecFlag2Fast = CodecContextFlag2(C.AV_CODEC_FLAG2_FAST)
CodecFlag2NoOutput = CodecContextFlag2(C.AV_CODEC_FLAG2_NO_OUTPUT)
CodecFlag2LocalHeader = CodecContextFlag2(C.AV_CODEC_FLAG2_LOCAL_HEADER)
CodecFlag2DropFrameTimecode = CodecContextFlag2(C.AV_CODEC_FLAG2_DROP_FRAME_TIMECODE)
CodecFlag2Chunks = CodecContextFlag2(C.AV_CODEC_FLAG2_CHUNKS)
CodecFlag2IgnoreCrop = CodecContextFlag2(C.AV_CODEC_FLAG2_IGNORE_CROP)
CodecFlag2ShowAll = CodecContextFlag2(C.AV_CODEC_FLAG2_SHOW_ALL)
CodecFlag2ExportMvs = CodecContextFlag2(C.AV_CODEC_FLAG2_EXPORT_MVS)
CodecFlag2SkipManual = CodecContextFlag2(C.AV_CODEC_FLAG2_SKIP_MANUAL)
CodecFlag2RoFlushNoop = CodecContextFlag2(C.AV_CODEC_FLAG2_RO_FLUSH_NOOP)
CodecFlag2Fast = CodecContextFlag2(C.AV_CODEC_FLAG2_FAST)
CodecFlag2NoOutput = CodecContextFlag2(C.AV_CODEC_FLAG2_NO_OUTPUT)
CodecFlag2LocalHeader = CodecContextFlag2(C.AV_CODEC_FLAG2_LOCAL_HEADER)
CodecFlag2Chunks = CodecContextFlag2(C.AV_CODEC_FLAG2_CHUNKS)
CodecFlag2IgnoreCrop = CodecContextFlag2(C.AV_CODEC_FLAG2_IGNORE_CROP)
CodecFlag2ShowAll = CodecContextFlag2(C.AV_CODEC_FLAG2_SHOW_ALL)
CodecFlag2ExportMvs = CodecContextFlag2(C.AV_CODEC_FLAG2_EXPORT_MVS)
CodecFlag2SkipManual = CodecContextFlag2(C.AV_CODEC_FLAG2_SKIP_MANUAL)
CodecFlag2RoFlushNoop = CodecContextFlag2(C.AV_CODEC_FLAG2_RO_FLUSH_NOOP)
)
4 changes: 4 additions & 0 deletions codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func TestCodec(t *testing.T) {
ChannelLayout5Point0Back,
ChannelLayout5Point1Back,
ChannelLayout7Point1WideBack,
ChannelLayout6Point1Back,
ChannelLayout7Point1,
ChannelLayout22Point2,
ChannelLayout5Point1Point2Back,
}
gls := c.ChannelLayouts()
require.Len(t, gls, len(els))
Expand Down
1 change: 0 additions & 1 deletion format_context_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const (
FormatContextFlagFlushPackets = FormatContextFlag(C.AVFMT_FLAG_FLUSH_PACKETS)
FormatContextFlagBitexact = FormatContextFlag(C.AVFMT_FLAG_BITEXACT)
FormatContextFlagSortDts = FormatContextFlag(C.AVFMT_FLAG_SORT_DTS)
FormatContextFlagPrivOpt = FormatContextFlag(C.AVFMT_FLAG_PRIV_OPT)
FormatContextFlagFastSeek = FormatContextFlag(C.AVFMT_FLAG_FAST_SEEK)
FormatContextFlagShortest = FormatContextFlag(C.AVFMT_FLAG_SHORTEST)
FormatContextFlagAutoBsf = FormatContextFlag(C.AVFMT_FLAG_AUTO_BSF)
Expand Down
6 changes: 3 additions & 3 deletions format_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ func TestFormatContext(t *testing.T) {
require.Len(t, ss, 2)
s1 := ss[0]

require.Equal(t, int64(607583), fc1.BitRate())
require.Equal(t, int64(607664), fc1.BitRate())
require.Equal(t, NewFormatContextCtxFlags(0), fc1.CtxFlags())
require.Equal(t, int64(5014000), fc1.Duration())
require.Equal(t, int64(5013333), fc1.Duration())
require.True(t, fc1.EventFlags().Has(FormatEventFlagMetadataUpdated))
require.True(t, fc1.Flags().Has(FormatContextFlagAutoBsf))
require.Equal(t, NewRational(24, 1), fc1.GuessFrameRate(s1, nil))
Expand All @@ -33,7 +33,7 @@ func TestFormatContext(t *testing.T) {

sdp, err := fc1.SDPCreate()
require.NoError(t, err)
require.Equal(t, "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=Big Buck Bunny\r\nt=0 0\r\na=tool:libavformat LIBAVFORMAT_VERSION\r\nm=video 0 RTP/AVP 96\r\nb=AS:441\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LADasgKDPz4CIAAAMAAgAAAwBhHihUkA==,aM48gA==; profile-level-id=42C00D\r\na=control:streamid=0\r\nm=audio 0 RTP/AVP 97\r\nb=AS:161\r\na=rtpmap:97 MPEG4-GENERIC/48000/2\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1190\r\na=control:streamid=1\r\n", sdp)
require.Equal(t, "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=Big Buck Bunny\r\nt=0 0\r\na=tool:libavformat 60.16.100\r\nm=video 0 RTP/AVP 96\r\nb=AS:441\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LADasgKDPz4CIAAAMAAgAAAwBhHihUkA==,aM48gA==; profile-level-id=42C00D\r\na=control:streamid=0\r\nm=audio 0 RTP/AVP 97\r\nb=AS:161\r\na=rtpmap:97 MPEG4-GENERIC/48000/2\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1190\r\na=control:streamid=1\r\n", sdp)

fc2, err := AllocOutputFormatContext(nil, "", "/tmp/test.mp4")
require.NoError(t, err)
Expand Down

0 comments on commit 3ce7cb5

Please sign in to comment.