From 58797595249783c1400db5678329b992879f1ff0 Mon Sep 17 00:00:00 2001 From: LKHZ <70903631+LKHZ@users.noreply.github.com> Date: Mon, 26 May 2025 11:03:22 +0800 Subject: [PATCH 1/4] Update sidedata.pyx add sei --- av/sidedata/sidedata.pyx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/av/sidedata/sidedata.pyx b/av/sidedata/sidedata.pyx index 24dbae119..8a3372f52 100644 --- a/av/sidedata/sidedata.pyx +++ b/av/sidedata/sidedata.pyx @@ -110,6 +110,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): From 410355b8c540099f60c032f0b9f73b30e0a4138a Mon Sep 17 00:00:00 2001 From: LKHZ <70903631+LKHZ@users.noreply.github.com> Date: Mon, 26 May 2025 11:05:16 +0800 Subject: [PATCH 2/4] Update frame.pxd add sei --- include/libavutil/frame.pxd | 1 + 1 file changed, 1 insertion(+) 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) From 2e48bf6c0536f34e38a80c03078c4418081caf0b Mon Sep 17 00:00:00 2001 From: LKHZ <70903631+LKHZ@users.noreply.github.com> Date: Mon, 26 May 2025 11:18:28 +0800 Subject: [PATCH 3/4] Update tests.yml ubuntu22.04 python3.12 x86_64 --- .github/workflows/tests.yml | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) 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 }} From 1c33151a9617c6e8f11d25b4a273ab36c2a9a8d4 Mon Sep 17 00:00:00 2001 From: LKHZ <70903631+LKHZ@users.noreply.github.com> Date: Mon, 26 May 2025 11:28:29 +0800 Subject: [PATCH 4/4] Update sidedata.pyx add touwenjian --- av/sidedata/sidedata.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/av/sidedata/sidedata.pyx b/av/sidedata/sidedata.pyx index 8a3372f52..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()