diff --git a/YUViewLib/src/ffmpeg/AVCodecWrapper.cpp b/YUViewLib/src/ffmpeg/AVCodecWrapper.cpp index 2d826e43c..febf9f275 100644 --- a/YUViewLib/src/ffmpeg/AVCodecWrapper.cpp +++ b/YUViewLib/src/ffmpeg/AVCodecWrapper.cpp @@ -57,7 +57,7 @@ typedef struct AVCodec_56_57_58 // Actually, there is more here, but nothing more of the public API } AVCodec_56_57_58; -typedef struct AVCodec_59 +typedef struct AVCodec_59_60 { const char * name; const char * long_name; @@ -73,7 +73,26 @@ typedef struct AVCodec_59 const AVClass * priv_class; // Actually, there is more here, but nothing more of the public API -} AVCodec_59; +} AVCodec_59_60; + +// Same as AVCodec_59_60 but without channel_layouts (removed by FF_API_OLD_CHANNEL_LAYOUT +// in avutil >= 59 for avcodec 61). +typedef struct AVCodec_61 +{ + const char * name; + const char * long_name; + enum AVMediaType type; + enum AVCodecID id; + int capabilities; + uint8_t max_lowres; + const AVRational * supported_framerates; + const enum AVPixelFormat * pix_fmts; + const int * supported_samplerates; + const enum AVSampleFormat *sample_fmts; + const AVClass * priv_class; + + // Actually, there is more here, but nothing more of the public API +} AVCodec_61; template std::vector convertRawListToVec(const T *rawValues, T terminationValue) { @@ -110,9 +129,9 @@ void AVCodecWrapper::update() this->channel_layouts = convertRawListToVec(p->channel_layouts, uint64_t(0)); this->max_lowres = p->max_lowres; } - else if (libVer.avcodec.major == 59) + else if (libVer.avcodec.major == 59 || libVer.avcodec.major == 60) { - auto p = reinterpret_cast(codec); + auto p = reinterpret_cast(codec); this->name = QString(p->name); this->long_name = QString(p->long_name); this->type = p->type; @@ -125,6 +144,21 @@ void AVCodecWrapper::update() this->channel_layouts = convertRawListToVec(p->channel_layouts, uint64_t(0)); this->max_lowres = p->max_lowres; } + else if (libVer.avcodec.major == 61) + { + auto p = reinterpret_cast(codec); + this->name = QString(p->name); + this->long_name = QString(p->long_name); + this->type = p->type; + this->id = p->id; + this->capabilities = p->capabilities; + this->supported_framerates = convertRawListToVec(p->supported_framerates, AVRational({0, 0})); + this->pix_fmts = convertRawListToVec(p->pix_fmts, AVPixelFormat(-1)); + this->supported_samplerates = convertRawListToVec(p->supported_samplerates, 0); + this->sample_fmts = convertRawListToVec(p->sample_fmts, AVSampleFormat(-1)); + this->channel_layouts = {}; + this->max_lowres = p->max_lowres; + } else throw std::runtime_error("Invalid library version"); } diff --git a/YUViewLib/src/ffmpeg/AVInputFormatWrapper.cpp b/YUViewLib/src/ffmpeg/AVInputFormatWrapper.cpp index 0193e9145..19b1f9437 100644 --- a/YUViewLib/src/ffmpeg/AVInputFormatWrapper.cpp +++ b/YUViewLib/src/ffmpeg/AVInputFormatWrapper.cpp @@ -38,7 +38,7 @@ namespace FFmpeg namespace { -typedef struct AVInputFormat_56_57_58_59_60 +typedef struct AVInputFormat_56_57_58_59_60_61 { const char * name; const char * long_name; @@ -49,7 +49,7 @@ typedef struct AVInputFormat_56_57_58_59_60 const char * mime_type; // There is more but it is not part of the public ABI -} AVInputFormat_56_57_58_59_60; +} AVInputFormat_56_57_58_59_60_61; } // namespace @@ -99,9 +99,10 @@ void AVInputFormatWrapper::update() this->libVer.avformat.major == 57 || // this->libVer.avformat.major == 58 || // this->libVer.avformat.major == 59 || // - this->libVer.avformat.major == 60) + this->libVer.avformat.major == 60 || + this->libVer.avformat.major == 61) { - auto p = reinterpret_cast(this->fmt); + auto p = reinterpret_cast(this->fmt); this->name = QString(p->name); this->long_name = QString(p->long_name); this->flags = p->flags; diff --git a/YUViewLib/src/ffmpeg/AVMotionVectorWrapper.cpp b/YUViewLib/src/ffmpeg/AVMotionVectorWrapper.cpp index 32c027616..1bd327b20 100644 --- a/YUViewLib/src/ffmpeg/AVMotionVectorWrapper.cpp +++ b/YUViewLib/src/ffmpeg/AVMotionVectorWrapper.cpp @@ -48,7 +48,7 @@ typedef struct AVMotionVector_54 uint64_t flags; } AVMotionVector_54; -typedef struct AVMotionVector_55_56_57 +typedef struct AVMotionVector_55_56_57_58_59 { int32_t source; uint8_t w, h; @@ -57,7 +57,7 @@ typedef struct AVMotionVector_55_56_57 uint64_t flags; int32_t motion_x, motion_y; uint16_t motion_scale; -} AVMotionVector_55_56_57; +} AVMotionVector_55_56_57_58_59; } // namespace @@ -80,9 +80,11 @@ AVMotionVectorWrapper::AVMotionVectorWrapper(LibraryVersion &libVer, uint8_t *da } else if (libVer.avutil.major == 55 || // libVer.avutil.major == 56 || // - libVer.avutil.major == 57) + libVer.avutil.major == 57 || + libVer.avutil.major == 58 || + libVer.avutil.major == 59) { - auto p = reinterpret_cast(data) + idx; + auto p = reinterpret_cast(data) + idx; this->source = p->source; this->w = p->w; this->h = p->h; @@ -103,8 +105,9 @@ size_t AVMotionVectorWrapper::getNumberOfMotionVectors(LibraryVersion &libVer, s { if (libVer.avutil.major == 54) return dataSize / sizeof(AVMotionVector_54); - else if (libVer.avutil.major == 55 || libVer.avutil.major == 56 || libVer.avutil.major == 57) - return dataSize / sizeof(AVMotionVector_55_56_57); + else if (libVer.avutil.major == 55 || libVer.avutil.major == 56 || libVer.avutil.major == 57 || + libVer.avutil.major == 58 || libVer.avutil.major == 59) + return dataSize / sizeof(AVMotionVector_55_56_57_58_59); else return 0; } diff --git a/YUViewLib/src/ui/views/PlotViewWidget.cpp b/YUViewLib/src/ui/views/PlotViewWidget.cpp index 53ab62553..ec9003014 100644 --- a/YUViewLib/src/ui/views/PlotViewWidget.cpp +++ b/YUViewLib/src/ui/views/PlotViewWidget.cpp @@ -808,8 +808,8 @@ void PlotViewWidget::drawInfoBox(QPainter &painter) const // Create a QTextDocument. This object can tell us the size of the rendered text. QTextDocument textDocument; + textDocument.setDefaultStyleSheet("* { color: #000000 }"); textDocument.setHtml(infoString); - textDocument.setDefaultStyleSheet("* { color: #FFFFFF }"); textDocument.setTextWidth(textDocument.size().width()); // Translate to the position where the text box shall be @@ -865,8 +865,8 @@ void PlotViewWidget::drawDebugBox(QPainter &painter) const // Create a QTextDocument. This object can tell us the size of the rendered text. QTextDocument textDocument; + textDocument.setDefaultStyleSheet("* { color: #000000 }"); textDocument.setHtml(infoString); - textDocument.setDefaultStyleSheet("* { color: #FFFFFF }"); textDocument.setTextWidth(textDocument.size().width()); // Translate to the position where the text box shall be diff --git a/YUViewLib/src/ui/views/SplitViewWidget.cpp b/YUViewLib/src/ui/views/SplitViewWidget.cpp index 1e71e5aca..eaee99461 100644 --- a/YUViewLib/src/ui/views/SplitViewWidget.cpp +++ b/YUViewLib/src/ui/views/SplitViewWidget.cpp @@ -732,7 +732,7 @@ void splitViewWidget::paintZoomBox(int view, // Create a QTextDocument. This object can tell us the size of the rendered text. QTextDocument textDocument; - textDocument.setDefaultStyleSheet("* { color: #FFFFFF }"); + textDocument.setDefaultStyleSheet("* { color: #000000 }"); textDocument.setHtml(pixelInfoString); textDocument.setTextWidth(textDocument.size().width());