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
6 changes: 6 additions & 0 deletions Source/Core/AudioStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
extern "C"
{
#include <libavutil/frame.h>
#include <libavutil/version.h>
#include <libavformat/avformat.h>
}
#include <qavplayer.h>
Expand Down Expand Up @@ -296,8 +297,13 @@ void AudioStats::TimeStampFromFrame (const QAVFrame& frame, size_t FramePos)
x[2][FramePos]=x[1][FramePos]/60;
x[3][FramePos]=x[2][FramePos]/60;
}
#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 30, 0)
if (Frame->pkt_duration != AV_NOPTS_VALUE)
durations[FramePos]=((double)Frame->pkt_duration)/Frequency;
#else
if (Frame->duration != AV_NOPTS_VALUE)
durations[FramePos]=((double)Frame->duration)/Frequency;
#endif
}

//---------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions Source/Core/AudioStreamStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C"
#include <libavutil/frame.h>
#include <libavutil/pixdesc.h>
#include <libavutil/bprint.h>
#include <libavutil/version.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
Expand Down Expand Up @@ -62,7 +63,11 @@ AudioStreamStats::AudioStreamStats(XMLElement *streamElement) : CommonStreamStat
AudioStreamStats::AudioStreamStats(QAVStream* stream) : CommonStreamStats(stream),
sample_fmt_string(""),
sample_rate(stream != NULL ? stream->stream()->codecpar->sample_rate : 0),
#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 23, 0)
channels(stream != NULL ? stream->stream()->codecpar->channels : 0),
#else
channels(stream != NULL ? stream->stream()->codecpar->ch_layout.nb_channels : 0),
#endif
channel_layout(""),
bits_per_sample(stream != NULL ? av_get_bits_per_sample(stream->stream()->codecpar->codec_id) : 0)
{
Expand All @@ -81,9 +86,15 @@ AudioStreamStats::AudioStreamStats(QAVStream* stream) : CommonStreamStats(stream
AVBPrint pbuf;
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);

#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 23, 0)
if (stream->stream()->codecpar->channel_layout) {
av_bprint_clear(&pbuf);
av_bprint_channel_layout(&pbuf, stream->stream()->codecpar->channels, stream->stream()->codecpar->channel_layout);
#else
if (av_channel_layout_check(&stream->stream()->codecpar->ch_layout)) {
av_bprint_clear(&pbuf);
av_channel_layout_describe_bprint(&stream->stream()->codecpar->ch_layout, &pbuf);
#endif
channel_layout = pbuf.str;
} else {
channel_layout = "unknown";
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/FileInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {
#include <libavutil/pixfmt.h>
#include <libavutil/imgutils.h>
#include <libavutil/ffversion.h>
#include <libavutil/version.h>

#ifndef WITH_SYSTEM_FFMPEG
#include <config.h>
Expand Down Expand Up @@ -1580,7 +1581,11 @@ struct Output {
return outPacket;
}

#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 30, 0)
outPacket->duration = Frame->pkt_duration;
#else
outPacket->duration = Frame->duration;
#endif
return outPacket;
}
};
Expand Down Expand Up @@ -2142,7 +2147,11 @@ std::string FileInformation::channelLayout() const
if (stream.codec()->codec()->long_name == nullptr)
return std::string();

#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 23, 0)
switch (stream.stream()->codecpar->channel_layout)
#else
switch (stream.stream()->codecpar->ch_layout.u.mask)
#endif
{
case AV_CH_LAYOUT_MONO: return "mono";
case AV_CH_LAYOUT_STEREO: return "stereo";
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/VideoStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extern "C"
{
#include <libavutil/frame.h>
#include <libavutil/pixdesc.h>
#include <libavutil/version.h>
}
#include <qavplayer.h>

Expand Down Expand Up @@ -411,8 +412,13 @@ void VideoStats::TimeStampFromFrame (const QAVFrame& frame, size_t FramePos)
x[2][FramePos]=x[1][FramePos]/60;
x[3][FramePos]=x[2][FramePos]/60;
}
#if LIBAVUTIL_VERSION_INT <= AV_VERSION_INT(57, 30, 0)
if (Frame->pkt_duration!=AV_NOPTS_VALUE)
durations[FramePos]=((double)Frame->pkt_duration)/Frequency;
#else
if (Frame->duration!=AV_NOPTS_VALUE)
durations[FramePos]=((double)Frame->duration)/Frequency;
#endif
}

//---------------------------------------------------------------------------
Expand Down