mirror of
https://github.com/asticode/go-astiav.git
synced 2025-09-26 20:21:15 +08:00
Added sample format is planar and bytes per sample
This commit is contained in:
@@ -31,3 +31,13 @@ func (f SampleFormat) Name() string {
|
||||
func (f SampleFormat) String() string {
|
||||
return f.Name()
|
||||
}
|
||||
|
||||
// https://ffmpeg.org/doxygen/7.0/group__lavu__sampfmts.html#ga0c3c218e1dd570ad4917c69a35a6c77d
|
||||
func (f SampleFormat) BytesPerSample() int {
|
||||
return int(C.av_get_bytes_per_sample((C.enum_AVSampleFormat)(f)))
|
||||
}
|
||||
|
||||
// https://ffmpeg.org/doxygen/7.0/group__lavu__sampfmts.html#ga06ba8a64dc4382c422789a5d0b6bf592
|
||||
func (f SampleFormat) IsPlanar() bool {
|
||||
return C.av_sample_fmt_is_planar((C.enum_AVSampleFormat)(f)) > 0
|
||||
}
|
||||
|
@@ -8,4 +8,7 @@ import (
|
||||
|
||||
func TestSampleFormat(t *testing.T) {
|
||||
require.Equal(t, "s16", SampleFormatS16.String())
|
||||
require.Equal(t, 2, SampleFormatS16.BytesPerSample())
|
||||
require.False(t, SampleFormatS16.IsPlanar())
|
||||
require.True(t, SampleFormatS16P.IsPlanar())
|
||||
}
|
||||
|
Reference in New Issue
Block a user