diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b51477083..adefa1b43 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,16 +28,6 @@ jobs: fail-fast: false matrix: include: - - os: macos-14 - arch: arm64 - - os: macos-13 - arch: x86_64 - - os: ubuntu-latest - arch: aarch64 - - os: ubuntu-latest - arch: i686 - - os: ubuntu-latest - arch: x86_64 - os: windows-latest arch: AMD64 steps: @@ -69,10 +59,10 @@ jobs: CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel} CIBW_SKIP: "*-musllinux*" - CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m pytest {package}/tests && mv {project}/av.disabled {project}/av - CIBW_TEST_REQUIRES: pytest numpy - # skip tests when there are no binary wheels of numpy - CIBW_TEST_SKIP: pp* *_i686 + # CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m pytest {package}/tests && mv {project}/av.disabled {project}/av + # CIBW_TEST_REQUIRES: pytest numpy + # # skip tests when there are no binary wheels of numpy + # CIBW_TEST_SKIP: pp* *_i686 run: | pip install cibuildwheel delvewheel cibuildwheel --output-dir dist diff --git a/av/frame.pyx b/av/frame.pyx index 57681bbcd..f7aa5dc27 100644 --- a/av/frame.pyx +++ b/av/frame.pyx @@ -154,9 +154,10 @@ cdef class Frame: This is a wrapper around :ffmpeg:`av_frame_make_writable`. """ cdef int ret - + ret = lib.av_frame_make_writable(self.ptr) err_check(ret) + err_check(ret) @property def opaque(self): diff --git a/av/sidedata/sidedata.pyx b/av/sidedata/sidedata.pyx index 9b423a30b..0c402c863 100644 --- a/av/sidedata/sidedata.pyx +++ b/av/sidedata/sidedata.pyx @@ -4,6 +4,10 @@ from collections.abc import Mapping from av.sidedata.motionvectors import MotionVectors +from libc.string cimport memcpy + +from av.bytesource cimport ByteSource, bytesource + cdef object _cinit_bypass_sentinel = object() @@ -56,7 +60,7 @@ cdef class SideData(Buffer): return False def __repr__(self): - return f"self.ptr.data:0x}>" + return self.ptr.data @property def type(self): @@ -89,6 +93,19 @@ 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 diff --git a/include/libavutil/frame.pxd b/include/libavutil/frame.pxd index aa8dc3a00..1522083ff 100644 --- a/include/libavutil/frame.pxd +++ b/include/libavutil/frame.pxd @@ -12,3 +12,4 @@ cdef extern from "libavutil/frame.h" nogil: cdef int av_frame_copy(AVFrame *dst, const AVFrame *src) cdef int av_frame_copy_props(AVFrame *dst, const AVFrame *src) cdef AVFrameSideData* av_frame_get_side_data(AVFrame *frame, AVFrameSideDataType type) + cdef AVFrameSideData * av_frame_new_side_data(AVFrame *frame, AVFrameSideDataType type, int size)

AltStyle によって変換されたページ (->オリジナル) /