Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions YUViewLib/src/ffmpeg/AVCodecWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 <typename T> std::vector<T> convertRawListToVec(const T *rawValues, T terminationValue)
{
Expand Down Expand Up @@ -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<AVCodec_59 *>(codec);
auto p = reinterpret_cast<AVCodec_59_60 *>(codec);
this->name = QString(p->name);
this->long_name = QString(p->long_name);
this->type = p->type;
Expand All @@ -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<AVCodec_61 *>(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");
}
Expand Down
9 changes: 5 additions & 4 deletions YUViewLib/src/ffmpeg/AVInputFormatWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand Down Expand Up @@ -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<AVInputFormat_56_57_58_59_60 *>(this->fmt);
auto p = reinterpret_cast<AVInputFormat_56_57_58_59_60_61 *>(this->fmt);
this->name = QString(p->name);
this->long_name = QString(p->long_name);
this->flags = p->flags;
Expand Down
15 changes: 9 additions & 6 deletions YUViewLib/src/ffmpeg/AVMotionVectorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand All @@ -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<AVMotionVector_55_56_57 *>(data) + idx;
auto p = reinterpret_cast<AVMotionVector_55_56_57_58_59 *>(data) + idx;
this->source = p->source;
this->w = p->w;
this->h = p->h;
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/ui/views/PlotViewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion YUViewLib/src/ui/views/SplitViewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down