@@ -, +, @@ __pyx_v_codecCtx->get_buffer = __pyx_f_6ffmpeg_7_ffmpeg_our_get_buffer; ^~~~~~~~~~ get_buffer2 int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); ^ __pyx_v_codecCtx->release_buffer = __pyx_f_6ffmpeg_7_ffmpeg_our_release_buffer; ~~~~~~~~~~~~~~~~ ^ --- multimedia/py-ffmpeg/Makefile | 2 +- .../py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi | 29 ++++++++++ .../py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx | 63 ++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi create mode 100644 multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx --- b/multimedia/py-ffmpeg/Makefile +++ b/multimedia/py-ffmpeg/Makefile @@ -3,7 +3,7 @@ PORTNAME= ffmpeg PORTVERSION= 1.2.4 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= multimedia python MASTER_SITES= GH LOCAL/dbn/${PORTNAME} PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} --- /dev/null +++ b/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi @@ -0,0 +1,29 @@ +--- ffmpeg/_ffmpeg.pxi.orig 2013-10-28 16:04:02 UTC ++++ ffmpeg/_ffmpeg.pxi +@@ -53,8 +53,6 @@ cdef extern from "libavcodec/avcodec.h" + int channels + AVCodec *codec + AVMediaType codec_type +- int (*get_buffer)(AVCodecContext *c, AVFrame *pic) +- void (*release_buffer)(AVCodecContext *c, AVFrame *pic) + AVRational time_base + AVSampleFormat sample_fmt + struct AVPicture: +@@ -83,7 +81,7 @@ cdef extern from "libavcodec/avcodec.h" + ctypedef int (*lockmgr_t)(void **mutex, AVLockOp op) + int av_lockmgr_register(lockmgr_t cb) + +- AVFrame *avcodec_alloc_frame() ++ AVFrame *av_frame_alloc() + int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, AVPacket *avpkt) + int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int +@@ -100,7 +98,7 @@ cdef extern from "libavcodec/avcodec.h" + int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic) + void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) + +- void avcodec_get_frame_defaults(AVFrame *) ++ void av_frame_unref(AVFrame *) + + cdef extern from "libavresample/avresample.h" nogil: + struct ResampleContext: --- /dev/null +++ b/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx @@ -0,0 +1,63 @@ +--- ffmpeg/_ffmpeg.pyx.orig 2013-10-28 16:04:02 UTC ++++ ffmpeg/_ffmpeg.pyx +@@ -518,11 +518,11 @@ cdef int audio_decode_frame(VideoState * + got_frame = 0 + + if frame == NULL: +- frame = avcodec_alloc_frame() ++ frame = av_frame_alloc() + if frame == NULL: + return -1 + else: +- avcodec_get_frame_defaults(frame) ++ av_frame_unref(frame) + + len1 = avcodec_decode_audio4(vs.audio_st.codec, + frame, &got_frame, pkt) +@@ -784,7 +784,7 @@ cdef void alloc_picture(void *userdata) + + vp.ff_data_size = avpicture_get_size(PF_RGB24, vp.width, vp.height) + vp.ff_data = av_malloc(vp.ff_data_size * sizeof(unsigned char)) +- vp.bmp = avcodec_alloc_frame() ++ vp.bmp = av_frame_alloc() + avpicture_fill(vp.bmp, vp.ff_data, PF_RGB24, + vp.width, vp.height) + +@@ -886,19 +886,6 @@ cdef double synchronize_video(VideoState + return pts + + +-cdef int our_get_buffer(AVCodecContext *c, AVFrame *pic) nogil: +- cdef int ret = avcodec_default_get_buffer(c, pic) +- cdef uint64_t *pts = av_malloc(sizeof(uint64_t)) +- memcpy(pts, &global_video_pkt_pts, sizeof(uint64_t)) +- pic.opaque = pts +- return ret +- +- +-cdef void our_release_buffer(AVCodecContext *c, AVFrame *pic) nogil: +- if pic != NULL: av_freep(&pic.opaque) +- avcodec_default_release_buffer(c, pic) +- +- + cdef int video_thread(void *arg) nogil: + cdef VideoState *vs = arg + cdef AVPacket pkt1, *packet = &pkt1 +@@ -906,7 +893,7 @@ cdef int video_thread(void *arg) nogil: + cdef AVFrame *pFrame + cdef double pts, ptst = 0 + +- pFrame = avcodec_alloc_frame() ++ pFrame = av_frame_alloc() + + while True: + if packet_queue_get(&vs.videoq, packet, 1) < 0: +@@ -1038,8 +1025,6 @@ cdef int stream_component_open(VideoStat + + packet_queue_init(&vs.videoq) + vs.video_tid = SDL_CreateThread(video_thread, vs) +- codecCtx.get_buffer = our_get_buffer +- codecCtx.release_buffer = our_release_buffer + + else: + pass