From 8305696be79fe650d3d9eee29b2a88e020d7c58f Mon Sep 17 00:00:00 2001 From: Voyager1 Date: Sun, 14 Feb 2016 17:15:56 +0100 Subject: [PATCH] [xbmc][dvdnav] expose dvdnav_get_vm, dvdnav_get_button_info, dvdnav_free --- src/dvdnav.c | 52 +++++++++++++++++++++++++++++++++++++++++++++ src/dvdnav/dvdnav.h | 1 + 2 files changed, 53 insertions(+) diff --git a/src/dvdnav.c b/src/dvdnav.c index ae267d5..39c11dd 100644 --- a/src/dvdnav.c +++ b/src/dvdnav.c @@ -1273,3 +1273,55 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t* this) { return ops.ops_struct; } + +#ifdef _XBMC + +vm_t* dvdnav_get_vm(dvdnav_t *this) { + if (!this) return 0; + return this->vm; +} + +/* return the alpha and color for the current active button + * color, alpha [0][] = selection + * color, alpha = color + * + * argsize = [2][4] + */ +int dvdnav_get_button_info(dvdnav_t* this, int alpha[2][4], int color[2][4]) +{ + int current_button, current_button_color, i; + pci_t* pci; + + if (!this) return -1; + + pci = dvdnav_get_current_nav_pci(this); + if (!pci) return -1; + + dvdnav_get_current_highlight(this, ¤t_button); + current_button_color = pci->hli.btnit[current_button - 1].btn_coln; + + for (i = 0; i < 2; i++) + { + alpha[i][0] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 0 & 0xf; + alpha[i][1] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 4 & 0xf; + alpha[i][2] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 8 & 0xf; + alpha[i][3] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 12 & 0xf; + + color[i][0] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 16 & 0xf; + color[i][1] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 20 & 0xf; + color[i][2] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 24 & 0xf; + color[i][3] = pci->hli.btn_colit.btn_coli[current_button_color - 1][i] >> 28 & 0xf; + } + + return 0; +} + +void dvdnav_free(void* pdata) +{ + free(pdata); +} + +#undef printerr +#define printerr(str) strncpy(self->err_str, str, MAX_ERR_LEN); + +#endif // _XBMC \ No newline at end of file diff --git a/src/dvdnav/dvdnav.h b/src/dvdnav/dvdnav.h index 8d68102..9f82b0f 100644 --- a/src/dvdnav/dvdnav.h +++ b/src/dvdnav/dvdnav.h @@ -699,6 +699,7 @@ int8_t dvdnav_is_domain_vtsm(dvdnav_t *self); */ int8_t dvdnav_is_domain_vts(dvdnav_t *self); +void dvdnav_free(void* pdata); #ifdef __cplusplus }