00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "config.h"
00027
00028 #include <stdio.h>
00029 #include <inttypes.h>
00030
00031 #include "nav_types.h"
00032 #include "nav_print.h"
00033 #include "dvdread_internal.h"
00034
00035 static void print_time(dvd_time_t *dtime) {
00036 const char *rate;
00037 CHECK_VALUE((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);
00038 CHECK_VALUE((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
00039 CHECK_VALUE((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);
00040 CHECK_VALUE((dtime->frame_u&0xf) < 0xa);
00041
00042 printf("%02x:%02x:%02x.%02x",
00043 dtime->hour,
00044 dtime->minute,
00045 dtime->second,
00046 dtime->frame_u & 0x3f);
00047 switch((dtime->frame_u & 0xc0) >> 6) {
00048 case 1:
00049 rate = "25.00";
00050 break;
00051 case 3:
00052 rate = "29.97";
00053 break;
00054 default:
00055 rate = "(please send a bug report)";
00056 break;
00057 }
00058 printf(" @ %s fps", rate);
00059 }
00060
00061
00062 static void navPrint_PCI_GI(pci_gi_t *pci_gi) {
00063 int i;
00064
00065 printf("pci_gi:\n");
00066 printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn);
00067 printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat);
00068 printf("vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl);
00069 printf("vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm);
00070 printf("vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm);
00071 printf("vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm);
00072 printf("e_eltm ");
00073 print_time(&pci_gi->e_eltm);
00074 printf("\n");
00075
00076 printf("vobu_isrc \"");
00077 for(i = 0; i < 32; i++) {
00078 char c = pci_gi->vobu_isrc[i];
00079 if((c >= ' ') && (c <= '~'))
00080 printf("%c", c);
00081 else
00082 printf(".");
00083 }
00084 printf("\"\n");
00085 }
00086
00087 static void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli) {
00088 int i, j = 0;
00089
00090 for(i = 0; i < 9; i++)
00091 j |= nsml_agli->nsml_agl_dsta[i];
00092 if(j == 0)
00093 return;
00094
00095 printf("nsml_agli:\n");
00096 for(i = 0; i < 9; i++)
00097 if(nsml_agli->nsml_agl_dsta[i])
00098 printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1,
00099 nsml_agli->nsml_agl_dsta[i]);
00100 }
00101
00102 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
00103
00104 if((hl_gi->hli_ss & 0x03) == 0)
00105 return;
00106
00107 printf("hl_gi:\n");
00108 printf("hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03);
00109 printf("hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm);
00110 printf("hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm);
00111 printf("btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm);
00112
00113 *btngr_ns = hl_gi->btngr_ns;
00114 printf("btngr_ns %d\n", hl_gi->btngr_ns);
00115 printf("btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty);
00116 printf("btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty);
00117 printf("btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty);
00118
00119 printf("btn_ofn %d\n", hl_gi->btn_ofn);
00120 *btn_ns = hl_gi->btn_ns;
00121 printf("btn_ns %d\n", hl_gi->btn_ns);
00122 printf("nsl_btn_ns %d\n", hl_gi->nsl_btn_ns);
00123 printf("fosl_btnn %d\n", hl_gi->fosl_btnn);
00124 printf("foac_btnn %d\n", hl_gi->foac_btnn);
00125 }
00126
00127 static void navPrint_BTN_COLIT(btn_colit_t *btn_colit) {
00128 int i, j;
00129
00130 j = 0;
00131 for(i = 0; i < 6; i++)
00132 j |= btn_colit->btn_coli[i/2][i&1];
00133 if(j == 0)
00134 return;
00135
00136 printf("btn_colit:\n");
00137 for(i = 0; i < 3; i++)
00138 for(j = 0; j < 2; j++)
00139 printf("btn_cqoli %d %s_coli: %08x\n",
00140 i, (j == 0) ? "sl" : "ac",
00141 btn_colit->btn_coli[i][j]);
00142 }
00143
00144 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
00145 int i, j;
00146
00147 printf("btnit:\n");
00148 printf("btngr_ns: %i\n", btngr_ns);
00149 printf("btn_ns: %i\n", btn_ns);
00150
00151 if(btngr_ns == 0)
00152 return;
00153
00154 for(i = 0; i < btngr_ns; i++) {
00155 for(j = 0; j < (36 / btngr_ns); j++) {
00156 if(j < btn_ns) {
00157 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
00158
00159 printf("group %d btni %d: ", i+1, j+1);
00160 printf("btn_coln %d, auto_action_mode %d\n",
00161 btni->btn_coln, btni->auto_action_mode);
00162 printf("coords (%d, %d) .. (%d, %d)\n",
00163 btni->x_start, btni->y_start, btni->x_end, btni->y_end);
00164
00165 printf("up %d, ", btni->up);
00166 printf("down %d, ", btni->down);
00167 printf("left %d, ", btni->left);
00168 printf("right %d\n", btni->right);
00169
00170
00171 printf("\n");
00172 }
00173 }
00174 }
00175 }
00176
00177 static void navPrint_HLI(hli_t *hli) {
00178 int btngr_ns = 0, btn_ns = 0;
00179
00180 printf("hli:\n");
00181 navPrint_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns);
00182 navPrint_BTN_COLIT(&hli->btn_colit);
00183 navPrint_BTNIT(hli->btnit, btngr_ns, btn_ns);
00184 }
00185
00186 void navPrint_PCI(pci_t *pci) {
00187 printf("pci packet:\n");
00188 navPrint_PCI_GI(&pci->pci_gi);
00189 navPrint_NSML_AGLI(&pci->nsml_agli);
00190 navPrint_HLI(&pci->hli);
00191 }
00192
00193 static void navPrint_DSI_GI(dsi_gi_t *dsi_gi) {
00194 printf("dsi_gi:\n");
00195 printf("nv_pck_scr 0x%08x\n", dsi_gi->nv_pck_scr);
00196 printf("nv_pck_lbn 0x%08x\n", dsi_gi->nv_pck_lbn );
00197 printf("vobu_ea 0x%08x\n", dsi_gi->vobu_ea);
00198 printf("vobu_1stref_ea 0x%08x\n", dsi_gi->vobu_1stref_ea);
00199 printf("vobu_2ndref_ea 0x%08x\n", dsi_gi->vobu_2ndref_ea);
00200 printf("vobu_3rdref_ea 0x%08x\n", dsi_gi->vobu_3rdref_ea);
00201 printf("vobu_vob_idn 0x%04x\n", dsi_gi->vobu_vob_idn);
00202 printf("vobu_c_idn 0x%02x\n", dsi_gi->vobu_c_idn);
00203 printf("c_eltm ");
00204 print_time(&dsi_gi->c_eltm);
00205 printf("\n");
00206 }
00207
00208 static void navPrint_SML_PBI(sml_pbi_t *sml_pbi) {
00209 printf("sml_pbi:\n");
00210 printf("category 0x%04x\n", sml_pbi->category);
00211 if(sml_pbi->category & 0x8000)
00212 printf("VOBU is in preunit\n");
00213 if(sml_pbi->category & 0x4000)
00214 printf("VOBU is in ILVU\n");
00215 if(sml_pbi->category & 0x2000)
00216 printf("VOBU at the beginning of ILVU\n");
00217 if(sml_pbi->category & 0x1000)
00218 printf("VOBU at end of PREU of ILVU\n");
00219
00220 printf("ilvu_ea 0x%08x\n", sml_pbi->ilvu_ea);
00221 printf("nxt_ilvu_sa 0x%08x\n", sml_pbi->ilvu_sa);
00222 printf("nxt_ilvu_size 0x%04x\n", sml_pbi->size);
00223
00224 printf("vob_v_s_s_ptm 0x%08x\n", sml_pbi->vob_v_s_s_ptm);
00225 printf("vob_v_e_e_ptm 0x%08x\n", sml_pbi->vob_v_e_e_ptm);
00226
00227
00228 }
00229
00230 static void navPrint_SML_AGLI(sml_agli_t *sml_agli) {
00231 int i;
00232 printf("sml_agli:\n");
00233 for(i = 0; i < 9; i++) {
00234 printf("agl_c%d address: 0x%08x size 0x%04x\n", i,
00235 sml_agli->data[i].address, sml_agli->data[i].size);
00236 }
00237 }
00238
00239 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) {
00240 int i;
00241 int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11,
00242 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
00243 printf("vobu_sri:\n");
00244 printf("Next VOBU with Video %08x\n", vobu_sri->next_video);
00245 for(i = 0; i < 19; i++) {
00246 printf("%3.1f %08x ", stime[i]/2.0, vobu_sri->fwda[i]);
00247 }
00248 printf("\n");
00249 printf("Next VOBU %08x\n", vobu_sri->next_vobu);
00250 printf("--\n");
00251 printf("Prev VOBU %08x\n", vobu_sri->prev_vobu);
00252 for(i = 0; i < 19; i++) {
00253 printf("%3.1f %08x ", stime[18 - i]/2.0, vobu_sri->bwda[i]);
00254 }
00255 printf("\n");
00256 printf("Prev VOBU with Video %08x\n", vobu_sri->prev_video);
00257 }
00258
00259 static void navPrint_SYNCI(synci_t *synci) {
00260 int i;
00261
00262 printf("synci:\n");
00263
00264 for(i = 0; i < 8; i++)
00265 printf("%04x ", synci->a_synca[i]);
00266 for(i = 0; i < 32; i++)
00267 printf("%08x ", synci->sp_synca[i]);
00268 }
00269
00270 void navPrint_DSI(dsi_t *dsi) {
00271 printf("dsi packet:\n");
00272 navPrint_DSI_GI(&dsi->dsi_gi);
00273 navPrint_SML_PBI(&dsi->sml_pbi);
00274 navPrint_SML_AGLI(&dsi->sml_agli);
00275 navPrint_VOBU_SRI(&dsi->vobu_sri);
00276 navPrint_SYNCI(&dsi->synci);
00277 }
00278
00279