Commit 04703e30 authored by Ganael Laplanche's avatar Ganael Laplanche

Fix build when LOG_DEBUG is defined

libtool: compile:  cc -DHAVE_CONFIG_H -I. -I./src -I./src/dvdnav -I/usr/local/include -D_THREAD_SAFE -I/usr/local/include -I/usr/local/include -D_THREAD_SAFE -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -std=c99 -mno-ms-bitfields -Wall -Wsign-compare -Wextra -MT src/dvdnav.lo -MD -MP -MF src/.deps/dvdnav.Tpo -c src/dvdnav.c  -fPIC -DPIC -o src/.libs/dvdnav.o
src/dvdnav.c:559:8: error: use of undeclared identifier 'vm'
  Log3(vm, "POS-NEXT ");
       ^
src/dvdnav.c:559:8: error: use of undeclared identifier 'vm'
src/dvdnav.c:560:3: warning: implicit declaration of function 'vm_position_print' is invalid in C99 [-Wimplicit-function-declaration]
parent 0f4f1fc0
Pipeline #28557 passed with stage
in 1 minute and 20 seconds
......@@ -22,6 +22,8 @@
#include "config.h"
#endif
/* Un-comment the following to enable additional Log3() function calls.
* Do not forget to #define TRACE in src/vm/vm.h (required) */
/*
#define LOG_DEBUG
*/
......@@ -558,9 +560,9 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
vm_position_get(this->vm, &this->position_next);
#ifdef LOG_DEBUG
Log3(vm, "POS-NEXT ");
Log3(this->vm, "POS-NEXT ");
vm_position_print(this->vm, &this->position_next);
Log3(vm, "POS-CUR ");
Log3(this->vm, "POS-CUR ");
vm_position_print(this->vm, &this->position_current);
#endif
......@@ -568,7 +570,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
if(this->position_current.hop_channel != this->position_next.hop_channel) {
(*event) = DVDNAV_HOP_CHANNEL;
#ifdef LOG_DEBUG
Log3(vm, "HOP_CHANNEL");
Log3(this->vm, "HOP_CHANNEL");
#endif
if (this->position_next.hop_channel - this->position_current.hop_channel >= HOP_SEEK) {
int32_t num_angles = 0, current;
......
......@@ -116,6 +116,152 @@ static uint16_t eval_reg(command_t* command, uint8_t reg) {
}
}
#ifdef TRACE
static char *linkcmd2str(link_cmd_t cmd) {
switch(cmd) {
case LinkNoLink:
return "LinkNoLink";
case LinkTopC:
return "LinkTopC";
case LinkNextC:
return "LinkNextC";
case LinkPrevC:
return "LinkPrevC";
case LinkTopPG:
return "LinkTopPG";
case LinkNextPG:
return "LinkNextPG";
case LinkPrevPG:
return "LinkPrevPG";
case LinkTopPGC:
return "LinkTopPGC";
case LinkNextPGC:
return "LinkNextPGC";
case LinkPrevPGC:
return "LinkPrevPGC";
case LinkGoUpPGC:
return "LinkGoUpPGC";
case LinkTailPGC:
return "LinkTailPGC";
case LinkRSM:
return "LinkRSM";
case LinkPGCN:
return "LinkPGCN";
case LinkPTTN:
return "LinkPTTN";
case LinkPGN:
return "LinkPGN";
case LinkCN:
return "LinkCN";
case Exit:
return "Exit";
case JumpTT:
return "JumpTT";
case JumpVTS_TT:
return "JumpVTS_TT";
case JumpVTS_PTT:
return "JumpVTS_PTT";
case JumpSS_FP:
return "JumpSS_FP";
case JumpSS_VMGM_MENU:
return "JumpSS_VMGM_MENU";
case JumpSS_VTSM:
return "JumpSS_VTSM";
case JumpSS_VMGM_PGC:
return "JumpSS_VMGM_PGC";
case CallSS_FP:
return "CallSS_FP";
case CallSS_VMGM_MENU:
return "CallSS_VMGM_MENU";
case CallSS_VTSM:
return "CallSS_VTSM";
case CallSS_VMGM_PGC:
return "CallSS_VMGM_PGC";
case PlayThis:
return "PlayThis";
}
return "*** (bug)";
}
void vm_print_link(link_t value) {
char *cmd = linkcmd2str(value.command);
switch(value.command) {
case LinkNoLink:
case LinkTopC:
case LinkNextC:
case LinkPrevC:
case LinkTopPG:
case LinkNextPG:
case LinkPrevPG:
case LinkTopPGC:
case LinkNextPGC:
case LinkPrevPGC:
case LinkGoUpPGC:
case LinkTailPGC:
case LinkRSM:
fprintf(MSG_OUT, "libdvdnav: %s (button %d)\n", cmd, value.data1);
break;
case LinkPGCN:
case JumpTT:
case JumpVTS_TT:
case JumpSS_VMGM_MENU: /* == 2 -> Title Menu */
case JumpSS_VMGM_PGC:
fprintf(MSG_OUT, "libdvdnav: %s %d\n", cmd, value.data1);
break;
case LinkPTTN:
case LinkPGN:
case LinkCN:
fprintf(MSG_OUT, "libdvdnav: %s %d (button %d)\n", cmd, value.data1, value.data2);
break;
case Exit:
case JumpSS_FP:
case PlayThis: /* Humm.. should we have this at all.. */
fprintf(MSG_OUT, "libdvdnav: %s\n", cmd);
break;
case JumpVTS_PTT:
fprintf(MSG_OUT, "libdvdnav: %s %d:%d\n", cmd, value.data1, value.data2);
break;
case JumpSS_VTSM:
fprintf(MSG_OUT, "libdvdnav: %s vts %d title %d menu %d\n",
cmd, value.data1, value.data2, value.data3);
break;
case CallSS_FP:
fprintf(MSG_OUT, "libdvdnav: %s resume cell %d\n", cmd, value.data1);
break;
case CallSS_VMGM_MENU: /* == 2 -> Title Menu */
case CallSS_VTSM:
fprintf(MSG_OUT, "libdvdnav: %s %d resume cell %d\n", cmd, value.data1, value.data2);
break;
case CallSS_VMGM_PGC:
fprintf(MSG_OUT, "libdvdnav: %s %d resume cell %d\n", cmd, value.data1, value.data2);
break;
}
}
void vm_print_registers( registers_t *registers ) {
int32_t i;
fprintf(MSG_OUT, "libdvdnav: # ");
for(i = 0; i < 24; i++)
fprintf(MSG_OUT, " %2d |", i);
fprintf(MSG_OUT, "\nlibdvdnav: SRPMS: ");
for(i = 0; i < 24; i++)
fprintf(MSG_OUT, "%04x|", registers->SPRM[i]);
fprintf(MSG_OUT, "\nlibdvdnav: GRPMS: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04x|", get_GPRM(registers, i) );
fprintf(MSG_OUT, "\nlibdvdnav: Gmode: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04x|", registers->GPRM_mode[i]);
fprintf(MSG_OUT, "\nlibdvdnav: Gtime: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04lx|", registers->GPRM_time[i].tv_sec & 0xffff);
fprintf(MSG_OUT, "\n");
}
#endif
/* Eval register or immediate data.
AAAA_AAAA BBBB_BBBB, if immediate use all 16 bits for data else use
lower eight bits for the system or general purpose register. */
......@@ -636,149 +782,3 @@ int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
return 0;
}
#ifdef TRACE
static char *linkcmd2str(link_cmd_t cmd) {
switch(cmd) {
case LinkNoLink:
return "LinkNoLink";
case LinkTopC:
return "LinkTopC";
case LinkNextC:
return "LinkNextC";
case LinkPrevC:
return "LinkPrevC";
case LinkTopPG:
return "LinkTopPG";
case LinkNextPG:
return "LinkNextPG";
case LinkPrevPG:
return "LinkPrevPG";
case LinkTopPGC:
return "LinkTopPGC";
case LinkNextPGC:
return "LinkNextPGC";
case LinkPrevPGC:
return "LinkPrevPGC";
case LinkGoUpPGC:
return "LinkGoUpPGC";
case LinkTailPGC:
return "LinkTailPGC";
case LinkRSM:
return "LinkRSM";
case LinkPGCN:
return "LinkPGCN";
case LinkPTTN:
return "LinkPTTN";
case LinkPGN:
return "LinkPGN";
case LinkCN:
return "LinkCN";
case Exit:
return "Exit";
case JumpTT:
return "JumpTT";
case JumpVTS_TT:
return "JumpVTS_TT";
case JumpVTS_PTT:
return "JumpVTS_PTT";
case JumpSS_FP:
return "JumpSS_FP";
case JumpSS_VMGM_MENU:
return "JumpSS_VMGM_MENU";
case JumpSS_VTSM:
return "JumpSS_VTSM";
case JumpSS_VMGM_PGC:
return "JumpSS_VMGM_PGC";
case CallSS_FP:
return "CallSS_FP";
case CallSS_VMGM_MENU:
return "CallSS_VMGM_MENU";
case CallSS_VTSM:
return "CallSS_VTSM";
case CallSS_VMGM_PGC:
return "CallSS_VMGM_PGC";
case PlayThis:
return "PlayThis";
}
return "*** (bug)";
}
void vm_print_link(link_t value) {
char *cmd = linkcmd2str(value.command);
switch(value.command) {
case LinkNoLink:
case LinkTopC:
case LinkNextC:
case LinkPrevC:
case LinkTopPG:
case LinkNextPG:
case LinkPrevPG:
case LinkTopPGC:
case LinkNextPGC:
case LinkPrevPGC:
case LinkGoUpPGC:
case LinkTailPGC:
case LinkRSM:
fprintf(MSG_OUT, "libdvdnav: %s (button %d)\n", cmd, value.data1);
break;
case LinkPGCN:
case JumpTT:
case JumpVTS_TT:
case JumpSS_VMGM_MENU: /* == 2 -> Title Menu */
case JumpSS_VMGM_PGC:
fprintf(MSG_OUT, "libdvdnav: %s %d\n", cmd, value.data1);
break;
case LinkPTTN:
case LinkPGN:
case LinkCN:
fprintf(MSG_OUT, "libdvdnav: %s %d (button %d)\n", cmd, value.data1, value.data2);
break;
case Exit:
case JumpSS_FP:
case PlayThis: /* Humm.. should we have this at all.. */
fprintf(MSG_OUT, "libdvdnav: %s\n", cmd);
break;
case JumpVTS_PTT:
fprintf(MSG_OUT, "libdvdnav: %s %d:%d\n", cmd, value.data1, value.data2);
break;
case JumpSS_VTSM:
fprintf(MSG_OUT, "libdvdnav: %s vts %d title %d menu %d\n",
cmd, value.data1, value.data2, value.data3);
break;
case CallSS_FP:
fprintf(MSG_OUT, "libdvdnav: %s resume cell %d\n", cmd, value.data1);
break;
case CallSS_VMGM_MENU: /* == 2 -> Title Menu */
case CallSS_VTSM:
fprintf(MSG_OUT, "libdvdnav: %s %d resume cell %d\n", cmd, value.data1, value.data2);
break;
case CallSS_VMGM_PGC:
fprintf(MSG_OUT, "libdvdnav: %s %d resume cell %d\n", cmd, value.data1, value.data2);
break;
}
}
void vm_print_registers( registers_t *registers ) {
int32_t i;
fprintf(MSG_OUT, "libdvdnav: # ");
for(i = 0; i < 24; i++)
fprintf(MSG_OUT, " %2d |", i);
fprintf(MSG_OUT, "\nlibdvdnav: SRPMS: ");
for(i = 0; i < 24; i++)
fprintf(MSG_OUT, "%04x|", registers->SPRM[i]);
fprintf(MSG_OUT, "\nlibdvdnav: GRPMS: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04x|", get_GPRM(registers, i) );
fprintf(MSG_OUT, "\nlibdvdnav: Gmode: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04x|", registers->GPRM_mode[i]);
fprintf(MSG_OUT, "\nlibdvdnav: Gtime: ");
for(i = 0; i < 16; i++)
fprintf(MSG_OUT, "%04lx|", registers->GPRM_time[i].tv_sec & 0xffff);
fprintf(MSG_OUT, "\n");
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment