Created
April 8, 2013 15:26
-
-
Save julianscheel/5337656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5159984883df5acc601ff408fc84ae9afba3a405 Mon Sep 17 00:00:00 2001 | |
From: Julian Scheel <julian@jusst.de> | |
Date: Mon, 8 Apr 2013 17:23:08 +0200 | |
Subject: [PATCH] ffmpeg git compatibility | |
--- | |
BitstreamConverter.cpp | 2 +- | |
BitstreamConverter.h | 4 ++-- | |
DllAvCodec.h | 12 ++++++------ | |
DllAvFilter.h | 6 ++++-- | |
OMXAudio.cpp | 6 +++--- | |
OMXAudio.h | 6 +++--- | |
OMXAudioCodecOMX.cpp | 1 + | |
OMXStreamInfo.h | 4 ++-- | |
OMXVideo.cpp | 2 +- | |
OMXVideo.h | 2 +- | |
10 files changed, 24 insertions(+), 21 deletions(-) | |
diff --git a/BitstreamConverter.cpp b/BitstreamConverter.cpp | |
index 8ae5d02..94026da 100644 | |
--- a/BitstreamConverter.cpp | |
+++ b/BitstreamConverter.cpp | |
@@ -432,7 +432,7 @@ CBitstreamConverter::~CBitstreamConverter() | |
Close(); | |
} | |
-bool CBitstreamConverter::Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb) | |
+bool CBitstreamConverter::Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb) | |
{ | |
m_to_annexb = to_annexb; | |
diff --git a/BitstreamConverter.h b/BitstreamConverter.h | |
index e72f9ca..9d214db 100644 | |
--- a/BitstreamConverter.h | |
+++ b/BitstreamConverter.h | |
@@ -115,7 +115,7 @@ public: | |
static void skip_bits( bits_reader_t *br, int nbits ); | |
static uint32_t get_bits( bits_reader_t *br, int nbits ); | |
- bool Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb); | |
+ bool Open(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb); | |
void Close(void); | |
bool NeedConvert(void) { return m_convert_bitstream; }; | |
bool Convert(uint8_t *pData, int iSize); | |
@@ -164,7 +164,7 @@ protected: | |
bool m_convert_bytestream; | |
DllAvUtil *m_dllAvUtil; | |
DllAvFormat *m_dllAvFormat; | |
- CodecID m_codec; | |
+ AVCodecID m_codec; | |
}; | |
#endif | |
diff --git a/DllAvCodec.h b/DllAvCodec.h | |
index b4fee93..f6708c7 100644 | |
--- a/DllAvCodec.h | |
+++ b/DllAvCodec.h | |
@@ -72,8 +72,8 @@ public: | |
virtual void avcodec_register_all(void)=0; | |
virtual void avcodec_flush_buffers(AVCodecContext *avctx)=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 AVCodec *avcodec_find_decoder(enum AVCodecID id)=0; | |
+ virtual AVCodec *avcodec_find_encoder(enum AVCodecID id)=0; | |
virtual int avcodec_close_dont_call(AVCodecContext *avctx)=0; | |
virtual AVFrame *avcodec_alloc_frame(void)=0; | |
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height)=0; | |
@@ -125,8 +125,8 @@ public: | |
} | |
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); } | |
+ virtual AVCodec *avcodec_find_decoder(enum AVCodecID id) { return ::avcodec_find_decoder(id); } | |
+ virtual AVCodec *avcodec_find_encoder(enum AVCodecID id) { return ::avcodec_find_encoder(id); } | |
virtual int avcodec_close(AVCodecContext *avctx) | |
{ | |
return ::avcodec_close(avctx); | |
@@ -196,8 +196,8 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface | |
LOAD_SYMBOLS(); | |
DEFINE_METHOD0(void, avcodec_register_all_dont_call) | |
- DEFINE_METHOD1(AVCodec*, avcodec_find_decoder, (enum CodecID p1)) | |
- DEFINE_METHOD1(AVCodec*, avcodec_find_encoder, (enum CodecID p1)) | |
+ DEFINE_METHOD1(AVCodec*, avcodec_find_decoder, (enum AVCodecID p1)) | |
+ DEFINE_METHOD1(AVCodec*, avcodec_find_encoder, (enum AVCodecID p1)) | |
DEFINE_METHOD1(int, avcodec_close_dont_call, (AVCodecContext *p1)) | |
DEFINE_METHOD0(AVFrame*, avcodec_alloc_frame) | |
DEFINE_METHOD5(int, avpicture_fill, (AVPicture *p1, uint8_t *p2, PixelFormat p3, int p4, int p5)) | |
diff --git a/DllAvFilter.h b/DllAvFilter.h | |
index 61b4904..dc64447 100644 | |
--- a/DllAvFilter.h | |
+++ b/DllAvFilter.h | |
@@ -46,10 +46,12 @@ extern "C" { | |
#include <libavfilter/avfiltergraph.h> | |
#include <libavfilter/buffersink.h> | |
#include <libavfilter/avcodec.h> | |
+ #include <libavfilter/buffersrc.h> | |
#elif (defined HAVE_FFMPEG_AVFILTER_H) | |
#include <ffmpeg/avfiltergraph.h> | |
#include <ffmpeg/buffersink.h> | |
#include <ffmpeg/avcodec.h> | |
+ #include <ffmpeg/buffersrc.h> | |
#endif | |
#else | |
#include "libavfilter/avfiltergraph.h" | |
@@ -77,7 +79,7 @@ public: | |
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) | |
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0; | |
#else | |
- virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0; | |
+ virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame *frame)=0; | |
#endif | |
virtual void avfilter_unref_buffer(AVFilterBufferRef *ref)=0; | |
virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)=0; | |
@@ -130,7 +132,7 @@ public: | |
#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0) | |
virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, flags); } | |
#else | |
- virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame* frame, int flags) { return ::av_buffersrc_add_frame(buffer_filter, frame, flags); } | |
+ virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame* frame) { return ::av_buffersrc_add_frame(buffer_filter, frame); } | |
#endif | |
virtual void avfilter_unref_buffer(AVFilterBufferRef *ref) { ::avfilter_unref_buffer(ref); } | |
virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { return ::avfilter_link(src, srcpad, dst, dstpad); } | |
diff --git a/OMXAudio.cpp b/OMXAudio.cpp | |
index 617c216..d1ff122 100644 | |
--- a/OMXAudio.cpp | |
+++ b/OMXAudio.cpp | |
@@ -1254,7 +1254,7 @@ bool COMXAudio::SetClock(OMXClock *clock) | |
return true; | |
} | |
-void COMXAudio::SetCodingType(CodecID codec) | |
+void COMXAudio::SetCodingType(AVCodecID codec) | |
{ | |
switch(codec) | |
{ | |
@@ -1274,7 +1274,7 @@ void COMXAudio::SetCodingType(CodecID codec) | |
} | |
} | |
-bool COMXAudio::CanHWDecode(CodecID codec) | |
+bool COMXAudio::CanHWDecode(AVCodecID codec) | |
{ | |
switch(codec) | |
{ | |
@@ -1317,7 +1317,7 @@ bool COMXAudio::CanHWDecode(CodecID codec) | |
return m_HWDecode; | |
} | |
-bool COMXAudio::HWDecode(CodecID codec) | |
+bool COMXAudio::HWDecode(AVCodecID codec) | |
{ | |
bool ret = false; | |
diff --git a/OMXAudio.h b/OMXAudio.h | |
index aec183a..13442ad 100644 | |
--- a/OMXAudio.h | |
+++ b/OMXAudio.h | |
@@ -84,9 +84,9 @@ public: | |
void Process(); | |
bool SetClock(OMXClock *clock); | |
- void SetCodingType(CodecID codec); | |
- bool CanHWDecode(CodecID codec); | |
- static bool HWDecode(CodecID codec); | |
+ void SetCodingType(AVCodecID codec); | |
+ bool CanHWDecode(AVCodecID codec); | |
+ static bool HWDecode(AVCodecID codec); | |
void PrintChannels(OMX_AUDIO_CHANNELTYPE eChannelMapping[]); | |
void PrintPCM(OMX_AUDIO_PARAM_PCMMODETYPE *pcm); | |
diff --git a/OMXAudioCodecOMX.cpp b/OMXAudioCodecOMX.cpp | |
index 0a79b56..77362b4 100644 | |
+++ b/OMXAudioCodecOMX.cpp | |
@@ -25,6 +25,7 @@ | |
#endif | |
#include "utils/log.h" | |
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 | |
#define MAX_AUDIO_FRAME_SIZE (AVCODEC_MAX_AUDIO_FRAME_SIZE*1.5) | |
COMXAudioCodecOMX::COMXAudioCodecOMX() | |
diff --git a/OMXStreamInfo.h b/OMXStreamInfo.h | |
index e853abb..38b6be1 100644 | |
--- a/OMXStreamInfo.h | |
+++ b/OMXStreamInfo.h | |
@@ -25,7 +25,7 @@ | |
#include "config.h" | |
#endif | |
#ifndef _LINUX | |
-enum CodecID; | |
+enum AVCodecID; | |
#else | |
extern "C" { | |
#include "libavcodec/avcodec.h" | |
@@ -43,7 +43,7 @@ public: | |
void Clear(); // clears current information | |
- CodecID codec; | |
+ AVCodecID codec; | |
bool software; //force software decoding | |
diff --git a/OMXVideo.cpp b/OMXVideo.cpp | |
index 5cbf1bc..8fe8fd3 100644 | |
--- a/OMXVideo.cpp | |
+++ b/OMXVideo.cpp | |
@@ -129,7 +129,7 @@ bool COMXVideo::SendDecoderConfig() | |
return true; | |
} | |
-bool COMXVideo::NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize) | |
+bool COMXVideo::NaluFormatStartCodes(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize) | |
{ | |
switch(codec) | |
{ | |
diff --git a/OMXVideo.h b/OMXVideo.h | |
index 52310b2..fd05e95 100644 | |
--- a/OMXVideo.h | |
+++ b/OMXVideo.h | |
@@ -45,7 +45,7 @@ public: | |
// Required overrides | |
bool SendDecoderConfig(); | |
- bool NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize); | |
+ bool NaluFormatStartCodes(enum AVCodecID codec, uint8_t *in_extradata, int in_extrasize); | |
bool Open(COMXStreamInfo &hints, OMXClock *clock, const CRect &m_DestRect, float display_aspect = 0.0f, bool deinterlace = false, bool hdmi_clock_sync = false, float fifo_size = 0.0f); | |
void Close(void); | |
unsigned int GetFreeSpace(); | |
-- | |
1.8.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment