/* * See the files COPYING and README for copyright information and how to reach * the author. * * $Id: config.c,v 1.17 2006/09/16 18:33:36 lordjaxom Exp $ */ #include "config.h" #include "filter.h" #include "setup.h" #include #include namespace vdr_burn { using namespace std; using proctools::logger; using proctools::format; // --- dvdauthor_xml ----------------------------------------------------- dvdauthor_xml::dvdauthor_xml(const job& Job): m_job(Job) { } #if 0 const char* dvdauthor_xml::get_video_format(component_type::type type_) { switch (type_) { case component_type::hz25_4_3 ... component_type::hz25_21_9: return "pal"; case component_type::hz30_4_3 ... component_type::hz30_21_9: return "ntsc"; default: return 0; } } #endif string dvdauthor_xml::get_video_aspect(track_info::aspectratio type) { switch (type) { case track_info::aspectratio_4_3: return "aspect=\"4:3\""; case track_info::aspectratio_16_9: case track_info::aspectratio_21_9: return "aspect=\"16:9\""; default: return ""; } } string dvdauthor_xml::get_audio_language(int language) { return "lang=\"" + track_info::get_language_codes()[ language ] + "\""; } void dvdauthor_xml::write_main_menu() { m_file << " " << endl; int pages = ScanPageCount(m_job.get_paths().data); for (int p = 0; p < pages; ++p) { if (p == 0) { m_file << " " << endl // pause="inf"?? << "
" << endl;
				for (int q = 2; q <= pages; q++)
					m_file << "           if (g0 eq " << q << ") { jump menu " << q <<";}" << endl;
				m_file << "             button=g1;g3=0;" << endl
				  	   << "        
" << endl; } else { m_file << " " << endl << "
button=g1;g3=0;
" << endl; } m_file << " " << endl; // TODO observe pause=inf for (uint i = p * m_job.get_skin().get_main_menu_titles().size(); i < std::min(static_cast((p + 1) * m_job.get_skin().get_main_menu_titles().size()), m_job.get_recordings().size()); ++i) m_file << " " << endl; if (p > 0) m_file << " " << endl; if (p < pages - 1) m_file << " " << endl; m_file << "
" << endl; } m_file << "
" << endl; } void dvdauthor_xml::write_title_menu(recording_list::const_iterator rec) { int pages = ScanPageCount(rec->get_paths().data); m_file << " " << endl; for (int i = 0; i < pages; ++i) { m_file << " " << endl; if (rec->get_eventDescription() == "" && m_job.get_skip_titlemenu()) m_file << "
jump title 1 chapter 1;
" << endl; else { if ( i == 0) { m_file << "
button=1024;
" << endl; } else { m_file << "
if (g3 eq 1){button=3072;}" << endl
					  	   << "             if (g3 eq 2){button=1024;}" << endl
					  	   << "             if (g3 eq 3){button=2048;}" << endl
					  	   << "        
" << endl; } m_file << " get_menu_mpeg(i) << "\" pause=\"inf\"/>" << endl; if (i > 0) m_file << " " << endl; m_file << " " << endl; if (i < pages - 1) m_file << " " << endl; // show the back button only unless SkipMainmenu or if we have more than one track on disk if( !m_job.get_options().SkipMainmenu || m_job.get_recordings().size() > 1 ) m_file << " " << endl; } m_file << " " << endl; } m_file << "
" << endl; } void dvdauthor_xml::write() { m_file.open(get_xml_path().c_str(), ios::out); if (!m_file) { logger::error(format("couldn't create {0}") % get_xml_path()); return; } m_file << "" << endl; m_file << "" << endl << " " << endl; bool createMenu = (m_job.get_disk_type() == disktype_dvd_menu); if (createMenu) { // Go directly to the menu of the first title, if SkipMainMenu and this is the only item in the main menu if( m_job.get_options().SkipMainmenu && m_job.get_recordings().size() == 1 ) { // Jump to the title-menu of the only track m_file << " g0=1;g1=1024;jump titleset 1 menu;" << endl; m_file << " " << endl << " " << endl << "
" << endl
				<< "          button=g1;g3=0;jump titleset 1 menu;" << endl;
				m_file << "        
" << endl << " " << endl << " " << endl << "
" << endl << "
" << endl; } else { // Jump to the main-menu m_file << " g0=1;g1=1024;jump vmgm menu 1;" << endl; write_main_menu(); } m_file << "
" << endl; for (recording_list::const_iterator rec = m_job.get_recordings().begin(); rec != m_job.get_recordings().end(); ++rec) { m_file << " " << endl; write_title_menu(rec); m_file << " " << endl; const_track_filter videoTracks( rec->get_tracks(), track_info::streamtype_video, track_predicate::used ); if (videoTracks.begin() != videoTracks.end()) { const track_info& track = *videoTracks.begin(); m_file << " " << endl << " " << endl; } } else { // DVD without menus m_file << " g3=1;jump vmgm menu 1;" << endl << " " << endl << " " << endl << "
" << endl;
			int titleset = 1;
			for (recording_list::const_iterator rec = m_job.get_recordings().begin();
				 rec != m_job.get_recordings().end(); ++rec) {
				m_file << "          if (g3 eq " << titleset << ") {jump title " << titleset
					   << ";}" << endl;
				titleset++;
			}
			m_file << "        
" << endl << " " << endl << "
" << endl << "
" << endl << " " << endl; int t = 1; for (recording_list::const_iterator rec = m_job.get_recordings().begin(); rec != m_job.get_recordings().end(); ++rec) { m_file << " " << endl; m_file << " " << endl; const_track_filter videoTracks( rec->get_tracks(), track_info::streamtype_video, track_predicate::used ); if (videoTracks.begin() != videoTracks.end()) { const track_info& track = *videoTracks.begin(); m_file << "" << endl << " " << endl; } } m_file << "
\n"; } }