sequence encapsulation
This commit is contained in:
@@ -404,22 +404,22 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
for (int j=0;j<stream.attributes().size();j++) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(j);
|
||||
if (attr.name() == "name") {
|
||||
s->name = attr.value().toString();
|
||||
s->set_name(attr.value().toString());
|
||||
} else if (attr.name() == "folder") {
|
||||
int folder = attr.value().toInt();
|
||||
if (folder > 0) parent = find_loaded_folder_by_id(folder);
|
||||
} else if (attr.name() == "id") {
|
||||
s->save_id = attr.value().toInt();
|
||||
} else if (attr.name() == "width") {
|
||||
s->width = attr.value().toInt();
|
||||
s->set_width(attr.value().toInt());
|
||||
} else if (attr.name() == "height") {
|
||||
s->height = attr.value().toInt();
|
||||
s->set_height(attr.value().toInt());
|
||||
} else if (attr.name() == "framerate") {
|
||||
s->frame_rate = attr.value().toDouble();
|
||||
s->set_frame_rate(attr.value().toDouble());
|
||||
} else if (attr.name() == "afreq") {
|
||||
s->audio_frequency = attr.value().toInt();
|
||||
s->set_audio_frequency(attr.value().toInt());
|
||||
} else if (attr.name() == "alayout") {
|
||||
s->audio_layout = attr.value().toInt();
|
||||
s->set_audio_layout(attr.value().toInt());
|
||||
} else if (attr.name() == "open") {
|
||||
open_seq = s;
|
||||
} else if (attr.name() == "workarea") {
|
||||
|
||||
+11
-11
@@ -189,12 +189,12 @@ void Media::update_tooltip(const QString& error) {
|
||||
"\nFrame Rate: %4"
|
||||
"\nAudio Frequency: %5"
|
||||
"\nAudio Layout: %6").arg(
|
||||
s->name,
|
||||
QString::number(s->width),
|
||||
QString::number(s->height),
|
||||
QString::number(s->frame_rate),
|
||||
QString::number(s->audio_frequency),
|
||||
Footage::get_channel_layout_name(av_get_channel_layout_nb_channels(s->audio_layout), s->audio_layout)
|
||||
s->name(),
|
||||
QString::number(s->width()),
|
||||
QString::number(s->height()),
|
||||
QString::number(s->frame_rate()),
|
||||
QString::number(s->audio_frequency()),
|
||||
Footage::get_channel_layout_name(av_get_channel_layout_nb_channels(s->audio_layout()), s->audio_layout())
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -213,7 +213,7 @@ int Media::get_type() {
|
||||
const QString &Media::get_name() {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE: return to_footage()->name;
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->name;
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->name();
|
||||
default: return folder_name;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ const QString &Media::get_name() {
|
||||
void Media::set_name(const QString &n) {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE: to_footage()->name = n; break;
|
||||
case MEDIA_TYPE_SEQUENCE: to_sequence()->name = n; break;
|
||||
case MEDIA_TYPE_SEQUENCE: to_sequence()->set_name(n); break;
|
||||
case MEDIA_TYPE_FOLDER: folder_name = n; break;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ double Media::get_frame_rate(int stream) {
|
||||
if (stream < 0) return f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
return f->get_stream_from_file_index(true, stream)->video_frame_rate * f->speed;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->frame_rate;
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->frame_rate();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ int Media::get_sampling_rate(int stream) {
|
||||
if (stream < 0) return f->audio_tracks.at(0).audio_frequency * f->speed;
|
||||
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency * f->speed;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->audio_frequency;
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->audio_frequency();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ int Media::columnCount() const {
|
||||
QString Media::GetStringDuration() {
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->GetEndFrame(), olive::config.timecode_view, s->frame_rate);
|
||||
return frame_to_timecode(s->GetEndFrame(), olive::config.timecode_view, s->frame_rate());
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
|
||||
@@ -18,14 +18,14 @@ SequencePtr olive::project::CreateSequenceFromMedia(QVector<olive::timeline::Med
|
||||
{
|
||||
SequencePtr s = std::make_shared<Sequence>();
|
||||
|
||||
s->name = olive::project_model.GetNextSequenceName();
|
||||
s->set_name(olive::project_model.GetNextSequenceName());
|
||||
|
||||
// Retrieve default Sequence settings from Config
|
||||
s->width = olive::config.default_sequence_width;
|
||||
s->height = olive::config.default_sequence_height;
|
||||
s->frame_rate = olive::config.default_sequence_framerate;
|
||||
s->audio_frequency = olive::config.default_sequence_audio_frequency;
|
||||
s->audio_layout = olive::config.default_sequence_audio_channel_layout;
|
||||
s->set_width(olive::config.default_sequence_width);
|
||||
s->set_height(olive::config.default_sequence_height);
|
||||
s->set_frame_rate(olive::config.default_sequence_framerate);
|
||||
s->set_audio_frequency(olive::config.default_sequence_audio_frequency);
|
||||
s->set_audio_layout(olive::config.default_sequence_audio_channel_layout);
|
||||
|
||||
bool got_video_values = false;
|
||||
bool got_audio_values = false;
|
||||
@@ -39,12 +39,12 @@ SequencePtr olive::project::CreateSequenceFromMedia(QVector<olive::timeline::Med
|
||||
if (!got_video_values) {
|
||||
for (int j=0;j<m->video_tracks.size();j++) {
|
||||
const FootageStream& ms = m->video_tracks.at(j);
|
||||
s->width = ms.video_width;
|
||||
s->height = ms.video_height;
|
||||
s->set_width(ms.video_width);
|
||||
s->set_height(ms.video_height);
|
||||
if (!qFuzzyCompare(ms.video_frame_rate, 0.0)) {
|
||||
s->frame_rate = ms.video_frame_rate * m->speed;
|
||||
s->set_frame_rate(ms.video_frame_rate * m->speed);
|
||||
|
||||
if (ms.video_interlacing != VIDEO_PROGRESSIVE) s->frame_rate *= 2;
|
||||
if (ms.video_interlacing != VIDEO_PROGRESSIVE) s->set_frame_rate(s->frame_rate() * 2);
|
||||
|
||||
// only break with a decent frame rate, otherwise there may be a better candidate
|
||||
got_video_values = true;
|
||||
@@ -54,7 +54,7 @@ SequencePtr olive::project::CreateSequenceFromMedia(QVector<olive::timeline::Med
|
||||
}
|
||||
if (!got_audio_values && m->audio_tracks.size() > 0) {
|
||||
const FootageStream& ms = m->audio_tracks.at(0);
|
||||
s->audio_frequency = ms.audio_frequency;
|
||||
s->set_audio_frequency(ms.audio_frequency);
|
||||
got_audio_values = true;
|
||||
}
|
||||
}
|
||||
@@ -65,11 +65,11 @@ SequencePtr olive::project::CreateSequenceFromMedia(QVector<olive::timeline::Med
|
||||
// Clone all attributes of the original sequence (seq) into the new one (s)
|
||||
Sequence* seq = media->to_sequence().get();
|
||||
|
||||
s->width = seq->width;
|
||||
s->height = seq->height;
|
||||
s->frame_rate = seq->frame_rate;
|
||||
s->audio_frequency = seq->audio_frequency;
|
||||
s->audio_layout = seq->audio_layout;
|
||||
s->set_width(seq->width());
|
||||
s->set_height(seq->height());
|
||||
s->set_frame_rate(seq->frame_rate());
|
||||
s->set_audio_frequency(seq->audio_frequency());
|
||||
s->set_audio_layout(seq->audio_layout());
|
||||
|
||||
got_video_values = true;
|
||||
got_audio_values = true;
|
||||
|
||||
Reference in New Issue
Block a user