mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +00:00
209 lines
7.0 KiB
Diff
209 lines
7.0 KiB
Diff
|
Description: Fix compilation against libav10
|
||
|
Author: Reinhard Tartler <siretart@tauware.de>
|
||
|
Bug-Debian: http://bugs.debian.org/739439
|
||
|
|
||
|
--- a/plugins/video/H.263-1998/h263-1998.cxx
|
||
|
+++ b/plugins/video/H.263-1998/h263-1998.cxx
|
||
|
@@ -94,7 +94,7 @@ static struct StdSizes {
|
||
|
{ CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI },
|
||
|
};
|
||
|
|
||
|
-static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P);
|
||
|
+static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P);
|
||
|
|
||
|
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
@@ -203,7 +203,7 @@ H263_Base_EncoderContext::~H263_Base_Enc
|
||
|
PTRACE(4, m_prefix, "Encoder closed");
|
||
|
}
|
||
|
|
||
|
-bool H263_Base_EncoderContext::Init(CodecID codecId)
|
||
|
+bool H263_Base_EncoderContext::Init(AVCodecID codecId)
|
||
|
{
|
||
|
PTRACE(5, m_prefix, "Opening encoder");
|
||
|
|
||
|
@@ -589,7 +589,7 @@ void H263_RFC2190_EncoderContext::RTPCal
|
||
|
|
||
|
bool H263_RFC2190_EncoderContext::Init()
|
||
|
{
|
||
|
- if (!H263_Base_EncoderContext::Init(CODEC_ID_H263))
|
||
|
+ if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263))
|
||
|
return false;
|
||
|
|
||
|
#if LIBAVCODEC_RTP_MODE
|
||
|
@@ -632,7 +632,7 @@ H263_RFC2429_EncoderContext::~H263_RFC24
|
||
|
|
||
|
bool H263_RFC2429_EncoderContext::Init()
|
||
|
{
|
||
|
- return H263_Base_EncoderContext::Init(CODEC_ID_H263P);
|
||
|
+ return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P);
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -656,7 +656,7 @@ H263_Base_DecoderContext::H263_Base_Deco
|
||
|
if (!FFMPEGLibraryInstance.Load())
|
||
|
return;
|
||
|
|
||
|
- if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) {
|
||
|
+ if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) {
|
||
|
PTRACE(1, m_prefix, "Codec not found for decoder");
|
||
|
return;
|
||
|
}
|
||
|
--- a/plugins/video/H.264/h264-x264.cxx
|
||
|
+++ b/plugins/video/H.264/h264-x264.cxx
|
||
|
@@ -105,7 +105,7 @@ static struct PluginCodec_information Li
|
||
|
|
||
|
///////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264);
|
||
|
+FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264);
|
||
|
|
||
|
PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF
|
||
|
|
||
|
@@ -1065,17 +1065,17 @@ class MyDecoder : public PluginCodec<MY_
|
||
|
allows you to fail the create operation (return false), which cannot
|
||
|
be done in the normal C++ constructor. */
|
||
|
|
||
|
- if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
|
||
|
+ if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL)
|
||
|
return false;
|
||
|
|
||
|
if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
|
||
|
return false;
|
||
|
|
||
|
m_context->workaround_bugs = FF_BUG_AUTODETECT;
|
||
|
- m_context->idct_algo = FF_IDCT_H264;
|
||
|
+ m_context->idct_algo = FF_IDCT_AUTO;
|
||
|
m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
|
||
|
m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
|
||
|
- m_context->flags2 = CODEC_FLAG2_SKIP_RD |
|
||
|
+ m_context->flags2 =
|
||
|
#ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
|
||
|
CODEC_FLAG2_DROP_FRAME_TIMECODE |
|
||
|
#endif
|
||
|
--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
|
||
|
+++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
|
||
|
@@ -205,7 +205,7 @@ const static struct mpeg4_resolution {
|
||
|
{ 0 }
|
||
|
};
|
||
|
|
||
|
-FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4);
|
||
|
+FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4);
|
||
|
|
||
|
|
||
|
static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen )
|
||
|
@@ -688,7 +688,7 @@ void MPEG4EncoderContext::ResizeEncoding
|
||
|
|
||
|
bool MPEG4EncoderContext::OpenCodec()
|
||
|
{
|
||
|
- if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
|
||
|
+ if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){
|
||
|
PTRACE(1, "MPEG4", "Encoder not found");
|
||
|
return false;
|
||
|
}
|
||
|
@@ -1390,7 +1390,7 @@ void MPEG4DecoderContext::ResizeDecoding
|
||
|
|
||
|
bool MPEG4DecoderContext::OpenCodec()
|
||
|
{
|
||
|
- if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) {
|
||
|
+ if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) {
|
||
|
PTRACE(1, "MPEG4", "Decoder not found for encoder");
|
||
|
return false;
|
||
|
}
|
||
|
--- a/plugins/video/H.263-1998/h263-1998.h
|
||
|
+++ b/plugins/video/H.263-1998/h263-1998.h
|
||
|
@@ -115,7 +115,7 @@ class H263_Base_EncoderContext
|
||
|
virtual ~H263_Base_EncoderContext();
|
||
|
|
||
|
virtual bool Init() = 0;
|
||
|
- virtual bool Init(CodecID codecId);
|
||
|
+ virtual bool Init(AVCodecID codecId);
|
||
|
|
||
|
virtual bool SetOptions(const char * const * options);
|
||
|
virtual void SetOption(const char * option, const char * value);
|
||
|
--- a/plugins/video/common/dyna.cxx
|
||
|
+++ b/plugins/video/common/dyna.cxx
|
||
|
@@ -217,14 +217,14 @@ static void logCallbackFFMPEG(void * avc
|
||
|
#endif
|
||
|
|
||
|
|
||
|
-FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
|
||
|
+FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
|
||
|
{
|
||
|
m_codec = codec;
|
||
|
- if (m_codec==CODEC_ID_H264)
|
||
|
+ if (m_codec==AV_CODEC_ID_H264)
|
||
|
snprintf( m_codecString, sizeof(m_codecString), "H264");
|
||
|
- if (m_codec==CODEC_ID_H263P)
|
||
|
+ if (m_codec==AV_CODEC_ID_H263P)
|
||
|
snprintf( m_codecString, sizeof(m_codecString), "H263+");
|
||
|
- if (m_codec==CODEC_ID_MPEG4)
|
||
|
+ if (m_codec==AV_CODEC_ID_MPEG4)
|
||
|
snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
|
||
|
m_isLoadedOK = false;
|
||
|
}
|
||
|
@@ -268,12 +268,12 @@ bool FFMPEGLibrary::Load()
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
-AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
|
||
|
+AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
|
||
|
{
|
||
|
return avcodec_find_encoder(id);
|
||
|
}
|
||
|
|
||
|
-AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
|
||
|
+AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
|
||
|
{
|
||
|
WaitAndSignal m(processLock);
|
||
|
|
||
|
@@ -308,13 +308,18 @@ int FFMPEGLibrary::AvcodecClose(AVCodecC
|
||
|
return avcodec_close(ctx);
|
||
|
}
|
||
|
|
||
|
+#undef FFMAX
|
||
|
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
|
||
|
int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
|
||
|
{
|
||
|
+ AVPacket pkt = { 0 };
|
||
|
+ int ret, got_output;
|
||
|
int res;
|
||
|
|
||
|
- res = avcodec_encode_video(ctx, buf, buf_size, pict);
|
||
|
+ ret = avcodec_encode_video2(ctx, &pkt, pict, &got_output);
|
||
|
|
||
|
- PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
|
||
|
+ PTRACE(6, m_codecString, "DYNA\tEncoded into " << ret << " bytes, max " << buf_size);
|
||
|
+ memcpy(buf, pkt.data, FFMAX(pkt.size, buf_size));
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
--- a/plugins/video/common/dyna.h
|
||
|
+++ b/plugins/video/common/dyna.h
|
||
|
@@ -88,13 +88,13 @@ class DynaLink
|
||
|
class FFMPEGLibrary
|
||
|
{
|
||
|
public:
|
||
|
- FFMPEGLibrary(CodecID codec);
|
||
|
+ FFMPEGLibrary(AVCodecID codec);
|
||
|
~FFMPEGLibrary();
|
||
|
|
||
|
bool Load();
|
||
|
|
||
|
- AVCodec *AvcodecFindEncoder(enum CodecID id);
|
||
|
- AVCodec *AvcodecFindDecoder(enum CodecID id);
|
||
|
+ AVCodec *AvcodecFindEncoder(enum AVCodecID id);
|
||
|
+ AVCodec *AvcodecFindDecoder(enum AVCodecID id);
|
||
|
AVCodecContext *AvcodecAllocContext(AVCodec*);
|
||
|
AVFrame *AvcodecAllocFrame(void);
|
||
|
int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
|
||
|
@@ -117,7 +117,7 @@ class FFMPEGLibrary
|
||
|
DynaLink m_libAvcodec;
|
||
|
DynaLink m_libAvutil;
|
||
|
|
||
|
- CodecID m_codec;
|
||
|
+ AVCodecID m_codec;
|
||
|
char m_codecString[32];
|
||
|
|
||
|
bool m_isLoadedOK;
|