[vlc-devel] [RFC PATCH] chromecast: Display a warning dialog on Android and iOS
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Dec 21 13:27:57 CET 2017
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
More information about the vlc-devel
mailing list