1 |
From c9111622ed27d68bd5a6c75468b45193f5f1f4d0 Mon Sep 17 00:00:00 2001 |
2 |
From: Alexis Ballier <aballier@gentoo.org> |
3 |
Date: Thu, 1 Mar 2012 11:08:29 -0300 |
4 |
Subject: [PATCH 124/145] Merge av_close_input_{file,stream} into |
5 |
avformat_close_input. |
6 |
|
7 |
The formers are deprecated and gone in libavformat 54. |
8 |
Moreover, this allows removing some code because avformat_close_input takes care of freeing relevant structures. |
9 |
(cherry picked from commit d6669d741f69e3d937c1949ef1986a952189fde4) |
10 |
--- |
11 |
lib/DllAvFormat.h | 12 ++++-------- |
12 |
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 16 ++++------------ |
13 |
2 files changed, 8 insertions(+), 20 deletions(-) |
14 |
|
15 |
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h |
16 |
index 4f9a60d..f6d6b70 100644 |
17 |
--- a/lib/DllAvFormat.h |
18 |
+++ b/lib/DllAvFormat.h |
19 |
@@ -63,8 +63,7 @@ public: |
20 |
virtual void av_register_all_dont_call(void)=0; |
21 |
virtual AVInputFormat *av_find_input_format(const char *short_name)=0; |
22 |
virtual int url_feof(AVIOContext *s)=0; |
23 |
- virtual void av_close_input_file(AVFormatContext *s)=0; |
24 |
- virtual void av_close_input_stream(AVFormatContext *s)=0; |
25 |
+ virtual void avformat_close_input(AVFormatContext **s)=0; |
26 |
virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt)=0; |
27 |
virtual void av_read_frame_flush(AVFormatContext *s)=0; |
28 |
virtual int av_read_play(AVFormatContext *s)=0; |
29 |
@@ -121,8 +120,7 @@ public: |
30 |
virtual void av_register_all_dont_call() { *(int* )0x0 = 0; } |
31 |
virtual AVInputFormat *av_find_input_format(const char *short_name) { return ::av_find_input_format(short_name); } |
32 |
virtual int url_feof(AVIOContext *s) { return ::url_feof(s); } |
33 |
- virtual void av_close_input_file(AVFormatContext *s) { ::av_close_input_file(s); } |
34 |
- virtual void av_close_input_stream(AVFormatContext *s) { ::av_close_input_stream(s); } |
35 |
+ virtual void avformat_close_input(AVFormatContext **s) { ::avformat_close_input(s); } |
36 |
virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt) { return ::av_read_frame(s, pkt); } |
37 |
virtual void av_read_frame_flush(AVFormatContext *s) { ::av_read_frame_flush(s); } |
38 |
virtual int av_read_play(AVFormatContext *s) { return ::av_read_play(s); } |
39 |
@@ -186,8 +184,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
40 |
DEFINE_METHOD0(void, av_register_all_dont_call) |
41 |
DEFINE_METHOD1(AVInputFormat*, av_find_input_format, (const char *p1)) |
42 |
DEFINE_METHOD1(int, url_feof, (AVIOContext *p1)) |
43 |
- DEFINE_METHOD1(void, av_close_input_file, (AVFormatContext *p1)) |
44 |
- DEFINE_METHOD1(void, av_close_input_stream, (AVFormatContext *p1)) |
45 |
+ DEFINE_METHOD1(void, avformat_close_input, (AVFormatContext **p1)) |
46 |
DEFINE_METHOD1(int, av_read_play, (AVFormatContext *p1)) |
47 |
DEFINE_METHOD1(int, av_read_pause, (AVFormatContext *p1)) |
48 |
DEFINE_METHOD1(void, av_read_frame_flush, (AVFormatContext *p1)) |
49 |
@@ -229,8 +226,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
50 |
RESOLVE_METHOD_RENAME(av_register_all, av_register_all_dont_call) |
51 |
RESOLVE_METHOD(av_find_input_format) |
52 |
RESOLVE_METHOD(url_feof) |
53 |
- RESOLVE_METHOD(av_close_input_file) |
54 |
- RESOLVE_METHOD(av_close_input_stream) |
55 |
+ RESOLVE_METHOD(avformat_close_input) |
56 |
RESOLVE_METHOD(av_read_frame) |
57 |
RESOLVE_METHOD(av_read_play) |
58 |
RESOLVE_METHOD(av_read_pause) |
59 |
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
60 |
index 991491c..f1fad8c 100644 |
61 |
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
62 |
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
63 |
@@ -502,20 +502,12 @@ void CDVDDemuxFFmpeg::Dispose() |
64 |
|
65 |
if (m_pFormatContext) |
66 |
{ |
67 |
- if (m_ioContext) |
68 |
+ if (m_ioContext && m_pFormatContext->pb && m_pFormatContext->pb != m_ioContext) |
69 |
{ |
70 |
- if(m_pFormatContext->pb && m_pFormatContext->pb != m_ioContext) |
71 |
- { |
72 |
- CLog::Log(LOGWARNING, "CDVDDemuxFFmpeg::Dispose - demuxer changed our byte context behind our back, possible memleak"); |
73 |
- m_ioContext = m_pFormatContext->pb; |
74 |
- } |
75 |
- m_dllAvFormat.av_close_input_stream(m_pFormatContext); |
76 |
- if (m_ioContext->buffer) |
77 |
- m_dllAvUtil.av_free(m_ioContext->buffer); |
78 |
- m_dllAvUtil.av_free(m_ioContext); |
79 |
+ CLog::Log(LOGWARNING, "CDVDDemuxFFmpeg::Dispose - demuxer changed our byte context behind our back, possible memleak"); |
80 |
+ m_ioContext = m_pFormatContext->pb; |
81 |
} |
82 |
- else |
83 |
- m_dllAvFormat.av_close_input_file(m_pFormatContext); |
84 |
+ m_dllAvFormat.avformat_close_input(&m_pFormatContext); |
85 |
} |
86 |
m_ioContext = NULL; |
87 |
m_pFormatContext = NULL; |
88 |
-- |
89 |
1.7.10 |
90 |
|