Commit e19d5f53 authored by Rafaël Carré's avatar Rafaël Carré

blurayOpen(): factorize error case

parent a16e34d7
...@@ -95,6 +95,7 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -95,6 +95,7 @@ static int blurayOpen( vlc_object_t *object )
char *pos_title; char *pos_title;
int i_title = -1; int i_title = -1;
char bd_path[PATH_MAX]; char bd_path[PATH_MAX];
const char *error_msg = NULL;
if (strcmp(p_demux->psz_access, "bluray")) { if (strcmp(p_demux->psz_access, "bluray")) {
// TODO BDMV support, once we figure out what to do in libbluray // TODO BDMV support, once we figure out what to do in libbluray
...@@ -136,43 +137,34 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -136,43 +137,34 @@ static int blurayOpen( vlc_object_t *object )
/* AACS */ /* AACS */
if (disc_info->aacs_detected) { if (disc_info->aacs_detected) {
if (!disc_info->libaacs_detected) { if (!disc_info->libaacs_detected) {
dialog_Fatal (p_demux, _("Blu-Ray error"), error_msg = _("This Blu-Ray Disc needs a library for AACS decoding, "
_("This Blu-Ray Disc needs a library for AACS decoding, " "and your system does not have it.");
"and your system does not have it.")); goto error;
blurayClose(object);
return VLC_EGENERIC;
} }
if (!disc_info->aacs_handled) { if (!disc_info->aacs_handled) {
dialog_Fatal (p_demux, _("Blu-Ray error"), error_msg = _("Your system AACS decoding library does not work. "
_("Your system AACS decoding library does not work. " "Missing keys?");
"Missing keys?")); goto error;
blurayClose(object);
return VLC_EGENERIC;
} }
} }
/* BD+ */ /* BD+ */
if (disc_info->bdplus_detected) { if (disc_info->bdplus_detected) {
if (!disc_info->libbdplus_detected) { if (!disc_info->libbdplus_detected) {
dialog_Fatal (p_demux, _("Blu-Ray error"), error_msg = _("This Blu-Ray Disc needs a library for BD+ decoding, "
_("This Blu-Ray Disc needs a library for BD+ decoding, " "and your system does not have it.");
"and your system does not have it.")); goto error;
blurayClose(object);
return VLC_EGENERIC;
} }
if (!disc_info->bdplus_handled) { if (!disc_info->bdplus_handled) {
dialog_Fatal (p_demux, _("Blu-Ray error"), error_msg = _("Your system BD+ decoding library does not work. "
_("Your system BD+ decoding library does not work. " "Missing configuration?");
"Missing configuration?")); goto error;
blurayClose(object);
return VLC_EGENERIC;
} }
} }
/* Get titles and chapters */ /* Get titles and chapters */
if (blurayInitTitles(p_demux) != VLC_SUCCESS) { if (blurayInitTitles(p_demux) != VLC_SUCCESS) {
blurayClose(object); goto error;
return VLC_EGENERIC;
} }
/* get title request */ /* get title request */
...@@ -185,21 +177,25 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -185,21 +177,25 @@ static int blurayOpen( vlc_object_t *object )
/* set start title number */ /* set start title number */
if (bluraySetTitle(p_demux, i_title) != VLC_SUCCESS) { if (bluraySetTitle(p_demux, i_title) != VLC_SUCCESS) {
msg_Err( p_demux, "Could not set the title %d", i_title ); msg_Err( p_demux, "Could not set the title %d", i_title );
blurayClose(object); goto error;
return VLC_EGENERIC;
} }
p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out); p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
if (!p_sys->p_parser) { if (!p_sys->p_parser) {
msg_Err(p_demux, "Failed to create TS demuxer"); msg_Err(p_demux, "Failed to create TS demuxer");
blurayClose(object); goto error;
return VLC_EGENERIC;
} }
p_demux->pf_control = blurayControl; p_demux->pf_control = blurayControl;
p_demux->pf_demux = blurayDemux; p_demux->pf_demux = blurayDemux;
return VLC_SUCCESS; return VLC_SUCCESS;
error:
if (error_msg)
dialog_Fatal(p_demux, _("Blu-Ray error"), "%s", error_msg);
blurayClose(object);
return VLC_EGENERIC;
} }
......
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