Lines 1-6
Link Here
|
1 |
--- ffmpeg/_ffmpeg.pyx.orig 2013-10-28 16:04:02 UTC |
1 |
--- ffmpeg/_ffmpeg.pyx.orig 2013-10-28 16:04:02 UTC |
2 |
+++ ffmpeg/_ffmpeg.pyx |
2 |
+++ ffmpeg/_ffmpeg.pyx |
3 |
@@ -518,11 +518,11 @@ cdef int audio_decode_frame(VideoState * |
3 |
@@ -81,8 +81,6 @@ DEF FF_REFRESH_EVENT = 2 |
|
|
4 |
DEF FF_QUIT_EVENT = 3 |
5 |
DEF FF_SCHEDULE_EVENT = 4 |
6 |
|
7 |
-cdef uint64_t global_video_pkt_pts = AV_NOPTS_VALUE |
8 |
- |
9 |
ctypedef void (*event_callback_t)(void *) |
10 |
|
11 |
cdef struct Event: |
12 |
@@ -518,11 +516,11 @@ cdef int audio_decode_frame(VideoState * |
4 |
got_frame = 0 |
13 |
got_frame = 0 |
5 |
|
14 |
|
6 |
if frame == NULL: |
15 |
if frame == NULL: |
Lines 14-20
Link Here
|
14 |
|
23 |
|
15 |
len1 = avcodec_decode_audio4(vs.audio_st.codec, |
24 |
len1 = avcodec_decode_audio4(vs.audio_st.codec, |
16 |
frame, &got_frame, pkt) |
25 |
frame, &got_frame, pkt) |
17 |
@@ -784,7 +784,7 @@ cdef void alloc_picture(void *userdata) |
26 |
@@ -784,7 +782,7 @@ cdef void alloc_picture(void *userdata) |
18 |
|
27 |
|
19 |
vp.ff_data_size = avpicture_get_size(PF_RGB24, vp.width, vp.height) |
28 |
vp.ff_data_size = avpicture_get_size(PF_RGB24, vp.width, vp.height) |
20 |
vp.ff_data = <unsigned char *>av_malloc(vp.ff_data_size * sizeof(unsigned char)) |
29 |
vp.ff_data = <unsigned char *>av_malloc(vp.ff_data_size * sizeof(unsigned char)) |
Lines 23-29
Link Here
|
23 |
avpicture_fill(<AVPicture *>vp.bmp, vp.ff_data, PF_RGB24, |
32 |
avpicture_fill(<AVPicture *>vp.bmp, vp.ff_data, PF_RGB24, |
24 |
vp.width, vp.height) |
33 |
vp.width, vp.height) |
25 |
|
34 |
|
26 |
@@ -886,19 +886,6 @@ cdef double synchronize_video(VideoState |
35 |
@@ -886,19 +884,6 @@ cdef double synchronize_video(VideoState |
27 |
return pts |
36 |
return pts |
28 |
|
37 |
|
29 |
|
38 |
|
Lines 43-49
Link Here
|
43 |
cdef int video_thread(void *arg) nogil: |
52 |
cdef int video_thread(void *arg) nogil: |
44 |
cdef VideoState *vs = <VideoState *>arg |
53 |
cdef VideoState *vs = <VideoState *>arg |
45 |
cdef AVPacket pkt1, *packet = &pkt1 |
54 |
cdef AVPacket pkt1, *packet = &pkt1 |
46 |
@@ -906,7 +893,7 @@ cdef int video_thread(void *arg) nogil: |
55 |
@@ -906,7 +891,7 @@ cdef int video_thread(void *arg) nogil: |
47 |
cdef AVFrame *pFrame |
56 |
cdef AVFrame *pFrame |
48 |
cdef double pts, ptst = 0 |
57 |
cdef double pts, ptst = 0 |
49 |
|
58 |
|
Lines 52-58
Link Here
|
52 |
|
61 |
|
53 |
while True: |
62 |
while True: |
54 |
if packet_queue_get(&vs.videoq, packet, 1) < 0: |
63 |
if packet_queue_get(&vs.videoq, packet, 1) < 0: |
55 |
@@ -1038,8 +1025,6 @@ cdef int stream_component_open(VideoStat |
64 |
@@ -919,16 +904,13 @@ cdef int video_thread(void *arg) nogil: |
|
|
65 |
|
66 |
pts = 0 |
67 |
|
68 |
- # Save global pts to be stored in pFrame |
69 |
- global_video_pkt_pts = packet.pts |
70 |
# Decode video frame |
71 |
with gil: |
72 |
len1 = avcodec_decode_video2( |
73 |
vs.video_st.codec, pFrame, &frameFinished, packet) |
74 |
- if packet.dts == AV_NOPTS_VALUE and pFrame.opaque: |
75 |
- memcpy(&ptst, pFrame.opaque, sizeof(uint64_t)) |
76 |
- if ptst != AV_NOPTS_VALUE: |
77 |
- pts = ptst |
78 |
+ if packet.dts == AV_NOPTS_VALUE: |
79 |
+ if pFrame.pkt_pts != AV_NOPTS_VALUE: |
80 |
+ pts = pFrame.pkt_pts |
81 |
elif packet.dts != AV_NOPTS_VALUE: |
82 |
pts = packet.dts |
83 |
else: |
84 |
@@ -1038,8 +1020,6 @@ cdef int stream_component_open(VideoStat |
56 |
|
85 |
|
57 |
packet_queue_init(&vs.videoq) |
86 |
packet_queue_init(&vs.videoq) |
58 |
vs.video_tid = SDL_CreateThread(video_thread, vs) |
87 |
vs.video_tid = SDL_CreateThread(video_thread, vs) |