[vlc-devel] [PATCH] chromecast: fix regression

Shaleen Jain shaleen at jain.sh
Thu Jan 17 05:53:39 CET 2019


Before commit ec61edc0d0292ab37bb1dbafb23a8aed49e966bb
chromecast depended on vlc_sout_renderer_GetVcodecOption
to signal the codec selected to transcode to.
Achieve that by introducing an output parameter
where the codec used is written.

---
 modules/stream_out/chromecast/cast.cpp | 1 +
 modules/stream_out/dlna/dlna.cpp       | 1 +
 modules/stream_out/renderer_common.cpp | 8 +++++---
 modules/stream_out/renderer_common.hpp | 3 ++-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index fbcd33ac0e..8e34a994c3 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -1057,6 +1057,7 @@ bool sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
             try {
                 ssout << vlc_sout_renderer_GetVcodecOption( p_stream,
                                         { VLC_CODEC_H264, VLC_CODEC_VP8 },
+                                        &i_codec_video,
                                         &p_original_video->video, i_quality );
                 new_transcoding_state |= TRANSCODING_VIDEO;
             } catch(const std::exception& e) {
diff --git a/modules/stream_out/dlna/dlna.cpp b/modules/stream_out/dlna/dlna.cpp
index 8716911b0c..da966442f5 100644
--- a/modules/stream_out/dlna/dlna.cpp
+++ b/modules/stream_out/dlna/dlna.cpp
@@ -439,6 +439,7 @@ int sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
             try {
                 ssout << vlc_sout_renderer_GetVcodecOption( p_stream,
                                         { i_codec_video },
+                                        &i_codec_video,
                                         &p_original_video->video, i_quality );
             } catch(const std::exception& e) {
                 return VLC_EGENERIC ;
diff --git a/modules/stream_out/renderer_common.cpp b/modules/stream_out/renderer_common.cpp
index 1555d7bb46..77b6c8c747 100644
--- a/modules/stream_out/renderer_common.cpp
+++ b/modules/stream_out/renderer_common.cpp
@@ -81,7 +81,7 @@ std::map<vlc_fourcc_t, std::vector<venc_options>> opts = {
 
 std::string
 GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
-        const video_format_t *p_vid, int i_quality )
+        vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality )
 {
     for (vlc_fourcc_t codec : codecs) {
         auto opt = opts.find(codec);
@@ -131,6 +131,7 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
                 if( success )
                 {
                     msg_Dbg( p_stream, "Converting video to %.4s", (const char*)&codec );
+                    *out_codec = codec;
                     return ssvenc.str();
                 }
             }
@@ -142,13 +143,14 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
 
 std::string
 vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
-        std::vector<vlc_fourcc_t> codecs, const video_format_t *p_vid, int i_quality)
+        std::vector<vlc_fourcc_t> codecs,
+        vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality)
 {
     std::stringstream ssout;
     static const char video_maxres_hd[] = "maxwidth=1920,maxheight=1080";
     static const char video_maxres_720p[] = "maxwidth=1280,maxheight=720";
 
-    ssout << GetVencOption( p_stream, codecs, p_vid, i_quality );
+    ssout << GetVencOption( p_stream, codecs, out_codec, p_vid, i_quality );
 
     switch ( i_quality )
     {
diff --git a/modules/stream_out/renderer_common.hpp b/modules/stream_out/renderer_common.hpp
index 808aa76ffb..46d09716b4 100644
--- a/modules/stream_out/renderer_common.hpp
+++ b/modules/stream_out/renderer_common.hpp
@@ -80,6 +80,7 @@ static const int conversion_quality_list[] = {
 
 std::string
 vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
-        std::vector<vlc_fourcc_t> codecs, const video_format_t *p_vid, int i_quality);
+        std::vector<vlc_fourcc_t> codecs,
+        vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality);
 
 #endif /* RENDERER_COMMON_H */
-- 
2.20.1


More information about the vlc-devel mailing list