[vlc-commits] sout: transcode: set the decoder video context in the encoder

Steve Lhomme git at videolan.org
Wed Jan 8 12:47:32 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 24 14:21:21 2019 +0200| [97fdf14824e6bd906b318c9bd243c44bba590800] | committer: Steve Lhomme

sout: transcode: set the decoder video context in the encoder

The video context matches the video format used in the same call.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=97fdf14824e6bd906b318c9bd243c44bba590800
---

 include/vlc_codec.h                            | 1 +
 modules/stream_out/transcode/encoder/encoder.h | 1 +
 modules/stream_out/transcode/encoder/video.c   | 3 +++
 modules/stream_out/transcode/transcode.h       | 1 +
 modules/stream_out/transcode/video.c           | 3 ++-
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index d8503a2531..6a91d4379d 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -250,6 +250,7 @@ struct encoder_t
 
     /* Properties of the input data fed to the encoder */
     es_format_t         fmt_in;
+    vlc_video_context   *vctx_in; /* for video */
 
     /* Properties of the output of the encoder */
     es_format_t         fmt_out;
diff --git a/modules/stream_out/transcode/encoder/encoder.h b/modules/stream_out/transcode/encoder/encoder.h
index 6f82f3afaa..30a8354770 100644
--- a/modules/stream_out/transcode/encoder/encoder.h
+++ b/modules/stream_out/transcode/encoder/encoder.h
@@ -88,6 +88,7 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
                                         const video_format_t *p_dec_out,
                                         const transcode_encoder_config_t *p_cfg,
                                         const video_format_t *p_src,
+                                        vlc_video_context *vctx_in,
                                         transcode_encoder_t *p_enc );
 
 void transcode_video_framerate_apply( const video_format_t *p_src,
diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index 5c3fe66522..85d323f09b 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -215,6 +215,7 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
                                         const video_format_t *p_dec_out,
                                         const transcode_encoder_config_t *p_cfg,
                                         const video_format_t *p_src,
+                                        vlc_video_context *vctx_in,
                                         transcode_encoder_t *p_enc )
 {
     video_format_t *p_enc_in = &p_enc->p_encoder->fmt_in.video;
@@ -260,6 +261,8 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
              p_enc_out->i_sar_num * p_enc_out->i_width,
              p_enc_out->i_sar_den * p_enc_out->i_height );
 
+    p_enc->p_encoder->vctx_in = vctx_in;
+
     /* Keep colorspace etc info along */
     p_enc_out->space     = p_src->space;
     p_enc_out->transfer  = p_src->transfer;
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index 3090bbb4f8..6e4c4f3291 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -129,6 +129,7 @@ struct sout_stream_id_sys_t
              vlc_blender_t   *p_spu_blender;
              spu_t           *p_spu;
              vlc_decoder_device *dec_dev;
+             vlc_video_context *enc_vctx_in;
          };
          struct
          {
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ac3ed3b28a..8453fb70f0 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -582,7 +582,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                 transcode_encoder_video_configure( VLC_OBJECT(p_stream),
                                                    &id->p_decoder->fmt_out.video,
                                                    id->p_enccfg,
-                                                   filtered_video_format( id, p_pic ),
+                                                   &p_pic->format,
+                                                   picture_GetVideoContext(p_pic),
                                                    id->encoder );
                 /* will be opened below */
             }



More information about the vlc-commits mailing list