+/*** CD Marker sutff ***/
+
+struct LocationSortByStart {
+ bool operator() (Location *a, Location *b) {
+ return a->start() < b->start();
+ }
+};
+
+void
+ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSpecPtr file_format,
+ std::string filename, CDMarkerFormat format)
+{
+ string filepath = get_cd_marker_filename(filename, format);
+
+ try {
+ void (ExportHandler::*header_func) (CDMarkerStatus &);
+ void (ExportHandler::*track_func) (CDMarkerStatus &);
+ void (ExportHandler::*index_func) (CDMarkerStatus &);
+
+ switch (format) {
+ case CDMarkerTOC:
+ header_func = &ExportHandler::write_toc_header;
+ track_func = &ExportHandler::write_track_info_toc;
+ index_func = &ExportHandler::write_index_info_toc;
+ break;
+ case CDMarkerCUE:
+ header_func = &ExportHandler::write_cue_header;
+ track_func = &ExportHandler::write_track_info_cue;
+ index_func = &ExportHandler::write_index_info_cue;
+ break;
+ default:
+ return;
+ }
+
+ CDMarkerStatus status (filepath, timespan, file_format, filename);
+
+ if (!status.out) {
+ error << string_compose(_("Editor: cannot open \"%1\" as export file for CD marker file"), filepath) << endmsg;
+ return;
+ }
+
+ (this->*header_func) (status);
+
+ /* Get locations and sort */
+
+ Locations::LocationList const & locations (session.locations()->list());
+ Locations::LocationList::const_iterator i;
+ Locations::LocationList temp;
+
+ for (i = locations.begin(); i != locations.end(); ++i) {
+ if ((*i)->start() >= timespan->get_start() && (*i)->end() <= timespan->get_end() && (*i)->is_cd_marker() && !(*i)->is_session_range()) {
+ temp.push_back (*i);