[vlc-devel] [PATCH] chromecast: Display a warning dialog when transcoding

Rémi Denis-Courmont remi at remlab.net
Thu Dec 28 18:27:23 CET 2017


On mercredi 27 décembre 2017 16:29:53 EET Hugo Beauzée-Luyssen wrote:
> refs #19306
> ---
>  modules/stream_out/chromecast/cast.cpp | 33
> +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4
> deletions(-)
> 
> diff --git a/modules/stream_out/chromecast/cast.cpp
> b/modules/stream_out/chromecast/cast.cpp index aef9b380e9..a7afacaab5
> 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-"
> @@ -110,6 +115,8 @@ static const char *const ppsz_sout_options[] = {
>  #define MUX_LONGTEXT N_("This sets the muxer used to stream to the
> Chromecast.") #define MIME_TEXT N_("MIME content type")
>  #define MIME_LONGTEXT N_("This sets the media MIME content type sent to the
> Chromecast.") +#define PERF_TEXT N_( "Performance warning" )
> +#define PERF_LONGTEXT N_( "Display a performance warning when transcoding"
> )
> 
>  #define IP_ADDR_TEXT N_("IP Address")
>  #define IP_ADDR_LONGTEXT N_("IP Address of the Chromecast.")
> @@ -132,6 +139,8 @@ vlc_module_begin ()
>      add_bool(SOUT_CFG_PREFIX "video", true, HAS_VIDEO_TEXT,
> HAS_VIDEO_LONGTEXT, false) add_string(SOUT_CFG_PREFIX "mux", DEFAULT_MUXER,
> MUX_TEXT, MUX_LONGTEXT, false) add_string(SOUT_CFG_PREFIX "mime",
> "video/x-matroska", MIME_TEXT, MIME_LONGTEXT, false) +   
> add_integer(SOUT_CFG_PREFIX "show-perf-warning", 1, PERF_TEXT,
> PERF_LONGTEXT, true ) +
> 
>  vlc_module_end ()
> 
> @@ -253,12 +262,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 +302,20 @@ void sout_stream_sys_t::UpdateOutput( sout_stream_t
> *p_stream ) std::stringstream ssout;
>      if ( !canRemux )
>      {
> +        if ( var_InheritInteger( p_stream, SOUT_CFG_PREFIX
> "show-perf-warning" ) ) +        {
> +            int res = vlc_dialog_wait_question( p_stream,
> +                          VLC_DIALOG_QUESTION_WARNING,
> +                         _("Cancel"), _("OK"), _("Ok, Don't warn me
> again"), +                         _("Performance warning"),
> +                         _("Casting this video requires it to be converted.
> " +                           "Your device might not be powerfull enough,
> or this " +                           "could heavily drain your battery" )

AFAIK, missing dot and "heavily drain[ing] a battery" does not make much 
sense, or is very confused wording.

-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list