void-packages/srcpkgs/xbmc/patches/180_all_alloc_put_byte.patch

91 lines
6.2 KiB
Diff

commit 05c142b34798ecea82132dd1faeff89338b3ac78
Author: Alexis Ballier <aballier@gentoo.org>
Date: Thu Mar 1 11:46:12 2012 -0300
Remove av_alloc_put_byte and replace its occurences by avio_alloc_context.
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h
index 7ac02e7..725f5be 100644
--- a/lib/DllAvFormat.h
+++ b/lib/DllAvFormat.h
@@ -95,10 +95,6 @@ public:
virtual AVFormatContext *avformat_alloc_context(void)=0;
virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)=0;
virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type)=0;
- virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- offset_t (*seek)(void *opaque, offset_t offset, int whence))=0;
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options)=0;
virtual int av_write_trailer(AVFormatContext *s)=0;
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt)=0;
@@ -154,10 +150,6 @@ public:
virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); }
virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { return ::avformat_new_stream(s, c); }
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); }
- virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- 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); }
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options) { return ::avformat_write_header (s, options); }
virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); }
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); }
@@ -212,10 +204,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context)
DEFINE_METHOD2(AVStream *, avformat_new_stream, (AVFormatContext *p1, AVCodec *p2))
DEFINE_METHOD3(AVOutputFormat *, av_guess_format, (const char *p1, const char *p2, const char *p3))
- DEFINE_METHOD7(AVIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4,
- int(*p5)(void *opaque, uint8_t *buf, int buf_size),
- int(*p6)(void *opaque, uint8_t *buf, int buf_size),
- offset_t(*p7)(void *opaque, offset_t offset, int whence)))
DEFINE_METHOD2(int, avformat_write_header , (AVFormatContext *p1, AVDictionary **p2))
DEFINE_METHOD1(int, av_write_trailer, (AVFormatContext *p1))
DEFINE_METHOD2(int, av_write_frame , (AVFormatContext *p1, AVPacket *p2))
@@ -250,7 +238,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
RESOLVE_METHOD(avformat_alloc_context)
RESOLVE_METHOD(avformat_new_stream)
RESOLVE_METHOD(av_guess_format)
- RESOLVE_METHOD(av_alloc_put_byte)
RESOLVE_METHOD(avformat_write_header)
RESOLVE_METHOD(av_write_trailer)
RESOLVE_METHOD(av_write_frame)
diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp
index b67b231..bcedb0c 100644
--- a/xbmc/cdrip/EncoderFFmpeg.cpp
+++ b/xbmc/cdrip/EncoderFFmpeg.cpp
@@ -78,7 +78,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int
}
m_Format = m_dllAvFormat.avformat_alloc_context();
- m_Format->pb = m_dllAvFormat.av_alloc_put_byte(m_BCBuffer, sizeof(m_BCBuffer), URL_RDONLY, this, NULL, MuxerReadPacket, NULL);
+ m_Format->pb = m_dllAvFormat.avio_alloc_context(m_BCBuffer, sizeof(m_BCBuffer), AVIO_FLAG_READ, this, NULL, MuxerReadPacket, NULL);
if (!m_Format->pb)
{
m_dllAvUtil.av_freep(&m_Format);
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
index d230623..20f9aff 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
@@ -99,7 +99,7 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri
muxer.m_pFormat->oformat = fOut;
/* allocate a put_byte struct so we can grab the output */
- muxer.m_pFormat->pb = m_dllAvFormat.av_alloc_put_byte(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), URL_RDONLY, &muxer, NULL, MuxerReadPacket, NULL);
+ muxer.m_pFormat->pb = m_dllAvFormat.avio_alloc_context(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), AVIO_FLAG_READ, &muxer, NULL, MuxerReadPacket, NULL);
if (!muxer.m_pFormat->pb)
{
CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to allocate ByteIOContext");
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 4f09346..caae1c8 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -298,7 +298,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput)
else
{
unsigned char* buffer = (unsigned char*)m_dllAvUtil.av_malloc(FFMPEG_FILE_BUFFER_SIZE);
- m_ioContext = m_dllAvFormat.av_alloc_put_byte(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek);
+ m_ioContext = m_dllAvFormat.avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek);
m_ioContext->max_packet_size = m_pInput->GetBlockSize();
if(m_ioContext->max_packet_size)
m_ioContext->max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_ioContext->max_packet_size;