File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,20 @@ func (f *Frame) SideData() *FrameSideData {
244244 return newFrameSideDataFromC (& f .c .side_data , & f .c .nb_side_data )
245245}
246246
247+ // https://ffmpeg.org/doxygen/7.0/structAVFrame.html#a5bde87fd101f66d6263bb451056dba13
248+ func (f * Frame ) Metadata () * Dictionary {
249+ return newDictionaryFromC (f .c .metadata )
250+ }
251+
252+ // https://ffmpeg.org/doxygen/7.0/structAVFrame.html#a5bde87fd101f66d6263bb451056dba13
253+ func (f * Frame ) SetMetadata (d * Dictionary ) {
254+ if d == nil {
255+ f .c .metadata = nil
256+ } else {
257+ f .c .metadata = d .c
258+ }
259+ }
260+
247261// https://ffmpeg.org/doxygen/7.0/structAVFrame.html#a1e71ce60cedd5f3b6811714a9f7f9e0a
248262func (f * Frame ) Width () int {
249263 return int (f .c .width )
Original file line number Diff line number Diff line change @@ -130,4 +130,16 @@ func TestFrame(t *testing.T) {
130130 f7b , err := f7 .Data ().Bytes (align )
131131 require .NoError (t , err )
132132 require .Equal (t , f6b , f7b )
133+
134+ f8 := AllocFrame ()
135+ require .NotNil (t , f8 )
136+ defer f8 .Free ()
137+ d := NewDictionary ()
138+ require .NoError (t , d .Set ("k" , "v" , 0 ))
139+ f8 .SetMetadata (d )
140+ v := f8 .Metadata ().Get ("k" , nil , 0 )
141+ require .NotNil (t , v )
142+ require .Equal (t , "v" , v .Value ())
143+ f8 .SetMetadata (nil )
144+ require .Nil (t , f8 .Metadata ())
133145}
You can’t perform that action at this time.
0 commit comments