Exemple #1
0
/*!
  Set reading to play an segment (e.g. still frame)
*/
static void
_vcdplayer_set_segment(access_t * p_access, unsigned int num)
{
  vcdplayer_t   *p_vcdplayer = (vcdplayer_t *)p_access->p_sys;
  vcdinfo_obj_t *p_vcdinfo   = p_vcdplayer->vcd;
  segnum_t       i_segs    = vcdinfo_get_num_segments(p_vcdinfo);

  if (num >= i_segs) {
    LOG_ERR("%s %d", "bad segment number", num);
    return;
  } else {
    vcdinfo_itemid_t itemid;

    if (VCDINFO_NULL_LSN==p_vcdplayer->i_lsn) {
      LOG_ERR("%s %d",
              "Error in getting current segment number", num);
      return;
    }
 
    itemid.num = num;
    itemid.type = VCDINFO_ITEM_TYPE_SEGMENT;

    VCDSetOrigin(p_access, vcdinfo_get_seg_lsn(p_vcdinfo, num), 0, &itemid);
 
    dbg_print(INPUT_DBG_LSN, "LSN: %u", p_vcdplayer->i_lsn);
  }
}
Exemple #2
0
/*****************************************************************************
 * VCDSegments: Reads the information about the segments the disc.
 *****************************************************************************/
static bool
VCDSegments( access_t * p_access )
{
    vcdplayer_t   *p_vcdplayer = (vcdplayer_t *) p_access->p_sys;
    unsigned int  i;
    input_title_t *t;

    p_vcdplayer->i_segments = vcdinfo_get_num_segments(p_vcdplayer->vcd);

    dbg_print( (INPUT_DBG_CALL|INPUT_DBG_MRL),
               "Segments: %d", p_vcdplayer->i_segments);

    if ( 0 == p_vcdplayer->i_segments ) return false;

    t = p_vcdplayer->p_title[p_vcdplayer->i_titles] = vlc_input_title_New();
    p_vcdplayer->i_titles++;

    t->i_size    = 0; /* Not sure Segments have a size associated */
    t->psz_name  = strdup(_("Segments"));

    /* We have one additional segment allocated so we can get the size
       by subtracting seg[i+1] - seg[i].
     */
    p_vcdplayer->p_segments=malloc(sizeof(lsn_t)*(p_vcdplayer->i_segments+1));
    if( p_vcdplayer->p_segments == NULL )
    {
        LOG_ERR ("not enough memory for segment treatment" );
        return false;
    }

    for( i = 0 ; i < p_vcdplayer->i_segments ; i++ )
    {
        char psz_segment[100];
        seekpoint_t *s = vlc_seekpoint_New();
        p_vcdplayer->p_segments[i] = vcdinfo_get_seg_lsn(p_vcdplayer->vcd, i);

        snprintf( psz_segment, sizeof(psz_segment), "%s %02d", _("Segment"),
                  i );

        s->i_byte_offset = 0; /* Not sure what this would mean here */
        s->psz_name  = strdup(psz_segment);
        TAB_APPEND( t->i_seekpoint, t->seekpoint, s );
    }

    p_vcdplayer->p_segments[p_vcdplayer->i_segments] =
      p_vcdplayer->p_segments[p_vcdplayer->i_segments-1]+
      vcdinfo_get_seg_sector_count(p_vcdplayer->vcd,
                                   p_vcdplayer->i_segments-1);

    return true;
}
Exemple #3
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 #4
0
/* Play a single item. */
static bool
vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid)
{
  vcdplayer_t   *p_vcdplayer = (vcdplayer_t *)p_access->p_sys;
  vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;

  dbg_print(INPUT_DBG_CALL, "called itemid.num: %d, itemid.type: %d",
            itemid.num, itemid.type);

  p_vcdplayer->i_still = 0;

  switch (itemid.type) {
  case VCDINFO_ITEM_TYPE_SEGMENT:
    {
      vcdinfo_video_segment_type_t segtype
        = vcdinfo_get_video_type(p_vcdinfo, itemid.num);
      segnum_t i_segs = vcdinfo_get_num_segments(p_vcdinfo);

      dbg_print(INPUT_DBG_PBC, "%s (%d), itemid.num: %d",
                vcdinfo_video_type2str(p_vcdinfo, itemid.num),
                (int) segtype, itemid.num);

      if (itemid.num >= i_segs) return false;
      _vcdplayer_set_segment(p_access, itemid.num);
 
      switch (segtype)
        {
        case VCDINFO_FILES_VIDEO_NTSC_STILL:
        case VCDINFO_FILES_VIDEO_NTSC_STILL2:
        case VCDINFO_FILES_VIDEO_PAL_STILL:
        case VCDINFO_FILES_VIDEO_PAL_STILL2:
          p_vcdplayer->i_still = STILL_READING;
          break;
        default:
          p_vcdplayer->i_still = 0;
        }
 
      break;
    }
 
  case VCDINFO_ITEM_TYPE_TRACK:
    dbg_print(INPUT_DBG_PBC, "track %d", itemid.num);
    if (itemid.num < 1 || itemid.num > p_vcdplayer->i_tracks) return false;
    _vcdplayer_set_track(p_access, itemid.num);
    break;
 
  case VCDINFO_ITEM_TYPE_ENTRY:
    {
      unsigned int i_entries = vcdinfo_get_num_entries(p_vcdinfo);
      dbg_print(INPUT_DBG_PBC, "entry %d", itemid.num);
      if (itemid.num >= i_entries) return false;
      _vcdplayer_set_entry(p_access, itemid.num);
      break;
    }
 
  case VCDINFO_ITEM_TYPE_LID:
    LOG_ERR("%s", "Should have converted p_vcdplayer above");
    return false;
    break;

  case VCDINFO_ITEM_TYPE_NOTFOUND:
    dbg_print(INPUT_DBG_PBC, "play nothing");
    p_vcdplayer->i_lsn = p_vcdplayer->end_lsn;
    return false;

  default:
    LOG_ERR("item type %d not implemented.", itemid.type);
    return false;
  }
 
  p_vcdplayer->play_item = itemid;

  /* Some players like xine, have a fifo queue of audio and video buffers
     that need to be flushed when playing a new selection. */
  /*  if (p_vcdplayer->flush_buffers)
      p_vcdplayer->flush_buffers(); */
  return true;
}
Exemple #5
0
/*****************************************************************************
 * vcd_Open: Opens a VCD device or file initializes, a list of
   tracks, segements and entry lsns and sizes and returns an opaque handle.
 *****************************************************************************/
