1 |
From c95515cf4ac4372302f9dbf78b214a57bd8c6eff Mon Sep 17 00:00:00 2001 |
2 |
From: Alexis Ballier <aballier@gentoo.org> |
3 |
Date: Thu, 1 Mar 2012 10:22:11 -0300 |
4 |
Subject: [PATCH 119/145] Drop url_set_interrupt_cb usage which was removed in |
5 |
libavformat 54 and set the callback directly in the |
6 |
AVFormatContext, which was added in |
7 |
libavformat-53.15.0 (cherry picked from commit |
8 |
0bf68bf61aab44ccf6f54a2923ed567f9a56af4a) |
9 |
|
10 |
--- |
11 |
lib/DllAvFormat.h | 4 ---- |
12 |
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 14 +++++++------- |
13 |
2 files changed, 7 insertions(+), 11 deletions(-) |
14 |
|
15 |
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h |
16 |
index d6753ae..405a58b 100644 |
17 |
--- a/lib/DllAvFormat.h |
18 |
+++ b/lib/DllAvFormat.h |
19 |
@@ -74,7 +74,6 @@ public: |
20 |
#if (!defined USE_EXTERNAL_FFMPEG) |
21 |
virtual int avformat_find_stream_info_dont_call(AVFormatContext *ic, AVDictionary **options)=0; |
22 |
#endif |
23 |
- virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)=0; |
24 |
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)=0; |
25 |
virtual int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
26 |
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
27 |
@@ -139,7 +138,6 @@ public: |
28 |
CSingleLock lock(DllAvCodec::m_critSection); |
29 |
return ::avformat_find_stream_info(ic, options); |
30 |
} |
31 |
- virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb) { ::url_set_interrupt_cb(interrupt_cb); } |
32 |
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options) |
33 |
{ return ::avformat_open_input(ps, filename, fmt, options); } |
34 |
virtual int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
35 |
@@ -216,7 +214,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
36 |
DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be24, AVIOContext*, unsigned int) |
37 |
DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be32, AVIOContext*, unsigned int) |
38 |
DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be16, AVIOContext*, unsigned int) |
39 |
- DEFINE_METHOD1(void, url_set_interrupt_cb, (URLInterruptCB *p1)) |
40 |
DEFINE_METHOD8(int, init_put_byte, (AVIOContext *p1, unsigned char *p2, int p3, int p4, void *p5, |
41 |
int (*p6)(void *opaque, uint8_t *buf, int buf_size), |
42 |
int (*p7)(void *opaque, uint8_t *buf, int buf_size), |
43 |
@@ -253,7 +250,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
44 |
RESOLVE_METHOD(av_read_frame_flush) |
45 |
RESOLVE_METHOD(av_seek_frame) |
46 |
RESOLVE_METHOD_RENAME(avformat_find_stream_info, avformat_find_stream_info_dont_call) |
47 |
- RESOLVE_METHOD(url_set_interrupt_cb) |
48 |
RESOLVE_METHOD(avformat_open_input) |
49 |
RESOLVE_METHOD(init_put_byte) |
50 |
RESOLVE_METHOD(av_probe_input_format) |
51 |
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
52 |
index 1205e05..aff44f6 100644 |
53 |
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
54 |
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
55 |
@@ -160,7 +160,7 @@ static TLS g_tls; |
56 |
#define g_demuxer (*((CDVDDemuxFFmpeg**)g_tls.Get())) |
57 |
#endif |
58 |
|
59 |
-static int interrupt_cb(void) |
60 |
+static int interrupt_cb(void* unused) |
61 |
{ |
62 |
if(g_demuxer && g_demuxer->Aborted()) |
63 |
return 1; |
64 |
@@ -178,7 +178,7 @@ static int dvd_file_open(URLContext *h, const char *filename, int flags) |
65 |
|
66 |
static int dvd_file_read(void *h, uint8_t* buf, int size) |
67 |
{ |
68 |
- if(interrupt_cb()) |
69 |
+ if(interrupt_cb(NULL)) |
70 |
return -1; |
71 |
|
72 |
CDVDInputStream* pInputStream = (CDVDInputStream*)h; |
73 |
@@ -192,7 +192,7 @@ static int dvd_file_write(URLContext *h, BYTE* buf, int size) |
74 |
*/ |
75 |
static offset_t dvd_file_seek(void *h, offset_t pos, int whence) |
76 |
{ |
77 |
- if(interrupt_cb()) |
78 |
+ if(interrupt_cb(NULL)) |
79 |
return -1; |
80 |
|
81 |
CDVDInputStream* pInputStream = (CDVDInputStream*)h; |
82 |
@@ -236,6 +236,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) |
83 |
m_speed = DVD_PLAYSPEED_NORMAL; |
84 |
g_demuxer = this; |
85 |
m_program = UINT_MAX; |
86 |
+ const AVIOInterruptCB int_cb = { interrupt_cb, NULL }; |
87 |
|
88 |
if (!pInput) return false; |
89 |
|
90 |
@@ -246,10 +247,6 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) |
91 |
|
92 |
// register codecs |
93 |
m_dllAvFormat.av_register_all(); |
94 |
- m_dllAvFormat.url_set_interrupt_cb(interrupt_cb); |
95 |
- |
96 |
- // could be used for interupting ffmpeg while opening a file (eg internet streams) |
97 |
- // url_set_interrupt_cb(NULL); |
98 |
|
99 |
m_pInput = pInput; |
100 |
strFile = m_pInput->GetFileName(); |
101 |
@@ -424,6 +421,9 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) |
102 |
} |
103 |
} |
104 |
|
105 |
+ // set the interrupt callback, appeared in libavformat 53.15.0 |
106 |
+ m_pFormatContext->interrupt_callback = int_cb; |
107 |
+ |
108 |
// analyse very short to speed up mjpeg playback start |
109 |
if (iformat && (strcmp(iformat->name, "mjpeg") == 0) && m_ioContext->seekable == 0) |
110 |
m_pFormatContext->max_analyze_duration = 500000; |
111 |
-- |
112 |
1.7.10 |
113 |
|