X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=webdvd.cpp;h=9063bce42befa3a31fb20abce50d029d67162484;hp=5b9afe042a412d2dbee489f426e79ffc999f5483;hb=ab30f1996d97f10d243b7075021840c37ae8238a;hpb=6afd65acff8fba3d5b98813ff040deb1261f06b2 diff --git a/webdvd.cpp b/webdvd.cpp index 5b9afe0..9063bce 100644 --- a/webdvd.cpp +++ b/webdvd.cpp @@ -1,4 +1,4 @@ -// Copyright 2005-6 Ben Hutchings . +// Copyright 2005-6 Ben Hutchings . // See the file "COPYING" for licence details. #include @@ -71,7 +71,7 @@ namespace // We can try using any of these encoders to convert PNG to MPEG. enum mpeg_encoder { - mpeg_encoder_ffmpeg, // ffmpeg - doesn't work yet + mpeg_encoder_ffmpeg, // ffmpeg mpeg_encoder_mjpegtools_old, // mjpegtools before version 1.8 mpeg_encoder_mjpegtools_new // mjpegtools from version 1.8 }; @@ -169,6 +169,7 @@ namespace dvd_contents::pgc_ref add_menu(const std::string & uri); dvd_contents::pgc_ref add_title(const std::string & uri); void load_next_page(); + bool on_idle(); void on_net_state_change(const char * uri, gint flags, guint status); bool browser_is_busy() const { @@ -220,11 +221,12 @@ namespace add(browser_widget_); browser_widget_.show(); + Glib::signal_idle().connect( + SigC::slot(*this, &webdvd_window::on_idle)); browser_widget_.signal_net_state().connect( SigC::slot(*this, &webdvd_window::on_net_state_change)); add_menu(main_page_uri); - load_next_page(); } bool webdvd_window::is_finished() const @@ -302,6 +304,12 @@ namespace browser_widget_.load_uri(uri); } + bool webdvd_window::on_idle() + { + load_next_page(); + return false; // don't call again thankyou + } + void webdvd_window::on_net_state_change(const char * uri, gint flags, guint status) { @@ -860,9 +868,9 @@ namespace // ranging from 10 to 25 inches wide, for a resolution of // 24-60 dpi. I therefore declare the average horizontal // resolution to be 40 dpi. The vertical resolution will be - // slightly higher (PAL/SECAM) or lower (NTSC), but - // unfortunately Mozilla doesn't support non-square pixels - // (and neither do fontconfig or Xft anyway). + // slightly different but unfortunately Mozilla doesn't + // support non-square pixels (and neither do fontconfig or Xft + // anyway). check(pref_service->GetDefaultBranch("browser.display", getter_AddRefs(pref_branch))); check(pref_branch->SetIntPref("screen_resolution", 40)); @@ -884,7 +892,7 @@ int main(int argc, char ** argv) bool preview_mode = false; std::string menu_url; std::string output_dir; - mpeg_encoder encoder = mpeg_encoder_mjpegtools_new; + mpeg_encoder encoder = mpeg_encoder_ffmpeg; // Do initial option parsing. We have to do this before // letting Gtk parse the arguments since we may need to spawn @@ -1033,7 +1041,9 @@ int main(int argc, char ** argv) // Run the browser/converter webdvd_window window(frame_params, menu_url, output_dir, encoder); - Gtk::Main::run(window); + window.show(); + window.signal_hide().connect(SigC::slot(&Gtk::Main::quit)); + Gtk::Main::run(); return ((preview_mode || window.is_finished()) ? EXIT_SUCCESS