static vcdinfo_obj_t *
vcd_Open( vlc_object_t *p_this, const char *psz_dev )
{
    access_t    *p_access = (access_t *)p_this;
    vcdplayer_t *p_vcdplayer    = (vcdplayer_t *) p_access->p_sys;
    vcdinfo_obj_t *p_vcdobj;
    char  *actual_dev;
    unsigned int i;

    dbg_print(INPUT_DBG_CALL, "called with %s", psz_dev);

    if( !psz_dev ) return NULL;

    actual_dev= ToLocaleDup(psz_dev);
    if( vcdinfo_open(&p_vcdobj, &actual_dev, DRIVER_UNKNOWN, NULL) !=
                                                    VCDINFO_OPEN_VCD)
    {
        free(actual_dev);
        return NULL;
    }
    free(actual_dev);

    /*
       Save summary info on tracks, segments and entries...
    */

    if ( 0 < (p_vcdplayer->i_tracks = vcdinfo_get_num_tracks(p_vcdobj)) )
    {
        p_vcdplayer->track = (vcdplayer_play_item_info_t *)
          calloc(p_vcdplayer->i_tracks, sizeof(vcdplayer_play_item_info_t));

        for (i=0; i<p_vcdplayer->i_tracks; i++)
        {
            unsigned int track_num=i+1;
            p_vcdplayer->track[i].size  =
            vcdinfo_get_track_sect_count(p_vcdobj, track_num);
            p_vcdplayer->track[i].start_LSN =
            vcdinfo_get_track_lsn(p_vcdobj, track_num);
        }
    } else
        p_vcdplayer->track = NULL;

    if( 0 < (p_vcdplayer->i_entries = vcdinfo_get_num_entries(p_vcdobj)) )
    {
        p_vcdplayer->entry = (vcdplayer_play_item_info_t *)
            calloc(p_vcdplayer->i_entries, sizeof(vcdplayer_play_item_info_t));

        for (i=0; i<p_vcdplayer->i_entries; i++)
        {
            p_vcdplayer->entry[i].size =
                                    vcdinfo_get_entry_sect_count(p_vcdobj, i);
            p_vcdplayer->entry[i].start_LSN =
                                           vcdinfo_get_entry_lsn(p_vcdobj, i);
        }
    } else
      p_vcdplayer->entry = NULL;

    if ( 0 < (p_vcdplayer->i_segments = vcdinfo_get_num_segments(p_vcdobj)) )
    {
        p_vcdplayer->segment = (vcdplayer_play_item_info_t *)
          calloc(p_vcdplayer->i_segments,  sizeof(vcdplayer_play_item_info_t));

        for (i=0; i<p_vcdplayer->i_segments; i++)
        {
            p_vcdplayer->segment[i].size =
                                    vcdinfo_get_seg_sector_count(p_vcdobj, i);
            p_vcdplayer->segment[i].start_LSN =
                                             vcdinfo_get_seg_lsn(p_vcdobj, i);
        }
    } else
      p_vcdplayer->segment = NULL;

    return p_vcdobj;
}