GNOME Bugzilla – Bug 763304
Add support for audio files with cue sheets
Last modified: 2018-01-10 14:50:37 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.
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.
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.
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.
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.
Created attachment 323380 [details] [review] grilo: Get Grl.METADATA_KEY_START_TIME This is the grilo-side property for nfo:audioOffset
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.
Review of attachment 323375 [details] [review]: Sure. Thanks!
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
(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?
-- 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.