[libbluray-devel] [Git][videolan/libbluray][master] hdmv: make playlist start event atomic (merge playlist and playitem/mark events)
Petri Hintukainen (@hpi)
gitlab at videolan.org
Tue Oct 18 17:24:11 UTC 2022
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
4ae2a2cf by Petri Hintukainen at 2022-10-18T20:08:35+03:00
hdmv: make playlist start event atomic (merge playlist and playitem/mark events)
Required for direct opening of correct clip.
Opening correct clip reduces latency and incorrect PI/PM/CHAPTER events.
- - - - -
3 changed files:
- src/libbluray/bluray.c
- src/libbluray/hdmv/hdmv_vm.c
- src/libbluray/hdmv/hdmv_vm.h
Changes:
=====================================
src/libbluray/bluray.c
=====================================
@@ -3525,6 +3525,8 @@ static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
break;
case HDMV_EVENT_PLAY_PL:
+ case HDMV_EVENT_PLAY_PL_PI:
+ case HDMV_EVENT_PLAY_PL_PM:
if (!_open_playlist(bd, hev->param, 0)) {
/* Missing playlist ?
* Seen on some discs while checking UHD capability.
@@ -3539,6 +3541,11 @@ static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
break;
}
} else {
+ if (hev->event == HDMV_EVENT_PLAY_PL_PM) {
+ bd_seek_mark(bd, hev->param2);
+ } else if (hev->event == HDMV_EVENT_PLAY_PL_PI) {
+ bd_seek_playitem(bd, hev->param2);
+ }
bd->hdmv_num_invalid_pl = 0;
}
=====================================
src/libbluray/hdmv/hdmv_vm.c
=====================================
@@ -310,6 +310,8 @@ const char *hdmv_event_str(hdmv_event_e event)
EVENT_ENTRY(HDMV_EVENT_IG_END);
EVENT_ENTRY(HDMV_EVENT_TITLE);
EVENT_ENTRY(HDMV_EVENT_PLAY_PL);
+ EVENT_ENTRY(HDMV_EVENT_PLAY_PL_PI);
+ EVENT_ENTRY(HDMV_EVENT_PLAY_PL_PM);
EVENT_ENTRY(HDMV_EVENT_PLAY_PI);
EVENT_ENTRY(HDMV_EVENT_PLAY_PM);
EVENT_ENTRY(HDMV_EVENT_PLAY_STOP);
@@ -336,21 +338,27 @@ static int _get_event(HDMV_VM *p, HDMV_EVENT *ev)
return -1;
}
-static int _queue_event(HDMV_VM *p, hdmv_event_e event, uint32_t param)
+static int _queue_event2(HDMV_VM *p, hdmv_event_e event, uint32_t param, uint32_t param2)
{
unsigned i;
for (i = 0; i < sizeof(p->event) / sizeof(p->event[0]) - 1; i++) {
if (p->event[i].event == HDMV_EVENT_NONE) {
p->event[i].event = event;
p->event[i].param = param;
+ p->event[i].param2 = param2;
return 0;
}
}
- BD_DEBUG(DBG_HDMV|DBG_CRIT, "_queue_event(%d:%s, %d): queue overflow !\n", event, hdmv_event_str(event), param);
+ BD_DEBUG(DBG_HDMV|DBG_CRIT, "_queue_event(%d:%s, %d %d): queue overflow !\n", event, hdmv_event_str(event), param, param2);
return -1;
}
+static int _queue_event(HDMV_VM *p, hdmv_event_e event, uint32_t param)
+{
+ return _queue_event2(p, event, param, 0);
+}
+
/*
* vm init
*/
@@ -646,16 +654,15 @@ static int _play_at(HDMV_VM *p, unsigned playlist, int playitem, int playmark)
BD_DEBUG(DBG_HDMV, "play_at(list %u, item %d, mark %d)\n",
playlist, playitem, playmark);
- _queue_event(p, HDMV_EVENT_PLAY_PL, playlist);
- _suspend_for_play_pl(p);
-
if (playitem >= 0) {
- _queue_event(p, HDMV_EVENT_PLAY_PI, playitem);
+ _queue_event2(p, HDMV_EVENT_PLAY_PL_PI, playlist, playitem);
+ } else if (playmark >= 0) {
+ _queue_event2(p, HDMV_EVENT_PLAY_PL_PM, playlist, playmark);
+ } else {
+ _queue_event(p, HDMV_EVENT_PLAY_PL, playlist);
}
- if (playmark >= 0) {
- _queue_event(p, HDMV_EVENT_PLAY_PM, playmark);
- }
+ _suspend_for_play_pl(p);
return 0;
}
=====================================
src/libbluray/hdmv/hdmv_vm.h
=====================================
@@ -39,6 +39,8 @@ typedef enum {
HDMV_EVENT_TITLE, /* play title (from disc index) */
HDMV_EVENT_PLAY_PL, /* select playlist */
+ HDMV_EVENT_PLAY_PL_PM, /* select playlist (and mark) */
+ HDMV_EVENT_PLAY_PL_PI, /* select playlist (and playitem) */
HDMV_EVENT_PLAY_PI, /* seek to playitem */
HDMV_EVENT_PLAY_PM, /* seek to playmark */
HDMV_EVENT_PLAY_STOP, /* stop playing playlist */
@@ -58,6 +60,7 @@ typedef enum {
typedef struct hdmv_vm_event_s {
hdmv_event_e event;
uint32_t param;
+ uint32_t param2;
} HDMV_EVENT;
BD_PRIVATE const char *hdmv_event_str(hdmv_event_e event);
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/4ae2a2cf32cddc229731e9f1022266151c1b42e6
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/4ae2a2cf32cddc229731e9f1022266151c1b42e6
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libbluray-devel
mailing list