Commit caaac10c authored by Devin Heitmueller's avatar Devin Heitmueller Committed by 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: default avatarRafaël Carré <funman@videolan.org>
parent 26258915
...@@ -1816,6 +1816,16 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force ) ...@@ -1816,6 +1816,16 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
i_wanted = es->i_channel; 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 else
{ {
/* If there is no user preference, select the default subtitle /* 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 ) ...@@ -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; 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 ); vlc_mutex_unlock( &p_sys->lock );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment