[vlc-devel] [PATCH 13/13] decoder: allow empty video.format_update to be used

Steve Lhomme robux4 at ycbcr.xyz
Tue Feb 19 10:38:26 CET 2019


For now the cleaned fmt_out is not used in those case. The same way as before.

The thumbnailer was setting the output i_chroma explictly but it's now done all
the time in decoder_UpdateVideoFormat.

It may be used to allocate the decoder pool (which doesn't currently exist for
those decoder owners).
---
 src/input/decoder.c         | 7 -------
 src/input/decoder_helpers.c | 6 ++++--
 src/misc/image.c            | 6 ------
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index c4350fa785..f7edf16607 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1094,12 +1094,6 @@ static void DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
     p_owner->pf_update_stat( p_owner, 1, i_lost );
 }
 
-static int thumbnailer_update_format( decoder_t *p_dec )
-{
-    VLC_UNUSED(p_dec);
-    return 0;
-}
-
 static picture_t *thumbnailer_buffer_new( decoder_t *p_dec )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
@@ -1697,7 +1691,6 @@ static const struct decoder_owner_callbacks dec_video_cbs =
 static const struct decoder_owner_callbacks dec_thumbnailer_cbs =
 {
     .video = {
-        .format_update = thumbnailer_update_format,
         .buffer_new = thumbnailer_buffer_new,
         .queue = DecoderQueueThumbnail,
     },
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 9e77f2d31c..2397e115fe 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -76,8 +76,7 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
 {
     video_format_t fmt_out;
     vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
-    if ( unlikely(dec->fmt_in.i_cat != VIDEO_ES || dec->cbs == NULL ||
-                  dec->cbs->video.format_update == NULL) )
+    if ( unlikely(dec->fmt_in.i_cat != VIDEO_ES || dec->cbs == NULL) )
         return -1;
 
     if( !dec->fmt_out.video.i_width || !dec->fmt_out.video.i_height ||
@@ -158,6 +157,9 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
                      fmt_out.i_sar_num, fmt_out.i_sar_den, 50000 );
     }
 
+    if ( dec->cbs->video.format_update == NULL )
+        return 0;
+
     video_format_t original = dec->fmt_out.video;
     dec->fmt_out.video = fmt_out;
     int err = dec->cbs->video.format_update( dec );
diff --git a/src/misc/image.c b/src/misc/image.c
index 0c5fb9a384..4b2203b1eb 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -650,11 +650,6 @@ vlc_fourcc_t image_Mime2Fourcc( const char *psz_mime )
     return 0;
 }
 
-static int video_update_format( decoder_t *p_dec )
-{
-    return 0;
-}
-
 static picture_t *video_new_buffer( decoder_t *p_dec )
 {
     return picture_NewFromFormat( &p_dec->fmt_out.video );
@@ -676,7 +671,6 @@ static decoder_t *CreateDecoder( image_handler_t *p_image, const es_format_t *fm
     static const struct decoder_owner_callbacks dec_cbs =
     {
         .video = {
-            .format_update = video_update_format,
             .buffer_new = video_new_buffer,
             .queue = ImageQueueVideo,
         },
-- 
2.17.1



More information about the vlc-devel mailing list