[vlc-devel] [PATCH 24/26] transcode: rename the video encoder to video_encoder

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 18 08:33:03 UTC 2021


In line with the audio and SPU encoder naming.
---
 modules/stream_out/transcode/transcode.h |  2 +-
 modules/stream_out/transcode/video.c     | 48 ++++++++++++------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index c5cb6a3cea0..b5d4867e52e 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -141,7 +141,7 @@ struct sout_stream_id_sys_t
     /* Encoder */
     const transcode_encoder_config_t *p_enccfg;
     union {
-        transcode_encoder_t *encoder;
+        transcode_encoder_t *video_encoder;
         encoder_t           *audio_encoder;
         encoder_t           *spu_encoder;
     };
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 69664c84330..b62d9528c47 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -105,7 +105,7 @@ static int video_update_format_decoder( decoder_t *p_dec, vlc_video_context *vct
 
     vlc_mutex_lock( &id->fifo.lock );
 
-    const es_format_t *p_enc_in = transcode_encoder_format_in( id->encoder );
+    const es_format_t *p_enc_in = transcode_encoder_format_in( id->video_encoder );
 
     if( p_enc_in->i_codec == p_dec->fmt_out.i_codec ||
         video_format_IsSimilar( &id->decoder_out.video, &p_dec->fmt_out.video ) )
@@ -243,8 +243,8 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
     if ( unlikely(p_enc_owner == NULL))
        goto error;
 
-    id->encoder = transcode_encoder_new( &p_enc_owner->enc, &encoder_tested_fmt_in );
-    if( !id->encoder )
+    id->video_encoder = transcode_encoder_new( &p_enc_owner->enc, &encoder_tested_fmt_in );
+    if( !id->video_encoder )
        goto error;
 
     p_enc_owner->id = id;
@@ -322,7 +322,7 @@ static int transcode_video_filters_init( sout_stream_t *p_stream,
     }
 
     /* Update encoder so it matches filters output */
-    transcode_encoder_update_format_in( id->encoder, p_src, id->p_enccfg );
+    transcode_encoder_update_format_in( id->video_encoder, p_src, id->p_enccfg );
 
     /* SPU Sources */
     if( p_cfg->video.psz_spu_sources )
@@ -337,8 +337,8 @@ static int transcode_video_filters_init( sout_stream_t *p_stream,
 void transcode_video_clean( sout_stream_id_sys_t *id )
 {
     /* Close encoder */
-    transcode_encoder_close( id->encoder );
-    transcode_encoder_delete( id->encoder );
+    transcode_encoder_close( id->video_encoder );
+    transcode_encoder_delete( id->video_encoder );
 
     es_format_Clean( &id->decoder_out );
 
@@ -405,7 +405,7 @@ static picture_t * RenderSubpictures( sout_stream_id_sys_t *id, picture_t *p_pic
         {
             /* We can't modify the picture, we need to duplicate it,
                  * in this point the picture is already p_encoder->fmt.in format*/
-            picture_t *p_tmp = video_new_buffer_encoder( id->encoder );
+            picture_t *p_tmp = video_new_buffer_encoder( id->video_encoder );
             if( likely( p_tmp ) )
             {
                 picture_Copy( p_tmp, p_pic );
@@ -459,10 +459,10 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             continue;
         }
 
-        if( p_pic && ( unlikely(!transcode_encoder_opened(id->encoder)) ||
+        if( p_pic && ( unlikely(!transcode_encoder_opened(id->video_encoder)) ||
               !video_format_IsSimilar( &id->decoder_out.video, &p_pic->format ) ) )
         {
-            if( !transcode_encoder_opened(id->encoder) ) /* Configure Encoder input/output */
+            if( !transcode_encoder_opened(id->video_encoder) ) /* Configure Encoder input/output */
             {
                 assert( !id->p_f_chain && !id->p_uf_chain );
                 transcode_encoder_video_configure( VLC_OBJECT(p_stream),
@@ -470,7 +470,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                                                    id->p_enccfg,
                                                    &p_pic->format,
                                                    picture_GetVideoContext(p_pic),
-                                                   id->encoder );
+                                                   id->video_encoder );
                 /* will be opened below */
             }
             else /* picture format has changed */
@@ -501,7 +501,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                                                  (id->p_enccfg->video.fps.num > 0),
                                                  &id->decoder_out,
                                                  picture_GetVideoContext(p_pic),
-                                                 transcode_encoder_format_in( id->encoder ),
+                                                 transcode_encoder_format_in( id->video_encoder ),
                                                  id ) != VLC_SUCCESS )
                     goto error;
             }
@@ -510,12 +510,12 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
              * a converter in p_final_conv_static. The encoder will override it
              * if it needs any different format or chroma. */
             es_format_t filter_fmt_out;
-            es_format_Copy( &filter_fmt_out, transcode_encoder_format_in( id->encoder ) );
-            bool is_encoder_open = transcode_encoder_opened( id->encoder );
+            es_format_Copy( &filter_fmt_out, transcode_encoder_format_in( id->video_encoder ) );
+            bool is_encoder_open = transcode_encoder_opened( id->video_encoder );
 
             /* Start missing encoder */
             if( !is_encoder_open &&
-                transcode_encoder_open( id->encoder, id->p_enccfg ) != VLC_SUCCESS )
+                transcode_encoder_open( id->video_encoder, id->p_enccfg ) != VLC_SUCCESS )
             {
                 msg_Err( p_stream, "cannot find video encoder (module:%s fourcc:%4.4s). "
                                    "Take a look few lines earlier to see possible reason.",
@@ -525,7 +525,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             }
 
             /* The fmt_in may have been overriden by the encoder. */
-            const es_format_t *encoder_fmt_in = transcode_encoder_format_in( id->encoder );
+            const es_format_t *encoder_fmt_in = transcode_encoder_format_in( id->video_encoder );
 
             /* check if we need to add a converter between last user filter and encoder. */
             if( filter_fmt_out.i_codec != encoder_fmt_in->i_codec ||
@@ -557,14 +557,14 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             es_format_Clean(&filter_fmt_out);
 
             msg_Dbg( p_stream, "destination (after video filters) %ux%u",
-                               transcode_encoder_format_in( id->encoder )->video.i_width,
-                               transcode_encoder_format_in( id->encoder )->video.i_height );
+                               transcode_encoder_format_in( id->video_encoder )->video.i_width,
+                               transcode_encoder_format_in( id->video_encoder )->video.i_height );
 
             if( !id->downstream_id )
                 id->downstream_id =
                     id->pf_transcode_downstream_add( p_stream,
                                                      &id->p_decoder->fmt_in,
-                                                     transcode_encoder_format_out( id->encoder ) );
+                                                     transcode_encoder_format_out( id->video_encoder ) );
             if( !id->downstream_id )
             {
                 msg_Err( p_stream, "cannot output transcoded stream %4.4s",
@@ -606,7 +606,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 
                 if( p_in )
                 {
-                    block_t *p_encoded = transcode_encoder_encode( id->encoder, p_in );
+                    block_t *p_encoded = transcode_encoder_encode( id->video_encoder, p_in );
                     if( p_encoded )
                         block_ChainAppend( out, p_encoded );
                     picture_Release( p_in );
@@ -617,9 +617,9 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         if( b_eos )
         {
             msg_Info( p_stream, "Drain/restart on EOS" );
-            if( transcode_encoder_drain( id->encoder, out ) != VLC_SUCCESS )
+            if( transcode_encoder_drain( id->video_encoder, out ) != VLC_SUCCESS )
                 goto error;
-            transcode_encoder_close( id->encoder );
+            transcode_encoder_close( id->video_encoder );
             /* Close filters */
             transcode_remove_filters( &id->p_f_chain );
             transcode_remove_filters( &id->p_uf_chain );
@@ -638,14 +638,14 @@ error:
     if( id->p_enccfg->video.threads.i_count >= 1 )
     {
         /* Pick up any return data the encoder thread wants to output. */
-        block_ChainAppend( out, transcode_encoder_get_output_async( id->encoder ) );
+        block_ChainAppend( out, transcode_encoder_get_output_async( id->video_encoder ) );
     }
 
     /* Drain encoder */
-    if( unlikely( !id->b_error && in == NULL ) && transcode_encoder_opened( id->encoder ) )
+    if( unlikely( !id->b_error && in == NULL ) && transcode_encoder_opened( id->video_encoder ) )
     {
         msg_Dbg( p_stream, "Flushing thread and waiting that");
-        if( transcode_encoder_drain( id->encoder, out ) == VLC_SUCCESS )
+        if( transcode_encoder_drain( id->video_encoder, out ) == VLC_SUCCESS )
             msg_Dbg( p_stream, "Flushing done");
         else
             msg_Warn( p_stream, "Flushing failed");
-- 
2.29.2



More information about the vlc-devel mailing list