After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763304 - Add support for audio files with cue sheets
Add support for audio files with cue sheets
Status: RESOLVED OBSOLETE
Product: gnome-music
Classification: Applications
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks:
 
 
Reported: 2016-03-08 11:25 UTC by Carlos Garnacho
Modified: 2018-01-10 14:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
query: Don't assume that nmm:MusicPieces will have a nie:url in playlists (2.31 KB, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
committed Details | Review
player: Store the current song ID instead of the URI (6.59 KB, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
none Details | Review
query: handle files with cue sheets (5.36 KB, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
none Details | Review
query: Add nfo:audioOffset to the queried data (1.56 KB, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
none Details | Review
grilo: Get Grl.METADATA_KEY_START_TIME (869 bytes, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
none Details | Review
player: Handle songs that are a portion of a larger file (4.14 KB, patch)
2016-03-08 11:26 UTC, Carlos Garnacho
none Details | Review

Description Carlos Garnacho 2016-03-08 11:25:11 UTC
gnome-music could be able to handle audio files with cue sheets, where songs themselves are portions of the larger file, with an specified start time and duration.

In this case tracker stores the info like this (very simplified):

<urn:example:file1> a nfo:FileDataObject, nfo:Audio;
  nie:url "file:///example/album.flac" ;
  nie:isStoredAs <urn:example:file1> ;
  nfo:duration 10000 .

<urn:example:song1> a nmm:MusicPiece, nfo:Audio;
  nie:isStoredAs <urn:example:file1> ;
  nfo:audioOffset 0;
  nfo:duration 1000 .

<urn:example:song2> a nmm:MusicPiece, nfo:Audio;
  nie:isStoredAs <urn:example:file1> ;
  nfo:audioOffset 1000;
  nfo:duration 3000 .

...

gnome-music can generically query for the normal case, and this indirect relationship (because in regular files nie:isStoredAs points to self), and the nfo:audioOffset/duration properties are enough to make it behave as expected with these songs.

I'm attaching a few patches.
Comment 1 Carlos Garnacho 2016-03-08 11:26:14 UTC
Created attachment 323375 [details] [review]
query: Don't assume that nmm:MusicPieces will have a nie:url in playlists

nmm:MusicPieces may have an indirect relation to the nfo:FileDataObject
and its nie:url, expressed through the nie:isStoredAs relationship. As
such, poking the nie:url of nmm:MusicPieces themselves may bring these
queries to bring 0 results unexpectedly.
Comment 2 Carlos Garnacho 2016-03-08 11:26:19 UTC
Created attachment 323376 [details] [review]
player: Store the current song ID instead of the URI

In audio files with cue sheets, several songs will actually have the
same URI. Using the media ID (boiling down to tracker:id) will be unique
and per-song enough.
Comment 3 Carlos Garnacho 2016-03-08 11:26:24 UTC
Created attachment 323377 [details] [review]
query: handle files with cue sheets

Songs in these are created as nmm:MusicPieces that are no nfo:FileDataObject
but use the nie:isStoredAs relationship to point to the container
nfo:FileDataObject, whereas regular songs will be both a nmm:MusicPiece and
a nfo:FileDataObject, and point to themselves with nie:isStoredAs.

Making the gnome-music queries observe this possibly indirect relationship
(eg. always pulling the nie:url from the resource in nie:isStoredAs) will
be sufficient to have it show songs in cue sheets as well.
Comment 4 Carlos Garnacho 2016-03-08 11:26:29 UTC
Created attachment 323378 [details] [review]
query: Add nfo:audioOffset to the queried data

This property stores the start time offset of the music piece in
the whole audio file. Is used by audio files with cue sheet support,
so the nmm:MusicPieces may express duration and start time.
Comment 5 Carlos Garnacho 2016-03-08 11:26:34 UTC
Created attachment 323380 [details] [review]
grilo: Get Grl.METADATA_KEY_START_TIME

This is the grilo-side property for nfo:audioOffset
Comment 6 Carlos Garnacho 2016-03-08 11:26:39 UTC
Created attachment 323381 [details] [review]
player: Handle songs that are a portion of a larger file

This may be the case of eg. flac files with cue sheets. This usecase
has some special conditions to handle:
- We need to seek the beginning of the song when it's reproduced,
  we obtain the start time from tracker/grilo. However we need to
  wait till the Gst pipeline is in PLAYING state before we can do
  so
- Likewise, the end of the song may not happen on bus EOS. We need
  to actively check our current position in the song and jump
  into the next one when we're past the song duration. Unfortunately
  this is done for all songs, the first song in the cue list will
  have Grl.METADATA_KEY_START_TIME=0, which is undetectable from
  the regular case of per-file songs.
- The scale needs translating between song and global times, both
  when setting the value, and when seeking through the song.
Comment 7 Felipe Borges 2016-03-09 10:28:57 UTC
Review of attachment 323375 [details] [review]:

Sure. Thanks!
Comment 8 Carlos Garnacho 2016-03-09 11:19:50 UTC
Comment on attachment 323375 [details] [review]
query: Don't assume that nmm:MusicPieces will have a nie:url in playlists

Pushed this one ATM, cheers!

Attachment 323375 [details] pushed as fd609d8 - query: Don't assume that nmm:MusicPieces will have a nie:url in playlists
Comment 9 Alexandre Franke 2016-09-25 11:05:13 UTC
(In reply to Felipe Borges from comment #7)
> Review of attachment 323375 [details] [review] [review]:
> 
> Sure. Thanks!

Anything blocking review/integration of the other patches?
Comment 10 GNOME Infrastructure Team 2018-01-10 14:50:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-music/issues/57.