summaryrefslogtreecommitdiffstats
path: root/k9author/k9avidecode.h
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-05-17 12:02:27 +0000
committerSlávek Banko <slavek.banko@axis.cz>2022-05-19 17:40:38 +0200
commit83beb081801183920497d4ac3ee2ef8786911e08 (patch)
tree9f53cf8fa3f1c8a5c060c987a075f4f6985f7829 /k9author/k9avidecode.h
parent6e5bd8f2aecca675dd0d7b1da4cbb06f1044c541 (diff)
downloadk9copy-83beb081.tar.gz
k9copy-83beb081.zip
Implement ffmpeg version 5 support
Version 5.0 of ffmpeg drops a load of deprecated API functions causing k9copy to fail its build. The necessary changes have been made to enable k9copy to build against ffmpeg 5.0 as well as retaining support for older versions. Support for older pre-0.5.1 versions has been dropped as has runtime linking of the ffmpeg libraries. libswscale is now mandatory. Signed-off-by: aneejit1 <aneejit1@gmail.com> (cherry picked from commit e71518b16cb4507712e2bf69e4902fc1689d9995)
Diffstat (limited to 'k9author/k9avidecode.h')
-rw-r--r--k9author/k9avidecode.h118
1 files changed, 8 insertions, 110 deletions
diff --git a/k9author/k9avidecode.h b/k9author/k9avidecode.h
index 912cb85..e1ecd0f 100644
--- a/k9author/k9avidecode.h
+++ b/k9author/k9avidecode.h
@@ -14,17 +14,16 @@
#include "k9common.h"
#include <tqobject.h>
-#ifdef OLD_FFMPEG
-#include <ffmpeg/avformat.h>
-#endif
-#ifdef NEW_FFMPEG
+
+extern "C" {
#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
-#endif
-
-#ifdef HAVE_SWSCALE
+#include <libavutil/time.h>
+#include <libavutil/imgutils.h>
+#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
-#endif
+};
#include <tqimage.h>
@@ -33,60 +32,6 @@
*/
-//typedef dvd_file_t * (*DVDOpenFile_t) ( dvd_reader_t *, int, dvd_read_domain_t );
-typedef void (*av_register_all_t) (void);
-typedef int64_t (*av_gettime_t) (void);
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 2, 0)
-typedef int (*avformat_open_input_t)(AVFormatContext **, const char *, AVInputFormat *, AVDictionary **);
-#else
-typedef int (*av_open_input_file_t)(AVFormatContext **, const char *,AVInputFormat *,int, AVFormatParameters *);
-#endif
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 6, 0)
-typedef int (*avformat_find_stream_info_t)(AVFormatContext *, AVDictionary **);
-#else
-typedef int (*av_find_stream_info_t)(AVFormatContext *);
-#endif
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 25, 0)
-typedef AVCodec* (*avcodec_find_decoder_t)(enum AVCodecID);
-#else
-typedef AVCodec* (*avcodec_find_decoder_t)(enum CodecID);
-#endif
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0)
-typedef int (*avcodec_open2_t)(AVCodecContext *, AVCodec *, AVDictionary **);
-#else
-typedef int (*avcodec_open_t)(AVCodecContext *, AVCodec *);
-#endif
-typedef AVFrame * (*avcodec_alloc_frame_t)(void);
-
-typedef int (*avpicture_get_size_t)(int , int , int );
-typedef void * (*av_malloc_t)(unsigned int );
-typedef int (*avpicture_fill_t)(AVPicture *, uint8_t *,int , int , int);
-typedef int (*av_read_frame_t)(AVFormatContext *, AVPacket *);
-
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 23, 0)
-typedef int (*avcodec_decode_video2_t)(AVCodecContext *, AVFrame *, int *, AVPacket *);
-#else
-typedef int (*avcodec_decode_video_t)(AVCodecContext *, AVFrame *,int *, uint8_t *, int );
-#endif
-typedef int (*img_convert_t)(AVPicture *, int , const AVPicture *, int ,int, int);
-typedef void (*av_free_t)(void *);
-typedef int (*avcodec_close_t)(AVCodecContext *);
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
-typedef void (*avformat_close_input_t)(AVFormatContext **);
-#else
-typedef void (*av_close_input_file_t)(AVFormatContext *);
-#endif
-typedef int (*av_seek_frame_t)(AVFormatContext *,int,int64_t timestamp,int flags); typedef int64_t (*av_rescale_q_t)(int64_t , AVRational , AVRational ) ;
-typedef void (*avcodec_flush_buffers_t)(AVCodecContext *);
-typedef void (*av_free_packet_t)(AVPacket *);
-
-#ifdef HAVE_SWSCALE
-typedef void (*sws_freeContext_t)(struct SwsContext *swsContext);
-typedef struct SwsContext* (*sws_getContext_t)(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);
-typedef int (*sws_scale_t)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,int srcSliceH, uint8_t* dst[], int dstStride[]);
-#endif
-
-
class k9AviDecode : public TQObject
{
Q_OBJECT
@@ -104,56 +49,9 @@ public:
TQString getFileName() const;
- TQString getError() const;
+ TQString getError() const;
private:
- av_register_all_t av_register_all;
-# if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 2, 0)
- avformat_open_input_t avformat_open_input;
-# else
- av_open_input_file_t av_open_input_file;
-# endif
-# if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 6, 0)
- avformat_find_stream_info_t avformat_find_stream_info;
-# else
- av_find_stream_info_t av_find_stream_info;
-# endif
- avcodec_find_decoder_t avcodec_find_decoder;
-# if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 8, 0)
- avcodec_open2_t avcodec_open2;
-# else
- avcodec_open_t avcodec_open;
-# endif
- avcodec_alloc_frame_t avcodec_alloc_frame;
- av_seek_frame_t av_seek_frame;
- avpicture_get_size_t avpicture_get_size;
- av_malloc_t av_malloc;
- avpicture_fill_t avpicture_fill;
- av_read_frame_t av_read_frame;
-# if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 23, 0)
- avcodec_decode_video2_t avcodec_decode_video2;
-# else
- avcodec_decode_video_t avcodec_decode_video;
-# endif
- img_convert_t img_convert;
- av_free_t av_free;
- avcodec_close_t avcodec_close;
-# if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
- avformat_close_input_t avformat_close_input;
-# else
- av_close_input_file_t av_close_input_file;
-# endif
- av_rescale_q_t av_rescale_q;
- av_gettime_t av_gettime;
- avcodec_flush_buffers_t avcodec_flush_buffers;
- av_free_packet_t av_free_packet;
-# ifdef HAVE_SWSCALE
- sws_freeContext_t sws_freeContext;
- sws_getContext_t sws_getContext;
- sws_scale_t sws_scale;
-# endif
-
-
AVFormatContext *m_FormatCtx;
AVCodecContext *m_CodecCtx;
AVCodec *m_Codec;