⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 highlight.c

📁 linux下的MPEG1
💻 C
📖 第 1 页 / 共 2 页
字号:
  dvdnav_button_select(this, pci, button_ptr->up);  return button_auto_action(this, pci);}dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this, pci_t *pci) {  btni_t *button_ptr;    if(!(button_ptr = get_current_button(this, pci)))    return DVDNAV_STATUS_ERR;  dvdnav_button_select(this, pci, button_ptr->down);  return button_auto_action(this, pci);}dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this, pci_t *pci) {  btni_t *button_ptr;    if(!(button_ptr = get_current_button(this, pci)))    return DVDNAV_STATUS_ERR;  dvdnav_button_select(this, pci, button_ptr->right);  return button_auto_action(this, pci);}dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this, pci_t *pci) {  btni_t *button_ptr;    if(!(button_ptr = get_current_button(this, pci)))    return DVDNAV_STATUS_ERR;  dvdnav_button_select(this, pci, button_ptr->left);  return button_auto_action(this, pci);}dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, 					  dvdnav_highlight_area_t *highlight) {  btni_t *button_ptr;#ifdef BUTTON_TESTING  fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button);#endif    if(!nav_pci->hli.hl_gi.hli_ss)    return DVDNAV_STATUS_ERR;  if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns))    return DVDNAV_STATUS_ERR;  button_ptr = &nav_pci->hli.btnit[button-1];  highlight->sx = button_ptr->x_start;  highlight->sy = button_ptr->y_start;  highlight->ex = button_ptr->x_end;  highlight->ey = button_ptr->y_end;  if(button_ptr->btn_coln != 0) {    highlight->palette = nav_pci->hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode];  } else {    highlight->palette = 0;  }  highlight->pts = nav_pci->hli.hl_gi.hli_s_ptm;  highlight->buttonN = button;#ifdef BUTTON_TESTING  fprintf(MSG_OUT, "libdvdnav: highlight: Highlight area is (%u,%u)-(%u,%u), display = %i, button = %u\n",               button_ptr->x_start, button_ptr->y_start,               button_ptr->x_end, button_ptr->y_end,               1,               button);#endif  return DVDNAV_STATUS_OK;}dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {  int32_t button;  btni_t *button_ptr = NULL;  if(!this || !pci) {    printerr("Passed a NULL pointer.");    return DVDNAV_STATUS_ERR;  }  if(!pci->hli.hl_gi.hli_ss) {    printerr("Not in a menu.");    return DVDNAV_STATUS_ERR;  }  if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {    printerr("This NAV has already been left.");    return DVDNAV_STATUS_ERR;  }  pthread_mutex_lock(&this->vm_lock);   button = this->vm->state.HL_BTNN_REG >> 10;  if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) {    /* Special code to handle still menus with no buttons.     * The navigation is expected to report to the application that a STILL is     * underway. In turn, the application is supposed to report to the user     * that the playback is paused. The user is then expected to undo the pause,     * ie: hit play. At that point, the navigation should release the still and     * go to the next Cell.     * Explanation by Mathieu Lacage <mathieu_lacage@realmagic.fr>     * Code added by jcdutton.     */    if (this->position_current.still != 0) {      /* In still, but no buttons. */      vm_get_next_cell(this->vm);      this->position_current.still = 0;      this->sync_wait = 0;      this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn;      pthread_mutex_unlock(&this->vm_lock);      /* clear error message */      printerr("");      return DVDNAV_STATUS_OK;    }    pthread_mutex_unlock(&this->vm_lock);     return DVDNAV_STATUS_ERR;  }    button_ptr = get_current_button(this, pci);  /* Finally, make the VM execute the appropriate code and probably   * scedule a jump */#ifdef BUTTON_TESTING  fprintf(MSG_OUT, "libdvdnav: Evaluating Button Activation commands.\n");#endif  if(vm_exec_cmd(this->vm, &(button_ptr->cmd)) == 1) {    /* Command caused a jump */    this->vm->hop_channel++;    this->position_current.still = 0;    this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn;  }    pthread_mutex_unlock(&this->vm_lock);   return DVDNAV_STATUS_OK;}dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd){  if(!this || !cmd) {    printerr("Passed a NULL pointer.");    return DVDNAV_STATUS_ERR;  }    pthread_mutex_lock(&this->vm_lock);  /* make the VM execute the appropriate code and probably   * schedule a jump */#ifdef BUTTON_TESTING  fprintf(MSG_OUT, "libdvdnav: dvdnav_button_activate_cmd: Evaluating Button Activation commands.\n");#endif  if(button > 0) {    this->vm->state.HL_BTNN_REG = (button << 10);    if(vm_exec_cmd(this->vm, cmd) == 1) {      /* Command caused a jump */      this->vm->hop_channel++;    }  }  /* Always remove still, because some still menus have no buttons. */  this->position_current.still = 0;  this->sync_wait = 0;  pthread_mutex_unlock(&this->vm_lock);  return DVDNAV_STATUS_OK;}  dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int32_t button) {    if(!this || !pci) {    printerr("Passed a NULL pointer.");    return DVDNAV_STATUS_ERR;  }  if(!pci->hli.hl_gi.hli_ss) {    printerr("Not in a menu.");    return DVDNAV_STATUS_ERR;  }  if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {    printerr("This NAV has already been left.");    return DVDNAV_STATUS_ERR;  } #ifdef BUTTON_TESTING  fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); #endif    if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) {    printerr("Button does not exist.");    return DVDNAV_STATUS_ERR;  }    this->vm->state.HL_BTNN_REG = (button << 10);  this->position_current.button = -1; /* Force Highligh change */  return DVDNAV_STATUS_OK;}dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *this, pci_t *pci, 						  int32_t button) {  /* A trivial function */  if(dvdnav_button_select(this, pci, button) != DVDNAV_STATUS_ERR)    return dvdnav_button_activate(this, pci);  return DVDNAV_STATUS_ERR;}dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) {  int32_t button, cur_button;  int32_t best,dist,d;  int32_t mx,my,dx,dy;  if(!this || !pci) {    printerr("Passed a NULL pointer.");    return DVDNAV_STATUS_ERR;  }  if(!pci->hli.hl_gi.hli_ss) {    printerr("Not in a menu.");    return DVDNAV_STATUS_ERR;  }  if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {    printerr("This NAV has already been left.");    return DVDNAV_STATUS_ERR;  }  cur_button = this->vm->state.HL_BTNN_REG >> 10;  best = 0;  dist = 0x08000000; /* >> than  (720*720)+(567*567); */    /* Loop through all buttons */  for(button = 1; button <= pci->hli.hl_gi.btn_ns; button++) {    btni_t *button_ptr = &(pci->hli.btnit[button-1]);    if((x >= button_ptr->x_start) && (x <= button_ptr->x_end) &&       (y >= button_ptr->y_start) && (y <= button_ptr->y_end)) {      mx = (button_ptr->x_start + button_ptr->x_end)/2;      my = (button_ptr->y_start + button_ptr->y_end)/2;      dx = mx - x;      dy = my - y;      d = (dx*dx) + (dy*dy);      /* If the mouse is within the button and the mouse is closer       * to the center of this button then it is the best choice. */      if(d < dist) {        dist = d;        best = button;      }    }  }  /* As an efficiency measure, only re-select the button   * if it is different to the previously selected one. */  if (best != 0 && best != cur_button)    dvdnav_button_select(this, pci, best);  /* return DVDNAV_STATUS_OK only if we actually found a matching button */  return best ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;}dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) {  /* A trivial function */  if(dvdnav_mouse_select(this, pci, x,y) != DVDNAV_STATUS_ERR)    return dvdnav_button_activate(this, pci);  return DVDNAV_STATUS_ERR;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -