Skip to content

Commit 717c78a

Browse files
committed
support new gstreamermm 1.8 api
Close #3.
1 parent 397312a commit 717c78a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/player.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ Player::on_bus_message(const Glib::RefPtr<Gst::Bus>& /*bus*/, const Glib::RefPtr
122122
Glib::ustring e = "Error";
123123

124124
if (error_msg) {
125+
#if GSTREAMERMM_MAJOR_VERSION == 1 and GSTREAMERMM_MINOR_VERSION >= 8
126+
Glib::Error err = error_msg->parse_error();
127+
#else
125128
Glib::Error err = error_msg->parse();
129+
#endif
126130
e.append(": ").append(err.what());
127131
}
128132

@@ -134,7 +138,11 @@ Player::on_bus_message(const Glib::RefPtr<Gst::Bus>& /*bus*/, const Glib::RefPtr
134138
auto msg_tag = Glib::RefPtr<Gst::MessageTag>::cast_static(message);
135139
Gst::TagList tag_list;
136140
#if GST_VERSION_MAJOR >= 1
141+
#if GSTREAMERMM_MAJOR_VERSION == 1 and GSTREAMERMM_MINOR_VERSION >= 8
142+
tag_list = msg_tag->parse_tag_list();
143+
#else
137144
msg_tag->parse(tag_list);
145+
#endif
138146
#else
139147
Glib::RefPtr<Gst::Pad> pad;
140148
msg_tag->parse(pad, tag_list);
@@ -148,8 +156,14 @@ Player::on_bus_message(const Glib::RefPtr<Gst::Bus>& /*bus*/, const Glib::RefPtr
148156
}
149157
} else if (message_type == Gst::MESSAGE_STATE_CHANGED) {
150158
auto state_changed_msg = Glib::RefPtr<Gst::MessageStateChanged>::cast_static(message);
159+
160+
#if GSTREAMERMM_MAJOR_VERSION == 1 and GSTREAMERMM_MINOR_VERSION >= 8
161+
Gst::State new_state = state_changed_msg->parse_new_state();
162+
Gst::State old_state = state_changed_msg->parse_old_state();
163+
#else
151164
Gst::State new_state = state_changed_msg->parse();
152165
Gst::State old_state = state_changed_msg->parse_old();
166+
#endif
153167

154168
StationState st;
155169
if (new_state == Gst::State::STATE_PLAYING) {

0 commit comments

Comments
 (0)