Exemple #1
0
/* Handles PBC navigation when reaching the end of a play item. */
static vcdplayer_read_status_t
vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
{
  vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;

  /* We are in playback control. */
  vcdinfo_itemid_t itemid;

  /* The end of an entry is really the end of the associated
     sequence (or track). */
 
  if ( (VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type) &&
       (p_vcdplayer->i_lsn < p_vcdplayer->end_lsn) ) {
    /* Set up to just continue to the next entry */
    p_vcdplayer->play_item.num++;
    dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC),
               "continuing into next entry: %u", p_vcdplayer->play_item.num);
    vcdplayer_play_single_item( p_access, p_vcdplayer->play_item );
    /* p_vcdplayer->update_title(); */
    return READ_BLOCK;
  }
 
  switch (p_vcdplayer->pxd.descriptor_type) {
  case PSD_TYPE_END_LIST:
    return READ_END;
    break;
  case PSD_TYPE_PLAY_LIST: {
    if (vcdplayer_inc_play_item(p_access))
      return READ_BLOCK;

    /* Set up for caller process wait time given. */
    if (p_vcdplayer->i_still) {
      *wait_time = vcdinf_get_wait_time(p_vcdplayer->pxd.pld);
      dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL),
        "playlist wait time: %d", *wait_time);
      return READ_STILL_FRAME;
    }

    /* Wait time has been processed; continue with next entry. */
    vcdplayer_update_entry( p_access,
                            vcdinf_pld_get_next_offset(p_vcdplayer->pxd.pld),
                            &itemid.num, "next" );
    itemid.type = VCDINFO_ITEM_TYPE_LID;
    vcdplayer_play( p_access, itemid );
    break;
  }
  case PSD_TYPE_SELECTION_LIST:     /* Selection List (+Ext. for SVCD) */
  case PSD_TYPE_EXT_SELECTION_LIST: /* Extended Selection List (VCD2.0) */
    {
      uint16_t timeout_offs = vcdinf_get_timeout_offset(p_vcdplayer->pxd.psd);
      uint16_t max_loop     = vcdinf_get_loop_count(p_vcdplayer->pxd.psd);
      vcdinfo_offset_t *offset_timeout_LID =
        vcdinfo_get_offset_t(p_vcdplayer->vcd, timeout_offs);
 
      dbg_print(INPUT_DBG_PBC, "looped: %d, max_loop %d",
                p_vcdplayer->i_loop, max_loop);
 
      /* Set up for caller process wait time given. */
      if (p_vcdplayer->i_still) {
        *wait_time = vcdinf_get_timeout_time(p_vcdplayer->pxd.psd);
        dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL),
                  "playlist wait_time: %d", *wait_time);
        return READ_STILL_FRAME;
      }
 
      /* Wait time has been processed; continue with next entry. */
      /* Handle any looping given. */
      if ( max_loop == 0 || p_vcdplayer->i_loop < max_loop ) {
        p_vcdplayer->i_loop++;
        if (p_vcdplayer->i_loop == 0x7f) p_vcdplayer->i_loop = 0;
        vcdplayer_play_single_item(p_access, p_vcdplayer->loop_item);
        /* if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay();*/
        return READ_BLOCK;
      }
 
      /* Looping finished and wait finished. Move to timeout
         entry or next entry, or handle still. */
 
      if (NULL != offset_timeout_LID) {
        /* Handle timeout_LID */
        itemid.num  = offset_timeout_LID->lid;
        itemid.type = VCDINFO_ITEM_TYPE_LID;
        dbg_print(INPUT_DBG_PBC, "timeout to: %d", itemid.num);
        vcdplayer_play( p_access, itemid );
        return READ_BLOCK;
      } else {
        int i_selections = vcdinf_get_num_selections(p_vcdplayer->pxd.psd);
        if (i_selections > 0) {
          /* Pick a random selection. */
          unsigned int bsn=vcdinf_get_bsn(p_vcdplayer->pxd.psd);
          int rand_selection=bsn +
            ((unsigned)vlc_lrand48() % (unsigned)i_selections);
          lid_t rand_lid=vcdinfo_selection_get_lid (p_vcdplayer->vcd,
                            p_vcdplayer->i_lid,
                            rand_selection);
          itemid.num = rand_lid;
          itemid.type = VCDINFO_ITEM_TYPE_LID;
          dbg_print(INPUT_DBG_PBC, "random selection %d, lid: %d",
                    rand_selection - bsn, rand_lid);
          vcdplayer_play( p_access, itemid );
          return READ_BLOCK;
        } else if (p_vcdplayer->i_still) {
          /* Hack: Just go back and do still again */
          msleep(10000);
          return READ_STILL_FRAME;
        }
      }
      break;
    }
  default:
    ;
  }
  /* FIXME: Should handle autowait ...  */

  return READ_ERROR;
}
Exemple #2
0
void
VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
{
  vcdplayer_t    *p_vcdplayer  = (vcdplayer_t *) p_access->p_sys;
  input_thread_t *p_input = p_vcdplayer->p_input;
  vcdinfo_obj_t  *p_vcdev = p_vcdplayer->vcd;

  size_t i_entries = vcdinfo_get_num_entries(p_vcdev);
  size_t last_entry = 0;
  char *psz_cat = _("Disc");

  track_t i_track;

# define addstr(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%s",v)
# define addnum(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%d",v)
# define addhex(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%x",v)

  addstr(_("VCD Format"),  vcdinfo_get_format_version_str(p_vcdev));
  addstr(_("Album"),       vcdinfo_get_album_id          (p_vcdev));
  addstr(_("Application"), vcdinfo_get_application_id    (p_vcdev));
  addstr(_("Preparer"),    vcdinfo_get_preparer_id       (p_vcdev));
  addnum(_("Vol #"),       vcdinfo_get_volume_num        (p_vcdev));
  addnum(_("Vol max #"),   vcdinfo_get_volume_count      (p_vcdev));
  addstr(_("Volume Set"),  vcdinfo_get_volumeset_id      (p_vcdev));
  addstr(_("Volume"),      vcdinfo_get_volume_id         (p_vcdev));
  addstr(_("Publisher"),   vcdinfo_get_publisher_id      (p_vcdev));
  addstr(_("System Id"),   vcdinfo_get_system_id         (p_vcdev));
  addnum("LIDs",           vcdinfo_get_num_LIDs          (p_vcdev));
  addnum(_("Entries"),     vcdinfo_get_num_entries       (p_vcdev));
  addnum(_("Segments"),    vcdinfo_get_num_segments      (p_vcdev));
  addnum(_("Tracks"),      vcdinfo_get_num_tracks        (p_vcdev));

  /* Spit out track information. Could also include MSF info.
     Also build title table.
   */

  for( i_track = 1 ; i_track < p_vcdplayer->i_tracks ; i_track++ ) {
    unsigned int audio_type = vcdinfo_get_track_audio_type(p_vcdev, i_track);
    uint32_t i_secsize = vcdinfo_get_track_sect_count(p_vcdev, i_track);

    if (p_vcdplayer->b_svd) {
      addnum(_("Audio Channels"),
             vcdinfo_audio_type_num_channels(p_vcdev, audio_type) );
    }

    addnum(_("First Entry Point"), 0 );

    for ( last_entry = 0 ; last_entry < i_entries
        && vcdinfo_get_track(p_vcdev, last_entry) == i_track; last_entry++ ) ;

    addnum(_("Last Entry Point"), last_entry-1 );
    addnum(_("Track size (in sectors)"), i_secsize );
  }
 
  {
    lid_t i_lid;
    for( i_lid = 1 ; i_lid <= p_vcdplayer->i_lids ; i_lid++ ) {
      PsdListDescriptor_t pxd;
      if (vcdinfo_lid_get_pxd(p_vcdev, &pxd, i_lid)) {
    switch (pxd.descriptor_type) {
    case PSD_TYPE_END_LIST:
      addstr(_("type"), _("end"));
      break;
    case PSD_TYPE_PLAY_LIST:
      addstr(_("type"), _("play list"));
      addnum("items",     vcdinf_pld_get_noi(pxd.pld));
      addhex("next",      vcdinf_pld_get_next_offset(pxd.pld));
      addhex("previous",  vcdinf_pld_get_prev_offset(pxd.pld));
      addhex("return",    vcdinf_pld_get_return_offset(pxd.pld));
      addnum("wait time", vcdinf_get_wait_time(pxd.pld));
      break;
    case PSD_TYPE_SELECTION_LIST:
    case PSD_TYPE_EXT_SELECTION_LIST:
      addstr(_("type"), PSD_TYPE_SELECTION_LIST == pxd.descriptor_type
             ? _("extended selection list") : _("selection list") );
      addhex("default",          vcdinf_psd_get_default_offset(pxd.psd));
      addhex("loop count",       vcdinf_get_loop_count(pxd.psd));
      addhex("next",             vcdinf_psd_get_next_offset(pxd.psd));
      addhex("previous",         vcdinf_psd_get_prev_offset(pxd.psd));
      addhex("return",           vcdinf_psd_get_return_offset(pxd.psd));
      addhex("rejected",         vcdinf_psd_get_lid_rejected(pxd.psd));
      addhex("time-out offset",  vcdinf_get_timeout_offset(pxd.psd));
      addnum("time-out time",    vcdinf_get_timeout_time(pxd.psd));
      break;
    default:
      addstr(_("type"), _("unknown type"));
      break;
    }
      }
    }
  }
# undef  addstr
# undef  addnum
# undef  addhex

  if ( CDIO_INVALID_TRACK != i_track )
  {
    char *psz_tfmt = var_InheritString( p_access, MODULE_STRING "-title-format" );
    char *psz_name = VCDFormatStr( p_vcdplayer, psz_tfmt, psz_mrl,
                                                  &(p_vcdplayer->play_item) );
    free( psz_tfmt );
 
    input_Control( p_input, INPUT_SET_NAME, psz_name );
    free( psz_name );
  }

}
Exemple #3
0
/* Handles PBC navigation when reaching the end of a play item. */
vcdplayer_read_status_t
vcdplayer_pbc_nav ( input_thread_t * p_input )
{
  thread_vcd_data_t *     p_vcd= (thread_vcd_data_t *)p_input->p_access_data;

  /* We are in playback control. */
  vcdinfo_itemid_t itemid;

  /* The end of an entry is really the end of the associated 
     sequence (or track). */
  
  if ( (VCDINFO_ITEM_TYPE_ENTRY == p_vcd->play_item.type) && 
       (p_vcd->cur_lsn < p_vcd->end_lsn) ) {
    /* Set up to just continue to the next entry */
    p_vcd->play_item.num++;
    dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC), 
               "continuing into next entry: %u", p_vcd->play_item.num);
    VCDPlay( p_input, p_vcd->play_item );
    /* p_vcd->update_title(); */
    return READ_BLOCK;
  }
  
  switch (p_vcd->pxd.descriptor_type) {
  case PSD_TYPE_END_LIST:
    return READ_END;
    break;
  case PSD_TYPE_PLAY_LIST: {
    int wait_time = vcdinf_get_wait_time(p_vcd->pxd.pld);
    
    dbg_print(INPUT_DBG_PBC, "playlist wait_time: %d", wait_time);
    
    if (vcdplayer_inc_play_item(p_input))
      return READ_BLOCK;

    /* Handle any wait time given. */
    if (p_vcd->in_still) {
      vcdIntfStillTime( p_vcd->p_intf, wait_time );
      return READ_STILL_FRAME;
    }

    vcdplayer_update_entry( p_input, 
                            vcdinf_pld_get_next_offset(p_vcd->pxd.pld),
                            &itemid.num, "next" );
    itemid.type = VCDINFO_ITEM_TYPE_LID;
    VCDPlay( p_input, itemid );
    break;
  }
  case PSD_TYPE_SELECTION_LIST:     /* Selection List (+Ext. for SVCD) */
  case PSD_TYPE_EXT_SELECTION_LIST: /* Extended Selection List (VCD2.0) */
    {
      int wait_time         = vcdinf_get_timeout_time(p_vcd->pxd.psd);
      uint16_t timeout_offs = vcdinf_get_timeout_offset(p_vcd->pxd.psd);
      uint16_t max_loop     = vcdinf_get_loop_count(p_vcd->pxd.psd);
      vcdinfo_offset_t *offset_timeout_LID = 
        vcdinfo_get_offset_t(p_vcd->vcd, timeout_offs);
      
      dbg_print(INPUT_DBG_PBC, "wait_time: %d, looped: %d, max_loop %d", 
                wait_time, p_vcd->loop_count, max_loop);
      
      /* Handle any wait time given */
      if (p_vcd->in_still) {
	vcdIntfStillTime( p_vcd->p_intf, wait_time );
	return READ_STILL_FRAME;
      } 
      
      /* Handle any looping given. */
      if ( max_loop == 0 || p_vcd->loop_count < max_loop ) {
        p_vcd->loop_count++;
        if (p_vcd->loop_count == 0x7f) p_vcd->loop_count = 0;
        VCDSeek( p_input, 0 );
        /* if (p_vcd->in_still) p_vcd->force_redisplay();*/
        return READ_BLOCK;
      }
      
      /* Looping finished and wait finished. Move to timeout
         entry or next entry, or handle still. */
      
      if (NULL != offset_timeout_LID) {
        /* Handle timeout_LID */
        itemid.num  = offset_timeout_LID->lid;
        itemid.type = VCDINFO_ITEM_TYPE_LID;
        dbg_print(INPUT_DBG_PBC, "timeout to: %d", itemid.num);
        VCDPlay( p_input, itemid );
        return READ_BLOCK;
      } else {
        int num_selections = vcdinf_get_num_selections(p_vcd->pxd.psd);
        if (num_selections > 0) {
          /* Pick a random selection. */
          unsigned int bsn=vcdinf_get_bsn(p_vcd->pxd.psd);
          int rand_selection=bsn +
            (int) ((num_selections+0.0)*rand()/(RAND_MAX+1.0));
          lid_t rand_lid=vcdinfo_selection_get_lid (p_vcd->vcd, 
						    p_vcd->cur_lid, 
						    rand_selection);
          itemid.num = rand_lid;
          itemid.type = VCDINFO_ITEM_TYPE_LID;
          dbg_print(INPUT_DBG_PBC, "random selection %d, lid: %d", 
                    rand_selection - bsn, rand_lid);
          VCDPlay( p_input, itemid );
          return READ_BLOCK;
        } else if (p_vcd->in_still) {
          /* Hack: Just go back and do still again */
          sleep(1);
          return READ_STILL_FRAME;
        }
      }
      break;
    }
  case VCDINFO_ITEM_TYPE_NOTFOUND:  
    LOG_ERR( "NOTFOUND in PBC -- not supposed to happen" );
    break;
  case VCDINFO_ITEM_TYPE_SPAREID2:  
    LOG_ERR( "SPAREID2 in PBC -- not supposed to happen" );
    break;
  case VCDINFO_ITEM_TYPE_LID:  
    LOG_ERR( "LID in PBC -- not supposed to happen" );
    break;
    
  default:
    ;
  }
  /* FIXME: Should handle autowait ...  */

  return READ_ERROR;
}