[vlc-commits] access: bluray: store the whole fmt in es_pair

Francois Cartegnie git at videolan.org
Tue Oct 30 18:12:29 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct 16 19:05:37 2018 +0200| [3aa82819ea0938e5e8c8055a6fdbfe200034d066] | committer: Francois Cartegnie

access: bluray: store the whole fmt in es_pair

(cherry picked from commit ea7791ad14a65cdf7e44f2cb08674cb80104f5ae)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3aa82819ea0938e5e8c8055a6fdbfe200034d066
---

 modules/access/bluray.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index ca8cdbe403..b98083d1ba 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -203,22 +203,27 @@ struct  demux_sys_t
  */
 typedef struct
 {
-    int         i_pid;
+    es_format_t fmt;
     es_out_id_t *p_es;
 } es_pair_t;
 
-static bool es_pair_Add(vlc_array_t *p_array, int i_pid, es_out_id_t *p_es)
+static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
+                        es_out_id_t *p_es)
 {
     es_pair_t *p_pair = malloc(sizeof(*p_pair));
     if (likely(p_pair != NULL))
     {
-        p_pair->i_pid = i_pid;
         p_pair->p_es = p_es;
         if(vlc_array_append(p_array, p_pair) != VLC_SUCCESS)
         {
             free(p_pair);
             p_pair = NULL;
         }
+        else
+        {
+            es_format_Init(&p_pair->fmt, p_fmt->i_cat, p_fmt->i_codec);
+            es_format_Copy(&p_pair->fmt, p_fmt);
+        }
     }
     return p_pair != NULL;
 }
@@ -226,6 +231,7 @@ static bool es_pair_Add(vlc_array_t *p_array, int i_pid, es_out_id_t *p_es)
 static void es_pair_Remove(vlc_array_t *p_array, es_pair_t *p_pair)
 {
     vlc_array_remove(p_array, vlc_array_index_of_item(p_array, p_pair));
+    es_format_Clean(&p_pair->fmt);
     free(p_pair);
 }
 
@@ -244,7 +250,7 @@ static es_pair_t *getEsPair(vlc_array_t *p_array,
 
 static bool es_pair_compare_PID(const es_pair_t *p_pair, const void *p_pid)
 {
-    return p_pair->i_pid == *((const int *)p_pid);
+    return p_pair->fmt.i_id == *((const int *)p_pid);
 }
 
 static bool es_pair_compare_ES(const es_pair_t *p_pair, const void *p_es)
@@ -1120,7 +1126,7 @@ static es_out_id_t *bluray_esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
         if (p_pair == NULL)
         {
             msg_Info(p_demux, "Adding ES %d", p_fmt->i_id);
-            if (es_pair_Add(&esout_sys->es, p_fmt->i_id, p_es) && b_select)
+            if (es_pair_Add(&esout_sys->es, &fmt, p_es) && b_select)
             {
                 if (fmt.i_cat == AUDIO_ES) {
                     var_SetInteger( p_demux->p_input, "audio-es", p_fmt->i_id );



More information about the vlc-commits mailing list