[vlc-commits] sout: chromecast: add stream info helpers

Filip Roséen git at videolan.org
Tue Jul 24 16:01:25 CEST 2018


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Jul 23 19:56:58 2018 +0200| [92c90c5b0a98a01d3f81d1a8d9ffeea0e230a7a2] | committer: Thomas Guillem

sout: chromecast: add stream info helpers

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.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=92c90c5b0a98a01d3f81d1a8d9ffeea0e230a7a2
---

 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 3796780eb4..2b0a0c2c34 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;



More information about the vlc-commits mailing list