[vlc-devel] [PATCH 09/14] renderer_common: use vlc_object instead of vlc_stream

Alaric Senat dev.asenat at posteo.net
Fri Mar 19 11:40:04 UTC 2021


A vlc_stream_t specialization of the objects is not needed by the actual
implementations of the functions.
---
 modules/stream_out/chromecast/cast.cpp |  2 +-
 modules/stream_out/dlna/dlna.cpp       |  2 +-
 modules/stream_out/renderer_common.cpp | 36 ++++++++++++++------------
 modules/stream_out/renderer_common.hpp |  3 +--
 4 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 08defbd5a1..6a9d510cf7 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -1049,7 +1049,7 @@ bool sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
         if ( i_codec_video == 0 && p_original_video )
         {
             try {
-                ssout << vlc_sout_renderer_GetVcodecOption( p_stream,
+                ssout << vlc_sout_renderer_GetVcodecOption( VLC_OBJECT(p_stream),
                                         { VLC_CODEC_H264, VLC_CODEC_VP8 },
                                         &i_codec_video,
                                         &p_original_video->video, i_quality );
diff --git a/modules/stream_out/dlna/dlna.cpp b/modules/stream_out/dlna/dlna.cpp
index 3e13dddde8..7b76cbd2ac 100644
--- a/modules/stream_out/dlna/dlna.cpp
+++ b/modules/stream_out/dlna/dlna.cpp
@@ -437,7 +437,7 @@ int sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
         {
             i_codec_video = stream_protocol->profile.video_codec;
             try {
-                ssout << vlc_sout_renderer_GetVcodecOption( p_stream,
+                ssout << vlc_sout_renderer_GetVcodecOption( VLC_OBJECT(p_stream),
                                         { i_codec_video },
                                         &i_codec_video,
                                         &p_original_video->video, i_quality );
diff --git a/modules/stream_out/renderer_common.cpp b/modules/stream_out/renderer_common.cpp
index ecb327bf7a..3966a014cd 100644
--- a/modules/stream_out/renderer_common.cpp
+++ b/modules/stream_out/renderer_common.cpp
@@ -33,30 +33,32 @@
 
 #include "renderer_common.hpp"
 
+#include <vlc_sout.h>
+
 std::string
-GetVencOption( sout_stream_t *p_stream, vlc_fourcc_t *p_codec_video,
+GetVencOption( vlc_object_t *p_object, vlc_fourcc_t *p_codec_video,
         const video_format_t *p_vid, int i_quality );
 
-std::string GetVencVPXOption( sout_stream_t * /* p_stream */,
+std::string GetVencVPXOption( vlc_object_t * /* p_object */,
                                       const video_format_t * /* p_vid */,
                                       int /* i_quality */ );
 
-std::string GetVencQSVH264Option( sout_stream_t * /* p_stream */,
+std::string GetVencQSVH264Option( vlc_object_t * /* p_object */,
                                          const video_format_t * /* p_vid */,
                                          int i_quality );
 
-std::string GetVencX264Option( sout_stream_t * /* p_stream */,
+std::string GetVencX264Option( vlc_object_t * /* p_object */,
                                       const video_format_t *p_vid,
                                       int i_quality );
 #ifdef __APPLE__
-std::string GetVencAvcodecVTOption( sout_stream_t * /* p_stream */,
+std::string GetVencAvcodecVTOption( vlc_object_t * /* p_object */,
                                            const video_format_t * p_vid,
                                            int i_quality );
 #endif
 
 struct venc_options
 {
-    std::string (*get_opt)( sout_stream_t *, const video_format_t *, int);
+    std::string (*get_opt)( vlc_object_t *, const video_format_t *, int);
 };
 
 std::map<vlc_fourcc_t, std::vector<venc_options>> opts = {
@@ -80,7 +82,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,
+GetVencOption( vlc_object_t *p_object, std::vector<vlc_fourcc_t> codecs,
         vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality )
 {
     for (vlc_fourcc_t codec : codecs) {
@@ -97,13 +99,13 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
             ssvenc << fourcc << ',';
 
             if( venc_opt.get_opt != NULL )
-                ssvenc << venc_opt.get_opt( p_stream, p_vid, i_quality ) << ',';
+                ssvenc << venc_opt.get_opt( p_object, p_vid, i_quality ) << ',';
 
             /* Test if a module can encode with the specified options / fmt_video. */
             ssout << "transcode{" << ssvenc.str() << "}:dummy";
 
             sout_stream_t *p_sout_test =
-                sout_StreamChainNew( VLC_OBJECT(p_stream), ssout.str().c_str(), NULL );
+                sout_StreamChainNew( p_object, ssout.str().c_str(), NULL );
 
             if( p_sout_test != NULL )
             {
@@ -131,7 +133,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 );
+                    msg_Dbg( p_object, "Converting video to %.4s", (const char*)&codec );
                     *out_codec = codec;
                     return ssvenc.str();
                 }
@@ -143,7 +145,7 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
 }
 
 std::string
-vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
+vlc_sout_renderer_GetVcodecOption(vlc_object_t *p_object,
         std::vector<vlc_fourcc_t> codecs,
         vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality)
 {
@@ -151,7 +153,7 @@ vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
     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, out_codec, p_vid, i_quality );
+    ssout << GetVencOption( p_object, codecs, out_codec, p_vid, i_quality );
 
     switch ( i_quality )
     {
@@ -167,21 +169,21 @@ vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
      || ( p_vid->i_frame_rate / p_vid->i_frame_rate_base ) > 30 )
     {
         /* Even force 24fps if the frame rate is unknown */
-        msg_Warn( p_stream, "lowering frame rate to 24fps" );
+        msg_Warn( p_object, "lowering frame rate to 24fps" );
         ssout << "fps=24,";
     }
 
     return ssout.str();
 }
 
-std::string GetVencVPXOption( sout_stream_t * /* p_stream */,
+std::string GetVencVPXOption( vlc_object_t * /* p_object */,
                                       const video_format_t * /* p_vid */,
                                       int /* i_quality */ )
 {
     return "venc=vpx{quality-mode=1}";
 }
 
-std::string GetVencQSVH264Option( sout_stream_t * /* p_stream */,
+std::string GetVencQSVH264Option( vlc_object_t * /* p_object */,
                                          const video_format_t * /* p_vid */,
                                          int i_quality )
 {
@@ -220,7 +222,7 @@ std::string GetVencQSVH264Option( sout_stream_t * /* p_stream */,
     return ssout.str();
 }
 
-std::string GetVencX264Option( sout_stream_t * /* p_stream */,
+std::string GetVencX264Option( vlc_object_t * /* p_object */,
                                       const video_format_t *p_vid,
                                       int i_quality )
 {
@@ -261,7 +263,7 @@ std::string GetVencX264Option( sout_stream_t * /* p_stream */,
 }
 
 #ifdef __APPLE__
-std::string GetVencAvcodecVTOption( sout_stream_t * /* p_stream */,
+std::string GetVencAvcodecVTOption( vlc_object_t * /* p_object */,
                                            const video_format_t * p_vid,
                                            int i_quality )
 {
diff --git a/modules/stream_out/renderer_common.hpp b/modules/stream_out/renderer_common.hpp
index 46d09716b4..4d5482857b 100644
--- a/modules/stream_out/renderer_common.hpp
+++ b/modules/stream_out/renderer_common.hpp
@@ -30,7 +30,6 @@
 #include <vector>
 
 #include <vlc_common.h>
-#include <vlc_sout.h>
 
 #define PERF_TEXT N_( "Performance warning" )
 #define PERF_LONGTEXT N_( "Display a performance warning when transcoding" )
@@ -79,7 +78,7 @@ static const int conversion_quality_list[] = {
 };
 
 std::string
-vlc_sout_renderer_GetVcodecOption(sout_stream_t *p_stream,
+vlc_sout_renderer_GetVcodecOption(vlc_object_t *object,
         std::vector<vlc_fourcc_t> codecs,
         vlc_fourcc_t *out_codec, const video_format_t *p_vid, int i_quality);
 
-- 
2.29.2



More information about the vlc-devel mailing list