mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-01 05:45:45 +00:00
multimedia/py-ffmpeg: adjust pts after r425471
AVFrame.pkt_pts didn't exist in ffmpeg-4f7d2fe-2010-12-16 snapshot when global_video_pkt_pts was added to py-ffmpeg. The code worked it around by saving PTS in AVFrame.opaque just before avcodec_decode_video2() call. This broke when r425471 removed our_get_buffer(). So, just use AVFrame.pkt_pts directly now. PR: 214247 Approved by: dbn (maintainer)
This commit is contained in:
parent
768d881995
commit
1a7f95e5a9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=425603
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME= ffmpeg
|
||||
PORTVERSION= 1.2.4
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
CATEGORIES= multimedia python
|
||||
MASTER_SITES= GH LOCAL/dbn/${PORTNAME}
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
@ -1,6 +1,14 @@
|
||||
--- 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
|
||||
@ -9,7 +17,7 @@
|
||||
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)
|
||||
|
||||
@ -18,7 +26,7 @@
|
||||
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)
|
||||
|
||||
|
@ -1,6 +1,15 @@
|
||||
--- 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:
|
||||
@ -14,7 +23,7 @@
|
||||
|
||||
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 = <unsigned char *>av_malloc(vp.ff_data_size * sizeof(unsigned char))
|
||||
@ -23,7 +32,7 @@
|
||||
avpicture_fill(<AVPicture *>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
|
||||
|
||||
|
||||
@ -43,7 +52,7 @@
|
||||
cdef int video_thread(void *arg) nogil:
|
||||
cdef VideoState *vs = <VideoState *>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
|
||||
|
||||
@ -52,7 +61,27 @@
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user