[vlc-devel] [PATCH] cast: force transcoding of x265 videos

Erick Tyndall erythros at gmail.com
Wed Sep 19 05:06:44 CEST 2018


Allow users to transcode x265 encoded videos for playback on Chromecast
version 1 and 2, as only Chromecast Ultra supports HEVC (H.265).

---
 modules/stream_out/chromecast/cast.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp
b/modules/stream_out/chromecast/cast.cpp
index 2ef26d8eb4..b567b7a001 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -115,7 +115,7 @@ struct sout_stream_sys_t
         vlc_mutex_destroy(&lock);
     }

-    bool canDecodeVideo( vlc_fourcc_t i_codec ) const;
+    bool canDecodeVideo( sout_stream_t* p_stream, vlc_fourcc_t i_codec )
const;
     bool canDecodeAudio( sout_stream_t* p_stream, vlc_fourcc_t i_codec,
                          const audio_format_t* p_fmt ) const;
     bool startSoutChain(sout_stream_t* p_stream,
@@ -203,6 +203,9 @@ static const char *const ppsz_sout_options[] = {
 #define PERF_LONGTEXT N_( "Display a performance warning when transcoding"
)
 #define AUDIO_PASSTHROUGH_TEXT N_( "Enable Audio passthrough" )
 #define AUDIO_PASSTHROUGH_LONGTEXT N_( "Disable if your receiver does not
support Dolby®." )
+#define FORCE_TRANSCODE_TEXT N_( "Transcode x265 videos" )
+#define FORCE_TRANSCODE_LONGTEXT N_( "Enable transcoding of x265 encoded
videos." )
+#define FORCE_TRANSCODE_DEFAULT true

 enum {
     CONVERSION_QUALITY_HIGH = 0,
@@ -266,6 +269,7 @@ vlc_module_begin ()
     add_integer(SOUT_CFG_PREFIX "show-perf-warning", 1, PERF_TEXT,
PERF_LONGTEXT, true )
         change_private()
     add_bool(SOUT_CFG_PREFIX "audio-passthrough", false,
AUDIO_PASSTHROUGH_TEXT, AUDIO_PASSTHROUGH_LONGTEXT, false )
+    add_bool(SOUT_CFG_PREFIX "force-transcode", FORCE_TRANSCODE_DEFAULT,
FORCE_TRANSCODE_TEXT, FORCE_TRANSCODE_LONGTEXT, false)
     add_integer(SOUT_CFG_PREFIX "conversion-quality",
CONVERSION_QUALITY_DEFAULT,
                 CONVERSION_QUALITY_TEXT, CONVERSION_QUALITY_LONGTEXT,
false );
         change_integer_list(conversion_quality_list,
conversion_quality_list_text)
@@ -803,10 +807,12 @@ static void Del(sout_stream_t *p_stream, void *_id)
  * Supported formats: https://developers.google.com/cast/docs/media
  */

-bool sout_stream_sys_t::canDecodeVideo( vlc_fourcc_t i_codec ) const
+bool sout_stream_sys_t::canDecodeVideo( sout_stream_t *p_stream,
vlc_fourcc_t i_codec ) const
 {
     if( transcoding_state & TRANSCODING_VIDEO )
         return false;
+    if( i_codec == VLC_CODEC_HEVC )
+        return !(var_InheritBool( p_stream, SOUT_CFG_PREFIX
"force-transcode" ));
     return i_codec == VLC_CODEC_H264 || i_codec == VLC_CODEC_HEVC
         || i_codec == VLC_CODEC_VP8 || i_codec == VLC_CODEC_VP9;
 }
@@ -1236,7 +1242,7 @@ bool sout_stream_sys_t::UpdateOutput( sout_stream_t
*p_stream )
         {
             if (p_es->i_cat == VIDEO_ES && p_original_video == NULL)
             {
-                if (!canDecodeVideo( p_es->i_codec ))
+                if (!canDecodeVideo( p_stream, p_es->i_codec ))
                 {
                     msg_Dbg( p_stream, "can't remux video track %d codec
%4.4s",
                              p_es->i_id, (const char*)&p_es->i_codec );
--
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180918/cfba76ad/attachment.html>


More information about the vlc-devel mailing list