function get_stream_cmml( $inline = false, $force_track = null ) {
		$dbr = wfGetDB( DB_SLAVE );
		// set cmml name space if inline:
		$ns = ( $inline ) ? 'cmml:':'';
		$ns = '';
		$encap = false;// if we should have a parent cmml tag
		if ( !$force_track ) {
			// check the request to get trac set:
			$mvcp = new MV_Component();
			$mvcp->procMVDReqSet();
			$tracks = $mvcp->mvd_tracks;
			if ( count( $mvcp->mvd_tracks ) > 1 )$encap = true;
		} else {
			$tracks = $force_track;
			$encap = false;
		}

		// get the stream title
		$streamTitle = new MV_Title( $this->stream_name . '/' . $this->req_time );
		$wgTitle = Title::newFromText( $this->stream_name . '/' . $this->req_time, MV_NS_STREAM );
		// do mvd_index query:
		$mvd_rows = MV_Index::getMVDInRange( $streamTitle->getStreamId(),
			$streamTitle->getStartTimeSeconds(),
			$streamTitle->getEndTimeSeconds(), $tracks, $getText = false, 'Speech_by,Bill,category' );
		// get the stream stream req
		if ( $this->output_xml_header )
			header( 'Content-Type: text/xml' );
		// print the header:
		if ( !$inline )print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
		// if(!$inline)print '<!DOCTYPE cmml SYSTEM "http://svn.annodex.net/standards/cmml_2_0.dtd">'."\n";
		$tracks = array();
		if ( count( $mvd_rows ) != 0 ) {
			global $wgOut;
			$MV_Overlay = new MV_Overlay();
			foreach ( $mvd_rows as $mvd ) {
				if ( !isset( $tracks[$mvd->mvd_type] ) )$tracks[$mvd->mvd_type] = '';
				$tracks[$mvd->mvd_type] .= '
						<' . $ns . 'clip id="mvd_' . htmlentities( $mvd->id ) . '" start="npt:' . htmlentities( seconds2npt( $mvd->start_time ) ) . '" end="npt:' . htmlentities( seconds2npt( $mvd->end_time ) ) . '">
							<' . $ns . 'img src="' . htmlentities( $streamTitle->getFullStreamImageURL( null, seconds2npt( $mvd->start_time ) ) ) . '"/>';
				// output all metadata @@todo we should generalize the semantic properties.
				$tracks[$mvd->mvd_type] .= ( isset( $mvd->Speech_by ) && trim( $mvd->Speech_by ) != '' ) ? '<meta name="Speech_by" content="' . htmlentities (  $mvd->Speech_by  ) . '"/>':'';
				$tracks[$mvd->mvd_type] .= ( isset( $mvd->Bill ) && trim( $mvd->Bill ) != '' ) ? '<meta name="Bill" content="' . htmlentities( $mvd->Bill ) . '"/>':'';

				// add in categories as "keywords"
				if ( count( $mvd->category ) != 0 ) {
					$tracks[$mvd->mvd_type] .= '<meta name="keywords" content="';
					$coma = '';
					foreach ( $mvd->category as $cat ) {
						$tracks[$mvd->mvd_type] .= $coma . htmlentities( $cat );
						$coma = ',';
					}
					$tracks[$mvd->mvd_type] .= '"/>';
				}
				$tracks[$mvd->mvd_type] .= '<' . $ns . 'body><![CDATA[
									' .	 $MV_Overlay->getMVDhtml( $mvd, $absolute_links = true ). '
								]]></' . $ns . 'body>
						</' . $ns . 'clip>';
				// clear wgOutput
			}
		}
		if ( $encap )print '<cmml_set>';
		// based on: http://trac.annodex.net/wiki/CmmlChanges
		foreach ( $tracks as $role => $body_string ) {
			$ns = htmlentities( $ns );
			?>
<cmml
	lang="en" id="<?php 
        echo htmlentities($role);
        ?>
"
	role="<?php 
        echo wfMsg($role);
        ?>
"
	xmlns="http://svn.annodex.net/standards/cmml_2_0.dtd">
<<?php 
        echo $ns;
        ?>
head> <<?php 
        echo $ns;
        ?>
title>
			<?php 
        echo wfMsg($role);
        ?>
</<?php 
        echo $ns;
        ?>
title> <<?php 
        echo $ns;
        ?>
meta name="description" content="<?php 
        echo htmlentities(wfMsg($role . '_desc'));
        ?>
"></<?php 
        echo $ns;
        ?>
meta> </<?php 
        echo $ns;
        ?>
head>
<?php 
        echo $body_string;
        ?>
</cmml>
<?
		}
		if ( $encap )print '</cmml_set>';
	}
	function get_stream_cmml($inline=false, $force_track=null){		
		$dbr =& wfGetDB(DB_SLAVE);		
		//set cmml name space if inline: 
		$ns = ($inline)?'cmml:':'';
		$ns='';
		$encap=false;//if we should have a parent cmml tag
		if(!$force_track){
			//check the request to get trac set:
			$mvcp = new MV_Component();
			$mvcp->procMVDReqSet();
			$tracks = $mvcp->mvd_tracks;
			if(count($mvcp->mvd_tracks)>1)$encap=true;
		}else{
			$tracks = $force_track;
			$encap=false;
		}
		
		//get the stream title	
		$streamTitle = new MV_Title($this->stream_name.'/'.$this->req_time);		
		$wgTitle = Title::newFromText($this->stream_name.'/'.$this->req_time, MV_NS_STREAM);
		//do mvd_index query:
		$mvd_res = MV_Index::getMVDInRange($streamTitle->getStreamId(),
				$streamTitle->getStartTimeSeconds(), 
				$streamTitle->getEndTimeSeconds(), $tracks);
		//get the stream stream req 
		if(!$inline)header('Content-Type: text/xml');
		//print the header:
		if(!$inline)print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n";		
		//if(!$inline)print '<!DOCTYPE cmml SYSTEM "http://svn.annodex.net/standards/cmml_2_0.dtd">'."\n";		
		$tracks=array();
		if(count($dbr->numRows($mvd_res))!=0){ 
			global $wgOut;
			$MV_Overlay = new MV_Overlay();				
			while($mvd = $dbr->fetchObject($mvd_res)){	
			
				if(!isset($tracks[$mvd->mvd_type]))$tracks[$mvd->mvd_type]='';			
				$tracks[$mvd->mvd_type].='						
						<'.$ns.'clip id="mvd_'.$mvd->id.'" start="ntp:'.seconds2ntp($mvd->start_time).'" end="ntp:'.seconds2ntp($mvd->end_time).'">
							<'.$ns.'img src="'.htmlentities($streamTitle->getFullStreamImageURL(null, seconds2ntp($mvd->start_time))).'"/>
							<'.$ns.'body><![CDATA[
									'.	$MV_Overlay->getMVDhtml($mvd, $absolute_links=true).'
								]]></'.$ns.'body> 
						</'.$ns.'clip>';			 					
				//clear wgOutput				
			}
		}		
		if($encap)print '<cmml_set>';
 	    //based on: http://trac.annodex.net/wiki/CmmlChanges
		foreach($tracks as $role=>$body_string){ ?>
					<cmml lang="en" id="<?=$role?>" role="<?=wfMsg($role)?>" xmlns="http://svn.annodex.net/standards/cmml_2_0.dtd">		
						<<?=$ns?>head>
							<<?=$ns?>title><?=wfMsg($role)?></<?=$ns?>title>	
							<<?=$ns?>description><?=htmlentities(wfMsg($role.'_desc'))?></<?=$ns?>description>				
						</<?=$ns?>head>
						<?=$body_string?>												
					</cmml>
<?
		}
		if($encap)print '</cmml_set>';
	}