Audio CD - Playlist

Help
2012-07-11
2013-05-30
  • Stefan Rehm

    Stefan Rehm - 2012-07-11

    Hello,

    if I play a Audio CD and press RED to open the playlist, I get a display similar to this

    *
      2
      3
      4

    Once track two starts playing, the display changes to

    *
      3
      4

    and so on. This can get quite confusing for the user, since there are only blank lines to choose from ;). My guess is, that this is because xineliboutput does not now the track names of the CD.
    Would it be possible to add "dummy" names to the playlist items of Audio CD tracks (something like "Track 1", "Track 2" etc.)?

     
  • Stefan Rehm

    Stefan Rehm - 2012-07-12

    I dont know, if its the most elegant solution, but the following patch does the trick for me.

    --- media_player.c  2012-07-12 19:52:21.778818854 +0200
    +++ media_player.c.new  2012-07-12 19:48:35.270828070 +0200
    @@ -191,34 +191,61 @@
    
     bool cXinelibPlayer::UpdateMetaInfo(bool Force)
     {
    +  cPlaylistItem *CurrentItem = Playlist().Current();
    +
       // update playlist metainfo
       const char *ti = GetMetaInfo(miTitle);
    -  bool TitleChanged =  ti && ti[0] && (!*Playlist().Current()->Title ||
    -                                       !strstr(Playlist().Current()->Title, ti));
    +  const char *tr = 0;
    +  char *buf = 0;
    +
    +  if (!ti || !ti[0]) // MetaInfo null or empty
    +  { 
    +    bool IsCDATrack = (*CurrentItem->Filename && strstr(*CurrentItem->Filename, "cdda:/"));
    +      
    +    if (IsCDATrack)
    +    {
    +      buf = new char[32];
    +
    +      sprintf(buf, "Track %s", *CurrentItem->Filename + 6);
    +      sprintf(buf + 16, "%s/%d", *CurrentItem->Filename + 6, Playlist().Count());
    +
    +      ti = buf;
    +      tr = buf + 16;
    +    }
    +  }
    + 
    +
    +  bool TitleChanged =  ti && ti[0] && (!*CurrentItem->Title || !strstr(*CurrentItem->Title, ti));
    +  bool MetainfoChanged = false;
    +
       if (Force || TitleChanged) {
    -    const char *tr = GetMetaInfo(miTracknumber);
    +    if (!tr)
    +      tr = GetMetaInfo(miTracknumber);
         const char *al = GetMetaInfo(miAlbum);
         const char *ar = GetMetaInfo(miArtist);
    
         if (!Force)
           LOGDBG("metainfo changed: %s->%s %s->%s %s->%s %s->%s",
    -             *Playlist().Current()->Artist      ?: "-", ar ?: "-",
    -             *Playlist().Current()->Album       ?: "-", al ?: "-",
    -             *Playlist().Current()->Tracknumber ?: "-", tr ?: "-",
    -             *Playlist().Current()->Title       ?: "-", ti ?: "-");
    +             *CurrentItem->Artist      ?: "-", ar ?: "-",
    +             *CurrentItem->Album       ?: "-", al ?: "-",
    +             *CurrentItem->Tracknumber ?: "-", tr ?: "-",
    +             *CurrentItem->Title       ?: "-", ti ?: "-");
    
    -    m_Playlist.Current()->Title = ti;
    +    CurrentItem->Title = ti;
         if (tr && tr[0])
    -      m_Playlist.Current()->Tracknumber = tr;
    +      CurrentItem->Tracknumber = tr;
         if (al && al[0])
    -      m_Playlist.Current()->Album = al;
    +      CurrentItem->Album = al;
         if (ar && ar[0])
    -      m_Playlist.Current()->Artist = ar;
    +      CurrentItem->Artist = ar;
    
    -    return true;
    +    MetainfoChanged = true;
       }
    
    -  return false;
    +  if (buf)
    +    delete buf;
    +
    +  return MetainfoChanged;
     }
    
     bool cXinelibPlayer::NextFile(int step)
    
     
  • Stefan Rehm

    Stefan Rehm - 2012-09-02

    Works with recent CVS HEAD. Thanks!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks