summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2011-06-19 22:00:30 +0000
committerphintuka <phintuka>2011-06-19 22:00:30 +0000
commita440d75d1e841752937f9670d9cd3e65bcc9aa0a (patch)
tree68a43a21e7c283da4084cc4422590ab2ee5dea8b
parentc5788fd40e4b697e6ef88b1b5e5f900d02cd5e53 (diff)
downloadxineliboutput-a440d75d1e841752937f9670d9cd3e65bcc9aa0a.tar.gz
xineliboutput-a440d75d1e841752937f9670d9cd3e65bcc9aa0a.tar.bz2
Splitted update_title_name() from update_title_info().
Send XINE_EVENT_UI_SET_TITLE event after all metadata has been updated.
-rw-r--r--xine/BluRay/input_bluray.c77
1 files changed, 43 insertions, 34 deletions
diff --git a/xine/BluRay/input_bluray.c b/xine/BluRay/input_bluray.c
index 0a7d73a6..62d68416 100644
--- a/xine/BluRay/input_bluray.c
+++ b/xine/BluRay/input_bluray.c
@@ -262,44 +262,18 @@ static void update_stream_info(bluray_input_plugin_t *this)
}
}
-static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
+static void update_title_name(bluray_input_plugin_t *this)
{
- pthread_mutex_lock(&this->title_info_mutex);
-
- if (this->title_info)
- bd_free_title_info(this->title_info);
-
- if (playlist_id < 0)
- this->title_info = bd_get_title_info(this->bdh, this->current_title_idx, 0);
- else
- this->title_info = bd_get_playlist_info(this->bdh, playlist_id, 0);
-
- pthread_mutex_unlock(&this->title_info_mutex);
-
- if (!this->title_info) {
- LOGMSG("bd_get_title_info(%d) failed\n", this->current_title_idx);
- return;
- }
-
-#ifdef LOG
- int ms = this->title_info->duration / INT64_C(90);
- lprintf("Opened title %d. Length %"PRId64" bytes / %02d:%02d:%02d.%03d\n",
- this->current_title_idx, bd_get_title_size(this->bdh),
- ms / 3600000, (ms % 3600000 / 60000), (ms % 60000) / 1000, ms % 1000);
-#endif
-
- /* set title */
-
+ char title_name[64] = "";
xine_ui_data_t udata;
- xine_event_t uevent = {
- .type = XINE_EVENT_UI_SET_TITLE,
- .stream = this->stream,
- .data = &udata,
+ xine_event_t uevent = {
+ .type = XINE_EVENT_UI_SET_TITLE,
+ .stream = this->stream,
+ .data = &udata,
.data_length = sizeof(udata)
};
- char title_name[64] = "";
-
+ /* check disc library metadata */
if (this->meta_dl) {
unsigned i;
for (i = 0; i < this->meta_dl->toc_count; i++)
@@ -309,6 +283,7 @@ static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
strncpy(title_name, this->meta_dl->toc_entries[i].title_name, sizeof(title_name));
}
+ /* title name */
if (title_name[0]) {
} else if (this->current_title == BLURAY_TITLE_TOP_MENU) {
strcpy(title_name, "Top Menu");
@@ -323,6 +298,7 @@ static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
this->current_title_idx + 1, this->num_title_idx);
}
+ /* disc name */
if (this->disc_name && this->disc_name[0]) {
udata.str_len = snprintf(udata.str, sizeof(udata.str), "%s, %s",
this->disc_name, title_name);
@@ -330,10 +306,40 @@ static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
udata.str_len = snprintf(udata.str, sizeof(udata.str), "%s",
title_name);
}
- xine_event_send(this->stream, &uevent);
_x_meta_info_set(this->stream, XINE_META_INFO_TITLE, udata.str);
+ xine_event_send(this->stream, &uevent);
+}
+
+static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
+{
+ /* update title_info */
+
+ pthread_mutex_lock(&this->title_info_mutex);
+
+ if (this->title_info)
+ bd_free_title_info(this->title_info);
+
+ if (playlist_id < 0)
+ this->title_info = bd_get_title_info(this->bdh, this->current_title_idx, 0);
+ else
+ this->title_info = bd_get_playlist_info(this->bdh, playlist_id, 0);
+
+ pthread_mutex_unlock(&this->title_info_mutex);
+
+ if (!this->title_info) {
+ LOGMSG("bd_get_title_info(%d) failed\n", this->current_title_idx);
+ return;
+ }
+
+#ifdef LOG
+ int ms = this->title_info->duration / INT64_C(90);
+ lprintf("Opened title %d. Length %"PRId64" bytes / %02d:%02d:%02d.%03d\n",
+ this->current_title_idx, bd_get_title_size(this->bdh),
+ ms / 3600000, (ms % 3600000 / 60000), (ms % 60000) / 1000, ms % 1000);
+#endif
+
/* calculate and set stream rate */
uint64_t rate = bd_get_title_size(this->bdh) * UINT64_C(8) // bits
@@ -363,6 +369,9 @@ static void update_title_info(bluray_input_plugin_t *this, int playlist_id)
}
update_stream_info(this);
+
+ /* set title */
+ update_title_name(this);
}
static int open_title (bluray_input_plugin_t *this, int title_idx)