Skip to content

Commit 821576a

Browse files
authored
Merge pull request #157 from aremmiw/master
fix compiling without gstreamer, libpeas
2 parents 964ab35 + c22a66f commit 821576a

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

src/booru/site.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ std::shared_ptr<Site> Site::create(const std::string& name,
133133
#else // !HAVE_LIBPEAS
134134
auto t{ get_type_from_url(url) };
135135
if (t != Type::UNKNOWN)
136-
return std::make_shared<SharedSite>(name, url, t, user, pass, use_samples);
136+
return std::make_shared<SharedSite>(name, url, t, user, pass, use_samples, user_agent);
137137
#endif // !HAVE_LIBPEAS
138138
}
139139
else

src/imagebox.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,12 @@ void ImageBox::draw_image(bool scroll)
431431
error = true;
432432
}
433433
}
434+
#ifdef HAVE_GSTREAMER
434435
else if (!m_VideoBox->is_playing())
435436
{
436437
std::tie(error, m_OrigWidth, m_OrigHeight) = m_VideoBox->load_file(m_Image->get_path());
437438
}
439+
#endif // HAVE_GSTREAMER
438440

439441
if (error)
440442
{
@@ -473,6 +475,7 @@ void ImageBox::draw_image(bool scroll)
473475
m_GtkImage->set(temp_pixbuf);
474476
m_Overlay->show();
475477
}
478+
#ifdef HAVE_GSTREAMER
476479
else
477480
{
478481
if (!m_VideoBox->is_playing())
@@ -485,6 +488,7 @@ void ImageBox::draw_image(bool scroll)
485488
m_Fixed->move(*m_VideoBox, x, y);
486489
m_VideoBox->set_size_request(w, h);
487490
}
491+
#endif // HAVE_GSTREAMER
488492

489493
// Reset the scrollbar positions
490494
if (scroll || m_FirstDraw)
@@ -523,9 +527,11 @@ void ImageBox::draw_image(bool scroll)
523527
m_ZoomScroll = false;
524528
}
525529

530+
#ifdef HAVE_GSTREAMER
526531
// Finally start playing the video
527532
if (!error && !m_VideoBox->is_playing() && m_Image->is_webm())
528533
m_VideoBox->start();
534+
#endif // HAVE_GSTREAMER
529535

530536
get_window()->thaw_updates();
531537
m_RedrawQueued = false;
@@ -684,10 +690,14 @@ bool ImageBox::advance_slideshow()
684690

685691
bool ImageBox::on_cursor_timeout()
686692
{
693+
#ifdef HAVE_GSTREAMER
687694
// hide_controls will return false if the cursor is over the controls widget
688695
// meaning we should not hide the cursor
689696
if (!m_VideoBox->is_playing() || m_VideoBox->hide_controls(true))
690697
m_Fixed->get_window()->set_cursor(m_BlankCursor);
698+
#else // !HAVE_GSTREAMER
699+
m_Fixed->get_window()->set_cursor(m_BlankCursor);
700+
#endif // !HAVE_GSTREAMER
691701

692702
return false;
693703
}

src/keybindingeditor.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ KeybindingEditor::KeybindingEditor(BaseObjectType* cobj, const Glib::RefPtr<Gtk:
5050
it->set_value(m_Columns.name, std::string{ cat.data() });
5151
cat_iters.emplace(cat, it);
5252
}
53+
#ifdef HAVE_LIBPEAS
5354
static constexpr auto is_plugin_loaded = [&](const std::string& action_name) {
5455
const auto& plugins{
5556
Application::get_default()->get_plugin_manager().get_window_plugins()
@@ -59,6 +60,7 @@ KeybindingEditor::KeybindingEditor(BaseObjectType* cobj, const Glib::RefPtr<Gtk:
5960
}) };
6061
return it != plugins.end();
6162
};
63+
#endif // HAVE_LIBPEAS
6264

6365
// Add the keybindings to the treeview model
6466
for (const auto& [name, binds] : Settings.get_keybindings())

src/videobox.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ gboolean VideoBox::bus_cb(GstBus*, GstMessage* msg, void* userp)
6060
#endif // HAVE_GSTREAMER
6161

6262
VideoBox::VideoBox(BaseObjectType* cobj, const Glib::RefPtr<Gtk::Builder>& bldr)
63-
: Gtk::Overlay{ cobj },
63+
: Gtk::Overlay{ cobj }
64+
#ifdef HAVE_GSTREAMER
65+
,
6466
m_Mute{ Settings.get_bool("Mute") }
67+
#endif // HAVE_GSTREAMER
6568
{
6669
bldr->get_widget("VideoBox::ControlRevealer", m_ControlRevealer);
6770
bldr->get_widget("VideoBox::PlayPauseButton", m_PlayPauseButton);
@@ -79,7 +82,7 @@ VideoBox::VideoBox(BaseObjectType* cobj, const Glib::RefPtr<Gtk::Builder>& bldr)
7982
"vaapih264dec", "vaapimpeg2dec", "vaapivc1dec",
8083
#ifdef _WIN32
8184
"d3d11h264dec", "d3d11h265dec", "d3d11vp8dec", "d3d11vp9dec",
82-
#endif
85+
#endif // _WIN32
8386
};
8487
GstRegistry* plugins_register{ gst_registry_get() };
8588

@@ -292,6 +295,7 @@ void VideoBox::start()
292295

293296
bool VideoBox::hide_controls(bool skip_timeout)
294297
{
298+
#ifdef HAVE_GSTREAMER
295299
m_HideConn.disconnect();
296300
// Don't hide if the cursor is currently inside the control widget
297301
if (m_HoveringControls)
@@ -306,6 +310,7 @@ bool VideoBox::hide_controls(bool skip_timeout)
306310
skip_timeout ? 0 : 500);
307311

308312
m_ShowControls = false;
313+
#endif // HAVE_GSTREAMER
309314

310315
return true;
311316
}

src/videobox.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ namespace AhoViewer
2222
std::tuple<bool, int, int> load_file(const std::string& path);
2323
void start();
2424

25+
#ifdef HAVE_GSTREAMER
2526
bool is_playing() const { return m_Playing; };
27+
#endif // HAVE_GSTREAMER
2628

2729
bool hide_controls(bool skip_timeout = false);
2830

@@ -31,9 +33,9 @@ namespace AhoViewer
3133
Gtk::Button *m_PlayPauseButton, *m_VolumeButton;
3234
Gtk::Label *m_PosLabel, *m_DurLabel;
3335
Gtk::Scale *m_VolumeScale, *m_SeekScale;
36+
#ifdef HAVE_GSTREAMER
3437
Gtk::Widget* m_GstWidget;
3538

36-
#ifdef HAVE_GSTREAMER
3739
static gboolean bus_cb(GstBus*, GstMessage* msg, void* userp);
3840
static void on_about_to_finish(GstElement*, void* userp);
3941

0 commit comments

Comments
 (0)