[vlc-devel] [PATCH 20/26] transcode: don't use a generic API for the audio/video encoder test

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 18 08:32:59 UTC 2021


In the end the generic structure is not even used, an encoder_t was already
used.
---
 modules/stream_out/transcode/audio.c          |  2 +-
 .../stream_out/transcode/encoder/encoder.c    | 21 -------------------
 .../stream_out/transcode/encoder/encoder.h    |  7 ++++++-
 .../transcode/encoder/encoder_priv.h          | 10 ---------
 modules/stream_out/transcode/video.c          |  2 +-
 5 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 899d650a3a5..ba481a2cf97 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -165,7 +165,7 @@ int transcode_audio_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
      * This should be enough to initialize the encoder for the first time (it
      * will be reloaded when all informations from the decoder are available).
      * */
-    if( transcode_encoder_test( sout_EncoderCreate(p_stream, sizeof(encoder_t),
+    if( transcode_encoder_audio_test( sout_EncoderCreate(p_stream, sizeof(encoder_t),
                                                    &id->decoder_out),
                                 id->p_enccfg,
                                 id->p_decoder->fmt_out.i_codec,
diff --git a/modules/stream_out/transcode/encoder/encoder.c b/modules/stream_out/transcode/encoder/encoder.c
index 1d953c0a578..71698a01298 100644
--- a/modules/stream_out/transcode/encoder/encoder.c
+++ b/modules/stream_out/transcode/encoder/encoder.c
@@ -214,24 +214,3 @@ int transcode_encoder_drain( transcode_encoder_t *p_enc, block_t **out )
             return VLC_EGENERIC;
     }
 }
-
-int transcode_encoder_test( encoder_t *p_encoder,
-                            const transcode_encoder_config_t *p_cfg,
-                            vlc_fourcc_t i_codec_in,
-                            es_format_t *p_enc_wanted_in )
-{
-    if( !p_encoder )
-        return VLC_EGENERIC;
-
-    switch ( p_encoder->fmt_in.i_cat )
-    {
-        case VIDEO_ES:
-            return transcode_encoder_video_test( p_encoder, p_cfg,
-                                                 i_codec_in, p_enc_wanted_in );
-        case AUDIO_ES:
-            return transcode_encoder_audio_test( p_encoder, p_cfg,
-                                                 i_codec_in, p_enc_wanted_in );
-        default:
-            return VLC_EGENERIC;
-    }
-}
diff --git a/modules/stream_out/transcode/encoder/encoder.h b/modules/stream_out/transcode/encoder/encoder.h
index 1b20fb9510e..40265eae24f 100644
--- a/modules/stream_out/transcode/encoder/encoder.h
+++ b/modules/stream_out/transcode/encoder/encoder.h
@@ -79,7 +79,7 @@ bool transcode_encoder_opened( const transcode_encoder_t * );
 int transcode_encoder_open( transcode_encoder_t *, const transcode_encoder_config_t * );
 int transcode_encoder_drain( transcode_encoder_t *, block_t ** );
 
-int transcode_encoder_test( encoder_t *p_encoder,
+int transcode_encoder_video_test( encoder_t *p_encoder,
                             const transcode_encoder_config_t *p_cfg,
                             vlc_fourcc_t i_codec_in,
                             es_format_t *p_enc_wanted_in );
@@ -99,6 +99,11 @@ void transcode_video_framerate_apply( const video_format_t *p_src,
 void transcode_video_sar_apply( const video_format_t *p_src,
                                       video_format_t *p_dst );
 
+int transcode_encoder_audio_test( encoder_t *p_encoder,
+                            const transcode_encoder_config_t *p_cfg,
+                            vlc_fourcc_t i_codec_in,
+                            es_format_t *p_enc_wanted_in );
+
 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/encoder_priv.h b/modules/stream_out/transcode/encoder/encoder_priv.h
index b5f9bf6d2e0..7559fc4fb64 100644
--- a/modules/stream_out/transcode/encoder/encoder_priv.h
+++ b/modules/stream_out/transcode/encoder/encoder_priv.h
@@ -48,13 +48,3 @@ block_t * transcode_encoder_spu_encode( transcode_encoder_t *p_enc, subpicture_t
 
 int transcode_encoder_audio_drain( transcode_encoder_t *p_enc, block_t **out );
 int transcode_encoder_video_drain( transcode_encoder_t *p_enc, block_t **out );
-
-int transcode_encoder_video_test( encoder_t *p_encoder,
-                                  const transcode_encoder_config_t *p_cfg,
-                                  vlc_fourcc_t i_codec_in,
-                                  es_format_t *p_enc_wanted_in );
-
-int transcode_encoder_audio_test( encoder_t *p_encoder,
-                                  const transcode_encoder_config_t *p_cfg,
-                                  vlc_fourcc_t i_codec_in,
-                                  es_format_t *p_enc_wanted_in );
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index a434c759c30..69664c84330 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -231,7 +231,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
     p_enc_owner->id = id;
     p_enc_owner->enc.cbs = &encoder_video_transcode_cbs;
 
-    if( transcode_encoder_test( &p_enc_owner->enc,
+    if( transcode_encoder_video_test( &p_enc_owner->enc,
                                 id->p_enccfg,
                                 id->p_decoder->fmt_out.i_codec,
                                 &encoder_tested_fmt_in ) )
-- 
2.29.2



More information about the vlc-devel mailing list