Skip to content

Commit

Permalink
Update libdvdnav to match commit dcb9109e45ccd304ec82a7c7bf46cca63620…
Browse files Browse the repository at this point in the history
  • Loading branch information
peper03 committed May 20, 2018
1 parent 85d8daf commit 5e88659
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 17 deletions.
34 changes: 26 additions & 8 deletions mythtv/external/libmythdvdnav/dvdnav/dvdnav.c
Expand Up @@ -39,6 +39,7 @@
#include <dvdread/ifo_types.h> /* 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 <dvdread/nav_read.h>
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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; i<state->cellN-1; i++) {
if(!
(state->pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK &&
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions mythtv/external/libmythdvdnav/dvdnav/dvdnav/dvdnav.h
Expand Up @@ -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" {
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 14 additions & 1 deletion mythtv/external/libmythdvdnav/dvdnav/highlight.c
Expand Up @@ -42,7 +42,7 @@

#ifdef BUTTON_TESTING

#include "nav_print.h"
#include <dvdread/nav_print.h>

static void print_time(dvd_time_t *dtime) {
const char *rate;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions mythtv/external/libmythdvdnav/dvdnav/navigation.c
Expand Up @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions mythtv/external/libmythdvdnav/dvdnav/vm/getset.c
Expand Up @@ -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++;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions mythtv/external/libmythdvdnav/dvdnav/vm/getset.h
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions mythtv/external/libmythdvdnav/dvdnav/vm/play.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -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")
Expand Down

0 comments on commit 5e88659

Please sign in to comment.