-// Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
+// Copyright 2005-8 Ben Hutchings <ben@decadent.org.uk>.
// See the file "COPYING" for licence details.
#include <cerrno>
#include <sstream>
#include <stdexcept>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include <gdkmm/pixbuf.h>
#include <glibmm/miscutils.h>
#include <glibmm/spawn.h>
std::string background_name(
temp_file_name(temp_dir_, "menu-%3d-back.png", 1 + index));
- std::cout << "saving " << background_name << std::endl;
+ std::cout << "INFO: Saving " << background_name << std::endl;
background->save(background_name, "png");
std::string highlights_name(
temp_file_name(temp_dir_, "menu-%3d-links.png", 1 + index));
- std::cout << "saving " << highlights_name << std::endl;
+ std::cout << "INFO: Saving " << highlights_name << std::endl;
highlights->save(highlights_name, "png");
std::string spumux_name(
}
}
}
+ // Pad vertically to even y coordinates since dvdauthor claims
+ // odd values may result in incorrect display.
+ // XXX This may cause overlappping where it wasn't previously
+ // a problem.
spumux_file << " <button"
" x0='" << this_entry.area.left << "'"
- " y0='" << this_entry.area.top << "'"
+ " y0='" << (this_entry.area.top & ~1) << "'"
" x1='" << this_entry.area.right << "'"
- " y1='" << this_entry.area.bottom << "'"
+ " y1='" << ((this_entry.area.bottom + 1) & ~1) << "'"
" left='" << (i == 0 ? button_count : i) << "'"
" right='" << 1 + (i + 1) % button_count << "'"
" up='" << 1 + up_button << "'"
if (!spumux_file)
throw std::runtime_error("Failed to write control file for spumux");
+ std::string output_name(
+ temp_file_name(temp_dir_, "menu-%3d.mpeg", 1 + index));
+
std::ostringstream command_stream;
unsigned frame_count(menu_duration_frames(frame_params_));
if (encoder_ == mpeg_encoder_ffmpeg)
" | mplex -v0 -f8 -o/dev/stdout /dev/stdin";
}
command_stream
- << " | spumux -v0 -mdvd " << spumux_name
- << " > " << temp_file_name(temp_dir_, "menu-%3d.mpeg", 1 + index);
+ << " | spumux -v0 -mdvd " << spumux_name << " > " << output_name;
std::string command(command_stream.str());
const char * argv[] = {
"/bin/sh", "-c", command.c_str(), 0
};
- std::cout << "running " << command << std::endl;
+ std::cout << "INFO: Running " << command << std::endl;
int command_result;
Glib::spawn_sync(".",
Glib::ArrayHandle<std::string>(
sigc::slot<void>(),
0, 0,
&command_result);
- if (command_result != 0)
+ struct stat stat_buf;
+ if (command_result != 0 || stat(output_name.c_str(), &stat_buf) != 0
+ || stat_buf.st_size == 0)
throw std::runtime_error("spumux pipeline failed");
}
const unsigned menu_begin = titleset_num * dvdauthor_anonymous_menus_max;
const unsigned menu_end =
have_real_menus
- ? std::min((titleset_num + 1) * dvdauthor_anonymous_menus_max,
- menus_.size())
+ ? std::min<unsigned>(
+ (titleset_num + 1) * dvdauthor_anonymous_menus_max,
+ menus_.size())
: menu_begin + 1;
for (unsigned menu_index = menu_begin;