void MediaFormatIO::xmlExportBegin(
	ExportContext&		context) const {
	
	switch(m_format.type) {

		case B_MEDIA_RAW_AUDIO:
			context.beginElement(s_raw_audio_tag);
			break;
		
		case B_MEDIA_RAW_VIDEO:
			context.beginElement(s_raw_video_tag);
			break;
			
		case B_MEDIA_MULTISTREAM:
			context.beginElement(s_multistream_tag);
			break;
			
		case B_MEDIA_ENCODED_AUDIO:
			context.beginElement(s_encoded_audio_tag);
			break;
			
		case B_MEDIA_ENCODED_VIDEO:
			context.beginElement(s_encoded_video_tag);
			break;
			
		default:
			// +++++ not very polite
			context.reportError("MediaFormatIO: type not supported\n");
			break;
	}	
}
Exemple #2
0
__USE_CORTEX_NAMESPACE

// -------------------------------------------------------- //
// EXPORT [not implemented]
// -------------------------------------------------------- //

void StringContent::xmlExportBegin(
	ExportContext&								context) const {
	context.reportError("StringContent: no export");
}	
// -------------------------------------------------------- //
void ConnectionIO::xmlExportBegin(
    ExportContext&						context) const {

    if(!m_exportValid) {
        context.reportError(
            "ConnectionIO::xmlExportBegin():\n"
            "*** invalid ***\n");
        return;
    }

    context.beginElement(_CONNECTION_ELEMENT);
}
Exemple #4
0
void RouteAppNodeManager::xmlExportBegin(
	ExportContext&								context) const {

	status_t err;
	
	try {
		NodeSetIOContext& set = dynamic_cast<NodeSetIOContext&>(context);
		context.beginElement(_NODE_SET_ELEMENT);
		
		// validate the node set
		for(int n = set.countNodes()-1; n >= 0; --n) {
			media_node_id id = set.nodeAt(n);
			ASSERT(id != media_node::null.node);
			
			// fetch node
			NodeRef* ref;
			err = getNodeRef(id, &ref);
			if(err < B_OK) {
				D_SETTINGS((
					"! RVNM::xmlExportBegin(): node %ld doesn't exist\n", id));

				set.removeNodeAt(n);
				continue;
			}
			// skip unless internal
			if(!ref->isInternal()) {
				D_SETTINGS((
					"! RVNM::xmlExportBegin(): node %ld not internal; skipping.\n", id));

				set.removeNodeAt(n);
				continue;
			}
		}
	}
	catch(bad_cast& e) {
		context.reportError("RouteAppNodeManager: expected a NodeSetIOContext\n");
	}
}
Exemple #5
0
void StringContent::xmlExportEnd(
	ExportContext&								context) const {
	context.reportError("StringContent: no export");
}
Exemple #6
0
void RouteAppNodeManager::xmlExportContent(
	ExportContext&								context) const {

	status_t err;

	try {
		NodeSetIOContext& nodeSet = dynamic_cast<NodeSetIOContext&>(context);
		context.beginContent();
	
		// write nodes; enumerate connections
		typedef map<uint32,Connection> connection_map;
		connection_map connections;
		int count = nodeSet.countNodes();
		for(int n = 0; n < count; ++n) {
			media_node_id id = nodeSet.nodeAt(n);
			ASSERT(id != media_node::null.node);
			
			// fetch node
			NodeRef* ref;
			err = getNodeRef(id, &ref);
			if(err < B_OK) {
				D_SETTINGS((
					"! RouteAppNodeManager::xmlExportContent():\n"
					"  getNodeRef(%ld) failed: '%s'\n",
					id, strerror(err)));
				continue;
			}

			// fetch connections
			vector<Connection> conSet;
			ref->getInputConnections(conSet);
			ref->getOutputConnections(conSet);
			for(uint32 c = 0; c < conSet.size(); ++c)
				// non-unique connections will be rejected:
				connections.insert(
					connection_map::value_type(conSet[c].id(), conSet[c]));

			// create an IO object for the node & write it
			DormantNodeIO io(ref, nodeSet.keyAt(n));
			if(context.writeObject(&io) < B_OK)
				// abort
				return;
		}		

		// write connections
		for(connection_map::const_iterator it = connections.begin();
			it != connections.end(); ++it) {
		
			ConnectionIO io(
				&(*it).second, 
				this,
				&nodeSet);
			if(context.writeObject(&io) < B_OK)
				// abort
				return;
				
		}
	
		// +++++ write groups
	
		// write UI state
		{
			BMessage m;
			nodeSet.exportUIState(&m);
			context.beginElement(_UI_STATE_ELEMENT);
			context.beginContent();
			MessageIO io(&m);
			context.writeObject(&io);
			context.endElement();
		}
	}
	catch(bad_cast& e) {
		context.reportError("RouteAppNodeManager: expected a NodeSetIOContext\n");
	}	
}