[vlc-commits] Allow --sub-track to work with EIA-608 captions, and fix crash on exit

Devin Heitmueller git at videolan.org
Tue Sep 23 13:33:46 CEST 2014


vlc | branch: master | Devin Heitmueller <dheitmueller at kernellabs.com> | Sun Sep 21 12:54:54 2014 -0400| [caaac10c04a89379f0677319ef973c37d86890b5] | committer: Rafaël Carré

Allow --sub-track to work with EIA-608 captions, and fix crash on exit

Prior to this patch, if the user specified the --sub-track argument on
the command line, it would not work with MPEG2 streams that contain
EIA-608 closed captions.  It would also cause an abort() on exit.

The crash was because the various functions that select/unselect
streams would check for the p_master member, which isn't set until
after EsOutAdd().  The call to EsOutAdd itself though would call
EsSelect(), which would treat the ES as a regular subtitle stream
and cause a resource leak -- which would cause an abort at exit.

The other change actually makes --sub-track work with the special
case of EIA-608 captions.

Signed-off-by: Rafaël Carré <funman at videolan.org>

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

 src/input/es_out.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index dafaaec..6709bde 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1816,6 +1816,16 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
                         i_wanted = es->i_channel;
                 }
             }
+            else if ( es->fmt.i_codec == EsOutFourccClosedCaptions[0] ||
+                      es->fmt.i_codec == EsOutFourccClosedCaptions[1] ||
+                      es->fmt.i_codec == EsOutFourccClosedCaptions[2] ||
+                      es->fmt.i_codec == EsOutFourccClosedCaptions[3])
+            {
+                    /* We don't want to enable on initial create since p_master
+                       isn't set yet (otherwise we will think it's a standard
+                       ES_SUB stream and cause a resource leak) */
+                    return;
+            }
             else
             {
                 /* If there is no user preference, select the default subtitle 
@@ -2000,6 +2010,10 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
 
         /* */
         es->pb_cc_present[i] = true;
+
+        /* Enable if user specified on command line */
+        if (p_sys->i_sub_last == i)
+            EsOutSelect(out, es->pp_cc_es[i], true);
     }
 
     vlc_mutex_unlock( &p_sys->lock );



More information about the vlc-commits mailing list