mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
resindvd: Don't open all VTS ifo at the start
Load each VTS ifo the first time the disc enters that VTS, rather than scanning them all at the start.
This commit is contained in:
parent
a5fbb123ca
commit
77aefd5870
1 changed files with 33 additions and 20 deletions
|
@ -421,7 +421,6 @@ fail:
|
||||||
static gboolean
|
static gboolean
|
||||||
read_vts_info (resinDvdSrc * src)
|
read_vts_info (resinDvdSrc * src)
|
||||||
{
|
{
|
||||||
gint i;
|
|
||||||
gint n_vts;
|
gint n_vts;
|
||||||
|
|
||||||
if (src->vts_attrs) {
|
if (src->vts_attrs) {
|
||||||
|
@ -450,28 +449,48 @@ read_vts_info (resinDvdSrc * src)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
g_array_set_size (src->vts_attrs, n_vts + 1);
|
g_array_set_size (src->vts_attrs, n_vts + 1);
|
||||||
|
|
||||||
for (i = 1; i <= n_vts; i++) {
|
return TRUE;
|
||||||
ifo_handle_t *ifo = ifoOpen (src->dvdread, i);
|
}
|
||||||
|
|
||||||
|
static vtsi_mat_t *
|
||||||
|
get_vts_attr (resinDvdSrc * src, gint n)
|
||||||
|
{
|
||||||
|
vtsi_mat_t *vts_attr;
|
||||||
|
|
||||||
|
if (src->vts_attrs == NULL || n >= src->vts_attrs->len) {
|
||||||
|
if (src->vts_attrs)
|
||||||
|
GST_ERROR_OBJECT (src, "No stream info for VTS %d (have %d)", n,
|
||||||
|
src->vts_attrs->len);
|
||||||
|
else
|
||||||
|
GST_ERROR_OBJECT (src, "No stream info");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
vts_attr = &g_array_index (src->vts_attrs, vtsi_mat_t, src->vts_n);
|
||||||
|
|
||||||
|
/* Check if we have read this VTS ifo yet */
|
||||||
|
if (vts_attr->vtsm_vobs == 0) {
|
||||||
|
ifo_handle_t *ifo = ifoOpen (src->dvdread, n);
|
||||||
|
|
||||||
if (!ifo) {
|
if (!ifo) {
|
||||||
GST_ERROR ("Can't open VTS %d", i);
|
GST_ERROR ("Can't open VTS %d", n);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG ("VTS %d, Menu has %d audio %d subpictures. "
|
GST_DEBUG ("VTS %d, Menu has %d audio %d subpictures. "
|
||||||
"Title has %d and %d", i,
|
"Title has %d and %d", n,
|
||||||
ifo->vtsi_mat->nr_of_vtsm_audio_streams,
|
ifo->vtsi_mat->nr_of_vtsm_audio_streams,
|
||||||
ifo->vtsi_mat->nr_of_vtsm_subp_streams,
|
ifo->vtsi_mat->nr_of_vtsm_subp_streams,
|
||||||
ifo->vtsi_mat->nr_of_vts_audio_streams,
|
ifo->vtsi_mat->nr_of_vts_audio_streams,
|
||||||
ifo->vtsi_mat->nr_of_vts_subp_streams);
|
ifo->vtsi_mat->nr_of_vts_subp_streams);
|
||||||
|
|
||||||
memcpy (&g_array_index (src->vts_attrs, vtsi_mat_t, i),
|
memcpy (&g_array_index (src->vts_attrs, vtsi_mat_t, n),
|
||||||
ifo->vtsi_mat, sizeof (vtsi_mat_t));
|
ifo->vtsi_mat, sizeof (vtsi_mat_t));
|
||||||
|
|
||||||
ifoClose (ifo);
|
ifoClose (ifo);
|
||||||
}
|
};
|
||||||
|
|
||||||
return TRUE;
|
return vts_attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -1646,15 +1665,6 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
|
||||||
gboolean have_audio;
|
gboolean have_audio;
|
||||||
gboolean have_subp;
|
gboolean have_subp;
|
||||||
|
|
||||||
if (src->vts_attrs == NULL || src->vts_n >= src->vts_attrs->len) {
|
|
||||||
if (src->vts_attrs)
|
|
||||||
GST_ERROR_OBJECT (src, "No stream info for VTS %d (have %d)", src->vts_n,
|
|
||||||
src->vts_attrs->len);
|
|
||||||
else
|
|
||||||
GST_ERROR_OBJECT (src, "No stream info");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src->vts_n == 0) {
|
if (src->vts_n == 0) {
|
||||||
/* VMGM info */
|
/* VMGM info */
|
||||||
vts_attr = NULL;
|
vts_attr = NULL;
|
||||||
|
@ -1665,7 +1675,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
|
||||||
n_subp = MIN (1, src->vmgm_attr.nr_of_vmgm_subp_streams);
|
n_subp = MIN (1, src->vmgm_attr.nr_of_vmgm_subp_streams);
|
||||||
} else if (src->in_menu) {
|
} else if (src->in_menu) {
|
||||||
/* VTSM attrs */
|
/* VTSM attrs */
|
||||||
vts_attr = &g_array_index (src->vts_attrs, vtsi_mat_t, src->vts_n);
|
vts_attr = get_vts_attr (src, src->vts_n);
|
||||||
v_attr = &vts_attr->vtsm_video_attr;
|
v_attr = &vts_attr->vtsm_video_attr;
|
||||||
a_attrs = &vts_attr->vtsm_audio_attr;
|
a_attrs = &vts_attr->vtsm_audio_attr;
|
||||||
n_audio = vts_attr->nr_of_vtsm_audio_streams;
|
n_audio = vts_attr->nr_of_vtsm_audio_streams;
|
||||||
|
@ -1673,7 +1683,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
|
||||||
n_subp = vts_attr->nr_of_vtsm_subp_streams;
|
n_subp = vts_attr->nr_of_vtsm_subp_streams;
|
||||||
} else {
|
} else {
|
||||||
/* VTS domain */
|
/* VTS domain */
|
||||||
vts_attr = &g_array_index (src->vts_attrs, vtsi_mat_t, src->vts_n);
|
vts_attr = get_vts_attr (src, src->vts_n);
|
||||||
v_attr = &vts_attr->vts_video_attr;
|
v_attr = &vts_attr->vts_video_attr;
|
||||||
a_attrs = vts_attr->vts_audio_attr;
|
a_attrs = vts_attr->vts_audio_attr;
|
||||||
n_audio = vts_attr->nr_of_vts_audio_streams;
|
n_audio = vts_attr->nr_of_vts_audio_streams;
|
||||||
|
@ -1681,6 +1691,9 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
|
||||||
n_subp = vts_attr->nr_of_vts_subp_streams;
|
n_subp = vts_attr->nr_of_vts_subp_streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->vts_n > 0 && vts_attr == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "Preparing streamsinfo for %d audio and "
|
GST_DEBUG_OBJECT (src, "Preparing streamsinfo for %d audio and "
|
||||||
"%d subpicture streams", n_audio, n_subp);
|
"%d subpicture streams", n_audio, n_subp);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue