Commit b85cf1a2 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Subtitle: do not dialog_Fatal when the subtitle was autodetected

When the subtitle is auto-detected, fail, complain, but do not block the
playback with annoying pop-up. This should fix the .txt subtitle issue.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0b59ba1b
......@@ -88,7 +88,8 @@ static void MRLSections( input_thread_t *, char *, int *, int *, int *, int *);
static input_source_t *InputSourceNew( input_thread_t *);
static int InputSourceInit( input_thread_t *, input_source_t *,
const char *, const char *psz_forced_demux );
const char *, const char *psz_forced_demux,
bool b_in_can_fail );
static void InputSourceClean( input_source_t * );
static void InputSourceMeta( input_thread_t *, input_source_t *, vlc_meta_t * );
......@@ -109,6 +110,7 @@ static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_atta
enum {
SUB_NOFLAG = 0x00,
SUB_FORCED = 0x01,
SUB_CANFAIL = 0x02,
};
static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, unsigned i_flags );
......@@ -1036,6 +1038,7 @@ static void LoadSubtitles( input_thread_t *p_input )
{
if( !psz_subtitle || strcmp( psz_subtitle, ppsz_subs[i] ) )
{
i_flags |= SUB_CANFAIL;
SubtitleAdd( p_input, ppsz_subs[i], i_flags );
i_flags = SUB_NOFLAG;
}
......@@ -1108,7 +1111,7 @@ static void LoadSlaves( input_thread_t *p_input )
msg_Dbg( p_input, "adding slave input '%s'", psz );
input_source_t *p_slave = InputSourceNew( p_input );
if( p_slave && !InputSourceInit( p_input, p_slave, psz, NULL ) )
if( p_slave && !InputSourceInit( p_input, p_slave, psz, NULL, false ) )
TAB_APPEND( p_input->p->i_slave, p_input->p->slave, p_slave );
else
free( p_slave );
......@@ -1239,7 +1242,7 @@ static int Init( input_thread_t * p_input )
/* */
if( InputSourceInit( p_input, &p_input->p->input,
p_input->p->p_item->psz_uri, NULL ) )
p_input->p->p_item->psz_uri, NULL, false ) )
{
goto error;
}
......@@ -2036,7 +2039,7 @@ static bool Control( input_thread_t *p_input,
{
input_source_t *slave = InputSourceNew( p_input );
if( slave && !InputSourceInit( p_input, slave, val.psz_string, NULL ) )
if( slave && !InputSourceInit( p_input, slave, val.psz_string, NULL, false ) )
{
vlc_meta_t *p_meta;
int64_t i_time;
......@@ -2323,7 +2326,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input )
*****************************************************************************/
static int InputSourceInit( input_thread_t *p_input,
input_source_t *in, const char *psz_mrl,
const char *psz_forced_demux )
const char *psz_forced_demux, bool b_in_can_fail )
{
const char *psz_access;
const char *psz_demux;
......@@ -2489,7 +2492,8 @@ static int InputSourceInit( input_thread_t *p_input,
{
msg_Err( p_input, "open of `%s' failed: %s", psz_mrl,
msg_StackMsg() );
dialog_Fatal( p_input, _("Your input can't be opened"),
if( !b_in_can_fail )
dialog_Fatal( p_input, _("Your input can't be opened"),
_("VLC is unable to open the MRL '%s'."
" Check the log for details."), psz_mrl );
}
......@@ -2608,10 +2612,11 @@ static int InputSourceInit( input_thread_t *p_input,
{
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
dialog_Fatal( VLC_OBJECT( p_input ),
_("VLC can't recognize the input's format"),
_("The format of '%s' cannot be detected. "
"Have a look at the log for details."), psz_mrl );
if( !b_in_can_fail )
dialog_Fatal( VLC_OBJECT( p_input ),
_("VLC can't recognize the input's format"),
_("The format of '%s' cannot be detected. "
"Have a look at the log for details."), psz_mrl );
}
goto error;
}
......@@ -3218,7 +3223,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, unsigned i
sub = InputSourceNew( p_input );
if( !sub || !url
|| InputSourceInit( p_input, sub, url, "subtitle" ) )
|| InputSourceInit( p_input, sub, url, "subtitle", (i_flags & SUB_CANFAIL) ) )
{
free( sub );
free( url );
......
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