diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a38af2c08..3e1053eb0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,12 +5,12 @@ on: workflow_dispatch: jobs: package-source: - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.12" - name: Build source package run: | pip install -U --pre cython setuptools @@ -28,32 +28,32 @@ jobs: fail-fast: false matrix: include: - - os: macos-14 - arch: arm64 - - os: macos-13 - arch: x86_64 - - os: ubuntu-24.04-arm - arch: aarch64 - - os: ubuntu-24.04 - arch: i686 + #- os: macos-14 + # arch: arm64 + #- os: macos-13 + # arch: x86_64 + #- os: ubuntu-24.04-arm + # arch: aarch64 + #- os: ubuntu-24.04 + # arch: i686 - os: ubuntu-24.04 arch: x86_64 - - os: windows-latest - arch: AMD64 + #- os: windows-latest + # arch: AMD64 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.13" - - name: Install packages - if: matrix.os == 'macos-13' - run: | - brew update - brew install pkg-config - - name: Set Minimum MacOS Target - if: matrix.os == 'macos-13' || matrix.os == 'macos-14' - run: | - echo "MACOSX_DEPLOYMENT_TARGET=12.0" >> $GITHUB_ENV + python-version: "3.12" + # - name: Install packages + # if: matrix.os == 'macos-13' + # run: | + # brew update + # brew install pkg-config + # - name: Set Minimum MacOS Target + # if: matrix.os == 'macos-13' || matrix.os == 'macos-14' + # run: | + # echo "MACOSX_DEPLOYMENT_TARGET=12.0" >> $GITHUB_ENV - name: Build wheels env: CIBW_ARCHS: ${{ matrix.arch }} diff --git a/av/sidedata/sidedata.pyx b/av/sidedata/sidedata.pyx index 24dbae119..1d1495ff3 100644 --- a/av/sidedata/sidedata.pyx +++ b/av/sidedata/sidedata.pyx @@ -4,7 +4,9 @@ from collections.abc import Mapping from enum import Enum from av.sidedata.motionvectors import MotionVectors +from libc.string cimport memcpy +from av.bytesource cimport ByteSource, bytesource cdef object _cinit_bypass_sentinel = object() @@ -110,6 +112,20 @@ cdef class _SideDataContainer: if isinstance(key, str): return self._by_type[Type[key]] return self._by_type[key] + + 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): 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)