ffmpeg versioning mods from Andrew
authorGood Guy <good1.2guy@gmail.com>
Fri, 13 May 2022 21:34:07 +0000 (15:34 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 13 May 2022 21:34:07 +0000 (15:34 -0600)
cinelerra-5.1/cinelerra/bdwrite.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/ffmpeg.h
cinelerra-5.1/cinelerra/fileac3.h
cinelerra-5.1/cinelerra/pluginfclient.C
cinelerra-5.1/configure.ac

index 96526002923d7cca154ab17e45b7560203fe38ed..1017c1690670046fa831d603a73474085601f2b2 100644 (file)
@@ -2530,7 +2530,12 @@ static int field_probe(AVFormatContext *fmt_ctx, AVStream *st)
   AVDictionary *copts = 0;
   //av_dict_copy(&copts, opts, 0);
   AVCodecID codec_id = st->codecpar->codec_id;
   AVDictionary *copts = 0;
   //av_dict_copy(&copts, opts, 0);
   AVCodecID codec_id = st->codecpar->codec_id;
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
   AVCodec *decoder = avcodec_find_decoder(codec_id);
   AVCodec *decoder = avcodec_find_decoder(codec_id);
+#endif
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+  const AVCodec *decoder = avcodec_find_decoder(codec_id);
+#endif
   AVCodecContext *ctx = avcodec_alloc_context3(decoder);
   if( !ctx ) {
     fprintf(stderr,"codec alloc failed\n");
   AVCodecContext *ctx = avcodec_alloc_context3(decoder);
   if( !ctx ) {
     fprintf(stderr,"codec alloc failed\n");
@@ -2604,7 +2609,13 @@ int media_info::scan()
     stream *s = new stream(type, i);
     s->pid = st->id;
     AVCodecID codec_id = st->codecpar->codec_id;
     stream *s = new stream(type, i);
     s->pid = st->id;
     AVCodecID codec_id = st->codecpar->codec_id;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+    const AVCodec *decoder = avcodec_find_decoder(codec_id);
+#endif
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
     AVCodec *decoder = avcodec_find_decoder(codec_id);
     AVCodec *decoder = avcodec_find_decoder(codec_id);
+#endif
+
     s->ctx = avcodec_alloc_context3(decoder);
     if( !s->ctx ) {
       fprintf(stderr, "avcodec_alloc_context failed\n");
     s->ctx = avcodec_alloc_context3(decoder);
     if( !s->ctx ) {
       fprintf(stderr, "avcodec_alloc_context failed\n");
index 3655d643fb097f4f954c768aeabf26bef44e6e60..2d441a79f6c2bcb244362d024305140cb61c6723 100644 (file)
@@ -380,8 +380,11 @@ AVHWDeviceType FFStream::decode_hw_activate()
 {
        return AV_HWDEVICE_TYPE_NONE;
 }
 {
        return AV_HWDEVICE_TYPE_NONE;
 }
-
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+int FFStream::decode_hw_format(const AVCodec *decoder, AVHWDeviceType type)
+#else
 int FFStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
 int FFStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
+#endif
 {
        return 0;
 }
 {
        return 0;
 }
@@ -406,7 +409,11 @@ int FFStream::decode_activate()
                }
                while( ret >= 0 && st != 0 && !reading ) {
                        AVCodecID codec_id = st->codecpar->codec_id;
                }
                while( ret >= 0 && st != 0 && !reading ) {
                        AVCodecID codec_id = st->codecpar->codec_id;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+                       const AVCodec *decoder = 0;
+#else
                        AVCodec *decoder = 0;
                        AVCodec *decoder = 0;
+#endif
                        if( is_video() ) {
                                if( ffmpeg->opt_video_decoder )
                                        decoder = avcodec_find_decoder_by_name(ffmpeg->opt_video_decoder);
                        if( is_video() ) {
                                if( ffmpeg->opt_video_decoder )
                                        decoder = avcodec_find_decoder_by_name(ffmpeg->opt_video_decoder);
@@ -722,10 +729,19 @@ int FFStream::seek(int64_t no, double rate)
        double secs = pos < 0 ? 0. : pos / rate;
        AVRational time_base = st->time_base;
        int64_t tstmp = time_base.num > 0 ? secs * time_base.den/time_base.num : 0;
        double secs = pos < 0 ? 0. : pos / rate;
        AVRational time_base = st->time_base;
        int64_t tstmp = time_base.num > 0 ? secs * time_base.den/time_base.num : 0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       int nb_index_entries = avformat_index_get_entries_count(st);
+#endif
        if( !tstmp ) {
        if( !tstmp ) {
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+               if( nb_index_entries > 0 ) tstmp = (avformat_index_get_entry(st, 0))->timestamp;
+#else
                if( st->nb_index_entries > 0 ) tstmp = st->index_entries[0].timestamp;
                if( st->nb_index_entries > 0 ) tstmp = st->index_entries[0].timestamp;
+#endif
                else if( st->start_time != AV_NOPTS_VALUE ) tstmp = st->start_time;
                else if( st->start_time != AV_NOPTS_VALUE ) tstmp = st->start_time;
+#if LIBAVCODEC_VERSION_INT  <= AV_VERSION_INT(58,134,100)
                else if( st->first_dts != AV_NOPTS_VALUE ) tstmp = st->first_dts;
                else if( st->first_dts != AV_NOPTS_VALUE ) tstmp = st->first_dts;
+#endif
                else tstmp = INT64_MIN+1;
        }
        else if( nudge != AV_NOPTS_VALUE ) tstmp += nudge;
                else tstmp = INT64_MIN+1;
        }
        else if( nudge != AV_NOPTS_VALUE ) tstmp += nudge;
@@ -1093,8 +1109,11 @@ AVHWDeviceType FFVideoStream::decode_hw_activate()
        }
        return type;
 }
        }
        return type;
 }
-
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+int FFVideoStream::decode_hw_format(const AVCodec *decoder, AVHWDeviceType type)
+#else
 int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
 int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
+#endif
 {
        int ret = 0;
        hw_pix_fmt = AV_PIX_FMT_NONE;
 {
        int ret = 0;
        hw_pix_fmt = AV_PIX_FMT_NONE;
@@ -1850,7 +1869,11 @@ FFMPEG::~FFMPEG()
        delete [] opt_hw_dev;
 }
 
        delete [] opt_hw_dev;
 }
 
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+int FFMPEG::check_sample_rate(const AVCodec *codec, int sample_rate)
+#else
 int FFMPEG::check_sample_rate(AVCodec *codec, int sample_rate)
 int FFMPEG::check_sample_rate(AVCodec *codec, int sample_rate)
+#endif
 {
        const int *p = codec->supported_samplerates;
        if( !p ) return sample_rate;
 {
        const int *p = codec->supported_samplerates;
        if( !p ) return sample_rate;
@@ -2100,7 +2123,11 @@ void FFMPEG::scan_audio_options(Asset *asset, EDL *edl)
                cin_fmt = (int)av_get_sample_fmt(cin_sample_fmt);
        if( cin_fmt < 0 ) {
                char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
                cin_fmt = (int)av_get_sample_fmt(cin_sample_fmt);
        if( cin_fmt < 0 ) {
                char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,18,100)
+               const AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
+#else
                AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
                AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
+#endif
                        avcodec_find_encoder_by_name(audio_codec) : 0;
                if( av_codec && av_codec->sample_fmts )
                        cin_fmt = find_best_sample_fmt_of_list(av_codec->sample_fmts, AV_SAMPLE_FMT_FLT);
                        avcodec_find_encoder_by_name(audio_codec) : 0;
                if( av_codec && av_codec->sample_fmts )
                        cin_fmt = find_best_sample_fmt_of_list(av_codec->sample_fmts, AV_SAMPLE_FMT_FLT);
@@ -2136,7 +2163,11 @@ void FFMPEG::scan_video_options(Asset *asset, EDL *edl)
                        cin_fmt = (int)av_get_pix_fmt(cin_pix_fmt);
        if( cin_fmt < 0 ) {
                char video_codec[BCSTRLEN];  video_codec[0] = 0;
                        cin_fmt = (int)av_get_pix_fmt(cin_pix_fmt);
        if( cin_fmt < 0 ) {
                char video_codec[BCSTRLEN];  video_codec[0] = 0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,18,100)
+               const AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
+#else
                AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
                AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
+#endif
                        avcodec_find_encoder_by_name(video_codec) : 0;
                if( av_codec && av_codec->pix_fmts ) {
                        if( 0 && edl ) { // frequently picks a bad answer
                        avcodec_find_encoder_by_name(video_codec) : 0;
                if( av_codec && av_codec->pix_fmts ) {
                        if( 0 && edl ) { // frequently picks a bad answer
@@ -2330,10 +2361,15 @@ int FFCodecRemaps::add(const char *val)
        return 0;
 }
 
        return 0;
 }
 
-
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+int FFCodecRemaps::update(AVCodecID &codec_id, const AVCodec *&decoder)
+{
+       const AVCodec *codec = avcodec_find_decoder(codec_id);
+#else
 int FFCodecRemaps::update(AVCodecID &codec_id, AVCodec *&decoder)
 {
        AVCodec *codec = avcodec_find_decoder(codec_id);
 int FFCodecRemaps::update(AVCodecID &codec_id, AVCodec *&decoder)
 {
        AVCodec *codec = avcodec_find_decoder(codec_id);
+#endif
        if( !codec ) return -1;
        const char *name = codec->name;
        FFCodecRemaps &map = *this;
        if( !codec ) return -1;
        const char *name = codec->name;
        FFCodecRemaps &map = *this;
@@ -2553,7 +2589,11 @@ int FFMPEG::init_decoder(const char *filename)
        char *sp = strrchr(bp, '.');
        if( !sp ) sp = bp + strlen(bp);
        FILE *fp = 0;
        char *sp = strrchr(bp, '.');
        if( !sp ) sp = bp + strlen(bp);
        FILE *fp = 0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,18,100)
+       const AVInputFormat *ifmt = 0;
+#else
        AVInputFormat *ifmt = 0;
        AVInputFormat *ifmt = 0;
+#endif
        if( sp ) {
                strcpy(sp, ".opts");
                fp = fopen(file_opts, "r");
        if( sp ) {
                strcpy(sp, ".opts");
                fp = fopen(file_opts, "r");
@@ -2774,7 +2814,11 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
        AVCodecContext *ctx = 0;
 
        const AVCodecDescriptor *codec_desc = 0;
        AVCodecContext *ctx = 0;
 
        const AVCodecDescriptor *codec_desc = 0;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       const AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
+#else
        AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
        AVCodec *codec = avcodec_find_encoder_by_name(codec_name);
+#endif
        if( !codec ) {
                eprintf(_("cant find codec %s:%s\n"), codec_name, filename);
                ret = 1;
        if( !codec ) {
                eprintf(_("cant find codec %s:%s\n"), codec_name, filename);
                ret = 1;
@@ -3027,7 +3071,11 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                }
                if( ret >= 0 ) {
 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
                }
                if( ret >= 0 ) {
 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
                        ret = avcodec_copy_context(st->codec, ctx);
                        ret = avcodec_copy_context(st->codec, ctx);
+#else
+                       ret = avcodec_parameters_to_context(ctx, st->codecpar);
+#endif
 _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
                        if( ret < 0 )
                                fprintf(stderr, "Could not copy the stream context\n");
 _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
                        if( ret < 0 )
                                fprintf(stderr, "Could not copy the stream context\n");
@@ -3672,7 +3720,11 @@ Preferences *FFMPEG::ff_prefs()
 
 double FFVideoStream::get_rotation_angle()
 {
 
 double FFVideoStream::get_rotation_angle()
 {
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       size_t size = 0;
+#else
        int size = 0;
        int size = 0;
+#endif
        int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size);
        int len = size/sizeof(*matrix);
        if( !matrix || len < 5 ) return 0;
        int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size);
        int len = size/sizeof(*matrix);
        if( !matrix || len < 5 ) return 0;
@@ -3897,7 +3949,11 @@ AVCodecContext *FFMPEG::activate_decoder(AVStream *st)
        AVDictionary *copts = 0;
        av_dict_copy(&copts, opts, 0);
        AVCodecID codec_id = st->codecpar->codec_id;
        AVDictionary *copts = 0;
        av_dict_copy(&copts, opts, 0);
        AVCodecID codec_id = st->codecpar->codec_id;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       const AVCodec *decoder = 0;
+#else
        AVCodec *decoder = 0;
        AVCodec *decoder = 0;
+#endif
        switch( st->codecpar->codec_type ) {
        case AVMEDIA_TYPE_VIDEO:
                if( opt_video_decoder )
        switch( st->codecpar->codec_type ) {
        case AVMEDIA_TYPE_VIDEO:
                if( opt_video_decoder )
@@ -4089,10 +4145,20 @@ void FFStream::load_markers(IndexMarks &marks, double rate)
        int in = 0;
        int64_t sz = marks.size();
        int max_entries = fmt_ctx->max_index_size / sizeof(AVIndexEntry) - 1;
        int in = 0;
        int64_t sz = marks.size();
        int max_entries = fmt_ctx->max_index_size / sizeof(AVIndexEntry) - 1;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       int nb_ent = avformat_index_get_entries_count(st);
+#endif
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
        int nb_ent = st->nb_index_entries;
        int nb_ent = st->nb_index_entries;
+#endif
 // some formats already have an index
        if( nb_ent > 0 ) {
 // some formats already have an index
        if( nb_ent > 0 ) {
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
                AVIndexEntry *ep = &st->index_entries[nb_ent-1];
                AVIndexEntry *ep = &st->index_entries[nb_ent-1];
+#endif
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+               const AVIndexEntry *ep = avformat_index_get_entry(st, nb_ent-1);
+#endif
                int64_t tstmp = ep->timestamp;
                if( nudge != AV_NOPTS_VALUE ) tstmp -= nudge;
                double secs = ffmpeg->to_secs(tstmp, st->time_base);
                int64_t tstmp = ep->timestamp;
                if( nudge != AV_NOPTS_VALUE ) tstmp -= nudge;
                double secs = ffmpeg->to_secs(tstmp, st->time_base);
index 4f1624cee5c73558233cf2ec00c8bd4169d228af..af5e43000b639dd4f1d478fc75254d85e0fac21d 100644 (file)
@@ -28,6 +28,9 @@ extern "C" {
 #include "libavformat/avformat.h"
 #include "libavformat/avio.h"
 #include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
 #include "libavformat/avio.h"
 #include "libavcodec/avcodec.h"
+#if LIBAVCODEC_VERSION_INT  >= AV_VERSION_INT(59,18,100)
+#include "libavcodec/bsf.h"
+#endif
 #include "libavfilter/avfilter.h"
 #include "libavutil/avutil.h"
 #include "libavfilter/buffersrc.h"
 #include "libavfilter/avfilter.h"
 #include "libavutil/avutil.h"
 #include "libavfilter/buffersrc.h"
@@ -86,7 +89,11 @@ public:
        virtual int encode_activate();
        virtual int decode_activate();
        virtual AVHWDeviceType decode_hw_activate();
        virtual int encode_activate();
        virtual int decode_activate();
        virtual AVHWDeviceType decode_hw_activate();
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       virtual int decode_hw_format(const AVCodec *decoder, AVHWDeviceType type);
+#else
        virtual int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
        virtual int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
+#endif
        virtual int write_packet(FFPacket &pkt);
        int read_packet();
        int seek(int64_t no, double rate);
        virtual int write_packet(FFPacket &pkt);
        int read_packet();
        int seek(int64_t no, double rate);
@@ -246,7 +253,11 @@ public:
        int is_video() { return 1; }
        int decode_frame(AVFrame *frame);
        AVHWDeviceType decode_hw_activate();
        int is_video() { return 1; }
        int decode_frame(AVFrame *frame);
        AVHWDeviceType decode_hw_activate();
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       int decode_hw_format(const AVCodec *decoder, AVHWDeviceType type);
+#else
        int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
        int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
+#endif
        AVHWDeviceType encode_hw_activate(const char *hw_dev);
        int encode_hw_write(FFrame *picture);
        int encode_frame(AVFrame *frame);
        AVHWDeviceType encode_hw_activate(const char *hw_dev);
        int encode_hw_write(FFrame *picture);
        int encode_frame(AVFrame *frame);
@@ -290,7 +301,11 @@ class FFCodecRemaps : public ArrayList<FFCodecRemap>
 public:
        FFCodecRemaps() {}
        int add(const char *val);
 public:
        FFCodecRemaps() {}
        int add(const char *val);
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       int update(AVCodecID &codec_id, const AVCodec *&decoder);
+#else
        int update(AVCodecID &codec_id, AVCodec *&decoder);
        int update(AVCodecID &codec_id, AVCodec *&decoder);
+#endif
 };
 
 // for get_initial_timecode auto deletes
 };
 
 // for get_initial_timecode auto deletes
@@ -331,7 +346,11 @@ public:
        static void ff_lock(const char *cp=0) { fflock.lock(cp); }
        static void ff_unlock() { fflock.unlock(); }
 
        static void ff_lock(const char *cp=0) { fflock.lock(cp); }
        static void ff_unlock() { fflock.unlock(); }
 
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       int check_sample_rate(const AVCodec *codec, int sample_rate);
+#else
        int check_sample_rate(AVCodec *codec, int sample_rate);
        int check_sample_rate(AVCodec *codec, int sample_rate);
+#endif
        AVRational check_frame_rate(const AVRational *p, double frame_rate);
        AVRational to_sample_aspect_ratio(Asset *asset);
        AVRational to_time_base(int sample_rate);
        AVRational check_frame_rate(const AVRational *p, double frame_rate);
        AVRational to_sample_aspect_ratio(Asset *asset);
        AVRational to_time_base(int sample_rate);
index 8ae62c76ebcbb23c242186653ad5adeaacf6318d..9355f3123effc4f8f331a67844287b3934fa4763 100644 (file)
@@ -60,7 +60,11 @@ public:
 
 private:
        AVPacket avpkt;
 
 private:
        AVPacket avpkt;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
+       const AVCodec *codec;
+#else
        AVCodec *codec;
        AVCodec *codec;
+#endif
        AVCodecContext *codec_context;
        SwrContext *resample_context;
 
        AVCodecContext *codec_context;
        SwrContext *resample_context;
 
index f4d9ba3a48fe30a9cc874d1d6923d8d6230536b3..32c3f4aae9846aa4ac76b8759fd6c4eb536260e7 100644 (file)
@@ -913,14 +913,22 @@ int PluginFAClient::get_inchannels()
 {
        AVFilterContext *fctx = ffilt->fctx;
        AVFilterLink **links = !fctx->nb_inputs ? 0 : fctx->inputs;
 {
        AVFilterContext *fctx = ffilt->fctx;
        AVFilterLink **links = !fctx->nb_inputs ? 0 : fctx->inputs;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,24,100)
+       return !links ? 0 : links[0]->ch_layout.nb_channels;
+#else
        return !links ? 0 : links[0]->channels;
        return !links ? 0 : links[0]->channels;
+#endif
 }
 
 int PluginFAClient::get_outchannels()
 {
        AVFilterContext *fctx = ffilt->fctx;
        AVFilterLink **links = !fctx->nb_outputs ? 0 : fctx->outputs;
 }
 
 int PluginFAClient::get_outchannels()
 {
        AVFilterContext *fctx = ffilt->fctx;
        AVFilterLink **links = !fctx->nb_outputs ? 0 : fctx->outputs;
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,24,100)
+       return !links ? 0 : links[0]->ch_layout.nb_channels;
+#else
        return !links ? 0 : links[0]->channels;
        return !links ? 0 : links[0]->channels;
+#endif
 }
 
 int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start_position, int sample_rate)
 }
 
 int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start_position, int sample_rate)
index 1cf621b49cbcb95a0b8f4cc8dbf6ccc5c60f1c31..5ee692fc02ed7871751a10a1b482aa4e08439d0c 100644 (file)
@@ -582,6 +582,8 @@ if test "x$HAVE_$1" != "xno"; then
 fi
 ])
 
 fi
 ])
 
+IMMATH_HEADERS=$(pkg-config --cflags Imath)
+
 CHECK_LIB([X11], [X11], [XOpenDisplay])
 CHECK_HEADERS([X11], [X11 headers], [X11/X.h X11/Xlib.h X11/Xutil.h X11/cursorfont.h])
 CHECK_HEADERS([X11], [X11 headers], [X11/keysym.h X11/Sunkeysym.h X11/Xatom.h X11/XF86keysym.h])
 CHECK_LIB([X11], [X11], [XOpenDisplay])
 CHECK_HEADERS([X11], [X11 headers], [X11/X.h X11/Xlib.h X11/Xutil.h X11/cursorfont.h])
 CHECK_HEADERS([X11], [X11 headers], [X11/keysym.h X11/Sunkeysym.h X11/Xatom.h X11/XF86keysym.h])
@@ -624,6 +626,7 @@ CHECK_LIB([libsndfile], [sndfile], [sf_open])
 CHECK_HEADERS([libsndfile], [sndfile headers], [sndfile.h])
 CHECK_LIB([ilmbase], [IlmImf], [ImfOpenInputFile])
 CHECK_HEADERS([ilmbase], [IlmImf headers], [OpenEXR/ImfCRgbaFile.h])
 CHECK_HEADERS([libsndfile], [sndfile headers], [sndfile.h])
 CHECK_LIB([ilmbase], [IlmImf], [ImfOpenInputFile])
 CHECK_HEADERS([ilmbase], [IlmImf headers], [OpenEXR/ImfCRgbaFile.h])
+CHECK_LIB([Imath], [Imath], [ImfOpenInputFile])
 CHECK_LIB([libvpx], [vpx], [vpx_codec_decode])
 CHECK_HEADERS([libvpx], [vpx headers], [vpx/vpx_decoder.h])
 CHECK_LIB([mjpegtools], [mjpegutils], [mjpeg_info])
 CHECK_LIB([libvpx], [vpx], [vpx_codec_decode])
 CHECK_HEADERS([libvpx], [vpx headers], [vpx/vpx_decoder.h])
 CHECK_LIB([mjpegtools], [mjpegutils], [mjpeg_info])
@@ -847,7 +850,11 @@ CHECK_WANT([OPENEXR], [auto], [use openexr], [
  saved_LIBS="$LIBS"
  saved_CXXFLAGS="$CXXFLAGS"
  # ilmbase libs
  saved_LIBS="$LIBS"
  saved_CXXFLAGS="$CXXFLAGS"
  # ilmbase libs
+ if test "xHAVE_Imath"="xyes"; then
+ LIBS=" -lImath -lIlmThread -lIex -lpthread"
+ else
  LIBS=" -lIlmImf -lIlmThread -lIex -lpthread"
  LIBS=" -lIlmImf -lIlmThread -lIex -lpthread"
+ fi
  CXXFLAGS="-I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
  CXXFLAGS+=" $(pkg-config --cflags OpenEXR)"
  AC_LANG_PUSH(C++)
  CXXFLAGS="-I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
  CXXFLAGS+=" $(pkg-config --cflags OpenEXR)"
  AC_LANG_PUSH(C++)
@@ -884,6 +891,13 @@ EXROStream() : Imf::OStream("mypath") {} };
  AC_LANG_POP(C++)
  AC_MSG_RESULT([$HAVE_OPENEXR])
 ])
  AC_LANG_POP(C++)
  AC_MSG_RESULT([$HAVE_OPENEXR])
 ])
+
+if test "x$WANT_CIN_3RDPARTY" = "xno"; then
+ if test "x$HAVE_OPENEXR" != "xyes" -a "x$WANT_OPENEXR" = "xyes"; then
+  AC_MSG_ERROR([requires OpenEXR but OpenEXR not found.])
+ fi
+fi
+
 AC_SUBST([HAVE_OPENEXR])
 # have all or none
 test "x$HAVE_openexr" = "xyes" && \
 AC_SUBST([HAVE_OPENEXR])
 # have all or none
 test "x$HAVE_openexr" = "xyes" && \