[vlc-devel] [PATCH 10/13] transcode: clean the decoder output format before using it as the encoder input

Steve Lhomme robux4 at ycbcr.xyz
Mon Dec 23 16:49:34 CET 2019


The deocder input is cleaned once this way, but not after receiving the actual
format from the decoder.
---
 modules/stream_out/transcode/encoder/encoder.h | 5 +++++
 modules/stream_out/transcode/encoder/video.c   | 8 ++++----
 modules/stream_out/transcode/video.c           | 2 ++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/stream_out/transcode/encoder/encoder.h b/modules/stream_out/transcode/encoder/encoder.h
index 6b5581571c4..6f82f3afaad 100644
--- a/modules/stream_out/transcode/encoder/encoder.h
+++ b/modules/stream_out/transcode/encoder/encoder.h
@@ -90,6 +90,11 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
                                         const video_format_t *p_src,
                                         transcode_encoder_t *p_enc );
 
+void transcode_video_framerate_apply( const video_format_t *p_src,
+                                            video_format_t *p_dst );
+void transcode_video_sar_apply( const video_format_t *p_src,
+                                      video_format_t *p_dst );
+
 int transcode_encoder_audio_configure( const transcode_encoder_config_t *p_cfg,
                                        const audio_format_t *p_dec_out,
                                        transcode_encoder_t *p_enc, bool );
diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index 24cf478da89..5c3fe66522d 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -34,8 +34,8 @@
 #include "encoder.h"
 #include "encoder_priv.h"
 
-static void transcode_video_framerate_apply( const video_format_t *p_src,
-                                             video_format_t *p_dst )
+void transcode_video_framerate_apply( const video_format_t *p_src,
+                                            video_format_t *p_dst )
 {
     /* Handle frame rate conversion */
     if( !p_dst->i_frame_rate || !p_dst->i_frame_rate_base )
@@ -162,8 +162,8 @@ static void transcode_video_scale_apply( vlc_object_t *p_obj,
                      i_dst_visible_width, i_dst_visible_height );
 }
 
-static void transcode_video_sar_apply( const video_format_t *p_src,
-                                       video_format_t *p_dst )
+void transcode_video_sar_apply( const video_format_t *p_src,
+                                      video_format_t *p_dst )
 {
     /* Check whether a particular aspect ratio was requested */
     if( p_dst->i_sar_num <= 0 || p_dst->i_sar_den <= 0 )
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index a1e0199a156..ac3ed3b28a5 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -606,6 +606,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             }
 
             video_format_Copy( &id->decoder_out.video, &p_pic->format );
+            transcode_video_framerate_apply( &p_pic->format, &id->decoder_out.video );
+            transcode_video_sar_apply( &p_pic->format, &id->decoder_out.video );
             id->decoder_vctx_out = picture_GetVideoContext(p_pic);
 
             if( !transcode_video_filters_configured( id ) )
-- 
2.17.1



More information about the vlc-devel mailing list