[vlc-devel] [PATCH 2/6] sout: chromecast: add stream info helpers

Filip Roséen filip at atch.se
Mon Jul 23 19:56:58 CEST 2018


The previous implementation had hard-coded paths in several places,
and each place relied on other relevant part using the same paths.
>From a maintainability perspective this is a mess, and bound to fail
one way or another.

These changes introduce helper-functions that can be called in places
where the values are needed, effectively adding a layer of protection
to maintainability issues by making sure everything is using the same
values.
---
 modules/stream_out/chromecast/chromecast.h        |  4 ++++
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index b32a0ded7b..dcc2c4bc27 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -182,6 +182,10 @@ struct intf_sys_t
     void sendInputEvent(enum cc_input_event event, union cc_input_arg arg);
     vlc_tick_t getPauseDelay();
 
+    unsigned int getHttpStreamPort() const;
+    std::string getHttpStreamPath() const;
+    std::string getHttpArtRoot() const;
+
     int httpd_file_fill( uint8_t *psz_request, uint8_t **pp_data, int *pi_data );
     void interrupt_wake_up();
 private:
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index e15a9d57b0..133e6e87cb 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -1112,6 +1112,21 @@ vlc_tick_t intf_sys_t::getPauseDelay()
     return m_pause_delay;
 }
 
+unsigned int intf_sys_t::getHttpStreamPort() const
+{
+    return m_streaming_port;
+}
+
+std::string intf_sys_t::getHttpStreamPath() const
+{
+    return "/stream";
+}
+
+std::string intf_sys_t::getHttpArtRoot() const
+{
+    return "/art";
+}
+
 bool intf_sys_t::isFinishedPlaying()
 {
     return m_cc_eof || isStateError() || m_state == Stopped;
-- 
2.18.0


More information about the vlc-devel mailing list