summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--k9author/k9avidecode.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/k9author/k9avidecode.cpp b/k9author/k9avidecode.cpp
index 3931337..d51ec9a 100644
--- a/k9author/k9avidecode.cpp
+++ b/k9author/k9avidecode.cpp
@@ -27,6 +27,10 @@
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#endif
+#if !defined(NEW_FFMPEG) || LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,42,0)
+#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+#endif
+
#include <tqimage.h>
#include <dlfcn.h>
#include <tdelocale.h>
@@ -43,7 +47,9 @@ int glibref=0;
void av_free_packet_internal(AVPacket *pkt)
{
if (pkt) {
+# if LIBAVCODEC_VERSION_INT < (AV_VERSION_INT(56,0,0))
if (pkt->destruct) pkt->destruct(pkt);
+# endif
pkt->data = NULL; pkt->size = 0;
}
}
@@ -259,14 +265,14 @@ bool k9AviDecode::open(const TQString & _fileName) {
int numBytes;
// Determine required buffer size and allocate buffer
- numBytes=avpicture_get_size(PIX_FMT_RGB24, m_CodecCtx->width,
+ numBytes=avpicture_get_size(AV_PIX_FMT_RGB24, m_CodecCtx->width,
m_CodecCtx->height);
m_buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
// Assign appropriate parts of buffer to image planes in pFrameRGB
// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
// of AVPicture
- avpicture_fill((AVPicture *)m_FrameRGB, m_buffer, PIX_FMT_RGB24,
+ avpicture_fill((AVPicture *)m_FrameRGB, m_buffer, AV_PIX_FMT_RGB24,
m_CodecCtx->width, m_CodecCtx->height);
m_duration=(double)m_FormatCtx->duration / AV_TIME_BASE;
@@ -321,7 +327,7 @@ void k9AviDecode::readFrame(double _seconds) {
bFound=true;
# ifndef HAVE_SWSCALE
// Convert the image from its native format to RGB
- img_convert((AVPicture *)m_FrameRGB, PIX_FMT_RGB24,
+ img_convert((AVPicture *)m_FrameRGB, AV_PIX_FMT_RGB24,
(AVPicture*)m_Frame, m_CodecCtx->pix_fmt,
m_CodecCtx->width, m_CodecCtx->height);
@@ -329,7 +335,7 @@ void k9AviDecode::readFrame(double _seconds) {
SaveFrame(m_FrameRGB, m_CodecCtx->width,
m_CodecCtx->height);
# else
- toRGB_convert_ctx=sws_getContext(m_CodecCtx->width, m_CodecCtx->height, m_CodecCtx->pix_fmt, m_CodecCtx->width, m_CodecCtx->height, PIX_FMT_RGB24, sws_flags,NULL,NULL,NULL);
+ toRGB_convert_ctx=sws_getContext(m_CodecCtx->width, m_CodecCtx->height, m_CodecCtx->pix_fmt, m_CodecCtx->width, m_CodecCtx->height, AV_PIX_FMT_RGB24, sws_flags,NULL,NULL,NULL);
sws_scale(toRGB_convert_ctx, m_Frame->data, m_Frame->linesize, 0, m_CodecCtx->height, m_FrameRGB->data,m_FrameRGB->linesize);
// convert frame to QImage
SaveFrame(m_FrameRGB, m_CodecCtx->width,