diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 0ea133b..a3a0437 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -134,7 +134,7 @@ jobs: } linux_test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Set up Python 3.x @@ -143,7 +143,6 @@ jobs: python-version: 3.x - name: Install run: | - sudo add-apt-repository ppa:jonathonf/ffmpeg-4 -y sudo apt update sudo apt install ffmpeg libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev sudo apt install libavutil-dev libswscale-dev libswresample-dev libpostproc-dev libsdl2-dev libsdl2-2.0-0 @@ -165,7 +164,7 @@ jobs: pytest "$name/tests" linux_wheels: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Set up Python 3.x @@ -213,7 +212,7 @@ jobs: pytest "$name/tests" osx_wheels: - runs-on: macos-10.15 + runs-on: macos-latest steps: - uses: actions/checkout@v1 - name: Brew setup @@ -289,7 +288,7 @@ jobs: pytest "$name/tests" docs: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Set up Python 3.x diff --git a/ffpyplayer/clib/misc.c b/ffpyplayer/clib/misc.c index 55181d1..3fe0a3d 100644 --- a/ffpyplayer/clib/misc.c +++ b/ffpyplayer/clib/misc.c @@ -159,8 +159,7 @@ int get_plane_sizes(int size[4], int required_plane[4], enum AVPixelFormat pix_f return AVERROR(EINVAL); size[0] = linesizes[0] * height; - if (desc->flags & AV_PIX_FMT_FLAG_PAL || - desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { + if (desc->flags & AV_PIX_FMT_FLAG_PAL) { size[1] = 256 * 4; required_plane[0] = 1; return size[0] + size[1]; diff --git a/ffpyplayer/includes/ffmpeg.pxi b/ffpyplayer/includes/ffmpeg.pxi index 9793f21..562caf0 100644 --- a/ffpyplayer/includes/ffmpeg.pxi +++ b/ffpyplayer/includes/ffmpeg.pxi @@ -299,8 +299,8 @@ cdef: int av_interleaved_write_frame(AVFormatContext *, AVPacket *) void avformat_free_context(AVFormatContext *) uint8_t *av_stream_get_side_data (AVStream *, AVPacketSideDataType, int *) - AVOutputFormat *av_oformat_next(AVOutputFormat *) - AVInputFormat *av_iformat_next(AVInputFormat *) + const AVOutputFormat *av_muxer_iterate(void **) + const AVInputFormat *av_demuxer_iterate(void **) extern from "libavdevice/avdevice.h" nogil: void avdevice_register_all() diff --git a/ffpyplayer/tests/test_write.py b/ffpyplayer/tests/test_write.py index 2f26330..15e0d87 100644 --- a/ffpyplayer/tests/test_write.py +++ b/ffpyplayer/tests/test_write.py @@ -19,8 +19,7 @@ def get_gray_image_with_val(w, h, val): # Construct images size = w * h buf = bytearray([int(val)] * size) - buf2 = bytearray([0] * size) - img = Image(plane_buffers=[buf, buf2], pix_fmt='gray', size=(w, h)) + img = Image(plane_buffers=[buf], pix_fmt='gray', size=(w, h)) return img diff --git a/ffpyplayer/tools.pyx b/ffpyplayer/tools.pyx index 85ab807..5c9f801 100644 --- a/ffpyplayer/tools.pyx +++ b/ffpyplayer/tools.pyx @@ -317,10 +317,12 @@ cpdef get_fmts(int input=False, int output=False): cdef list fmts = [], full_names = [], exts = [] cdef AVOutputFormat *ofmt = NULL cdef AVInputFormat *ifmt = NULL + cdef void *ifmt_opaque = NULL + cdef void *ofmt_opaque = NULL cdef object names, full_name, ext if output: - ofmt = av_oformat_next(ofmt) + ofmt = av_muxer_iterate(&ofmt_opaque) while ofmt != NULL: if ofmt.name != NULL: names = tcode(ofmt.name).split(',') @@ -330,10 +332,10 @@ cpdef get_fmts(int input=False, int output=False): fmts.extend(names) full_names.extend([full_name, ] * len(names)) exts.extend([ext, ] * len(names)) - ofmt = av_oformat_next(ofmt) + ofmt = av_muxer_iterate(&ofmt_opaque) if input: - ifmt = av_iformat_next(ifmt) + ifmt = av_demuxer_iterate(&ifmt_opaque) while ifmt != NULL: if ifmt.name != NULL: names = tcode(ifmt.name).split(',') @@ -343,7 +345,7 @@ cpdef get_fmts(int input=False, int output=False): fmts.extend(names) full_names.extend([full_name, ] * len(names)) exts.extend([ext, ] * len(names)) - ifmt = av_iformat_next(ifmt) + ifmt = av_demuxer_iterate(&ifmt_opaque) exts = [x for (y, x) in sorted(zip(fmts, exts), key=_get_item0)] full_names = [x for (y, x) in sorted(zip(fmts, full_names), key=_get_item0)]