Ticket #2542: madagascar_fix_attempt_2.diff

File madagascar_fix_attempt_2.diff, 4.5 KB (added by skamithi, 14 years ago)

2nd attempt to detect if the title menu doesn't exist. should fix madagscar issue.

  • libmythtv/DVDRingBuffer.cpp

     
    4343      jumptotitle(true), repeatseek(false),
    4444      seekpos(0), seekwhence(0),
    4545      dvdname(NULL), serialnumber(NULL),
     46      titleMenuSupported(true),
    4647      parent(0)
    4748{
    4849    memset(&dvdMenuButton, 0, sizeof(AVSubtitle));
     
    161162        dvdnav_get_serial_number(dvdnav, &serialnum);
    162163        dvdname = QString(name);
    163164        serialnumber = QString(serialnum);
     165        if (dvdnav_menu_supported(dvdnav, DVD_MENU_Title) == DVDNAV_STATUS_ERR)
     166            titleMenuSupported = false;
     167           
    164168        return true;
    165169    }
    166170}
     
    539543{
    540544    DVDMenuID_t menuid;
    541545    if (str.compare("chapter") == 0)
    542         menuid = DVD_MENU_Root;
     546    {
     547        if (titleMenuSupported)
     548            menuid = DVD_MENU_Root;
     549        else
     550            menuid = DVD_MENU_Part;
     551    }
    543552    else if (str.compare("menu") == 0)
    544         menuid = DVD_MENU_Title;
     553    {
     554        if (titleMenuSupported)
     555            menuid = DVD_MENU_Title;
     556        else
     557            menuid = DVD_MENU_Root;
     558    }
    545559    else
    546560        return;
    547561
  • libmythtv/DVDRingBuffer.h

     
    156156    int            seekwhence;
    157157    QString        dvdname;
    158158    QString        serialnumber;
     159    bool           titleMenuSupported;
     160       
    159161
    160162    NuppelVideoPlayer *parent;
    161163
  • libmythdvdnav/searching.c

     
    416416  return DVDNAV_STATUS_OK;
    417417}
    418418
     419dvdnav_status_t dvdnav_menu_supported(dvdnav_t *this, DVDMenuID_t menu)
     420{
     421  vm_t *try_vm;
     422
     423  if (!this) {
     424    printerr("Passed a NULL pointer.");
     425    return DVDNAV_STATUS_ERR;
     426  }
     427
     428  pthread_mutex_lock(&this->vm_lock);
     429  if(!this->vm->state.pgc) {
     430    printerr("No current PGC");
     431    pthread_mutex_unlock(&this->vm_lock);
     432    return DVDNAV_STATUS_ERR;
     433  }
     434
     435  /* make a copy of the current VM and try to navigate the copy to the menu */
     436  try_vm = vm_new_copy(this->vm);
     437  if ((menu == DVD_MENU_Escape) && (this->vm->state.domain != VTS_DOMAIN)) {
     438    /* Try resume */
     439    if (vm_jump_resume(try_vm) && !try_vm->stopped) {
     440        vm_free_copy(try_vm);
     441        pthread_mutex_unlock(&this->vm_lock);
     442        return DVDNAV_STATUS_OK;
     443    }
     444  }
     445
     446  if (menu == DVD_MENU_Escape) menu = DVD_MENU_Root;
     447
     448  if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) {
     449    vm_get_next_cell(try_vm);
     450    if (!try_vm->pgcN_invalid)
     451    {
     452      vm_free_copy(try_vm);
     453      pthread_mutex_unlock(&this->vm_lock);
     454      return DVDNAV_STATUS_OK;
     455    }
     456  }
     457 
     458  vm_free_copy(try_vm);
     459  printerr("No such menu or menu not reachable.");
     460  pthread_mutex_unlock(&this->vm_lock);
     461  return DVDNAV_STATUS_ERR;
     462}
     463
    419464dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
    420465  vm_t *try_vm;
    421466 
  • libmythdvdnav/vm.c

     
    16361636  pgcit = get_PGCIT(vm);
    16371637  assert(pgcit != NULL);  /* ?? Make this return -1 instead */
    16381638
     1639  vm->pgcN_invalid = 0;
     1640
    16391641  if(pgcN < 1 || pgcN > pgcit->nr_of_pgci_srp) {
    16401642#ifdef TRACE
    16411643    fprintf(MSG_OUT, "libdvdnav:  ** No such pgcN = %d\n", pgcN);
    16421644#endif
     1645    vm->pgcN_invalid = 1;
    16431646    return 0;
    16441647  }
    16451648 
  • libmythdvdnav/dvdnav.h

     
    299299dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int32_t title,
    300300                                 uint64_t time);
    301301
     302/* Check if the given menu is supported */
     303dvdnav_status_t dvdnav_menu_supported(dvdnav_t *self, DVDMenuID_t menu);
     304
    302305/*
    303306 * Stop playing the current position and jump to the specified menu.
    304307 *
  • libmythdvdnav/vm.h

     
    9191  char          serial_number[19];
    9292  remap_t      *map;
    9393  int           stopped;
     94  int           pgcN_invalid;
    9495} vm_t;
    9596
    9697/* magic number for seeking hops */