[libdvdnav-devel] [Git][videolan/libdvdnav][master] Fix build when LOG_DEBUG is defined
Jean-Baptiste Kempf
gitlab at videolan.org
Thu Oct 15 23:07:02 CEST 2020
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdnav
Commits:
04703e30 by Ganael Laplanche at 2020-10-15T22:01:34+02:00
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]
- - - - -
2 changed files:
- src/dvdnav.c
- src/vm/decoder.c
Changes:
=====================================
src/dvdnav.c
=====================================
@@ -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;
=====================================
src/vm/decoder.c
=====================================
@@ -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
-
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/04703e30235c530c132ce4acd4a0892a085e991c
--
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/04703e30235c530c132ce4acd4a0892a085e991c
You're receiving this email because of your account on code.videolan.org.
More information about the libdvdnav-devel
mailing list