[vlc-devel] [PATCH] decoder: don't pass always 1 value

Rémi Denis-Courmont remi at remlab.net
Tue Sep 3 15:25:49 CEST 2019


Hi,

The callback needs to be renamed then. This may save one parameter, but it's rather obscure.

Le 3 septembre 2019 12:29:34 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>If we need to pass new stats where the decoded amount didn't change we
>can
>always reintroduce it.
>---
> src/input/decoder.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
>diff --git a/src/input/decoder.c b/src/input/decoder.c
>index e28b179212..63f858c397 100644
>--- a/src/input/decoder.c
>+++ b/src/input/decoder.c
>@@ -78,7 +78,7 @@ struct decoder_owner
> 
>     vlc_thread_t     thread;
> 
>-    void (*pf_update_stat)( struct decoder_owner *, unsigned decoded,
>unsigned lost );
>+    void (*pf_update_stat)( struct decoder_owner *, unsigned lost );
> 
>/* Some decoders require already packetized data (ie. not truncated) */
>     decoder_t *p_packetizer;
>@@ -1056,7 +1056,7 @@ static int DecoderPlayVideo( struct decoder_owner
>*p_owner, picture_t *p_picture
> }
> 
> static void DecoderUpdateStatVideo( struct decoder_owner *p_owner,
>-                                    unsigned decoded, unsigned lost )
>+                                    unsigned lost )
> {
>     unsigned displayed = 0;
> 
>@@ -1068,7 +1068,7 @@ static void DecoderUpdateStatVideo( struct
>decoder_owner *p_owner,
>         lost += vout_lost;
>     }
> 
>-    decoder_Notify(p_owner, on_new_video_stats, decoded, lost,
>displayed);
>+    decoder_Notify(p_owner, on_new_video_stats, 1, lost, displayed);
> }
> 
> static void DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
>@@ -1078,7 +1078,7 @@ static void DecoderQueueVideo( decoder_t *p_dec,
>picture_t *p_pic )
> 
>     int success = DecoderPlayVideo( p_owner, p_pic );
> 
>-    p_owner->pf_update_stat( p_owner, 1, success != VLC_SUCCESS ? 1 :
>0 );
>+    p_owner->pf_update_stat( p_owner, success != VLC_SUCCESS ? 1 : 0
>);
> }
> 
> static int thumbnailer_update_format( decoder_t *p_dec )
>@@ -1181,7 +1181,7 @@ static int DecoderPlayAudio( struct decoder_owner
>*p_owner, block_t *p_audio )
> }
> 
> static void DecoderUpdateStatAudio( struct decoder_owner *p_owner,
>-                                    unsigned decoded, unsigned lost )
>+                                    unsigned lost )
> {
>     unsigned played = 0;
> 
>@@ -1193,7 +1193,7 @@ static void DecoderUpdateStatAudio( struct
>decoder_owner *p_owner,
>         lost += aout_lost;
>     }
> 
>-    decoder_Notify(p_owner, on_new_audio_stats, decoded, lost,
>played);
>+    decoder_Notify(p_owner, on_new_audio_stats, 1, lost, played);
> }
> 
> static void DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
>@@ -1202,7 +1202,7 @@ static void DecoderQueueAudio( decoder_t *p_dec,
>block_t *p_aout_buf )
> 
>     int success = DecoderPlayAudio( p_owner, p_aout_buf );
> 
>-    p_owner->pf_update_stat( p_owner, 1, success != VLC_SUCCESS ? 1 :
>0 );
>+    p_owner->pf_update_stat( p_owner, success != VLC_SUCCESS ? 1 : 0
>);
> }
> 
>static void DecoderPlaySpu( struct decoder_owner *p_owner, subpicture_t
>*p_subpic )
>@@ -1240,9 +1240,9 @@ static void DecoderPlaySpu( struct decoder_owner
>*p_owner, subpicture_t *p_subpi
> }
> 
> static void DecoderUpdateStatSpu( struct decoder_owner *p_owner,
>-                                  unsigned decoded, unsigned lost )
>+                                  unsigned lost )
> {
>-    (void) p_owner; (void) decoded; (void) lost;
>+    (void) p_owner; (void) lost;
> }
> 
> static void DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
>@@ -1278,7 +1278,7 @@ static void DecoderDecode( struct decoder_owner
>*p_owner, block_t *p_block )
>     switch( ret )
>     {
>         case VLCDEC_SUCCESS:
>-            p_owner->pf_update_stat( p_owner, 1, 0 );
>+            p_owner->pf_update_stat( p_owner, 0 );
>             break;
>         case VLCDEC_ECRITICAL:
>             p_owner->error = true;
>-- 
>2.17.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190903/b2e5817f/attachment.html>


More information about the vlc-devel mailing list