diff --git a/av/sidedata/sidedata.pyx b/av/sidedata/sidedata.pyx index 9b423a30b..c7070c34f 100644 --- a/av/sidedata/sidedata.pyx +++ b/av/sidedata/sidedata.pyx @@ -88,7 +88,21 @@ cdef class _SideDataContainer: type_ = Type.get(key) return self._by_type[type_] + + def add(self, buffer, type): + # Add Frame side data + cdef ByteSource source = bytesource(buffer) + i = self.frame.ptr.nb_side_data + lib.av_frame_make_writable(self.frame.ptr) + ptr = lib.av_frame_new_side_data(self.frame.ptr, type, source.length) + memcpy(ptr.data, source.ptr, source.length) + + # Update side_data + + cdef SideData data = wrap_side_data(self.frame, i) + self._by_index.append(data) + self._by_type[data.type] = data class SideDataContainer(_SideDataContainer, Mapping): pass