DLNA Player can now play back Audio CDs!

DLNA Player can now play back Audio CDs!

NOTE: This post was originally posted in Spanish on August 11, 2018. I’m posting the English language translation today.

Hi everyone,

Today, I’ve took some time to improve my “DLNA Player” software, which is capable of streaming music tracks to DLNA-Enabled players. Up to this point, the software was able to play back local files as well as music files stored on Google Drive. It wasn’t able to play Audio CD tracks.

Compact Discs

Because I have a bunch of Audio CDs, I’ve decided to integrate this function into the software. This was almost easy because there was an existing library to “rip” audio tracks. This, with some aditional lines made it possible to integrate this functionality.

Now, in the “File” menu, I’ve added a new option called “Open Audio CD”. We have to click it to listen to our Audio CDs:

DLNA Player 1

This will open another window where we choose which optical drive to use. We then press “Open”:

DLNA Player 2

Now, we get to see the Audio Tracks, and we simply need to press “Play”, or we double click on the audio track.

The Technical Side

We will now be taking a look at the code:

DLNA Player 3

Here, we have the code responsible for showing the drive letters and pass the audio tracks to the main window.

I’ve also wrote a class that contains code that we call on the other windows. This is code acts like a bridge between the software and the library I’m using to read audio CDs:

DLNA Player 4
DLNA Player 5

Basically, the software will first rip an audio track and let our DLNA-Enabled device stream it.

The following code is responsible for calling the code that loads a track to memory:

DLNA Player 6

We have 3 types of files declared in the code:

  • Type 1 are local files.
  • Type 2 are files stored in Google Drive.
  • Type 3 are Audio CD tracks.

Depending on the file type, the software knows which code to run. Once it loads the track to RAM, the final part of this function is to send the URL to the DLNA device for playback:

DLNA Player 7

To accelerate the playback process, we load the next track if the current track was loaded successfully. This will make the next track start playback immediately after the current track finishes playing because it will be already loaded in RAM. Once this next track starts playing, the software loads the following one, and this process continue until the final track is played and there’s no more to load.

The LoadNextTrack function makes this happen:

DLNA Player 8

NOTE: This function is in the codebase but is not available in the v0.3 release from today.

Let’s see the software in action

1. We go to File -> Open Audio CD:

DLNA Player 9

2. We select the drive leter and press Open:

DLNA Player 10

3. We will select the DLNA playback device and double click on a track or press the “Play” button:

DLNA Player 11

4. You can now see the optical drive starts to read the track:

DVD Drive

5. ¡Enjoy your music!

Hiby R3 with Hidizs DH1000 DLNA

Some commits performed to accomplish this:

DLNA Player Commits

Download links

You can download DLNA Player v0.3 by clicking here.

The source code can be found here.

This release has been tested on a Hiby R3 Digital Audio Player.