m_view.clip_aindex->setValue(props.value("audio_index").toInt());
}
+ if (props.contains("audio_max")) {
+ m_view.clip_aindex->setMaximum(props.value("audio_max").toInt());
+ }
+
+ if (props.contains("video_max")) {
+ m_view.clip_vindex->setMaximum(props.value("video_max").toInt());
+ }
+
connect(m_view.clip_force_ar, SIGNAL(toggled(bool)), m_view.clip_ar, SLOT(setEnabled(bool)));
connect(m_view.clip_force_threads, SIGNAL(toggled(bool)), m_view.clip_threads, SLOT(setEnabled(bool)));
connect(m_view.clip_force_vindex, SIGNAL(toggled(bool)), m_view.clip_vindex, SLOT(setEnabled(bool)));
QMap <QString, QString> ClipProperties::properties() {
QMap <QString, QString> props;
- props["description"] = m_view.clip_description->text();
CLIPTYPE t = m_clip->clipType();
QMap <QString, QString> old_props = m_clip->properties();
+
+ if (old_props.value("description") != m_view.clip_description->text())
+ props["description"] = m_view.clip_description->text();
+
double aspect = m_view.clip_ar->value();
if (m_view.clip_force_ar->isChecked()) {
if (aspect != old_props.value("force_aspect_ratio").toDouble()) {
} else if (key == "video_index") {
if (value.isEmpty()) {
m_properties.remove("video_index");
- m_clipProducer->set("video_index", 0);
+ m_clipProducer->set("video_index", m_properties.value("default_video").toInt());
} else m_clipProducer->set("video_index", value.toInt());
} else if (key == "audio_index") {
if (value.isEmpty()) {
m_properties.remove("audio_index");
- m_clipProducer->set("audio_index", 0);
+ m_clipProducer->set("audio_index", m_properties.value("default_audio").toInt());
} else m_clipProducer->set("audio_index", value.toInt());
}
}
}*/
// Get the video_index
int index = mlt_properties_get_int(properties, "video_index");
+ int default_video = -1;
+ int video_max = 0;
+ int default_audio = -1;
+ int audio_max = 0;
+ // Find default audio stream (borrowed from MLT)
+ for (int ix = 0; ix < context->nb_streams; ix++) {
+ // Get the codec context
+ AVCodecContext *codec_context = context->streams[ ix ]->codec;
+
+ if (avcodec_find_decoder(codec_context->codec_id) == NULL)
+ continue;
+ // Determine the type and obtain the first index of each type
+ switch (codec_context->codec_type) {
+ case CODEC_TYPE_VIDEO:
+ if (default_video < 0) default_video = ix;
+ video_max = ix;
+ break;
+ case CODEC_TYPE_AUDIO:
+ if (default_audio < 0) default_audio = ix;
+ audio_max = ix;
+ break;
+ default:
+ break;
+ }
+ }
+ filePropertyMap["default_video"] = QString::number(default_video);
+ filePropertyMap["video_max"] = QString::number(video_max);
+ filePropertyMap["default_audio"] = QString::number(default_audio);
+ filePropertyMap["audio_max"] = QString::number(audio_max);
+
#if ENABLE_FFMPEG_CODEC_DESCRIPTION
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name) {
+ if (index > -1 && context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name) {
filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->long_name;
} else
#endif
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name) {
+ if (index > -1 && context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name) {
filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->name;
}
} else kDebug() << " / / / / /WARNING, VIDEO CONTEXT IS NULL!!!!!!!!!!!!!!";
int index = mlt_properties_get_int(properties, "audio_index");
#if ENABLE_FFMPEG_CODEC_DESCRIPTION
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name)
+ if (index > -1 && context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name)
filePropertyMap["audiocodec"] = context->streams[ index ]->codec->codec->long_name;
else
#endif
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name)
+ if (index > -1 && context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name)
filePropertyMap["audiocodec"] = context->streams[ index ]->codec->codec->name;
}
#endif
//if (producer) delete producer;
}
+
/** Create the producer from the Westley QDomDocument */
#if 0
void Render::initSceneList() {