[vlc-commits] es_out: prevent fmt update with != i_id

Thomas Guillem git at videolan.org
Mon Aug 20 13:44:28 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Aug 17 13:42:34 2018 +0200| [2a7c1f7d9735ad6b27e3da44dad31869afb6b521] | committer: Thomas Guillem

es_out: prevent fmt update with != i_id

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

 include/vlc_es_out.h | 5 +++--
 src/input/es_out.c   | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 627b1c5494..83add54f3f 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -64,8 +64,9 @@ enum es_out_query_e
     ES_OUT_SET_GROUP_PCR,       /* arg1= int i_group, arg2=vlc_tick_t i_pcr(microsecond!)*/
     ES_OUT_RESET_PCR,           /* no arg */
 
-    /* Try not to use this one as it is a bit hacky */
-    ES_OUT_SET_ES_FMT,         /* arg1= es_out_id_t* arg2=es_format_t* */
+    /* This will update the fmt, drain and restart the decoder (if any).
+     * The new fmt must have the same i_cat and i_id. */
+    ES_OUT_SET_ES_FMT,         /* arg1= es_out_id_t* arg2=es_format_t* res=can fail */
 
     /* Allow preroll of data (data with dts/pts < i_pts for all ES will be decoded but not displayed */
     ES_OUT_SET_NEXT_DISPLAY_TIME,       /* arg1=int64_t i_pts(microsecond) */
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 000cad3f97..056c60d1ec 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2633,7 +2633,8 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
     {
         es_out_id_t *es = va_arg( args, es_out_id_t * );
         es_format_t *p_fmt = va_arg( args, es_format_t * );
-        if( es == NULL || es->fmt.i_cat != p_fmt->i_cat )
+        if( es == NULL || es->fmt.i_cat != p_fmt->i_cat
+         || es->fmt.i_id != p_fmt->i_id )
             return VLC_EGENERIC;
 
         es_format_Clean( &es->fmt );



More information about the vlc-commits mailing list