diff --git a/mythtv/external/libmythdvdnav/dvdnav/dvdnav.c b/mythtv/external/libmythdvdnav/dvdnav/dvdnav.c index a4ae2253beb..44c486b0c7c 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/dvdnav.c +++ b/mythtv/external/libmythdvdnav/dvdnav/dvdnav.c @@ -39,6 +39,7 @@ #include /* For vm_cmd_t */ #include "vm/decoder.h" #include "vm/vm.h" +#include "vm/getset.h" #include "dvdnav_internal.h" #include "read_cache.h" #include @@ -152,7 +153,7 @@ static dvdnav_status_t dvdnav_open_common(dvdnav_t** dest, const char *path, struct timeval time; /* Create a new structure */ - fprintf(MSG_OUT, "libdvdnav: Using dvdnav version %d - commit %s\n", DVDNAV_VERSION, DVDNAV_VERSION_GIT); + fprintf(MSG_OUT, "libdvdnav: Using dvdnav version %s - commit %s\n", DVDNAV_VERSION, DVDNAV_VERSION_GIT); (*dest) = NULL; this = (dvdnav_t*)calloc(1, sizeof(dvdnav_t)); @@ -485,6 +486,9 @@ int64_t dvdnav_get_current_time(dvdnav_t *this) { int64_t tm=0; dvd_state_t *state = &this->vm->state; + if(! state->pgc) + return 0; + for(i=0; icellN-1; i++) { if(! (state->pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK && @@ -517,6 +521,12 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf, this->started = 1; } + if (!this->vm->state.pgc) { + printerr("No current PGC."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } + state = &(this->vm->state); (*event) = DVDNAV_NOP; (*len) = 0; @@ -781,6 +791,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf, fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_pan_scan=%d\n",stream_change->physical_pan_scan); fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning DVDNAV_STATUS_OK\n"); #endif + /* This is not realy the right place to do this. FOSL_BTNN should set the register + * at HLI_S_PTM rather than when we enter the SPU. As well we should activate FOAC_BTNN + * at HLI_E_PTM + */ + if (this->pci.hli.hl_gi.fosl_btnn != 0) { + set_HL_BTN(this->vm, this->pci.hli.hl_gi.fosl_btnn); + } + pthread_mutex_unlock(&this->vm_lock); return DVDNAV_STATUS_OK; } @@ -935,12 +953,12 @@ uint8_t dvdnav_get_video_aspect(dvdnav_t *this) { return retval; } -int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) { +dvdnav_status_t dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) { int w, h; if(!this->started) { printerr("Virtual DVD machine not started."); - return -1; + return DVDNAV_STATUS_ERR; } pthread_mutex_lock(&this->vm_lock); @@ -949,7 +967,7 @@ int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *heigh *width = w; *height = h; - return 0; + return DVDNAV_STATUS_OK; } uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) { @@ -1098,13 +1116,13 @@ int8_t dvdnav_get_audio_logical_stream(dvdnav_t *this, uint8_t audio_num) { dvdnav_status_t dvdnav_get_audio_attr(dvdnav_t *this, uint8_t audio_num, audio_attr_t *audio_attr) { if(!this->started) { printerr("Virtual DVD machine not started."); - return -1; + return DVDNAV_STATUS_ERR; } pthread_mutex_lock(&this->vm_lock); if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock); - return -1; + return DVDNAV_STATUS_ERR; } *audio_attr=vm_get_audio_attr(this->vm, audio_num); pthread_mutex_unlock(&this->vm_lock); @@ -1135,13 +1153,13 @@ int8_t dvdnav_get_spu_logical_stream(dvdnav_t *this, uint8_t subp_num) { dvdnav_status_t dvdnav_get_spu_attr(dvdnav_t *this, uint8_t audio_num, subp_attr_t *subp_attr) { if(!this->started) { printerr("Virtual DVD machine not started."); - return -1; + return DVDNAV_STATUS_ERR; } pthread_mutex_lock(&this->vm_lock); if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock); - return -1; + return DVDNAV_STATUS_ERR; } *subp_attr=vm_get_subp_attr(this->vm, audio_num); pthread_mutex_unlock(&this->vm_lock); diff --git a/mythtv/external/libmythdvdnav/dvdnav/dvdnav/dvdnav.h b/mythtv/external/libmythdvdnav/dvdnav/dvdnav/dvdnav.h index 79cf0c30c85..cb99f543849 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/dvdnav/dvdnav.h +++ b/mythtv/external/libmythdvdnav/dvdnav/dvdnav/dvdnav.h @@ -26,8 +26,8 @@ #ifndef LIBDVDNAV_DVDNAV_H #define LIBDVDNAV_DVDNAV_H -#define DVDNAV_VERSION 50400 -#define DVDNAV_VERSION_GIT "8a270d6dd40ac43c98c948fe9d10e5bcb4aa3d41" +#define DVDNAV_VERSION "6.0.0" +#define DVDNAV_VERSION_GIT "dcb9109e45ccd304ec82a7c7bf46cca63620adf9" #ifdef __cplusplus extern "C" { @@ -583,7 +583,7 @@ uint8_t dvdnav_get_video_aspect(dvdnav_t *self); /* * Get video resolution. */ -int dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height); +dvdnav_status_t dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height); /* * Get video scaling permissions. diff --git a/mythtv/external/libmythdvdnav/dvdnav/highlight.c b/mythtv/external/libmythdvdnav/dvdnav/highlight.c index ecdf4978da8..08647a4db83 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/highlight.c +++ b/mythtv/external/libmythdvdnav/dvdnav/highlight.c @@ -42,7 +42,7 @@ #ifdef BUTTON_TESTING -#include "nav_print.h" +#include static void print_time(dvd_time_t *dtime) { const char *rate; @@ -403,6 +403,12 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) { } pthread_mutex_lock(&this->vm_lock); + if(!this->vm->state.pgc) { + printerr("No current PGC."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } + button = this->vm->state.HL_BTNN_REG >> 10; if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { @@ -454,6 +460,13 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) { dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd) { pthread_mutex_lock(&this->vm_lock); + + if(!this->vm->state.pgc) { + printerr("No current PGC."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } + /* make the VM execute the appropriate code and probably * schedule a jump */ #ifdef BUTTON_TESTING diff --git a/mythtv/external/libmythdvdnav/dvdnav/navigation.c b/mythtv/external/libmythdvdnav/dvdnav/navigation.c index 4fe4a91ac5b..8cbe63a750e 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/navigation.c +++ b/mythtv/external/libmythdvdnav/dvdnav/navigation.c @@ -269,6 +269,12 @@ dvdnav_status_t dvdnav_go_up(dvdnav_t *this) { /* A nice easy function... delegate to the VM */ int retval; pthread_mutex_lock(&this->vm_lock); + if (!this->vm->state.pgc) { + printerr("No current PGC."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } + retval = vm_jump_up(this->vm); pthread_mutex_unlock(&this->vm_lock); diff --git a/mythtv/external/libmythdvdnav/dvdnav/vm/getset.c b/mythtv/external/libmythdvdnav/dvdnav/vm/getset.c index cd0c0746d2d..a93ba3e16fd 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/vm/getset.c +++ b/mythtv/external/libmythdvdnav/dvdnav/vm/getset.c @@ -172,6 +172,9 @@ int set_PGN(vm_t *vm) { int new_pgN = 0; int dummy, part = 0; + if ((vm->state).pgc == NULL) + return 0; + while(new_pgN < (vm->state).pgc->nr_of_programs && (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN]) new_pgN++; @@ -213,6 +216,13 @@ void set_RSMinfo(vm_t *vm, int cellN, int blockN) { } } + +/* Force the highlight button number register */ +void set_HL_BTN(vm_t *vm, int btnn) +{ + (vm->state).HL_BTNN_REG = btnn << 10; +} + /* Get functions */ /* Searches the TT tables, to find the current TT. @@ -280,6 +290,10 @@ int get_PGCN(vm_t *vm) { pgcit_t *pgcit; int pgcN = 1; + if ((vm->state).pgc == NULL) { + return 0; /* error */ + } + pgcit = get_PGCIT(vm); if (pgcit) { diff --git a/mythtv/external/libmythdvdnav/dvdnav/vm/getset.h b/mythtv/external/libmythdvdnav/dvdnav/vm/getset.h index da2d53e4ca3..bd3b018d95b 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/vm/getset.h +++ b/mythtv/external/libmythdvdnav/dvdnav/vm/getset.h @@ -38,6 +38,7 @@ int set_MENU(vm_t *vm, int menu); int set_PGCN(vm_t *vm, int pgcN); int set_PGN(vm_t *vm); /* Set PGN based on (vm->state).CellN */ void set_RSMinfo(vm_t *vm, int cellN, int blockN); +void set_HL_BTN(vm_t *vm, int btnn); /* Get */ int get_TT(vm_t *vm, int vtsN, int vts_ttn); diff --git a/mythtv/external/libmythdvdnav/dvdnav/vm/play.c b/mythtv/external/libmythdvdnav/dvdnav/vm/play.c index 0c50855f4e9..e2c9978641a 100644 --- a/mythtv/external/libmythdvdnav/dvdnav/vm/play.c +++ b/mythtv/external/libmythdvdnav/dvdnav/vm/play.c @@ -216,8 +216,8 @@ link_t play_Cell(vm_t *vm) { } #endif break; - case 2: /* ?? */ - case 3: /* ?? */ + case 2: /* reserved */ + case 3: /* reserved */ default: fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n", (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode, @@ -304,8 +304,8 @@ link_t play_Cell_post(vm_t *vm) { (vm->state).cellN++; } break; - case 2: /* ?? */ - case 3: /* ?? */ + case 2: /* reserved */ + case 3: /* reserved */ default: fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n", (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode, diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp index 7c424d14704..e250748dffb 100644 --- a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp +++ b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp @@ -2021,7 +2021,7 @@ int DVDRingBuffer::GetAudioTrackType(uint idx) if (physicalStreamId < 0) return -1; - if (dvdnav_get_audio_attr(m_dvdnav, physicalStreamId, &attributes) >= 1) + if (dvdnav_get_audio_attr(m_dvdnav, physicalStreamId, &attributes) == DVDNAV_STATUS_OK) { LOG(VB_AUDIO, LOG_INFO, QString("DVD Audio Track #%1 Language " "Extension Code - %2")