Beispiel #1
0
// _StorePlaylistItem
status_t
XMLExporter::_StorePlaylistItem(XMLHelper& xml, ClipPlaylistItem* item)
{
	status_t ret = xml.CreateTag("ITEM");

	if (ret == B_OK && item->StartFrame() != 0)
		ret = xml.SetAttribute("startframe", item->StartFrame());

	if (ret == B_OK)
		ret = xml.SetAttribute("duration", item->Duration());

	if (ret == B_OK && item->Track() != 0)
		ret = xml.SetAttribute("track", item->Track());

	if (ret == B_OK)
		ret = xml.SetAttribute("clip_offset", item->ClipOffset());

	if (ret == B_OK && item->IsVideoMuted())
		ret = xml.SetAttribute("video_muted", true);

	if (ret == B_OK && item->IsAudioMuted())
		ret = xml.SetAttribute("audio_muted", true);

	if (ret == B_OK) {
		BString clipID;
		if (item->Clip()) {
			clipID = item->Clip()->ID();
		} else {
			item->GetValue(PROPERTY_CLIP_ID, clipID);
		}
		if (fClipIdIndexMap.ContainsKey(clipID.String())) {
			// the map should always contain the id!
			ret = xml.SetAttribute("clip_index",
				fClipIdIndexMap.Get(clipID.String()));
		} else {
			// this is a fallback, but we should not be here!
			ret = xml.SetAttribute("clip_id", clipID.String());
		}
	}

	if (ret == B_OK)
		ret = store_properties(xml, item);

	// store the NavigationInfo if it exists
	if (const NavigationInfo* info = item->NavigationInfo()) {
		ret = xml.CreateTag("NAV_INFO");
		if (ret == B_OK)
			ret = info->XMLStore(xml);
		if (ret == B_OK)
			ret = xml.CloseTag();
	}

	if (ret == B_OK)
		ret = xml.CloseTag();

	return ret;
}
Beispiel #2
0
// _StorePlaylist
status_t
XMLExporter::_StorePlaylist(XMLHelper& xml, Playlist* list)
{
	status_t ret = xml.CreateTag("PLAYLIST");

	if (ret == B_OK) {
		int32 count = list->CountItems(); 
		for (int32 i = 0; i < count; i++) {
			PlaylistItem* item = list->ItemAtFast(i);
			ret = _StorePlaylistItem(xml, item);
			if (ret != B_OK)
				break;
		}
	}

	if (ret == B_OK) {
		int32 count = list->CountTrackProperties(); 
		for (int32 i = 0; i < count; i++) {
			TrackProperties* properties = list->TrackPropertiesAtFast(i);
			ret = _StoreTrackProperties(xml, properties);
			if (ret != B_OK)
				break;
		}
	}

	if (ret == B_OK && list->SoloTrack() >= 0)
		ret = xml.SetAttribute("solo_track", list->SoloTrack());

	if (ret == B_OK)
		ret = xml.CloseTag();

	return ret;
}
Beispiel #3
0
// XMLStore
status_t
RenderPreset::XMLStore(XMLHelper& xmlHelper) const
{
	status_t error = B_OK;
	xmlHelper.SetAttribute("name", Name());
	xmlHelper.SetAttribute("preview", fRenderPreview);
	xmlHelper.SetAttribute("use_alpha", fUseAlpha);
	if ((error = xmlHelper.CreateTag("FILE_FORMAT")) == B_OK) {
		xmlHelper.SetAttribute("name", FormatFamily());
		xmlHelper.CloseTag();	// FILE_FORMAT
	}
	if ((error = xmlHelper.CreateTag("VIDEO")) == B_OK) {
		xmlHelper.SetAttribute("on", fHasVideoTrack);
		if ((error = xmlHelper.CreateTag("VIDEO_FORMAT")) == B_OK) {
			xmlHelper.SetAttribute("line_width", fLineWidth);
			xmlHelper.SetAttribute("line_count", fLineCount);
			xmlHelper.SetAttribute("color_space", (int32)fColorSpace);
			xmlHelper.CloseTag();	// VIDEO_FORMAT
		}
		if ((error = xmlHelper.CreateTag("VIDEO_CODEC")) == B_OK) {
			xmlHelper.SetAttribute("name", fVideoCodecName);
			xmlHelper.CloseTag();	// VIDEO_CODEC
		}
		if ((error = xmlHelper.CreateTag("QUALITY")) == B_OK) {
			xmlHelper.SetAttribute("value", fVideoQuality);
			xmlHelper.CloseTag();	// QUALITY
		}
		xmlHelper.CloseTag();	// VIDEO
	}
	if ((error = xmlHelper.CreateTag("AUDIO")) == B_OK) {
		xmlHelper.SetAttribute("on", fHasAudioTrack);
		if ((error = xmlHelper.CreateTag("AUDIO_CODEC")) == B_OK) {
			xmlHelper.SetAttribute("name", fAudioCodecName);
			xmlHelper.SetAttribute("frame_rate", fAudioFrameRate);
			xmlHelper.SetAttribute("channels", fAudioChannelCount);
			xmlHelper.CloseTag();	// AUDIO_CODEC
		}
		xmlHelper.CloseTag();	// AUDIO
	}
	if ((error = xmlHelper.CreateTag("COPYRIGHT")) == B_OK) {
		xmlHelper.SetAttribute("string", fCopyright);
		xmlHelper.CloseTag();	// COPYRIGHT
	}
	if ((error = xmlHelper.CreateTag("TIMECODE")) == B_OK) {
		xmlHelper.SetAttribute("visible", fTimeCodeOverlay);
		xmlHelper.SetAttribute("transparency", fTimeCodeTransparency);
		xmlHelper.SetAttribute("scale", fTimeCodeScale);
		xmlHelper.CloseTag();	// TIMECODE
	}
	// Who cares about errors?
	return B_OK;
}
Beispiel #4
0
// _StoreTrackProperties
status_t
XMLExporter::_StoreTrackProperties(XMLHelper& xml, TrackProperties* properties)
{
	status_t ret = xml.CreateTag("TRACK_PROPERTIES");

	if (ret == B_OK)
		ret = properties->XMLStore(xml);

	if (ret == B_OK)
		ret = xml.CloseTag();

	return ret;
}
Beispiel #5
0
// _StoreClipLibrary
status_t
XMLExporter::_StoreClipLibrary(XMLHelper& xml, const Playlist* list)
{
	status_t ret = xml.CreateTag("REFERENCED_OBJECTS");

	if (ret == B_OK)
		ret = _StoreAllClips(xml, list);

	if (ret == B_OK)
		ret = xml.CloseTag(); // REFERENCED_OBJECTS

	return ret;
}
Beispiel #6
0
// XMLStore
status_t
PlaybackReport::XMLStore(XMLHelper& xml) const
{
	status_t ret = B_OK;

	PlaybackMap::Iterator iterator = fIDPlaybackCountMap.GetIterator();
	while (iterator.HasNext()) {
		PlaybackMap::Entry entry = iterator.Next();

		ret = xml.CreateTag("CLIP");
		if (ret == B_OK)
			ret = xml.SetAttribute("clip_id", entry.key.GetString());
		if (ret == B_OK)
			ret = xml.SetAttribute("playback_count", entry.value);
		if (ret == B_OK)
			ret = xml.CloseTag(); // CLIP

		if (ret < B_OK)
			break;
	}

	return ret;
}
Beispiel #7
0
// _StoreClipID
status_t
XMLExporter::_StoreClipID(XMLHelper& xml, const BString& clipID, int32 index,
	const BString& templateName, int32 version)
{
	status_t ret = xml.CreateTag("OBJECT");

	if (ret == B_OK)
		ret = xml.SetAttribute("id", clipID.String());

	if (ret == B_OK)
		ret = xml.SetAttribute("index", index);

	if (ret == B_OK && version >= 0)
		ret = xml.SetAttribute("version", version);

	if (ret == B_OK && templateName.Length() > 0)
		ret = xml.SetAttribute("template_name", templateName.String());

	if (ret == B_OK)
		ret = xml.CloseTag();

	return ret;
}