1 |
From 279ad09b6d119085d1321b66b658bd220bf05f12 Mon Sep 17 00:00:00 2001 |
2 |
From: Alexis Ballier <aballier@gentoo.org> |
3 |
Date: Thu, 1 Mar 2012 11:46:12 -0300 |
4 |
Subject: [PATCH 128/145] Remove av_alloc_put_byte and replace its occurences |
5 |
by avio_alloc_context. (cherry picked from commit |
6 |
05c142b34798ecea82132dd1faeff89338b3ac78) |
7 |
|
8 |
--- |
9 |
lib/DllAvFormat.h | 13 ------------- |
10 |
xbmc/cdrip/EncoderFFmpeg.cpp | 2 +- |
11 |
.../DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp | 2 +- |
12 |
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 2 +- |
13 |
4 files changed, 3 insertions(+), 16 deletions(-) |
14 |
|
15 |
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h |
16 |
index 7ac02e7..725f5be 100644 |
17 |
--- a/lib/DllAvFormat.h |
18 |
+++ b/lib/DllAvFormat.h |
19 |
@@ -95,10 +95,6 @@ public: |
20 |
virtual AVFormatContext *avformat_alloc_context(void)=0; |
21 |
virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)=0; |
22 |
virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type)=0; |
23 |
- virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
24 |
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
25 |
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
26 |
- offset_t (*seek)(void *opaque, offset_t offset, int whence))=0; |
27 |
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options)=0; |
28 |
virtual int av_write_trailer(AVFormatContext *s)=0; |
29 |
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt)=0; |
30 |
@@ -154,10 +150,6 @@ public: |
31 |
virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); } |
32 |
virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { return ::avformat_new_stream(s, c); } |
33 |
virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::av_guess_format(short_name, filename, mime_type); } |
34 |
- virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
35 |
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
36 |
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
37 |
- offset_t (*seek)(void *opaque, offset_t offset, int whence)) { return ::av_alloc_put_byte(buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); } |
38 |
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options) { return ::avformat_write_header (s, options); } |
39 |
virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); } |
40 |
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); } |
41 |
@@ -212,10 +204,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
42 |
DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context) |
43 |
DEFINE_METHOD2(AVStream *, avformat_new_stream, (AVFormatContext *p1, AVCodec *p2)) |
44 |
DEFINE_METHOD3(AVOutputFormat *, av_guess_format, (const char *p1, const char *p2, const char *p3)) |
45 |
- DEFINE_METHOD7(AVIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4, |
46 |
- int(*p5)(void *opaque, uint8_t *buf, int buf_size), |
47 |
- int(*p6)(void *opaque, uint8_t *buf, int buf_size), |
48 |
- offset_t(*p7)(void *opaque, offset_t offset, int whence))) |
49 |
DEFINE_METHOD2(int, avformat_write_header , (AVFormatContext *p1, AVDictionary **p2)) |
50 |
DEFINE_METHOD1(int, av_write_trailer, (AVFormatContext *p1)) |
51 |
DEFINE_METHOD2(int, av_write_frame , (AVFormatContext *p1, AVPacket *p2)) |
52 |
@@ -250,7 +238,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
53 |
RESOLVE_METHOD(avformat_alloc_context) |
54 |
RESOLVE_METHOD(avformat_new_stream) |
55 |
RESOLVE_METHOD(av_guess_format) |
56 |
- RESOLVE_METHOD(av_alloc_put_byte) |
57 |
RESOLVE_METHOD(avformat_write_header) |
58 |
RESOLVE_METHOD(av_write_trailer) |
59 |
RESOLVE_METHOD(av_write_frame) |
60 |
diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp |
61 |
index b67b231..bcedb0c 100644 |
62 |
--- a/xbmc/cdrip/EncoderFFmpeg.cpp |
63 |
+++ b/xbmc/cdrip/EncoderFFmpeg.cpp |
64 |
@@ -78,7 +78,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int |
65 |
} |
66 |
|
67 |
m_Format = m_dllAvFormat.avformat_alloc_context(); |
68 |
- m_Format->pb = m_dllAvFormat.av_alloc_put_byte(m_BCBuffer, sizeof(m_BCBuffer), URL_RDONLY, this, NULL, MuxerReadPacket, NULL); |
69 |
+ m_Format->pb = m_dllAvFormat.avio_alloc_context(m_BCBuffer, sizeof(m_BCBuffer), AVIO_FLAG_READ, this, NULL, MuxerReadPacket, NULL); |
70 |
if (!m_Format->pb) |
71 |
{ |
72 |
m_dllAvUtil.av_freep(&m_Format); |
73 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp |
74 |
index d230623..20f9aff 100644 |
75 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp |
76 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp |
77 |
@@ -99,7 +99,7 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri |
78 |
muxer.m_pFormat->oformat = fOut; |
79 |
|
80 |
/* allocate a put_byte struct so we can grab the output */ |
81 |
- muxer.m_pFormat->pb = m_dllAvFormat.av_alloc_put_byte(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), URL_RDONLY, &muxer, NULL, MuxerReadPacket, NULL); |
82 |
+ muxer.m_pFormat->pb = m_dllAvFormat.avio_alloc_context(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), AVIO_FLAG_READ, &muxer, NULL, MuxerReadPacket, NULL); |
83 |
if (!muxer.m_pFormat->pb) |
84 |
{ |
85 |
CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to allocate ByteIOContext"); |
86 |
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
87 |
index 4f09346..caae1c8 100644 |
88 |
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
89 |
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp |
90 |
@@ -298,7 +298,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) |
91 |
else |
92 |
{ |
93 |
unsigned char* buffer = (unsigned char*)m_dllAvUtil.av_malloc(FFMPEG_FILE_BUFFER_SIZE); |
94 |
- m_ioContext = m_dllAvFormat.av_alloc_put_byte(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek); |
95 |
+ m_ioContext = m_dllAvFormat.avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek); |
96 |
m_ioContext->max_packet_size = m_pInput->GetBlockSize(); |
97 |
if(m_ioContext->max_packet_size) |
98 |
m_ioContext->max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_ioContext->max_packet_size; |
99 |
-- |
100 |
1.7.10 |
101 |
|