1 |
From 3bdb2c8f8b6d5ef90c208af567606e61d6c0e02a Mon Sep 17 00:00:00 2001 |
2 |
From: Alexis Ballier <aballier@gentoo.org> |
3 |
Date: Thu, 5 Apr 2012 11:07:41 -0300 |
4 |
Subject: [PATCH 142/145] Bring av_read_frame_flush in line with ffmpeg git. |
5 |
|
6 |
Current version failed to build with ffmpeg git. This patch uses the new code when we are building against libavformat 54. |
7 |
(cherry picked from commit ac2d961354533972c4bde5e8c7defd5404754877) |
8 |
--- |
9 |
lib/xbmc-dll-symbols/DllAvFormat.c | 35 +++++++++++++++++++++++++++++++++++ |
10 |
1 file changed, 35 insertions(+) |
11 |
|
12 |
diff --git a/lib/xbmc-dll-symbols/DllAvFormat.c b/lib/xbmc-dll-symbols/DllAvFormat.c |
13 |
index 31040a3..61ffdf4 100644 |
14 |
--- a/lib/xbmc-dll-symbols/DllAvFormat.c |
15 |
+++ b/lib/xbmc-dll-symbols/DllAvFormat.c |
16 |
@@ -28,6 +28,7 @@ |
17 |
#include <libavformat/avformat.h> |
18 |
|
19 |
/* Taken from libavformat/utils.c */ |
20 |
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0) |
21 |
static void flush_packet_queue(AVFormatContext *s) |
22 |
{ |
23 |
AVPacketList *pktl; |
24 |
@@ -53,6 +54,27 @@ static void flush_packet_queue(AVFormatContext *s) |
25 |
s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; |
26 |
#endif |
27 |
} |
28 |
+#else |
29 |
+static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) |
30 |
+{ |
31 |
+ while (*pkt_buf) { |
32 |
+ AVPacketList *pktl = *pkt_buf; |
33 |
+ *pkt_buf = pktl->next; |
34 |
+ av_free_packet(&pktl->pkt); |
35 |
+ av_freep(&pktl); |
36 |
+ } |
37 |
+ *pkt_buf_end = NULL; |
38 |
+} |
39 |
+/* XXX: suppress the packet queue */ |
40 |
+static void flush_packet_queue(AVFormatContext *s) |
41 |
+{ |
42 |
+ free_packet_buffer(&s->parse_queue, &s->parse_queue_end); |
43 |
+ free_packet_buffer(&s->packet_buffer, &s->packet_buffer_end); |
44 |
+ free_packet_buffer(&s->raw_packet_buffer, &s->raw_packet_buffer_end); |
45 |
+ |
46 |
+ s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; |
47 |
+} |
48 |
+#endif |
49 |
|
50 |
/* Taken from libavformat/utils.c */ |
51 |
void av_read_frame_flush(AVFormatContext *s) |
52 |
@@ -62,7 +84,9 @@ void av_read_frame_flush(AVFormatContext *s) |
53 |
|
54 |
flush_packet_queue(s); |
55 |
|
56 |
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0) |
57 |
s->cur_st = NULL; |
58 |
+#endif |
59 |
|
60 |
/* for each stream, reset read state */ |
61 |
for(i = 0; i < s->nb_streams; i++) { |
62 |
@@ -71,14 +95,25 @@ void av_read_frame_flush(AVFormatContext *s) |
63 |
if (st->parser) { |
64 |
av_parser_close(st->parser); |
65 |
st->parser = NULL; |
66 |
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0) |
67 |
av_free_packet(&st->cur_pkt); |
68 |
+#endif |
69 |
} |
70 |
st->last_IP_pts = AV_NOPTS_VALUE; |
71 |
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0) |
72 |
st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */ |
73 |
st->reference_dts = AV_NOPTS_VALUE; |
74 |
/* fail safe */ |
75 |
st->cur_ptr = NULL; |
76 |
st->cur_len = 0; |
77 |
+#else |
78 |
+#define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48)) |
79 |
+ if(st->first_dts == AV_NOPTS_VALUE) st->cur_dts = RELATIVE_TS_BASE; |
80 |
+ else st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */ |
81 |
+ st->reference_dts = AV_NOPTS_VALUE; |
82 |
+ |
83 |
+ st->probe_packets = MAX_PROBE_PACKETS; |
84 |
+#endif |
85 |
|
86 |
for(j=0; j<MAX_REORDER_DELAY+1; j++) |
87 |
st->pts_buffer[j]= AV_NOPTS_VALUE; |
88 |
-- |
89 |
1.7.10 |
90 |
|