[vlc-devel] [RFC PATCH] chromecast: Display a warning dialog on Android and iOS

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Dec 21 15:43:01 CET 2017


On Thu, Dec 21, 2017, at 3:22 PM, Rémi Denis-Courmont wrote:
> Le 21 décembre 2017 14:27:57 GMT+02:00, "Hugo Beauzée-Luyssen" 
> <hugo at beauzee.fr> a écrit :
> >refs #19306
> >---
> > modules/stream_out/chromecast/cast.cpp | 24 ++++++++++++++++++++----
> > 1 file changed, 20 insertions(+), 4 deletions(-)
> >
> >diff --git a/modules/stream_out/chromecast/cast.cpp
> >b/modules/stream_out/chromecast/cast.cpp
> >index aef9b380e9..fe23140a73 100644
> >--- a/modules/stream_out/chromecast/cast.cpp
> >+++ b/modules/stream_out/chromecast/cast.cpp
> >@@ -30,7 +30,12 @@
> > # include "config.h"
> > #endif
> > 
> >+#ifdef __APPLE__
> >+#include "TargetConditionals.h"
> >+#endif
> >+
> > #include "chromecast.h"
> >+#include <vlc_dialog.h>
> > 
> > #include <vlc_sout.h>
> > #include <vlc_block.h>
> >@@ -77,7 +82,7 @@ struct sout_stream_sys_t
> >     std::vector<sout_stream_id_sys_t*> streams;
> > 
> > private:
> >-    void UpdateOutput( sout_stream_t * );
> >+    bool UpdateOutput( sout_stream_t * );
> > };
> > 
> > #define SOUT_CFG_PREFIX "sout-chromecast-"
> >@@ -253,12 +258,12 @@ bool sout_stream_sys_t::startSoutChain(
> >sout_stream_t *p_stream )
> >     return streams.empty() == false;
> > }
> > 
> >-void sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
> >+bool sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
> > {
> >     assert( p_stream->p_sys == this );
> > 
> >     if ( !es_changed )
> >-        return;
> >+        return true;
> > 
> >     es_changed = false;
> > 
> >@@ -293,6 +298,15 @@ void sout_stream_sys_t::UpdateOutput(
> >sout_stream_t *p_stream )
> >     std::stringstream ssout;
> >     if ( !canRemux )
> >     {
> >+#if __ANDROID__ || TARGET_OS_IPHONE
> >+        if ( vlc_dialog_wait_question(p_stream,
> >VLC_DIALOG_QUESTION_WARNING,
> >+                         _("Cancel"), _("OK"), NULL,
> >+                         _("Performance warning"),
> >+                         _("Casting this video requires it to be
> >converted. "
> >+                           "Your device might not be powerfull enough,
> >or this "
> >+                           "could heavily drain your battery" ) ) != 1
> >)
> >+             return false;
> >+#endif
> >         /* TODO: provide audio samplerate and channels */
> >         ssout << "transcode{";
> >         char s_fourcc[5];
> >@@ -346,6 +360,7 @@ void sout_stream_sys_t::UpdateOutput( sout_stream_t
> >*p_stream )
> >         p_out = NULL;
> >         sout = "";
> >     }
> >+    return true;
> > }
> > 
> >sout_stream_id_sys_t *sout_stream_sys_t::GetSubId( sout_stream_t
> >*p_stream,
> >@@ -355,7 +370,8 @@ sout_stream_id_sys_t *sout_stream_sys_t::GetSubId(
> >sout_stream_t *p_stream,
> > 
> >     assert( p_stream->p_sys == this );
> > 
> >-    UpdateOutput( p_stream );
> >+    if ( UpdateOutput( p_stream ) == false )
> >+        return NULL;
> > 
> >     for (i = 0; i < streams.size(); ++i)
> >     {
> >-- 
> >2.11.0
> >
> >_______________________________________________
> >vlc-devel mailing list
> >To unsubscribe or modify your subscription options:
> >https://mailman.videolan.org/listinfo/vlc-devel
> 
> Doing this on Android and iOS seems dubiously arbitrary. This should be 
> done on any device w/o hardware-accelerated encoding - which is all of 
> them at the moment.

That is indeed completely arbitrary, hence the RFC.
I'm not sure we want to display this on desktops versions TBH. Or we can display it at least once on all platforms, but add a way to discard  this warning in the future.

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list