340 lines
18 KiB
Diff
340 lines
18 KiB
Diff
commit 1aed04a52e753b5fd395b55d97a70226f62bc634
|
|
Author: elupus <elupus@xbmc.org>
|
|
Date: Tue Nov 1 21:36:32 2011 +0100
|
|
|
|
Replace more depreciated ffmpeg functions
|
|
|
|
diff --git a/lib/DllAvCodec.h b/lib/DllAvCodec.h
|
|
index 05edcb7..355b8b2 100644
|
|
--- a/lib/DllAvCodec.h
|
|
+++ b/lib/DllAvCodec.h
|
|
@@ -106,7 +106,7 @@ public:
|
|
virtual ~DllAvCodecInterface() {}
|
|
virtual void avcodec_register_all(void)=0;
|
|
virtual void avcodec_flush_buffers(AVCodecContext *avctx)=0;
|
|
- virtual int avcodec_open_dont_call(AVCodecContext *avctx, AVCodec *codec)=0;
|
|
+ virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)=0;
|
|
virtual AVCodec *avcodec_find_decoder(enum CodecID id)=0;
|
|
virtual AVCodec *avcodec_find_encoder(enum CodecID id)=0;
|
|
virtual int avcodec_close_dont_call(AVCodecContext *avctx)=0;
|
|
@@ -117,9 +117,9 @@ public:
|
|
virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)=0;
|
|
virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)=0;
|
|
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height)=0;
|
|
- virtual AVCodecContext *avcodec_alloc_context(void)=0;
|
|
+ virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec)=0;
|
|
virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)=0;
|
|
- virtual void avcodec_get_context_defaults(AVCodecContext *s)=0;
|
|
+ virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec)=0;
|
|
virtual AVCodecParserContext *av_parser_init(int codec_id)=0;
|
|
virtual int av_parser_parse2(AVCodecParserContext *s,AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size,
|
|
const uint8_t *buf, int buf_size,
|
|
@@ -165,12 +165,12 @@ public:
|
|
::avcodec_register_all();
|
|
}
|
|
virtual void avcodec_flush_buffers(AVCodecContext *avctx) { ::avcodec_flush_buffers(avctx); }
|
|
- virtual int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
|
|
+ virtual int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
|
|
{
|
|
CSingleLock lock(DllAvCodec::m_critSection);
|
|
- return ::avcodec_open(avctx, codec);
|
|
+ return ::avcodec_open2(avctx, codec, options);
|
|
}
|
|
- virtual int avcodec_open_dont_call(AVCodecContext *avctx, AVCodec *codec) { *(int *)0x0 = 0; return 0; }
|
|
+ virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { *(int *)0x0 = 0; return 0; }
|
|
virtual int avcodec_close_dont_call(AVCodecContext *avctx) { *(int *)0x0 = 0; return 0; }
|
|
virtual AVCodec *avcodec_find_decoder(enum CodecID id) { return ::avcodec_find_decoder(id); }
|
|
virtual AVCodec *avcodec_find_encoder(enum CodecID id) { return ::avcodec_find_encoder(id); }
|
|
@@ -193,9 +193,9 @@ public:
|
|
#endif
|
|
virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples) { return ::avcodec_encode_audio(avctx, buf, buf_size, samples); }
|
|
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); }
|
|
- virtual AVCodecContext *avcodec_alloc_context() { return ::avcodec_alloc_context(); }
|
|
+ virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec) { return ::avcodec_alloc_context3(codec); }
|
|
virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) { ::avcodec_string(buf, buf_size, enc, encode); }
|
|
- virtual void avcodec_get_context_defaults(AVCodecContext *s) { ::avcodec_get_context_defaults(s); }
|
|
+ virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec) { ::avcodec_get_context_defaults3(s, codec); }
|
|
|
|
virtual AVCodecParserContext *av_parser_init(int codec_id) { return ::av_parser_init(codec_id); }
|
|
virtual int av_parser_parse2(AVCodecParserContext *s,AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size,
|
|
@@ -254,12 +254,12 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
|
|
{
|
|
DECLARE_DLL_WRAPPER(DllAvCodec, DLL_PATH_LIBAVCODEC)
|
|
DEFINE_FUNC_ALIGNED1(void, __cdecl, avcodec_flush_buffers, AVCodecContext*)
|
|
- DEFINE_FUNC_ALIGNED2(int, __cdecl, avcodec_open_dont_call, AVCodecContext*, AVCodec *)
|
|
+ DEFINE_FUNC_ALIGNED3(int, __cdecl, avcodec_open2_dont_call, AVCodecContext*, AVCodec *, AVDictionary **)
|
|
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_video2, AVCodecContext*, AVFrame*, int*, AVPacket*)
|
|
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_audio3, AVCodecContext*, int16_t*, int*, AVPacket*)
|
|
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_subtitle2, AVCodecContext*, AVSubtitle*, int*, AVPacket*)
|
|
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_encode_audio, AVCodecContext*, uint8_t*, int, const short*)
|
|
- DEFINE_FUNC_ALIGNED0(AVCodecContext*, __cdecl, avcodec_alloc_context)
|
|
+ DEFINE_FUNC_ALIGNED1(AVCodecContext*, __cdecl, avcodec_alloc_context3, AVCodec *)
|
|
DEFINE_FUNC_ALIGNED1(AVCodecParserContext*, __cdecl, av_parser_init, int)
|
|
DEFINE_FUNC_ALIGNED9(int, __cdecl, av_parser_parse2, AVCodecParserContext*,AVCodecContext*, uint8_t**, int*, const uint8_t*, int, int64_t, int64_t, int64_t)
|
|
DEFINE_METHOD1(int, av_dup_packet, (AVPacket *p1))
|
|
@@ -276,7 +276,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
|
|
DEFINE_METHOD5(int, avpicture_fill, (AVPicture *p1, uint8_t *p2, PixelFormat p3, int p4, int p5))
|
|
DEFINE_METHOD3(int, avpicture_get_size, (PixelFormat p1, int p2, int p3))
|
|
DEFINE_METHOD4(void, avcodec_string, (char *p1, int p2, AVCodecContext *p3, int p4))
|
|
- DEFINE_METHOD1(void, avcodec_get_context_defaults, (AVCodecContext *p1))
|
|
+ DEFINE_METHOD2(void, avcodec_get_context_defaults3, (AVCodecContext *p1, AVCodec *p2))
|
|
DEFINE_METHOD1(void, av_parser_close, (AVCodecParserContext *p1))
|
|
DEFINE_METHOD1(void, avpicture_free, (AVPicture *p1))
|
|
DEFINE_METHOD1(AVBitStreamFilterContext*, av_bitstream_filter_init, (const char *p1))
|
|
@@ -298,7 +298,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
|
|
const void * const p4[6], const int p5[6], int p6))
|
|
BEGIN_METHOD_RESOLVE()
|
|
RESOLVE_METHOD(avcodec_flush_buffers)
|
|
- RESOLVE_METHOD_RENAME(avcodec_open,avcodec_open_dont_call)
|
|
+ RESOLVE_METHOD_RENAME(avcodec_open2,avcodec_open2_dont_call)
|
|
RESOLVE_METHOD_RENAME(avcodec_close,avcodec_close_dont_call)
|
|
RESOLVE_METHOD(avcodec_find_decoder)
|
|
RESOLVE_METHOD(avcodec_find_encoder)
|
|
@@ -310,9 +310,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
|
|
RESOLVE_METHOD(avcodec_decode_subtitle2)
|
|
RESOLVE_METHOD(avcodec_encode_audio)
|
|
RESOLVE_METHOD(avpicture_get_size)
|
|
- RESOLVE_METHOD(avcodec_alloc_context)
|
|
+ RESOLVE_METHOD(avcodec_alloc_context3)
|
|
RESOLVE_METHOD(avcodec_string)
|
|
- RESOLVE_METHOD(avcodec_get_context_defaults)
|
|
+ RESOLVE_METHOD(avcodec_get_context_defaults3)
|
|
RESOLVE_METHOD(av_parser_init)
|
|
RESOLVE_METHOD(av_parser_parse2)
|
|
RESOLVE_METHOD(av_parser_close)
|
|
@@ -340,10 +340,10 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface
|
|
|
|
public:
|
|
static CCriticalSection m_critSection;
|
|
- int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
|
|
+ int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
|
|
{
|
|
CSingleLock lock(DllAvCodec::m_critSection);
|
|
- return avcodec_open_dont_call(avctx,codec);
|
|
+ return avcodec_open2_dont_call(avctx,codec, options);
|
|
}
|
|
int avcodec_close(AVCodecContext *avctx)
|
|
{
|
|
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h
|
|
index ed26a0b..9b38c9c 100644
|
|
--- a/lib/DllAvFormat.h
|
|
+++ b/lib/DllAvFormat.h
|
|
@@ -98,7 +98,7 @@ public:
|
|
virtual void put_be32(AVIOContext *s, unsigned int val)=0;
|
|
virtual void put_be16(AVIOContext *s, unsigned int val)=0;
|
|
virtual AVFormatContext *avformat_alloc_context(void)=0;
|
|
- virtual AVStream *av_new_stream(AVFormatContext *s, int id)=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 int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)=0;
|
|
virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
|
|
@@ -146,7 +146,7 @@ public:
|
|
}
|
|
virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb) { ::url_set_interrupt_cb(interrupt_cb); }
|
|
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
|
|
- { return ::avformat_open_input(ps, filename, fmt, opt, ap); }
|
|
+ { return ::avformat_open_input(ps, filename, fmt, options); }
|
|
virtual int init_put_byte(AVIOContext *s, 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),
|
|
@@ -174,7 +174,7 @@ public:
|
|
virtual void put_be32(AVIOContext *s, unsigned int val) { ::put_be32(s, val); }
|
|
virtual void put_be16(AVIOContext *s, unsigned int val) { ::put_be16(s, val); }
|
|
virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); }
|
|
- virtual AVStream *av_new_stream(AVFormatContext *s, int id) { return ::av_new_stream(s, id); }
|
|
+ virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { return ::avformat_new_stream(s, c); }
|
|
#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
|
|
virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::guess_format(short_name, filename, mime_type); }
|
|
#else
|
|
@@ -251,7 +251,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
|
|
DEFINE_METHOD2(int, url_close_dyn_buf, (AVIOContext *p1, uint8_t **p2))
|
|
DEFINE_METHOD3(offset_t, url_fseek, (AVIOContext *p1, offset_t p2, int p3))
|
|
DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context)
|
|
- DEFINE_METHOD2(AVStream *, av_new_stream, (AVFormatContext *p1, int p2))
|
|
+ DEFINE_METHOD2(AVStream *, avformat_new_stream, (AVFormatContext *p1, AVCodec *p2))
|
|
#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
|
|
DEFINE_METHOD3(AVOutputFormat *, guess_format, (const char *p1, const char *p2, const char *p3))
|
|
#else
|
|
@@ -300,7 +300,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
|
|
RESOLVE_METHOD(put_be32)
|
|
RESOLVE_METHOD(put_be16)
|
|
RESOLVE_METHOD(avformat_alloc_context)
|
|
- RESOLVE_METHOD(av_new_stream)
|
|
+ RESOLVE_METHOD(avformat_new_stream)
|
|
#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
|
|
RESOLVE_METHOD(guess_format)
|
|
#else
|
|
diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp
|
|
index 1ec9805..0b3ef76 100644
|
|
--- a/xbmc/cdrip/EncoderFFmpeg.cpp
|
|
+++ b/xbmc/cdrip/EncoderFFmpeg.cpp
|
|
@@ -103,7 +103,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int
|
|
}
|
|
|
|
/* add a stream to it */
|
|
- m_Stream = m_dllAvFormat.av_new_stream(m_Format, 1);
|
|
+ m_Stream = m_dllAvFormat.avformat_new_stream(m_Format, codec);
|
|
if (!m_Stream)
|
|
{
|
|
m_dllAvUtil.av_freep(&m_Format->pb);
|
|
@@ -144,7 +144,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int
|
|
return false;
|
|
}
|
|
|
|
- if (m_dllAvCodec.avcodec_open(m_CodecCtx, codec))
|
|
+ if (m_dllAvCodec.avcodec_open2(m_CodecCtx, codec, NULL))
|
|
{
|
|
CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Failed to open the codec");
|
|
m_dllAvUtil.av_freep(&m_Stream);
|
|
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
|
|
index 6037781..838a27f 100644
|
|
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
|
|
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
|
|
@@ -63,8 +63,6 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
return false;
|
|
|
|
m_dllAvCodec.avcodec_register_all();
|
|
- m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
|
|
- m_dllAvCodec.avcodec_get_context_defaults(m_pCodecContext);
|
|
|
|
pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
|
|
if (!pCodec)
|
|
@@ -73,6 +71,7 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
return false;
|
|
}
|
|
|
|
+ m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
|
|
m_pCodecContext->debug_mv = 0;
|
|
m_pCodecContext->debug = 0;
|
|
m_pCodecContext->workaround_bugs = 1;
|
|
@@ -97,7 +96,7 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
|
|
}
|
|
|
|
- if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
|
|
+ if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
|
|
{
|
|
CLog::Log(LOGDEBUG,"CDVDAudioCodecFFmpeg::Open() Unable to open codec");
|
|
Dispose();
|
|
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
|
|
index 34e93a4..440b04b 100644
|
|
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
|
|
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
|
|
@@ -149,7 +149,7 @@ bool CDVDAudioCodecPassthroughFFmpeg::SetupMuxer(CDVDStreamInfo &hints, CStdStri
|
|
}
|
|
|
|
/* add a stream to it */
|
|
- muxer.m_pStream = m_dllAvFormat.av_new_stream(muxer.m_pFormat, 1);
|
|
+ muxer.m_pStream = m_dllAvFormat.avformat_new_stream(muxer.m_pFormat, NULL);
|
|
if (!muxer.m_pStream)
|
|
{
|
|
CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to allocate AVStream context");
|
|
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp
|
|
index 6f30e11..6141982 100644
|
|
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp
|
|
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp
|
|
@@ -65,7 +65,7 @@ bool CDVDAudioEncoderFFmpeg::Initialize(unsigned int channels, enum PCMChannels
|
|
return false;
|
|
|
|
/* always assume 6 channels, 5.1... m_remap will give us what we want */
|
|
- m_CodecCtx = m_dllAvCodec.avcodec_alloc_context();
|
|
+ m_CodecCtx = m_dllAvCodec.avcodec_alloc_context3(codec);
|
|
m_CodecCtx->bit_rate = AC3_ENCODE_BITRATE;
|
|
m_CodecCtx->sample_rate = sampleRate;
|
|
m_CodecCtx->channels = 6;
|
|
@@ -104,7 +104,7 @@ bool CDVDAudioEncoderFFmpeg::Initialize(unsigned int channels, enum PCMChannels
|
|
}
|
|
}
|
|
|
|
- if (m_dllAvCodec.avcodec_open(m_CodecCtx, codec))
|
|
+ if (m_dllAvCodec.avcodec_open2(m_CodecCtx, codec, NULL))
|
|
{
|
|
m_dllAvUtil.av_freep(&m_CodecCtx);
|
|
return false;
|
|
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
|
|
index 563ce78..754169e 100644
|
|
--- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
|
|
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
|
|
@@ -49,7 +49,14 @@ bool CDVDOverlayCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &optio
|
|
|
|
m_dllAvCodec.avcodec_register_all();
|
|
|
|
- m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
|
|
+ AVCodec* pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
|
|
+ if (!pCodec)
|
|
+ {
|
|
+ CLog::Log(LOGDEBUG,"%s - Unable to find codec %d", __FUNCTION__, hints.codec);
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
|
|
m_pCodecContext->debug_mv = 0;
|
|
m_pCodecContext->debug = 0;
|
|
m_pCodecContext->workaround_bugs = FF_BUG_AUTODETECT;
|
|
@@ -100,14 +107,7 @@ bool CDVDOverlayCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &optio
|
|
delete[] parse_extra;
|
|
}
|
|
|
|
- AVCodec* pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
|
|
- if (!pCodec)
|
|
- {
|
|
- CLog::Log(LOGDEBUG,"%s - Unable to find codec %d", __FUNCTION__, hints.codec);
|
|
- return false;
|
|
- }
|
|
-
|
|
- if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
|
|
+ if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
|
|
{
|
|
CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Unable to open codec");
|
|
return false;
|
|
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
|
|
index 26bdb3a..c792cfd 100644
|
|
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
|
|
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
|
|
@@ -163,9 +163,9 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
m_dllAvFilter.avfilter_register_all();
|
|
|
|
m_bSoftware = hints.software;
|
|
- m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
|
|
|
|
pCodec = NULL;
|
|
+ m_pCodecContext = NULL;
|
|
|
|
if (hints.codec == CODEC_ID_H264)
|
|
{
|
|
@@ -196,6 +196,7 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
|
|
CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Creating VDPAU(%ix%i, %d)",hints.width, hints.height, hints.codec);
|
|
CVDPAU* vdp = new CVDPAU();
|
|
+ m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
|
|
m_pCodecContext->codec_id = hints.codec;
|
|
m_pCodecContext->width = hints.width;
|
|
m_pCodecContext->height = hints.height;
|
|
@@ -207,7 +208,7 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
m_pCodecContext->codec_id = CODEC_ID_NONE; // ffmpeg will complain if this has been set
|
|
break;
|
|
}
|
|
- m_pCodecContext->codec_id = CODEC_ID_NONE; // ffmpeg will complain if this has been set
|
|
+ m_dllAvUtil.av_freep(&m_pCodecContext);
|
|
CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Failed to get VDPAU device");
|
|
vdp->Release();
|
|
}
|
|
@@ -226,6 +227,9 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
|
|
CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Using codec: %s",pCodec->long_name ? pCodec->long_name : pCodec->name);
|
|
|
|
+ if(m_pCodecContext == NULL)
|
|
+ m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
|
|
+
|
|
m_pCodecContext->opaque = (void*)this;
|
|
m_pCodecContext->debug_mv = 0;
|
|
m_pCodecContext->debug = 0;
|
|
@@ -281,7 +285,7 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
|
|
|| pCodec->id == CODEC_ID_MPEG4 ))
|
|
m_pCodecContext->thread_count = num_threads;
|
|
|
|
- if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
|
|
+ if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
|
|
{
|
|
CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Unable to open codec");
|
|
return false;
|