Index: head/multimedia/py-ffmpeg/Makefile =================================================================== --- head/multimedia/py-ffmpeg/Makefile (revision 425602) +++ head/multimedia/py-ffmpeg/Makefile (revision 425603) @@ -1,36 +1,36 @@ # Created by: David Naylor # $FreeBSD$ PORTNAME= ffmpeg PORTVERSION= 1.2.4 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= multimedia python MASTER_SITES= GH LOCAL/dbn/${PORTNAME} PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} # Should not be setting DISTNAME, USE_GITHUB already sets a very nice and unique distname. DISTNAME= ${PORTNAME}-android-${PORTVERSION} MAINTAINER= dbn@FreeBSD.org COMMENT= Python bindings for FFmpeg LICENSE= LGPL20 LGPL21 LGPL3 LICENSE_COMB= dual BUILD_DEPENDS= cython:lang/cython LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg MAKE_ENV= FFMPEG_LIBRARIES="SDL SDL_mixer" FFMPEG_LIBRARY_DIRS=${LOCALBASE}/lib \ FFMPEG_INCLUDES=${LOCALBASE}/include/SDL FFMPEG_ROOT=${LOCALBASE} GH_ACCOUNT= tito GH_PROJECT= ${PORTNAME}-android GH_TAGNAME= 6636c3a USE_GITHUB= yes USES= python:2 USE_PYTHON= distutils autoplist USE_SDL= mixer WRKSRC_SUBDIR= python post-install: ${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/ffmpeg/_ffmpeg.so .include Index: head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi =================================================================== --- head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi (revision 425602) +++ head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pxi (revision 425603) @@ -1,29 +1,37 @@ --- ffmpeg/_ffmpeg.pxi.orig 2013-10-28 16:04:02 UTC +++ ffmpeg/_ffmpeg.pxi -@@ -53,8 +53,6 @@ cdef extern from "libavcodec/avcodec.h" +@@ -35,6 +35,7 @@ cdef extern from "libavcodec/avcodec.h" + unsigned char **data + int *linesize + int64_t pts ++ int64_t pkt_pts; + int repeat_pict + int nb_samples + int format +@@ -53,8 +54,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" +@@ -83,7 +82,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" +@@ -100,7 +99,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: Index: head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx =================================================================== --- head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx (revision 425602) +++ head/multimedia/py-ffmpeg/files/patch-ffmpeg___ffmpeg.pyx (revision 425603) @@ -1,63 +1,92 @@ --- ffmpeg/_ffmpeg.pyx.orig 2013-10-28 16:04:02 UTC +++ ffmpeg/_ffmpeg.pyx -@@ -518,11 +518,11 @@ cdef int audio_decode_frame(VideoState * +@@ -81,8 +81,6 @@ DEF FF_REFRESH_EVENT = 2 + DEF FF_QUIT_EVENT = 3 + DEF FF_SCHEDULE_EVENT = 4 + +-cdef uint64_t global_video_pkt_pts = AV_NOPTS_VALUE +- + ctypedef void (*event_callback_t)(void *) + + cdef struct Event: +@@ -518,11 +516,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) +@@ -784,7 +782,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 +@@ -886,19 +884,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: +@@ -906,7 +891,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 +@@ -919,16 +904,13 @@ cdef int video_thread(void *arg) nogil: + + pts = 0 + +- # Save global pts to be stored in pFrame +- global_video_pkt_pts = packet.pts + # Decode video frame + with gil: + len1 = avcodec_decode_video2( + vs.video_st.codec, pFrame, &frameFinished, packet) +- if packet.dts == AV_NOPTS_VALUE and pFrame.opaque: +- memcpy(&ptst, pFrame.opaque, sizeof(uint64_t)) +- if ptst != AV_NOPTS_VALUE: +- pts = ptst ++ if packet.dts == AV_NOPTS_VALUE: ++ if pFrame.pkt_pts != AV_NOPTS_VALUE: ++ pts = pFrame.pkt_pts + elif packet.dts != AV_NOPTS_VALUE: + pts = packet.dts + else: +@@ -1038,8 +1020,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