// resize start
if (m_dragItem->type() == AVWIDGET) {
bool success = m_document->renderer()->mltResizeClipStart(m_tracksList.count() - m_dragItem->track(), m_dragItem->endPos(), m_dragItem->startPos(), m_dragItemInfo.startPos, m_dragItem->cropStart(), m_dragItem->cropStart() + m_dragItem->endPos() - m_dragItem->startPos());
- if (success) {
- updateClipFade((ClipItem *) m_dragItem);
- ResizeClipCommand *command = new ResizeClipCommand(this, m_dragItemInfo, info, false);
- m_commandStack->push(command);
- }
- else {
- m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps()), m_scale);
- emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
- }
+ if (success) {
+ updateClipFade((ClipItem *) m_dragItem);
+ ResizeClipCommand *command = new ResizeClipCommand(this, m_dragItemInfo, info, false);
+ m_commandStack->push(command);
+ } else {
+ m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps()), m_scale);
+ emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
+ }
} else if (m_dragItem->type() == TRANSITIONWIDGET) {
MoveTransitionCommand *command = new MoveTransitionCommand(this, m_dragItemInfo, info, false);
m_commandStack->push(command);
ItemInfo info = item->info();
int percent = QInputDialog::getInteger(this, i18n("Edit Clip Speed"), i18n("New speed (percents)"), 100, 1, 300);
double speed = (double) percent / 100.0;
- if (item->speed() != speed)
- new ChangeSpeedCommand(this, info, item->speed(), speed, item->clipProducer(), true, changeSelected);
+ if (item->speed() != speed)
+ new ChangeSpeedCommand(this, info, item->speed(), speed, item->clipProducer(), true, changeSelected);
}
}
m_commandStack->push(changeSelected);
if (resizeClipStart) {
bool success = m_document->renderer()->mltResizeClipStart(m_tracksList.count() - item->track(), item->endPos(), end.startPos, item->startPos(), item->cropStart() + end.startPos - start.startPos, item->cropStart() + end.startPos - start.startPos + item->endPos() - end.startPos);
if (success) {
- item->resizeStart((int) end.startPos.frames(m_document->fps()), m_scale);
- updateClipFade(item);
- }
- else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
+ item->resizeStart((int) end.startPos.frames(m_document->fps()), m_scale);
+ updateClipFade(item);
+ } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
} else {
m_document->renderer()->mltResizeClipEnd(m_tracksList.count() - item->track(), item->startPos(), item->cropStart(), item->cropStart() + end.endPos - item->startPos());
item->resizeEnd((int) end.endPos.frames(m_document->fps()), m_scale);
if (QString(paramdesc.get("type")) == "boolean")
params.setAttribute("type", "bool");
if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) != "geometry") {
- params.setAttribute("type", "complex");
+ params.setAttribute("type", "geometry");
params.setAttribute("format", paramdesc.get("format"));
}
if (!QString(paramdesc.get("format")).isEmpty() && QString(paramdesc.get("type")) == "geometry") {
int pos = 0;
for (int i = 0; i < maxprod; i++) {
QDomNode m = prods.at(pos);
- QString prodId = m.toElement().attribute("id");
+ QString prodId = m.toElement().attribute("id");
if (prodId == "black" || prodId.startsWith("slowmotion"))
pos++;
else westley.removeChild(m);
parent->slotGotProgressInfo(QString(), (int) m_documentLoadingProgress);
qApp->processEvents();
}
- QString prodId = e.attribute("id");
+ QString prodId = e.attribute("id");
if (!e.isNull() && prodId != "black" && prodId.toInt() > 0) {
addClip(e, e.attribute("id").toInt());
}
KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
-void KdenliveSettingsDialog::initDevices()
-{
+void KdenliveSettingsDialog::initDevices() {
// Fill audio drivers
m_configSdl.kcfg_audio_driver->addItem(i18n("Automatic"), QString());
m_configSdl.kcfg_audio_driver->addItem(i18n("OSS"), "dsp");
m_configSdl.kcfg_audio_driver->addItem(i18n("ARTS daemon"), "artsc");
/*if (!KdenliveSettings::audiodriver().isEmpty())
- for (uint i = 1;i < m_configDisplay.kcfg_audio_driver->count(); i++) {
- if (m_configDisplay.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodriver())
- m_configDisplay.kcfg_audio_driver->setCurrentIndex(i);
- }*/
-
- // Fill video drivers
+ for (uint i = 1;i < m_configDisplay.kcfg_audio_driver->count(); i++) {
+ if (m_configDisplay.kcfg_audio_driver->itemData(i).toString() == KdenliveSettings::audiodriver())
+ m_configDisplay.kcfg_audio_driver->setCurrentIndex(i);
+ }*/
+
+ // Fill video drivers
m_configSdl.kcfg_video_driver->addItem(i18n("Automatic"), QString());
m_configSdl.kcfg_video_driver->addItem(i18n("X11"), "x11");
m_configSdl.kcfg_video_driver->addItem(i18n("XFREE86 DGA 2.0"), "dga");
m_configSdl.kcfg_video_driver->addItem(i18n("General graphics interface"), "ggi");
m_configSdl.kcfg_video_driver->addItem(i18n("Ascii art library"), "aalib");
- // Fill the list of audio playback devices
+ // Fill the list of audio playback devices
m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString());
if (KStandardDirs::findExe("aplay") != QString::null) {
- m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
- m_readProcess.setProgram("aplay", QStringList() << "-l");
- connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) ,this, SLOT(slotReadAudioDevices()));
- m_readProcess.execute(5000);
- }
- else {
- // If aplay is not installed on the system, parse the /proc/asound/pcm file
- QFile file("/proc/asound/pcm");
- if ( file.open( QIODevice::ReadOnly ) ) {
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
+ m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel);
+ m_readProcess.setProgram("aplay", QStringList() << "-l");
+ connect(&m_readProcess, SIGNAL(readyReadStandardOutput()) , this, SLOT(slotReadAudioDevices()));
+ m_readProcess.execute(5000);
+ } else {
+ // If aplay is not installed on the system, parse the /proc/asound/pcm file
+ QFile file("/proc/asound/pcm");
+ if (file.open(QIODevice::ReadOnly)) {
+ QTextStream stream(&file);
+ QString line;
+ while (!stream.atEnd()) {
line = stream.readLine();
- if (line.contains("playback")) {
- QString deviceId = line.section(":", 0, 0);
- m_configSdl.kcfg_audio_device->addItem(line.section(":", 1, 1), "plughw:" + QString::number(deviceId.section("-", 0, 0).toInt()) + "," + QString::number(deviceId.section("-", 1, 1).toInt()));
- }
- }
+ if (line.contains("playback")) {
+ QString deviceId = line.section(":", 0, 0);
+ m_configSdl.kcfg_audio_device->addItem(line.section(":", 1, 1), "plughw:" + QString::number(deviceId.section("-", 0, 0).toInt()) + "," + QString::number(deviceId.section("-", 1, 1).toInt()));
+ }
+ }
file.close();
- }
+ }
}
}
-void KdenliveSettingsDialog::slotReadAudioDevices()
-{
+void KdenliveSettingsDialog::slotReadAudioDevices() {
QString result = QString(m_readProcess.readAllStandardOutput());
- kDebug()<<"// / / / / / READING APLAY: ";
- kDebug()<< result;
+ kDebug() << "// / / / / / READING APLAY: ";
+ kDebug() << result;
QStringList lines = result.split('\n');
- foreach (QString data, lines) {
- kDebug()<<"// READING LINE: "<<data;
- if (data.simplified().startsWith("card")) {
- QString card = data.section(":", 0, 0).section(" ", -1);
- QString device = data.section(":", 1, 1).section(" ", -1);
- m_configSdl.kcfg_audio_device->addItem(data.section(":", -1), "plughw:" + card + "," + device);
- }
+ foreach(QString data, lines) {
+ kDebug() << "// READING LINE: " << data;
+ if (data.simplified().startsWith("card")) {
+ QString card = data.section(":", 0, 0).section(" ", -1);
+ QString device = data.section(":", 1, 1).section(" ", -1);
+ m_configSdl.kcfg_audio_device->addItem(data.section(":", -1), "plughw:" + card + "," + device);
+ }
}
}
bool resetProfile = false;
QString value = m_configSdl.kcfg_audio_device->itemData(m_configSdl.kcfg_audio_device->currentIndex()).toString();
if (value != KdenliveSettings::audiodevicename()) {
- KdenliveSettings::setAudiodevicename(value);
- resetProfile = true;
+ KdenliveSettings::setAudiodevicename(value);
+ resetProfile = true;
}
value = m_configSdl.kcfg_audio_driver->itemData(m_configSdl.kcfg_audio_driver->currentIndex()).toString();
if (value != KdenliveSettings::audiodrivername()) {
- KdenliveSettings::setAudiodrivername(value);
- resetProfile = true;
+ KdenliveSettings::setAudiodrivername(value);
+ resetProfile = true;
}
value = m_configSdl.kcfg_video_driver->itemData(m_configSdl.kcfg_video_driver->currentIndex()).toString();
if (value != KdenliveSettings::videodrivername()) {
- KdenliveSettings::setVideodrivername(value);
- resetProfile = true;
+ KdenliveSettings::setVideodrivername(value);
+ resetProfile = true;
}
KConfigDialog::updateSettings();
m_mltConsumer->set("terminate_on_pause", 1);
m_mltConsumer->set("rescale", "nearest");
m_mltConsumer->set("progressive", 1);
- char *tmp;
-
- QString audioDevice = KdenliveSettings::audiodevicename();
- if (!audioDevice.isEmpty()) {
- tmp = decodedString(audioDevice);
- m_mltConsumer->set("audio_device", tmp);
- delete[] tmp;
- }
-
- QString videoDriver = KdenliveSettings::videodrivername();
- if (!videoDriver.isEmpty()) {
- tmp = decodedString(videoDriver);
- m_mltConsumer->set("video_driver", tmp);
- delete[] tmp;
- }
-
- QString audioDriver = KdenliveSettings::audiodrivername();
- if (!audioDriver.isEmpty()) {
- tmp = decodedString(audioDriver);
- m_mltConsumer->set("audio_driver", tmp);
- delete[] tmp;
- }
+ char *tmp;
+
+ QString audioDevice = KdenliveSettings::audiodevicename();
+ if (!audioDevice.isEmpty()) {
+ tmp = decodedString(audioDevice);
+ m_mltConsumer->set("audio_device", tmp);
+ delete[] tmp;
+ }
+
+ QString videoDriver = KdenliveSettings::videodrivername();
+ if (!videoDriver.isEmpty()) {
+ tmp = decodedString(videoDriver);
+ m_mltConsumer->set("video_driver", tmp);
+ delete[] tmp;
+ }
+
+ QString audioDriver = KdenliveSettings::audiodrivername();
+ if (!audioDriver.isEmpty()) {
+ tmp = decodedString(audioDriver);
+ m_mltConsumer->set("audio_driver", tmp);
+ delete[] tmp;
+ }
m_mltConsumer->set("audio_buffer", 1024);
m_mltConsumer->set("frequency", 48000);
QString audioDevice = KdenliveSettings::audiodevicename();
if (!audioDevice.isEmpty()) {
- tmp = decodedString(audioDevice);
- m_mltConsumer->set("audio_device", tmp);
- delete[] tmp;
+ tmp = decodedString(audioDevice);
+ m_mltConsumer->set("audio_device", tmp);
+ delete[] tmp;
}
QString videoDriver = KdenliveSettings::videodrivername();
if (!videoDriver.isEmpty()) {
- tmp = decodedString(videoDriver);
- m_mltConsumer->set("video_driver", tmp);
- delete[] tmp;
+ tmp = decodedString(videoDriver);
+ m_mltConsumer->set("video_driver", tmp);
+ delete[] tmp;
}
QString audioDriver = KdenliveSettings::audiodrivername();
if (!audioDriver.isEmpty()) {
- tmp = decodedString(audioDriver);
- m_mltConsumer->set("audio_driver", tmp);
- delete[] tmp;
+ tmp = decodedString(audioDriver);
+ m_mltConsumer->set("audio_driver", tmp);
+ delete[] tmp;
}
-
+
m_mltConsumer->set("progressive", 1);
m_mltConsumer->set("audio_buffer", 1024);
int newLength = 0;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) kWarning() << "// TRACTOR PROBLEM";
- kDebug()<<"Changing clip speed, set in and out: "<<info.cropStart.frames(m_fps)<<" to "<<(info.endPos - info.startPos).frames(m_fps) - 1;
+ kDebug() << "Changing clip speed, set in and out: " << info.cropStart.frames(m_fps) << " to " << (info.endPos - info.startPos).frames(m_fps) - 1;
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(info.track));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
mlt_service_lock(service.get_service());
QString url = clip.parent().get("resource");
url.append("?" + QString::number(speed));
- Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
- if (!slowprod || slowprod->get_producer() == NULL) {
- char *tmp = decodedString(url);
- slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp);
- delete[] tmp;
- QString producerid = "slowmotion:" + id + ":" + QString::number(speed);
- tmp = decodedString(producerid);
- slowprod->set("id", tmp);
- delete[] tmp;
- m_slowmotionProducers.insert(url, slowprod);
- }
- Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1);
+ Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
+ if (!slowprod || slowprod->get_producer() == NULL) {
+ char *tmp = decodedString(url);
+ slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp);
+ delete[] tmp;
+ QString producerid = "slowmotion:" + id + ":" + QString::number(speed);
+ tmp = decodedString(producerid);
+ slowprod->set("id", tmp);
+ delete[] tmp;
+ m_slowmotionProducers.insert(url, slowprod);
+ }
+ Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1);
newLength = cut->get_length();
trackPlaylist.replace_with_blank(clipIndex);
trackPlaylist.consolidate_blanks(0);
QString url = clip.parent().get("resource");
url = url.section("?", 0, 0);
url.append("?" + QString::number(speed));
- Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
- if (!slowprod || slowprod->get_producer() == NULL) {
- char *tmp = decodedString(url);
- slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp);
- delete[] tmp;
- QString producerid = "slowmotion:" + id.section(":", 1, 1) + ":" + QString::number(speed);
- tmp = decodedString(producerid);
- slowprod->set("id", tmp);
- delete[] tmp;
- m_slowmotionProducers.insert(url, slowprod);
- }
- Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1);
+ Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
+ if (!slowprod || slowprod->get_producer() == NULL) {
+ char *tmp = decodedString(url);
+ slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", tmp);
+ delete[] tmp;
+ QString producerid = "slowmotion:" + id.section(":", 1, 1) + ":" + QString::number(speed);
+ tmp = decodedString(producerid);
+ slowprod->set("id", tmp);
+ delete[] tmp;
+ m_slowmotionProducers.insert(url, slowprod);
+ }
+ Mlt::Producer *cut = slowprod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps) - 1);
newLength = cut->get_length();
trackPlaylist.replace_with_blank(clipIndex);
trackPlaylist.consolidate_blanks(0);
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
if (trackPlaylist.is_blank_at((int) pos.frames(m_fps) - 1)) {
kDebug() << "//////// ERROR RSIZING BLANK CLIP!!!!!!!!!!!";
- return false;
+ return false;
}
int clipIndex = trackPlaylist.get_clip_index_at((int) pos.frames(m_fps) - 1);
int previousStart = trackPlaylist.clip_start(clipIndex);
//kDebug() << " ** RESIZING CLIP START:" << clipIndex << " on track:" << track << ", mid pos: " << pos.frames(25) << ", moving: " << moveFrame << ", in: " << in.frames(25) << ", out: " << out.frames(25);
Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
if (clip == NULL) {
- return false;
+ return false;
}
m_isBlocked = true;
trackPlaylist.resize_clip(clipIndex, (int) in.frames(m_fps), (int) out.frames(m_fps));
void mltResizeTransparency(int oldStart, int newStart, int newEnd, int track, int id);
/** Change speed of a clip in playlist. To do this, we create a new "framebuffer" producer.
- This new producer must have its "resource" param set to: video.mpg?0.6 where video.mpg is the path
- to the clip and 0.6 is the speed in percents. The newly created producer will have it's
- "id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip
- in the ClipManager list and speed is the current speed */
+ This new producer must have its "resource" param set to: video.mpg?0.6 where video.mpg is the path
+ to the clip and 0.6 is the speed in percents. The newly created producer will have it's
+ "id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip
+ in the ClipManager list and speed is the current speed */
int mltChangeClipSpeed(ItemInfo info, double speed, Mlt::Producer *prod);
private: // Private attributes & methods
QPixmap pix(m_frameWidth, m_frameHeight);
pix.fill(Qt::transparent);
QPainter painter(&pix);
-
+ //painter.setRenderHint( QPainter::Antialiasing );
m_scene->clearSelection();
QPen framepen = m_frameBorder->pen();
m_frameBorder->setPen(Qt::NoPen);
// Found a clip
int in = elem.attribute("in").toInt();
QString idString = elem.attribute("producer");
- int id = idString.toInt();
- bool hasSpeedAttribute = false;
- double speed;
- if (idString.startsWith("slowmotion")) {
- hasSpeedAttribute = true;
- id = idString.section(":", 1, 1).toInt();
- speed = idString.section(":", 2, 2).toDouble();
- }
+ int id = idString.toInt();
+ bool hasSpeedAttribute = false;
+ double speed;
+ if (idString.startsWith("slowmotion")) {
+ hasSpeedAttribute = true;
+ id = idString.section(":", 1, 1).toInt();
+ speed = idString.section(":", 2, 2).toDouble();
+ }
DocClipBase *clip = m_doc->clipManager()->getClipById(id);
if (clip != NULL) {
int out = elem.attribute("out").toInt();
clipinfo.track = ix;
//kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
ClipItem *item = new ClipItem(clip, clipinfo, m_scale, m_doc->fps());
- if (hasSpeedAttribute) item->setSpeed(speed);
+ if (hasSpeedAttribute) item->setSpeed(speed);
m_scene->addItem(item);
clip->addReference();
position += (out - in + 1);