footage: fixed appearance of some metadata, particularly audio metadata

This commit is contained in:
itsmattkc
2020-02-29 17:19:47 +11:00
parent b134ac877f
commit 139c14f941
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -508,7 +508,7 @@ bool FFmpegDecoder::Probe(Footage *f, const QAtomicInt* cancelled)
if (error_code == 0) {
// Retrieve metadata about the media
av_dump_format(fmt_ctx_, 0, filename, 0);
avformat_find_stream_info(fmt_ctx_, nullptr);
// Dump it into the Footage object
for (unsigned int i=0;i<fmt_ctx_->nb_streams;i++) {
+10 -3
View File
@@ -22,9 +22,10 @@
#include <QCoreApplication>
#include "codec/decoder.h"
#include "common/timecodefunctions.h"
#include "common/xmlreadloop.h"
#include "codec/decoder.h"
#include "config/config.h"
#include "ui/icons/icons.h"
Footage::Footage()
@@ -235,8 +236,14 @@ QString Footage::duration()
} else if (streams_.first()->type() == Stream::kAudio) {
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(streams_.first());
return Timecode::timestamp_to_timecode(streams_.first()->duration(),
streams_.first()->timebase(),
// We show audio time in a timecode corresponding to the default sequence frame rate
rational rtime = Timecode::timestamp_to_time(streams_.first()->duration(), streams_.first()->timebase());
int64_t time_in_default_tb = Timecode::time_to_timestamp(rtime, Config::Current()["DefaultSequenceFrameRate"].value<rational>());
return Timecode::timestamp_to_timecode(time_in_default_tb,
Config::Current()["DefaultSequenceFrameRate"].value<rational>(),
Timecode::CurrentDisplay());
}